[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Terminal Mode Examples

Display part parameters, modify eeprom cells, perform a chip erase:

% avrdude -p m128 -c stk500 -t

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9702
avrdude> part
>>> part 

AVR Part              : ATMEGA128
Chip Erase delay      : 9000 us
PAGEL                 : PD7
BS2                   : PA0
RESET disposition     : dedicated
RETRY pulse           : SCK
serial program mode   : yes
parallel program mode : yes
Memory Detail         :

                            Page                       Polled
  Memory Type Paged  Size   Size #Pages MinW  MaxW   ReadBack
  ----------- ------ ------ ---- ------ ----- ----- ---------
  eeprom      no       4096    8     0  9000  9000 0xff 0xff
  flash       yes    131072  256   512  4500  9000 0xff 0x00
  lfuse       no          1    0     0     0     0 0x00 0x00
  hfuse       no          1    0     0     0     0 0x00 0x00
  efuse       no          1    0     0     0     0 0x00 0x00
  lock        no          1    0     0     0     0 0x00 0x00
  calibration no          1    0     0     0     0 0x00 0x00
  signature   no          3    0     0     0     0 0x00 0x00

avrdude> dump eeprom 0 16
>>> 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
>>> write eeprom 0 1 2 3 4 

avrdude> dump eeprom 0 16
>>> dump eeprom 0 16 
0000  01 02 03 04 ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> erase
>>> erase 
avrdude: erasing chip
avrdude> dump eeprom 0 16
>>> dump eeprom 0 16 
0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> 

Program the fuse bits of an ATmega128 (disable M103 compatibility, enable high speed external crystal, enable brown-out detection, slowly rising power). Note since we are working with fuse bits the -u (unsafe) option is specified, which allows you to modify the fuse bits. First display the factory defaults, then reprogram:

% avrdude -p m128 -u -c stk500 -t

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9702
avrdude> d efuse
>>> d efuse 
0000  fd                                                |.               |

avrdude> d hfuse
>>> d hfuse 
0000  99                                                |.               |

avrdude> d lfuse
>>> d lfuse 
0000  e1                                                |.               |

avrdude> w efuse 0 0xff
>>> w efuse 0 0xff 

avrdude> w hfuse 0 0x89
>>> w hfuse 0 0x89 

avrdude> w lfuse 0 0x2f
>>> w lfuse 0 0x2f 

avrdude> 
% avrdude -c pkobn_updi -p avr128db48 -t

         Vtarget                      : 4.71 V
         PDI/UPDI clock Xmega/megaAVR : 100 kHz

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e970c (probably avr128db48)
avrdude> write eeprom 0 1234567890 'A' 'V' 'R' 2.718282 "Hello World!"
>>> write eeprom 0 1234567890 'A' 'V' 'R' 2.718282 "Hello World!"
Warning: no size suffix specified for "1234567890". Writing 4 byte(s)
Info: Writing 24 bytes starting from address 0x00

avrdude> dump eeprom 0 32
>>> dump eeprom 0 32 

0000  d2 02 96 49 41 56 52 55  f8 2d 40 48 65 6c 6c 6f  |...IAVRU.-@Hello|
0010  20 57 6f 72 6c 64 21 00  ff ff ff ff ff ff ff ff  | World!.........|

avrdude> q

The following example demonstrates the second form of the write command where the last data value provided is used to fill up the indicated memory range.

avrdude> write eeprom 0x00 0x20 'a' 'b' 'c' 0x11 0xcafe 0x55 ...
>>> write eeprom 0x00 0x20 'a' 'b' 'c' 0x11 0xcafe 0x55 ... 

avrdude> dump eeprom 0 0x30
>>> dump eeprom 0 0x30 
0000  61 62 63 11 fe ca 55 55  55 55 55 55 55 55 55 55  |abc...UUUUUUUUUU|
0010  55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55  |UUUUUUUUUUUUUUUU|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 8, 2023 using texi2html 5.0.