AVRDUDE A program for download/uploading AVR microcontroller flash and eeprom. For AVRDUDE, Version 5.8, 14 April 2009. by Brian S.
Send comments on AVRDUDE to avrdude-dev@nongnu.org. Use http://savannah.nongnu.org/bugs/?group=avrdude to report bugs. Copyright c 2003,2005 Brian S. Dean Copyright c 2006 - 2008 Jörg Wunsch Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
i Table of Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 2 Command Line Options . . . . . . . . . . . . . . . . . . . . 3 2.1 2.2 2.3 3 Option Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Programmers accepting extended parameters . . . . . . . . . . . . . . . . . 12 Example Command Line Invocations . . . . . . . . . . . . . . . . . . . . . . . . 13 Terminal Mode Operation . . . . . . . . . . . . . . . .
ii A.2.4 Using the parallel port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.4.1 Windows NT/2K/XP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.4.2 Windows 95/98 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.5 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.6 Credits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1: Introduction 1 1 Introduction AVRDUDE - AVR Downloader Uploader - is a program for downloading and uploading the on-chip memories of Atmel’s AVR microcontrollers. It can program the Flash and EEPROM, and where supported by the serial programming protocol, it can program fuse and lock bits. AVRDUDE also supplies a direct instruction mode allowing one to issue any programming instruction to the AVR chip regardless of whether AVRDUDE implements that specific feature of a particular chip.
Chapter 1: Introduction 2 The Arduino (which is very similar to the STK500 1.x) is supported via its own programmer type specification “arduino”. The AVR Dragon is supported in all modes (ISP, JTAG, HVSP, PP, debugWire). When used in JTAG and debugWire mode, the AVR Dragon behaves similar to a JTAG ICE mkII, so all device-specific comments for that device will apply as well.
Chapter 2: Command Line Options 3 2 Command Line Options 2.1 Option Descriptions AVRDUDE is a command line tool, used as follows: avrdude -p partno options ... Command line options are used to control AVRDUDE’s behaviour. The following options are recognized: -p partno This is the only mandatory option and it tells AVRDUDE what type of part (MCU) that is connected to the programmer. The partno parameter is the part’s id listed in the configuration file.
Chapter 2: Command Line Options 4 m48 ATmega48 m64 ATmega64 m640 ATmega640 m644 ATmega644 m649 ATmega649 m6490 ATmega6490 m8 ATmega8 m8515 ATmega8515 m8535 ATmega8535 m88 ATmega88 t12 ATtiny12 t13 ATtiny13 t15 ATtiny15 t2313 ATtiny2313 t25 ATtiny25 t26 ATtiny26 t45 ATtiny45 t85 ATtiny85 x128a1 ATxmega128A1 x128a1d ATxmega128A1revD (*) The AT90S2323 and ATtiny22 use the same algorithm. (**) Flash addressing above 128 KB is not supported by all programming hardware.
Chapter 2: Command Line Options alf arduino Arduino board, protocol similar to STK500 1.x atisp avr109 avr910 avr911 avrisp avrisp2 avrispmkII avrispv2 bascom blaster bsd butterfly c2n232i dapa dasa dasa3 dragon_dw dragon_hvsp dragon_isp dragon_jtag dragon_pp dt006 ere-isp-avr frank-stk200 futurlec jtag1 jtag1slow 5 Nightshade ALF-PgmAVR, http://nightshade.homeip.net/ AT-ISP V1.1 programming cable for AVR-SDK1 from, http://micro-research.co.
Chapter 2: Command Line Options jtag2slow jtag2 jtag2fast jtag2isp jtag2dw jtagmkI jtagmkII mib510 pavr picoweb pony-stk200 ponyser siprog sp12 stk200 stk500 stk500hvsp stk500pp stk500v1 stk500v2 stk600 stk600hvsp stk600pp usbasp usbtiny xil 6 Atmel JTAG ICE mkII (default speed 19200 Bd) Atmel JTAG ICE mkII, running at 115200 Bd Atmel JTAG ICE mkII, running at 115200 Bd Atmel JTAG ICE mkII in ISP mode. Atmel JTAG ICE mkII in debugWire mode.
Chapter 2: Command Line Options 7 -D Disable auto erase for flash. When the -U option with flash memory is specified, avrdude will perform a chip erase before starting any of the programming operations, since it generally is a mistake to program the flash without performing an erase first. This option disables that. Auto erase is not used for ATxmega devices as these devices can use page erase before writing each page so no explicit chip erase is required.
Chapter 2: Command Line Options 8 -i delay For bitbang-type programmers, delay for approximately delay microseconds between each bit state change. If the host system is very fast, or the target runs off a slow clock (like a 32 kHz crystal, or the 128 kHz internal RC oscillator), this can become necessary to satisfy the requirement that the ISP clock frequency must not be higher than 1/4 of the CPU clock frequency. This is implemented as a spin-loop delay to allow even for very short delays.
Chapter 2: Command Line Options 9 net:host:port. In this case, instead of trying to open a local device, a TCP network connection to (TCP) port on host is established. The remote endpoint is assumed to be a terminal or console server that connects the network stream to a local serial port where the actual programmer has been attached to. The port is assumed to be properly configured, for example using a transparent 8-bit data connection without parity at 115200 Baud for a STK500.
Chapter 2: Command Line Options 10 The filename field indicates the name of the file to read or write. The format field is optional and contains the format of the file to read or write. Possible values are: i s r m a d h o b Intel Hex Motorola S-record raw binary; little-endian byte order, in the case of the flash ROM data immediate mode; actual byte values specified on the command line, seperated by commas or spaces in place of the filename field of the ‘-i’, ‘-o’, or ‘-U’ options.
Chapter 2: Command Line Options 11 indication of how many erase-rewrite cycles the part has undergone. Since the FLASH memory can only endure a finite number of erase-rewrite cycles, one can use this option to track when a part is nearing the limit. The typical limit for Atmel AVR FLASH is 1000 cycles. Of course, if the application needs the last four bytes of EEPROM memory, this option should not be used.
Chapter 2: Command Line Options 12 2.2 Programmers accepting extended parameters JTAG ICE mkII AVR Dragon When using the JTAG ICE mkII or AVR Dragon in JTAG mode, the following extended parameter is accepted: ‘jtagchain=UB,UA,BB,BA’ Setup the JTAG scan chain for UB units before, UA units after, BB bits before, and BA bits after the target AVR, respectively. Each AVR unit within the chain shifts by 4 bits. Other JTAG units might require a different bit shift count.
Chapter 2: Command Line Options 13 2.3 Example Command Line Invocations 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 Reading | ################################################## | 100% 0.03s avrdude: avrdude: avrdude: avrdude: avrdude: avrdude: avrdude: Device signature = 0x1e9702 erasing chip done.
Chapter 2: Command Line Options 14 Upload the flash memory from the ATmega128 connected to the STK500 programmer and save it in raw binary format in 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 Reading | ################################################## | 100% 0.
Chapter 2: Command Line Options 15 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 -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 Reading | ################################################## | 100% 0.
Chapter 2: Command Line Options 16 Connect to the JTAG ICE mkII which serial number ends up 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 Reading | ################################################## | 100% 0.03s 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.
Chapter 3: Terminal Mode Operation 17 3 Terminal Mode Operation AVRDUDE has an interactive mode called terminal mode that is enabled by the ‘-t’ option. This mode allows one to enter interactive commands to display and modify the various device memories, perform a chip erase, display the device signature bytes and part parameters, and to send raw programming commands. Commands and parameters may be abbreviated to their shortest unambiguous form.
Chapter 3: Terminal Mode Operation 18 varef [channel ] voltage Set the adjustable voltage source to voltage Volts. This voltage is normally used to drive the target’s Aref input on the STK500 and STK600. The STK600 offers two reference voltages, which can be selected by the optional parameter channel (either 0 or 1). fosc freq [M|k] Set the master oscillator to freq Hz. An optional trailing letter M multiplies by 1E6, a trailing letter k by 1E3. fosc off Turn the master oscillator off.
Chapter 3: Terminal Mode Operation 19 % avrdude -p m128 -c stk500 -t avrdude: avrdude: avrdude: avrdude> >>> part AVR device initialized and ready to accept instructions Device signature = 0x1e9702 current erase-rewrite cycle count is 52 (if being tracked) part AVR Part Chip Erase delay PAGEL BS2 RESET disposition RETRY pulse serial program mode parallel program mode Memory Detail Memory Type ----------eeprom flash lfuse hfuse efuse lock calibration signature : : : : : : : : : ATMEGA128 9000 us PD7
Chapter 3: Terminal Mode Operation 20 % avrdude -p m128 -u -c stk500 -t avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e9702 avrdude: current erase-rewrite cycle count is 52 (if being tracked) avrdude> d efuse >>> d efuse 0000 fd |. | avrdude> d hfuse >>> d hfuse 0000 99 |. | avrdude> d lfuse >>> d lfuse 0000 e1 |.
Chapter 4: Configuration File 21 4 Configuration File AVRDUDE reads a configuration file upon startup which describes all of the parts and programmers that it knows about. The advantage of this is that if you have a chip that is not currently supported by AVRDUDE, you can add it to the configuration file without waiting for a new release of AVRDUDE.
Chapter 4: Configuration File 22 devicecode = ; # numeric chip_erase_delay = ; # micro-seconds pagel = ; # pin name in hex, i.e., 0xD7 bs2 = ; # pin name in hex, i.e.
Chapter 4: Configuration File 23 "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; write = "1 1 0 0 "x a6 a5 a4 0 0 0 0 a3 a2 a1 a0 x x x x i i i i x x x x", i i i i"; 4.4 Other Notes • The devicecode parameter is the device code used by the STK500 and is obtained from the software section (avr061.zip) of Atmel’s AVR061 application note available from http://www.atmel.com/atmel/acrobat/doc2525.pdf. • Not all memory types will implement all instructions.
Chapter 5: Programmer Specific Information 24 5 Programmer Specific Information 5.
Chapter 5: Programmer Specific Information 25 AT32UC3A0512 AT32UC3A0256 AT32UC3A0128 STK600-RCuC3B0-21 STK600-TQFP64-2 AT32UC3B0256 AT32UC3B0128 AT32UC3B064 Ensure the correct socket and routing card are mounted before powering on the STK600. While the STK600 firmware ensures the socket and routing card mounted match each other (using a table stored internally in nonvolatile memory), it cannot handle the case where a wrong routing card is used, e. g.
Appendix A: Platform Dependent Information 26 Appendix A Platform Dependent Information A.1 Unix A.1.1 Unix Installation To build and install from the source tarball on Unix like systems: $ $ $ $ $ gunzip -c avrdude-5.8.tar.gz | tar xf cd avrdude-5.8 ./configure make su root -c ’make install’ The default location of the install is into /usr/local so you will need to be sure that /usr/local/bin is in your PATH environment variable.
Appendix A: Platform Dependent Information 27 A.1.2 Unix Configuration Files When AVRDUDE is build using the default ‘--prefix’ configure option, the default configuration file for a Unix system is located at /usr/local/etc/avrdude.conf. This can be overridden by using the ‘-C’ command line option. Additionally, the user’s home directory is searched for a file named .avrduderc, and if found, is used to augment the system default configuration file. A.1.2.
Appendix A: Platform Dependent Information 28 $ set PREFIX= $ export PREFIX $ gunzip -c avrdude-5.8.tar.gz | tar xf $ cd avrdude-5.8 $ ./configure LDFLAGS="-static" --prefix=$PREFIX --datadir=$PREFIX --sysconfdir=$PREFIX/bin --enable-versioned-doc=no $ make $ make install A.2.2 Configuration Files A.2.2.1 Configuration file names AVRDUDE on Windows looks for a system configuration file name of avrdude.conf and looks for a user override configuration file of avrdude.rc. A.2.
Appendix A: Platform Dependent Information 29 If the parallel port can be accessed through a different address, this address can be specified directly, using the common C language notation (i. e., hexadecimal values are prefixed by 0x). A.2.4 Using the parallel port A.2.4.1 Windows NT/2K/XP On Windows NT, 2000, and XP user applications cannot directly access the parallel port. However, kernel mode drivers can access the parallel port. giveio.
Appendix B: Troubleshooting 30 Appendix B Troubleshooting In general, please report any bugs encountered via http://savannah.nongnu.org/bugs/?group=avrdude. • Problem: I’m using a serial programmer under Windows and get the following error: avrdude: serial_open(): can’t set attributes for device "com1", Solution: This problem seems to appear with certain versions of Cygwin. Specifying "/dev/com1" instead of "com1" should help. • Problem: I’m using linux and my AVR910 programmer is really slow.
Appendix B: Troubleshooting 31 12 V pulse (thus the name high voltage), so the target AVR can subsequently be reprogrammed, and the DWEN fuse can be cleared. Typically, this operation cannot be performed while the AVR is located in the target circuit though. The second option requires a JTAG ICE mkII that can talk the debugWire protocol. The ICE needs to be connected to the target using the JTAG-to-ISP adapter, so the JTAG ICE mkII can be used as a debugWire initiator as well as an ISP programmer.