AVRdude

From Deskthority wiki
Jump to: navigation, search

AVRdude is used to program AVR microcontrollers through a ISP interface.

Example commands

These examples are all for the ATmega32u4 and the AVR-ISP500 programmer. If you have problems connecting to the chip, adding the -B flag to the command may help i.e.

avrdude -B 2 ...

Reading the chip parameters

avrdude -p m32u4 -P /dev/ttyACM0 -c stk500v2

Erase the chip

An erase is required before programming can be done.

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

Flash the file program.hex to the chip

avrdude -p m32u4 -P /dev/ttyACM0 -c stk500v2 -U flash:w:program.hex:i

Fuse settings

Fuses are used to control low level behavior of the chip. Setting clock frequency, bootloader size, and many more parameters. Use the Engbedded fuse calculator to determine desired values.

Default fuse settings

ATmega32u2

avrdude -p m32u2 -P /dev/ttyACM0 -c stk500v2 -U lfuse:w:0x5e:m -U hfuse:w:0xd9:m -U efuse:w:0xf4:m

ATmega32u4

avrdude -p m32u4 -P /dev/ttyACM0 -c stk500v2 -U lfuse:w:0x5e:m -U hfuse:w:0x99:m -U efuse:w:0xf3:m

Teensy 2.0

avrdude -p m32u4 -P /dev/ttyACM0 -c stk500v2 -U lfuse:w:0x5f:m -U hfuse:w:0xdf:m -U efuse:w:0xf4:m