man avrdude (Commandes) - avrdude
NAME
SYNOPSIS
DESCRIPTION
is a program for downloading code and data to Atmel AVR microcontrollers. Avrdude supports Atmel's STK500 programmer, Atmel's JTAG ICE mkII, programmers complying to AppNote AVR910 and AVR109 (including the Butterfly), as well as a simple hard-wired programmer connected directly to a ppi() or parport() parallel port, or to a standard serial port. In the simplest case, the hardware consists just of a cable connecting the respective AVR signal lines to the parallel port.
The MCU is programmed in so, for the ppi() based programmer, the MCU signals and need to be connected to the parallel port. Optionally, some otherwise unused output pins of the parallel port can be used to supply power for the MCU part, so it is also possible to construct a passive standalone programming device. Some status LEDs indicating the current operating state of the programmer can be connected, and a signal is available to control a buffer/driver IC 74LS367 (or 74HCT367). The latter can be useful to decouple the parallel port from the MCU when in-system programming is used.
A number of equally simple bit-bang programming adapters that connect to a serial port are supported as well, among them the popular Ponyprog serial adapter, and the DASA and DASA3 adapters that used to be supported by uisp(1). Note that these adapters are meant to be attached to a physical serial port. Connecting to a serial port emulated on top of USB is likely to not work at all, or to work abysmally slow.
Atmel's STK500 programmer is also supported and connects to a serial port. Both, firmware versions 1.x and 2.x can be handled, but require a different programmer type specification (by now).
The simple serial programmer described in Atmel's application note AVR910, and the bootloader described in Atmel's application note AVR109 (which is also used by the AVR Butterfly evaluation board), are supported on a serial port.
Atmel's JTAG ICE mkII is supported as well to up- or download memory areas from/to an AVR target (no support for on-chip debugging).
Input files can be provided, and output files can be written in different file formats, such as raw binary files containing the data to download to the chip, Intel hex format, or Motorola S-record format. There are a number of tools available to produce those files, like asl() as a standalone assembler, or avr-objcopy() for the final stage of the GNU toolchain for the AVR microcontroller.
Avrdude can program the EEPROM and flash ROM memory cells of supported AVR parts. Where supported by the serial instruction set, fuse bits and lock bits can be programmed as well. These are implemented within as seperate memory types and can be programmed using data from a file (see the -m option) or from terminal mode (see the dump and write commands). It is also possible to read the chip (provided it has not been code-protected previously, of course) and store the data in a file. Finally, a ``terminal'' mode is available that allows one to interactively communicate with the MCU, and to display or program individual memory cells. On the STK500 programmer, several operational parameters (target supply voltage, target Aref voltage, master clock) can be examined and changed from within terminal mode as well.
Options
In order to control all the different operation modi, a number of options need to be specified to avrdude .
- -p partno
-
This is the only option that is mandatory for every invocation of
avrdude .
It specifies the type of the MCU connected to the programmer. These are read from the config file. If
avrdude
does not know about a part that you have, simply add it to the config
file (be sure and submit a patch back to the author so that it can be
incorporated for the next version). See the sample config file for
the format. Currently, the following MCU types are understood:
ll.
Option tag Official part name
c128 AT90CAN128
pwm2 AT90PWM2
pwm3 AT90PWM3
1200 AT90S1200
2313 AT90S2313
2333 AT90S2333
2343 AT90S2343 (*)
4414 AT90S4414
4433 AT90S4433
4434 AT90S4434
8515 AT90S8515
8535 AT90S8535
m103 ATmega103
m128 ATmega128
m16 ATmega16
m161 ATmega161
m162 ATmega162
m163 ATmega163
m164 ATmega164
m169 ATmega169
m32 ATmega32
m324 ATmega324
m329 ATmega329
m3290 ATmega3290
m48 ATmega48
m64 ATmega64
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
- (*)
- The AT90S2323 and ATtiny22 use the same algorithm.
- -b baudrate
- Override the RS-232 connection baud rate specified in the respective programmer's entry of the configuration file.
- -B bitclock
- Specify the bit clock period for the JTAG interface (JTAG ICE only). The value is a floating-point number in microseconds. The default value of the JTAG ICE results in about 1 microsecond bit clock period, suitable for target MCUs running at 4 MHz clock and above. Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to default values when the programming software signs off from the ICE, so for MCUs running at lower clock speeds, this parameter must be specified on the command-line.
- -c programmer-id
- Use the pin configuration specified by the argument. Pin configurations are read from the config file (see the -C option). New pin configurations can be easily added or modified through the use of a config file to make avrdude work with different programmers as long as the programmer supports the Atmel AVR serial program method. You can use the 'default_programmer' keyword in your ${HOME}/.avrduderc file to assign a default programmer to keep from having to specify this option on every invocation.
- -C config-file
- Use the specified config file to load configuration data. This file contains all programmer and part definitions that avrdude knows about. If you have a programmer or part that avrdude does not know about, you can add it to the config file (be sure and submit a patch back to the author so that it can be incorporated for the next version). See the config file, located at /etc/avrdude.conf , which contains a description of the format.
- -D
- Disable auto erase for flash. When the -U option with flash memory is specified, 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.
- -e
- Causes a chip erase to be executed. This will reset the contents of the flash ROM and EEPROM to the value and is basically a prerequisite command before the flash ROM can be reprogrammed again. The only exception would be if the new contents would exclusively cause bits to be programmed from the value to Note that in order to reprogram EERPOM cells, no explicit prior chip erase is required since the MCU provides an auto-erase cycle in that case before programming the cell.
- Xo -E exitspec Ns
-
[, Ns exitspec]
By default,
leaves the parallel port in the same state at exit as it has been
found at startup. This option modifies the state of the
and
lines the parallel port is left at, according to the
exitspec
arguments provided, as follows:
- reset
- The signal will be left activated at program exit, that is it will be held in order to keep the MCU in reset state afterwards. Note in particular that the programming algorithm for the AT90S1200 device mandates that the signal is active powering up the MCU, so in case an external power supply is used for this MCU type, a previous invocation of with this option specified is one of the possible ways to guarantee this condition.
- noreset
- The line will be deactivated at program exit, thus allowing the MCU target program to run while the programming hardware remains connected.
- vcc
- This option will leave those parallel port pins active that can be used to supply power to the MCU.
- novcc
- This option will pull the pins of the parallel port down at program exit.
- -F
- Normally, tries to verify that the device signature read from the part is reasonable before continuing. Since it can happen from time to time that a device has a broken (erased or overwritten) device signature but is otherwise operating normally, this options is provided to override the check.
- -n
- No-write - disables actually writing data to the MCU (useful for debugging avrdude ).
- -P port
- Use port to identify the device to which the programmer is attached. By default the /dev/ppi0 port is used, but if the programmer type normally connects to the serial port, the /dev/cuaa0 port is the default. If you need to use a different parallel or serial port, use this option to specify the alternate port name. For the JTAG ICE mkII, if has been configured with libusb support, port can alternatively be specified as usb Ns [: Ns serialno .] This will cause to search a JTAG ICE mkII on USB. If serialno is also specified, it will be matched against the serial number read from any JTAG ICE mkII found on USB. The match is done after stripping any existing colons from the given serial number, and right-to-left, so only the least significant bytes from the serial number need to be given.
- -q
- Disable (or quell) output of the progress bar while reading or writing to the device. Specify it a second time for even quieter operation.
- -s
- Disable safemode prompting. When safemode discovers that one or more fuse bits have unintentionally changed, it will prompt for confirmation regarding whether or not it should attempt to recover the fuse bit(s). Specifying this flag disables the prompt and assumes that the fuse bit(s) should be recovered without asking for confirmation first.
- -t
- Tells to enter the interactive ``terminal'' mode instead of up- or downloading files. See below for a detailed description of the terminal mode.
- -u
- Disable the safemode fuse bit checks. Safemode is enabled by default and is intended to prevent unintentional fuse bit changes. When enabled, safemode will issue a warning if the any fuse bits are found to be different at program exit than they were when was invoked. Safemode won't alter fuse bits itself, but rather will prompt for instructions, unless the terminal is non-interactive, in which case safemode is disabled. See the -s option to disable safemode prompting.
- Xo -U memtype Ns
-
: Ns op Ns
: Ns filename Ns
[: Ns format]
Perform a memory operation as indicated. The
memtype
field specifies the memory type to operate on.
The available memory types are device-dependant, the actual
configuration can be viewed with the
part
command in terminal mode.
Typically, a device's memory configuration at least contains
the memory types
flash
and
eeprom .
All memory types currently known are:
- calibration
- One or more bytes of RC oscillator calibration data.
- eeprom
- The EEPROM of the device.
- efuse
- The extended fuse byte.
- flash
- The flash ROM of the device.
- fuse
- The fuse byte in devices that have only a single fuse byte.
- hfuse
- The high fuse byte.
- lfuse
- The low fuse byte.
- lock
- The lock byte.
- signature
- The three device signature bytes (device ID).
- r
- read device memory and write to the specified file
- w
- read data from the specified file and write to the device memory
- v
- read data from both the device and the specified file and perform a verify
- i
- Intel Hex
- s
- Motorola S-record
- r
- raw binary; little-endian byte order, in the case of the flash ROM data
- m
- immediate; actual byte values specified on the command line, seperated by commas or spaces. This is good for programming fuse bytes without having to create a single-byte file or enter terminal mode.
- a
- auto detect; valid for input only, and only if the input is not provided at
- -v
- Enable verbose output.
- -V
- Disable automatic verify check when uploading data.
- -y
- Tells to use the last four bytes of the connected parts' EEPROM memory to track the number of times the device has been erased. When this option is used and the -e flag is specified to generate a chip erase, the previous counter will be saved before the chip erase, it is then incremented, and written back after the erase cycle completes. Presumably, the device would only be erased just before being programmed, and thus, this can be utilized to give an 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.
- -Y cycles
- Instructs to initialize the erase-rewrite cycle counter residing at the last four bytes of EEPROM memory to the specified value. If the application needs the last four bytes of EEPROM memory, this option should not be used.
Terminal mode
In this mode, only initializes communication with the MCU, and then awaits user commands on standard input. Commands and parameters may be abbreviated to the shortest unambiguous form. Terminal mode provides a command history using readline(3) , so previously entered command lines can be recalled and edited. The following commands are currently implemented:
- dump memtype addr nbytes
- Read nbytes bytes from the specified memory area, and display them in the usual hexadecimal and ASCII form.
- dump
- Continue dumping the memory contents for another nbytes where the previous dump command left off.
- write memtype addr byte1 ... byteN
- Manually program the respective memory cells, starting at address addr , using the values byte1 through byteN . This feature is not implemented for bank-addressed memories such as the flash memory of ATMega devices.
- erase
- Perform a chip erase.
- send b1 b2 b3 b4
- Send raw instruction codes to the AVR device. If you need access to a feature of an AVR part that is not directly supported by , this command allows you to use it, even though does not implement the command.
- sig
- Display the device signature bytes.
- part
- Display the current part settings and parameters. Includes chip specific information including all memory types supported by the device, read/write timing, etc.
- vtarg voltage
- Set the target's supply voltage to voltage Volts.
- varef voltage
- Set the adjustable voltage source to voltage Volts. This voltage is normally used to drive the target's input on the STK500.
- fosc freq Ns [M Ns | Ns 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.
- sck period
- Set the SCK clock period to period microseconds. Set the JTAG ICE bit clock period to period microseconds. Note that unlike STK500 settings, this setting will be reverted to its default value (approximately 1 microsecond) when the programming software signs off from the JTAG ICE.
- parms
- Display the current voltage and master oscillator parameters. Display the current target supply voltage and JTAG bit clock rate/period.
- ?
- help
- Give a short on-line summary of the available commands.
- quit
- Leave terminal mode and thus avrdude .
Default Parallel port pin connections
(these can be changed, see the -c option) ll. Pin number Function 2-5 Vcc (optional power supply to MCU) 7 /RESET (to MCU) 8 SCK (to MCU) 9 MOSI (to MCU) 10 MISO (from MCU) 18-25 GND
FILES
- /dev/ppi0
- default device to be used for communication with the programming hardware
- /etc/avrdude.conf
- programmer and parts configuration file
- ${HOME}/.avrduderc
- programmer and parts configuration file (per-user overrides)
- ~/.inputrc
- Initialization file for the readline() library
- /usr/share/doc/avrdude-doc/avrdude.pdf.gz
- Schematic of programming hardware
SEE ALSO
AUTHORS
was written by Brian S. Dean <bsd@bsdhome.com>.
This man page by
BUGS
Please report bugs via
The JTAGICE mkII programmer currently cannot write to the flash ROM one byte at a time. For that reason, updating the flash ROM from terminal mode does not work.
The device IDs used by AVR910 and AVR109 do not match, so the avr109 (aka. butterfly) programmer might report Use the -F option to force to contiue anway.