This is an old revision of the document!



AVRdude


AVRDUDE is a command line tool to program AVR chips. It runs in the background of the Arduino IDE. Sometimes it is necessary to erase a chip or set the fuse bits that's when the AVRdude comes handy.

Dokumentations:
http://www.nongnu.org/avrdude/user-manual/avrdude.html
Command description:
http://www.nongnu.org/avrdude/user-manual/avrdude_4.html


avrdude -C <arduino-ide-folder>/hardware/tools/avrdude.conf -v -p <partno> -c <programmer> -P <port> -b 115200 -U flash:w:<full_path_to_hex>:i

-C <config-file>specify location of configuration file
-vverbose output-v, in case you want to debug something
-p <partno>specify AVR devicee could be atmega328p or m8u, …
-c <programmer>specify programmer type could be stk500v1 or stk500v2, …
-P <port>specify connection port could be /dev/ttyACMx (Linux $ ls /dev), or COMx (Win)
-b <baudrate>override RS-232 baud rate
-U <memtype>

memory operation specification, the <memtype> is either flash or eeprom, r,w,v means r (read) w (write) or v (verify)|

<full_path_to_hex>is the hex filename and location

ATmega32U4
To erase the chip:

sudo avrdude -p m32u4 -c stk500v2 -P /dev/ttyACM0 -e -F

ATmega328p
To erase the chip:

sudo avrdude -p m328p -c stk500v2 -P /dev/ttyACM0 -e -F

ATmega168
set the fuse bits:

avrdude -c stk500v2 -p m168 -P /dev/ttyACM0 -B 6 -v -U lock:w:0x3f:m -U lfuse:w:0xff:m -U hfuse:w:0xdf:m -U efuse:w:0x0:m

Atmega8u2
It is the chip for serial to USB on the Arduino Uno and on the Usb2Serial board.

<!> On the Arduino Usb2Serial Light Board the ISP header is marked wrong, pin 1 is the nearest one to the Atmega8u2 chip <!>

Burning Serial to USB:

sudo avrdude -C /usr/share/arduino/hardware/tools/avrdude.conf -p m8u2 -c stk500v2 -P /dev/ttyACM0 -b115200 -U flash:w:Arduino-usbserial-uno.hex:i

Burning Serial to Midi:

sudo avrdude -C /usr/share/arduino/hardware/tools/avrdude.conf -p m8u2 -c stk500v2 -P /dev/ttyACM0 -b115200 -U flash:w:MIDI_Firmware/Arduino-usbmidi-0.2.hex:i

Burning Serial to USB on Sparkfun Atmega8u2 Breakout:

sudo avrdude -p m8u2 -c stk500v2 -P /dev/ttyACM0 -U flash:w:Arduino-usbserial-uno.hex:i