Beginner AVR First Steps - Page 1
Forum section: electronics / beginners

author: Mcfly
author_rank: Contributor
timestamp: December 22, 2012, 04:56:39 am
content: Hi allI have been programming for the arduino for some time now and i'm getting reasonably good at it, but how should I go aboutmoving on to AVR MCUs? I also already know how to make PCBs for thru hole and SMD, so mounting isnt an option.__What should i buy?Can i get away with using the arduino as an isp?What software? --> 64 bit windows 7_thanks

author: notsob
author_rank: Frequent Contributor
timestamp: December 22, 2012, 05:04:08 am
content: Probably be a good idea to go to avrfreaks.net website

author: McMonster
author_rank: Frequent Contributor
timestamp: December 22, 2012, 05:36:09 am
content: Arduino isn't a microcontroller! It is a developement board, IDE, C++ libraries and a bootloader for the AVR microcontrollers. So you've been programming an AVR all the time.To program bare AVRs outside Arduino IDE just install Atmel Studio or find a tutorial for Eclipse + WinAVR. You don't even need to buy a programmer, you can use the existing bootloader to load the hex. Then get the datasheet for the micro in your Arduino and start programming. It'll be the same, but you'll be setting individual bits in registers instead of calling functions that did it for you. Any tutorial should be a good start, I learned AVRs fromthis one, just skip the programmer stuff.

author: UPI
author_rank: Regular Contributor
timestamp: December 22, 2012, 01:52:34 pm
content: I use the Pololu USB AVR Programmer for ICSP programming as well as changing fuse settings.http://www.pololu.com/catalog/product/1300It works well with Atmel Studio 6.http://www.atmel.com/microsite/atmel_studio6/I purchased a license for Cadsoft Eagle for schematics and board layout. It works good enough for me but expensive.http://www.cadsoftusa.com/I downloaded all of the Arduino Eagle schematics to use as examples as well as to borrow different package layouts etc.http://arduino.cc/en/Main/ProductsHere are some links to basic MCU interfacing circuits.http://www.bristolwatch.com/ele/transistor_drivers.htmhttp://cq.cx/interface.pl

author: Kremmen
author_rank: Super Contributor
timestamp: December 22, 2012, 02:11:05 pm
content: Quote from: Mcfly on December 22, 2012, 04:56:39 amOK, you can make PCBs. In that case let me suggest this: Come up with a reasonably simple small project where you can put the features of a microcontroller into use. A combined egg timer / oven thermometer or something equally silly but something where you need to exercise the integrated peripherals of the chip.The ATMega328 in an Arduino is a good candidate for a practice MCU. They come in 32 pin QFPs that are reasonably easy to solder even manually with an iron (i do that all the time).One thing you need to make clear to yourself early on: how are you going to program the chip and how are you going to debug the code you are going to write. In Arduino the programming has been taken care of, so you didn't need to worry. Similar idea is possible in your own system but then you need to get familiar with bootloaders; how to set it up and how to communicate with one. Conceptually simpler is just to use Atmel's ready made tools as part of say AVR Studio 4-5 / Atmel Studio 6. That way you don't need a bootlöoader+accessories at all, but you do need a programmer device to move the program image to the target MCU. Also you need to implement the ISP signaling header on your PCB (piece of cake). Personally, i never bother with bootloaders because i have all the tools, but it may be significant if you want to do field upgrades. Then an Arduino style bootloading system gets you there with just a regular PC and a USB cable.The Arduino I/O is the simplest possible - wires out from the MCU and straight into the headers. That is not how it is done in real life. Generally you need to consider input protection against surges, and signal integrity in the environment that the device is subjected to. Also you need to pay attention to pin assignment regarding primary and secondary functions available for each of them.Once you have created your initial HW design, you should check that it will be programmable to function the way you wanted, and that you are clear how to transfer the program image and debug the solution (if you plan to do that, but i highly recommend it). Once there it is time to implement and let loose.A final word about debugging: Arduino doesn't have it. The Atmel chip inside sure does, but Arduino does not implement it due to lack of necessary hardware. The 328 and many other Atmel chips implement a system called debugWire, where the reset signal pin is used to communicate debugging info across. For that to work, you need PC hardware to support the protocol. I haven't studied the alternatives, personally i use Atmel's JTAGICE 2 and 3 devices but they have their price. There may be other, 3rd party options but you will have to find out. AVRFreaks forum, as stated, is the go-to place.