[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Enter terminal, display part parameters, modify EEPROM, perform a chip erase and quit:
$ avrdude -qq -c usbasp -p atmega328p -t avrdude> part AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : possible i/o RETRY pulse : SCK Serial program mode : yes Parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Page Polled Memory Type Alias Mode Delay Size Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 no 1024 4 0 3600 3600 0x00 0x00 flash 65 10 128 yes 32768 128 256 4500 4500 0x00 0x00 lfuse 0 0 0 no 1 1 0 4500 4500 0x00 0x00 hfuse 0 0 0 no 1 1 0 4500 4500 0x00 0x00 efuse 0 0 0 no 1 1 0 4500 4500 0x00 0x00 lock 0 0 0 no 1 1 0 4500 4500 0x00 0x00 signature 0 0 0 no 3 1 0 0 0 0x00 0x00 calibration 0 0 0 no 1 1 0 0 0 0x00 0x00 avrdude> dump eeprom 0 16 0000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| avrdude> write eeprom 0 1 2 3 4 0xcafe "Avrdude" avrdude> dump eeprom 0 16 0000 01 02 03 04 fe ca 41 76 72 64 75 64 65 00 ff ff |......Avrdude...| avrdude> flush avrdude> erase erasing chip ... avrdude> dump eeprom 0 16 0000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| avrdude> quit |
Program the fuse bits of an ATmega328P with a fuse calculator
First display the factory defaults, then consult an external fuse calculator, select the ATmega328P part, find above settings, note the ensuinig new values for the three fuses and reprogram:
$ avrdude -c usbasp -p atmega328p -t avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e950f (probably m328p) avrdude> dump efuse Reading | ################################################## | 100% 0.00 s 0000 ff |. | avrdude> dump hfuse Reading | ################################################## | 100% 0.00 s 0000 d9 |. | avrdude> dump lfuse Reading | ################################################## | 100% 0.00 s 0000 62 |b | avrdude> # avrdude> # Consult external fuse calculator avrdude> # avrdude> # avrdude> write efuse 0xfd Writing | ################################################## | 100% 0.01 s avrdude> write hfuse 0xde Writing | ################################################## | 100% 0.01 s avrdude> write lfuse 0xf7 Writing | ################################################## | 100% 0.01 s avrdude> quit avrdude done. Thank you. |
Program the fuse bits of an ATmega328P with the config command
$ avrdude -qq -c usbasp -p atmega328p -t avrdude> # Show all configurations avrdude> config config sut_cksel=intrcosc_8mhz_6ck_14ck_65ms # 34 config ckout=co_disabled # 1 config ckdiv8=by_8 # 0 config bootrst=application # 1 config bootsz=bs_2048w # 0 config eesave=ee_erased # 1 config wdton=wdt_programmable # 1 config spien=isp_enabled # 0 config dwen=dw_off # 1 config rstdisbl=external_reset # 1 config bodlevel=bod_disabled # 7 config lb=no_lock # 3 config blb0=no_lock_in_app # 3 config blb1=no_lock_in_boot # 3 avrdude> # Show possible values for full-swing external crystal avrdude> config sut_cksel=extfs avrdude warning: (config) ambiguous; known sut_cksel extfs symbols are: - sut_cksel=extfsxtal_258ck_14ck_4ms1 # 6 - sut_cksel=extfsxtal_1kck_14ck_65ms # 7 - sut_cksel=extfsxtal_258ck_14ck_65ms # 22 - sut_cksel=extfsxtal_16kck_14ck_0ms # 23 - sut_cksel=extfsxtal_1kck_14ck_0ms # 38 - sut_cksel=extfsxtal_16kck_14ck_4ms1 # 39 - sut_cksel=extfsxtal_1kck_14ck_4ms1 # 54 - sut_cksel=extfsxtal_16kck_14ck_65ms # 55 avrdude> # Set the one with appropriate startup times avrdude> c su=55 avrdude> # Unprogram clock division by 8, make reset jump to boot loader avrdude> c ckdiv8=1 avrdude> c bootrst=boot avrdude> c bootsz=bs_256w avrdude> # Query which bod levels exist; set brown-out at 2.7 V avrdude> c bodlevel= # conf bodlevel=bod_4v3 # 4 # conf bodlevel=bod_2v7 # 5 # conf bodlevel=bod_1v8 # 6 config bodlevel=bod_disabled # 7 (factory) avrdude> c bod=*2v7 avrdude> quit |
The following example demonstrates negative address and length
bytes, and the fill form of the write
command using an
ellipis ... where the last data item provided is used to fill up the
indicated memory range.
$ avrdude -c usbasp -p atmega328p -t avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e950f (probably m328p) avrdude> dump flash -64 -33 Reading | ################################################## | 100% 0.02 s 7fc0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 7fd0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| avrdude> dump flash -32 -1 Reading | ################################################## | 100% 0.00 s 7fe0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 7ff0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| avrdude> write flash -64 1234567890 'A' 'V' 'R' 2.718282 0xaa 0xbb 0xcc "Hello World!" Caching | ################################################## | 100% 0.00 s avrdude> write flash -32 -1 0x01 0b00000010 0b11 0x04 0x05 ... Caching | ################################################## | 100% 0.00 s avrdude> read flash -64 -33 Reading | ################################################## | 100% 0.00 s 7fc0 d2 02 96 49 41 56 52 55 f8 2d 40 aa bb cc 48 65 |...IAVRU.-@...He| 7fd0 6c 6c 6f 20 57 6f 72 6c 64 21 00 ff ff ff ff ff |llo World!......| avrdude> read flash -32 -1 Reading | ################################################## | 100% 0.00 s 7fe0 01 02 03 04 05 05 05 05 05 05 05 05 05 05 05 05 |................| 7ff0 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 |................| avrdude> flush avrdude: synching cache to device ... Writing | ################################################## | 100% 0.05 s avrdude> quit avrdude done. Thank you. |
Mixing terminal commands and -U
memory operations: the
example below burns a bootloader, uses a terminal line to write
application data to flash, loads the application, configures the brownout
detection level to 2.7 V and, finally, stores the full flash as new hex
file. Note the use of different quotation marks in bash
to pass the
terminal command lines as single entity to AVRDUDE.
$ avrdude -qc dryrun -p m328p \ -U urboot_m328p_1s_autobaud_uart0_pr_ee_ce.hex \ -T 'write flash 0x7D00 0xc0cac01a 0xcafe "secret Coca Cola recipe"' \ -U flash:w:cola-vending-machine.hex \ -T "config -v bod=*2v7" \ -U flash:r:app+data.hex:I avrdude: AVR device initialized and ready to accept instructions avrdude: device signature = 0x1e950f (probably m328p) 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: processing -U flash:w:urboot_m328p_1s_autobaud_uart0_pr_ee_ce.hex:i avrdude: reading input file urboot_m328p_1s_autobaud_uart0_pr_ee_ce.hex for flash with 368 bytes in 2 sections within [0x7e80, 0x7fff] using 3 pages and 16 pad bytes avrdude: writing 368 bytes flash ... avrdude: 368 bytes of flash written avrdude: verifying flash memory against urboot_m328p_1s_autobaud_uart0_pr_ee_ce.hex avrdude: 368 bytes of flash verified avrdude: processing -T write flash 0x7D00 0xc0cac01a 0xcafe "secret Coca Cola recipe" avrdude: synching cache to device ... done avrdude: processing -U flash:w:cola-vending-machine.hex:i avrdude: reading input file cola-vending-machine.hex for flash with 736 bytes in 1 section within [0, 0x2df] using 6 pages and 32 pad bytes avrdude: writing 736 bytes flash ... avrdude: 736 bytes of flash written avrdude: verifying flash memory against cola-vending-machine.hex avrdude: 736 bytes of flash verified avrdude: processing -T config -v bod=*2v7 config bodlevel=bod_2v7 # 5 avrdude: processing -U flash:r:app+data.hex:I avrdude: reading flash memory ... avrdude: writing output file app+data.hex avrdude done. Thank you. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on July 19, 2023 using texi2html 5.0.