AVRdude & Arduino

AVRDUDE is a command line tool to program AVR chips. It runs in the background of the Arduino IDE. When burning the bootloader on an Arduino clone it is somtimes necessary to erase a chip or set the fuse bits manualy - that's when the AVRdude comes handy.

Command description:

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>:r w v:<filename>[:format]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

The fuse settings are in /Arduino/hardware/arduino/avr/board.txt

To erase the chip:

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

To erase the chip:

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

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

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:
The hex file is in the arduino folder:

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

Burning Serial to USB on Sparkfun Atmega8u2 Breakout Board:

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

Burning Serial to Midi:
The hex file is here: http://hunt.net.nz/users/darran/weblog/52882/Arduino_UNO_MIDI_USB_version_02.html

sudo avrdude -p m8u2 -c stk500v2 -P /dev/ttyACM0 -b115200 -U flash:w:MIDI_Firmware/Arduino-usbmidi-0.2.hex:i


This manual was made by Wolfgang Spahn 2011-20.
It is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Creative Commons License