[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
AVRDUDE error messages, warnings and progress reports are generally
written to stderr which can, in bash, be turned off by 2>/dev/null
or by using increasingly more -q
options to suppress them. Terminal
output of commands or that of the -U
command with an output file
named -
are written to stdout. In some examples empty lines are
shown for clarity that are not printed by AVRDUDE or the shell.
Download the file diag.hex
to the ATmega128 chip using the
STK500 programmer connected to the default serial port:
$ avrdude -p m128 -c stk500 -e -U flash:w:diag.hex avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e9702 (probably m128) avrdude: erasing chip avrdude: reading input file diag.hex for flash with 19278 bytes in 74 section within [0, 0x4b4e] avrdude: writing 19278 bytes flash ... Writing | ################################################## | 100% 7.60 s avrdude: 19278 bytes of flash written avrdude: verifying flash memory against diag.hex Reading | ################################################## | 100% 6.83 s avrdude: 19278 bytes of flash verified avrdude done. Thank you. |
Same but in quell-progress-reporting (silent) mode -qq
:
$ avrdude -qq -p m128 -c stk500 -e -U flash:w:diag.hex |
Using &&
to confirm that the silent AVRDUDE command went OK:
$ avrdude -qq -p m128 -c stk500 -e -U flash:w:diag.hex && echo OK OK |
Save flash memory in raw binary format to the file named c:/diag flash.bin
:
$ avrdude -p m128 -c stk500 -U flash:r:"c:/diag flash.bin":r avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e9702 (probably m128) avrdude: reading flash memory ... Reading | ################################################## | 100% 46.10s avrdude: writing output file c:/diag flash.bin avrdude done. Thank you. |
Using the default programmer, download the file diag.hex
to
flash, eeprom.hex
to EEPROM, and set the extended, high, and low
fuse bytes to 0xff, 0x89, and 0x2e respectively:
$ avrdude -p m128 -U flash:w:diag.hex \ -U eeprom:w:eeprom.hex \ -U efuse:w:0xff:m \ -U hfuse:w:0x89:m \ -U lfuse:w:0x2e:m avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e9702 (probably m128) avrdude: Note: flash memory has been specified, an erase cycle will be performed. To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file diag.hex for flash with 19278 bytes in 74 section within [0, 0x4b4e] avrdude: writing 19278 bytes flash ... Writing | ################################################## | 100% 7.60 s avrdude: 19278 bytes of flash written avrdude: verifying flash memory against diag.hex Reading | ################################################## | 100% 6.83 s avrdude: 19278 bytes of flash verified [ ... other memory status output skipped for brevity ... ] avrdude done. Thank you. |
Read the fuses and print their values in different formats (hexadecimal, binary and octal):
$ avrdude -cusbasp -patmega128 -qq -Ulfuse:r:-:h -Uhfuse:r:-:b -Uefuse:r:-:o 0xbf 0b11000110 0377 |
Connect to the JTAG ICE mkII with a serial number ending in 1C37 via USB, and enter terminal mode:
$ avrdude -c jtag2 -p m649 -P usb:1c:37 -t avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e9603 [ ... terminal mode output skipped for brevity ... ] avrdude done. Thank you. |
List the serial numbers of all JTAG ICEs attached to USB; this is done by specifying an invalid serial number, and increasing the verbosity level:
$ avrdude -c jtag2 -p m128 -P usb:xx -v [...] Using Port : usb:xxx Using Programmer : jtag2 avrdude: usbdev_open(): Found JTAG ICE, serno: 00A000001C6B avrdude: usbdev_open(): Found JTAG ICE, serno: 00A000001C3A avrdude: usbdev_open(): Found JTAG ICE, serno: 00A000001C30 avrdude: usbdev_open(): did not find any (matching) USB device "usb:xxx" |
Write data from stdin (standard input) to EEPROM; no error output means all went fine:
$ echo 'The quick brown fox' | avrdude -c usbasp -p attiny13 -qq -U eeprom:w:-:r |
Execute multiple terminal mode commands separated by semicolons:
$ echo 'write eeprom 0 "Bonjour"; write ee 0x18 0x12345678; dump eeprom 0 0x20' | \ avrdude -qqcdryrun -patmega328p -t 0000 42 6f 6e 6a 6f 75 72 00 ff ff ff ff ff ff ff ff |Bonjour.........| 0010 ff ff ff ff ff ff ff ff 78 56 34 12 ff ff ff ff |........xV4.....| |
Read EEPROM and write content to stdout (standard output):
$ avrdude -qq -cusbasp -pattiny13 -Ueeprom:r:-:i :20000000E2809954686520717569636B2062726F776E20666F78E280990AFFFFFFFFFFFFD3 :20002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 :00000001FF |
Same but redirect stderr (standard error output) to /dev/null
instead of using -qq
:
$ avrdude -cusbasp -pattiny13 -Ueeprom:r:-:i 2>/dev/null :20000000E2809954686520717569636B2062726F776E20666F78E280990AFFFFFFFFFFFFD3 :20002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 :00000001FF |
Using the Avrdude output to print strings present in flash memory:
$ avrdude -pattiny13 -qq -U flash:r:-:r | strings Main menu Distance: %dcm Exit |
Factory fuse setting of a device:
$ avrdude -patmega328p/St | grep initval .ptmm ATmega328P lfuse initval 0x62 .ptmm ATmega328P hfuse initval 0xd9 .ptmm ATmega328P efuse initval 0xff .ptmm ATmega328P lock initval 0xff |
List of all parts known to AVRDUDE:
$ avrdude -p*/d | grep = | cut -f2 -d"'" ATtiny11 ATtiny12 ATtiny13 ATtiny13A ATtiny15 AT89S51 [...] AVR64EA48 LGT8F88P LGT8F168P LGT8F328P |
List of all modern AVR parts (with UPDI interface) known to AVRDUDE:
$ avrdude -p*/d | grep PM_UPDI | cut -f2 -d"'" ATtiny202 ATtiny204 ATtiny402 [...] AVR64EA28 AVR64EA32 AVR64EA48 |
AVRDUDE in a bash script creating terminal scripts that reset a part to factory settings:
$ cat make-init-scripts #!/bin/bash mkdir /tmp/factory for part in $(avrdude -p*/d | grep = | cut -f2 -d"'"); do echo $part avrdude -p$part/St | grep initval | cut -f3,5 | grep -ve-1 \ | sed "s/.*/write &/" >/tmp/factory/$part.ini done |
Run above script and use one of the created terminal scripts:
$ ./make-init-scripts $ cat /tmp/factory/ATmega328P.ini write lfuse 0x62 write hfuse 0xd9 write efuse 0xff write lock 0xff $ avrdude -qq -cusbasp -pATmega328P -t < /tmp/factory/ATmega328P.ini |
Output a list of non-bootloader programmers that can be used for a part. Note that |& folds stderr into stdout in a bash shell:
$ avrdude -c? -pavr32ea32 |& grep -v bootloader Valid programmers for part AVR32EA32 are: atmelice_updi = Atmel-ICE (ARM/AVR) via UPDI dryrun = Emulates programming without a programmer via UPDI jtag2updi = JTAGv2 to UPDI bridge via UPDI jtag3updi = Atmel AVR JTAGICE3 via UPDI pickit4_updi = MPLAB(R) PICkit 4 via UPDI pkobn_updi = Curiosity nano (nEDBG) via UPDI powerdebugger_updi = Atmel PowerDebugger (ARM/AVR) via UPDI serialupdi = SerialUPDI via UPDI snap_updi = MPLAB(R) SNAP via UPDI xplainedmini_updi = Atmel AVR XplainedMini via UPDI xplainedpro_updi = Atmel AVR XplainedPro via UPDI |
Print filename of last stored sketch with its date stamp (only with urclock programmer):
$avrdude -qq -curclock -P/dev/ttyUSB0 -pattiny13 -xshowdate -xshowfilename 2023-05-19 11.13 blink.hex |
Create a bash function avrdude-elf
that takes an elf file as input,
with support for optional Avrdude flags at the end, and writes to all memories
specified in the elf file. In this example, the elf file did not contain any
EEPROM data:
# Show all writable memories present for the ATtiny13 $ echo $(avrdude -pattiny13/ot | grep write | cut -f3 | uniq) eeprom flash lfuse hfuse lock # Function that writes to all memories present in the elf file avrdude-elf() { avrdude -cusbasp -pattiny13 -U{eeprom,flash,{l,h}fuse,lock}:w:"$1":e "${@:2}" } # Run function where -B8 and -V is appended to the Avrdude command $ avrdude-elf program.elf -B8 -V avrdude: set SCK frequency to 93750 Hz avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e9007 (probably t13) avrdude: Note: flash memory has been specified, an erase cycle will be performed. To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file Blink.elf for eeprom with 0 bytes in 0 sections within [0, -1] using 0 pages and 0 pad bytes avrdude: writing 0 bytes eeprom ... Writing | ################################################## | 100% 0.00 s avrdude: 0 bytes of eeprom written avrdude: reading input file Blink.elf for flash with 78 bytes in 1 section within [0, 0x4d] using 3 pages and 18 pad bytes avrdude: writing 78 bytes flash ... Writing | ################################################## | 100% 0.09 s avrdude: 78 bytes of flash written avrdude: reading input file Blink.elf for lfuse with 1 byte in 1 section within [0, 0] avrdude: writing 1 byte lfuse ... avrdude: 1 byte of lfuse written avrdude: reading input file Blink.elf for hfuse with 1 byte in 1 section within [0, 0] avrdude: writing 1 byte hfuse ... avrdude: 1 byte of hfuse written avrdude: reading input file Blink.elf for lock with 1 byte in 1 section within [0, 0] avrdude: writing 1 byte lock ... avrdude: 1 byte of lock written avrdude done. Thank you. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on July 19, 2023 using texi2html 5.0.