6.3 Command line utility

Programming

AVR Studio 4 is shipped with a command line tool to perform progamming tasks with the AVR Dragon. It is located at [INSTALL PATH]\Atmel\AVR Tools\AvrDragon\avrdragon.exe or equivalent. Here is how to use it.

Usage: avrdragon.exe [commands] [options]
Commands:
 -h, -?         Print this help.
 -he            Print exit codes.
 -e             Erase device.
 -f <fusebytes> Write high/low fuse bytes. The LSB of fusebytes will be
                written to the low fuse byte, and the MSB will be written
                to the high fuse byte.
 -j <ID>        Read JTAG ID string. If an optional ID is specified, the
                program will terminate if the read ID differs.
 -l <lockbyte>  Set the lock byte to the specified value.
 -p[f|e|b]      Program FLASH (-pf), EEPROM (-pe) or both (-pb) memories.
                Requires input files specified with the -if (FLASH)
                and/or -ie (EEPROM) options.
 -q             Read fuse bytes. If the selected device has extended fuse,
                it will be also be read.
 -r[f|e|b]      Read FLASH (-rf), EEPROM (-re) or both (-rb) memories.
                Requires output files specified with the -of (FLASH) and/or
                -oe (EEPROM) options.
 -s             Read signature bytes.
 -v[f|e|b]      Verify FLASH (-vf), EEPROM (-ve) or both (vb) memories.
                Requires input files specified with the -if (FLASH) and/or
                -ie (EEPROM) options.
 -y             Read lock byte.
 -E <ext.fuse>  Write extended fuse byte.
 -F <fusebytes> Verify high/low fuse bytes. The LSB of fusebytes will be
                compared to the low fuse byte, and the MSB will be compared
                to the high fuse byte.
 -L <lockbyte>  Verify the lock byte.
 -G <ext.fuse>  Verify the extended fuse byte against the given value.
 -O <address>   Read oscillator calibration byte. Address is location of byte
                as specified in the device's data sheet.
 -S[f|e] <address>
                Write oscillator calibration byte read with -O or -Z to given
                location in FLASH (-Sf) or EEPROM (-Se).
 -W             Disable debugWIRE interface, enabling ISP mode. Only available
                for debugWIRE devices.
 -Y             Perform the oscillator calibration sequence. See appnote
                AVR053 for more information.
 -Z <address>   Load value from address in EEPROM prior to erasing the device.
                This value can be written to FLASH or EEPROM again with
                the -S[f|e] command.

Options:
 -ae <start>,<end>
                Specify address range for reading EEPROM memory. Default is
                entire memory.
 -af <start>,<end>
                Specify address range for reading FLASH memory. Default is
                entire memory.
 -c <port>      Optional. Specify port to connect to. Can only be USB with
                AVR Dragon serial number specified. Ex: -c USB:00A00000002C
 -d <device>    [required] Specify the type of device.
 -ie <file>     Specify input file for programming EEPROM memory.
 -if <file>     Specify input file for programming FLASH memory.
 -m[i|j|p]      Choose programming mode: ISP (-mi), parallel/high-voltage (-mp)
                or JTAG (-mj) (default).
 -oe <file>     Specify output file for reading EEPROM memory.
 -of <file>     Specify output file for reading FLASH memory.
 -z             No progress indicator. Useful when redirecting output to file.
 -D <devsbefore,devsafter,bitsbefore,bitsafter>
                Set daisy chain settings. Only available in JTAG mode.
 -I <speed>     Specify ISP frequency (Hz). Only available for ISP mode.
 -J <speed>     Specify device speed (Hz). Only available for JTAG mode.
 -R             Apply external reset while programming. Only available in
                JTAG mode.

Example usage: avrdragon.exe -d ATmega128 -e -pf -if c:\tmp\test.hex       


              

Firmware upgrade

For preparations: FW upgrade preparations

Firmware upgrade can be achieved using the command line utility:

[INSTALL PATH]\Atmel\AVR Tools\AvrDragon\avrdragon.exe