Avrdude is a command line tool for uploading to and downloading from AVR microcontrollers. It is used in the background by Arduino to upload sketches.
It’s also the tool we used to upload the bootloader to all of the atmega644p chips provided in the TVRRUG OMC electronics kits.
Here are some useful commands when using avrdude.
Don’t forget to plug in your ISP (in my case a USBtiny) and check drivers are installed (if required).
USBTiny ISP drivers – https://learn.adafruit.com/usbtinyisp/drivers
Check avrdude version
$ avrdude
See list of compatible programmers
$ avrdude -c ?
USBtiny programmer name:
usbtiny
Test your setup
e.g. using a USBtiny to program an atmega644
$ avrdude -c usbtiny -p m644
Successful test result:
avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.02s avrdude: Device signature = 0x1e9609 avrdude: current erase-rewrite cycle count is -44032 (if being tracked) avrdude: safemode: Fuses OK avrdude done. Thank you.
If you receive “Operation not permitted” error messages, you need to run the commands as root e.g. using sudo
in Ubuntu.
Upload the TVRRUG bootloader and set fuses
$ avrdude -c usbtiny -B 2.4 -p atmega644 -U hfuse:w:0xd4:m -U lfuse:w:0xe7:m -U flash:w:bootloader-644-20MHz_0.hex
Successful upload:
avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.02s avrdude: Device signature = 0x1e9609 avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performe To disable this feature, specify the -D option. avrdude: current erase-rewrite cycle count is -44032 (if being tracked) avrdude: erasing chip avrdude: reading input file "0xd4" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xd4: avrdude: load data hfuse data from input file 0xd4: avrdude: input file 0xd4 contains 1 bytes avrdude: reading on-chip hfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xe7" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xe7: avrdude: load data lfuse data from input file 0xe7: avrdude: input file 0xe7 contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: reading input file "bootloader-644-20MHz_0.hex" avrdude: input file bootloader-644-20MHz_0.hex auto detected as Intel Hex avrdude: writing flash (64646 bytes): Writing | ################################################## | 100% 19.88s avrdude: 64646 bytes of flash written avrdude: verifying flash memory against bootloader-644-20MHz_0.hex: avrdude: load data flash data from input file bootloader-644-20MHz_0.hex: avrdude: input file bootloader-644-20MHz_0.hex auto detected as Intel Hex avrdude: input file bootloader-644-20MHz_0.hex contains 64646 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 17.78s avrdude: verifying ... avrdude: 64646 bytes of flash verified avrdude: safemode: Fuses OK avrdude done. Thank you.
Additional sources of information: