You are on page 1of 5

Programming AVR microcontroller with AVRDUDE in Windows Step - 1: Install avrdude

Download and install winavr which includes avrdude from the link below. Note - If AVR studio is installed on you PC, a different driver is used for avrispmk2 and hence avrdude can not be used for programing. http://sourceforge.net/projects/winavr/files/ Once installed, go to command terminal and type avrdude. you should get something like this -

Step - 2: Verify your micro-controller and programmer is supported by avrdude


To get list of supported programmers, type

C:\>avrdude -c asdf You should get response similar to below (with list of supported programmers)

To get list of supported micro-controller type

C:\>avrdude -c avrisp The response should be similar to this (list of supported micro-controllers) -

Once verified, that you have supported programmer and controller. Next step is to program the microcontroller. For this tutorial, I am using attiny45 and avrisp mkII programmer.

Step - 3: Programming
The syntex of the command is avrdude [options] Where the options are (1) -p To specify which micro-controller to program Example - for attiny 45 uC, the syntax should be avrdude -p t45 (2) -c Type of programmer Example - if using Atmel AVRISP mk II, the syntax should be avrdude -p t45 -c avrisp2

(3) -P Which serial port to use, If using USB device like AVRISP mkII you don't need to include this option or simply use -P usb avrdude -p t45 -c avrisp2 -P usb (4) -U [memory]:r|w|v:[:format]:

[memory] - is either flash or eeprom (or hfuse, lfuse or efuse for the chip configuration fuses r|w|v - means you can use r (read) or w (write) or v (verify) code in memory [:format] - is file format which we will read/write/verify. we will always be using "Intel Hex" format, so use i

Example:

If you wanted to write the file test .hex to the flash memory, the complete syntax will be. avrdude -p t45 -c avrisp2 -P usb -U flash:w:test.hex:i If you wanted to read the eeprom memory into the file "eedump.hex" you would use -U eeprom:r:eedump.hex:i

Step - 4: Make makefile (optional)


A good practice is to make a .make file with all the commands in it and simply run the following commands from command window 1) Make Hex file make -f filename.make 2) Program fuses using avrispmk2 programmer (or other programmer, see makefile) sudo make -f .make program-avrisp2-fuses 3) Program flash sudo make -f .make program-avrisp2 update - if AVR studio is also installed in your system than you will get this error did not find any USB device "usb"

http://blog.patilprashant.com/2013/12/programming-avr-microcontroller-with.html

http://download.savannah.gnu.org/releases/avrdude/

You might also like