LinuxCommandLibrary

avrdude

Upload/download data to/from AVR microcontrollers

TLDR

[r]ead the flash ROM of a AVR microcontroller with a specific [p]art ID

$ avrdude -p [part_no] -c [programmer_id] -U flash:r:[file.hex]:i
copy

[w]rite to the flash ROM AVR microcontroller
$ avrdude -p [part_no] -c [programmer] -U flash:w:[file.hex]
copy

List available AVR devices
$ avrdude -p \?
copy

List available AVR programmers
$ avrdude -c \?
copy

SYNOPSIS

avrdude [-c programmer-id] [-p partno] [-P port] [-b baudrate] [-D] [-V] [-e] [-U memtype:file[:format]] [-v] [-C conf]

PARAMETERS

-c programmer-id
    Specify programmer type (e.g., usbasp, arduino).

-p partno
    Select AVR device (e.g., m328p, atmega2560).

-P port
    Set communication port (e.g., /dev/ttyUSB0, usb).

-b baudrate
    Override baud rate for serial programmers.

-D
    Disable auto chip erase.

-e
    Perform chip erase before programming.

-V
    Disable automatic verify after write.

-F
    Override signature/lock checks (risky).

-U memtype:file[:format]
    Memory operation: r/w/v for read/write/verify (e.g., flash:w:file.hex:i).

-v
    Enable verbose output (-vv more, -vvv debug).

-q
    Quiet mode, minimal output.

-C config-file
    Use alternate config file.

-i
    Use fast (non-page) programming mode.

-E exit-specs
    Set programmer pin states on exit (e.g., reset,halt).

-B bitclock
    Set SCK frequency (e.g., 0.5 for ISP).

DESCRIPTION

AVRDUDE is a command-line tool for communicating with Atmel AVR microcontrollers and variants, such as those used in Arduino boards. It supports reading, writing, erasing, and verifying flash, EEPROM, fuse bits, and lock bits via diverse programmers including USBasp, AVRISP, Arduino-as-ISP, and serial/parallel interfaces.

Primarily part of the AVR-GCC toolchain, AVRDUDE is invoked by Arduino IDE and Make-based projects to upload firmware (.hex, .eep, etc.). It uses a configuration file (avrdude.conf) defining parts, programmers, and protocols. Key features include high-voltage programming, chip erase, verification, and safe modes to prevent damage.

Usage involves specifying the target part (-p m328p), programmer (-c usbasp), port (-P /dev/ttyUSB0), and memory operation (-U flash:w:firmware.hex:i). Verbose output aids debugging. It's essential for embedded development on Linux, handling baud rates, bitclock adjustments, and retries for reliable operation.

CAVEATS

Can permanently damage chips with wrong -p or -F; always verify fuses. Requires udev rules for USB devices. Serial ports need user in dialout group. Config mismatches cause failures.

CONFIG FILE

Default /usr/share/avrdude/avrdude.conf lists 300+ parts/programmers. Edit for custom signatures.

MEMORY TYPES

flash, eeprom, lfuse, hfuse, efuse, lock, signature. Formats: i (Intel hex), s (Motorola SREC), etc.

EXAMPLE

avrdude -c usbasp -p m328p -U flash:w:sketch.hex:i uploads to Arduino Uno clone.

HISTORY

Developed by Brian Dean in 2002 for AVR Dragon support. Evolved with AVR community, integrated into AVRDUDE 6.x (2010s) with Arduino boom. Now at v7.x, maintained by Microchip post-Atmel acquisition, with JSON config experiments.

SEE ALSO

stty(1), screen(1), minicom(1), usb(8)

Copied to clipboard