AVRdude

From Deskthority Wiki
Revision as of 22:24, 26 January 2018 by >Tactica (Style guide, typos, categorised under keyboard modding.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Example commands[edit | edit source]

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[edit | edit source]

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

Erase the chip[edit | edit source]

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[edit | edit source]

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

Fuse settings[edit | edit source]

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[edit | edit source]

ATmega32u2[edit | edit source]

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

ATmega32u4[edit | edit source]

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[edit | edit source]

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