The AVRDUDE files...

 AVRDUDE (AVR Downloader UploaDEr) is the program that is used by the Arduino IDE to communicate with either programmers or the AVR itself if the Serial Port is being used. We will only discuss using a programmer with AVRDUDE here.

The Arduino IDE provides an editor for writing the sketch and a compiler to create a HEX file that contains the raw binary instructions for the AVR. AVRDUDE is then used to transfer the HEX file via a programmer to the AVR.

To do this, the Arduino IDE works in one of three modes:

  1. The Arduino IDE tells AVRDUDE to transfer the HEX file via a port such as the Serial Port to the bootloader on the device
  2. The Arduino IDE tells AVRDUDE to program the HEX file and set/reset the fuses using a programmer straight into the device memory
  3. The Arduino IDE tells AVRDUDE to set/reset the fuses and load a bootloader onto the device (if required)

Remember, the fuses on the device are only set/reset during the bootloading operation. AVRDUDE relies on a file called "avrdude.conf" which can be found in the following folder:

  "C:\Program Files\Arduino\hardware\tools\avr\etc\"

C:\Program Files

The "avrdude.conf" file is large and contains definitions and programming information for just about all the AVRs in "common" use. I say  "just about all" because one glaring omission is an entry for the ATmega328 as we will discuss later. The one really annoying fact is the the Arduino IDE does not support all of the devices that AVRDUDE does and this includes some commonly used AVR devices.

The Arduino IDE also does not recognise the ATmega328 or ATtiny4313, but there ways around this, messy but effective. More on this later!

If you don't use the "missing" AVR types don't worry, it isn't going to affect you but many people still do and Arduino have not taken the oportunity to rectify this matter in the new Arduino IDE 1.5. Why, I don't know but they haven't!

Here is just one definition from "avrdude.conf":

For readers using Safari on an Apple computer or iPad, the window below is "scrollable" but the scroll bar may not be visible!

Please note the "signature" entry 15 lines down from the top as this will be discussed later. This is the unique device identifier used by AVRDUDE to ensure that it is writing to the correct device. AVRDUDE reads the "signature" value from the device and compares it with the above entry. If they don't match, AVRDUDE exits with the infamous messages below:

avrdude: Device signature = 0x1e9514
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
Double check chip, or use -F to override this check.

(this is the message generated when the Arduino IDE and AVRDUDE try to program an ATmega328 place of an ATmega328P)


avrdude: Yikes! Invalid device signature.

It is worth noting that a reported device signature of 0x000000 or 0xFFFFFF is a complete failure to read the signature at all which suggests a wiring or device fault.

Just below the "signature" entry is one called "pgm_enable" and this is the actual command in binary that will be sent by AVRDUDE to the AVR. There are many other commands and some configuration data but you don't have to worry about it unless you hit a snag. The biggest snag you will hit will be because the current "avrdude.conf" file is incomplete. I present a revised version of the "avrdude.conf" file later on which fixes most of the issues (I hope).

The programmer's job is to accept the commands via its USB, Serial or Parallel Port and covert the data stream into a form that is meaningful to the device being programmed. There is a two way interaction with the device, using the SPI bus, such as when the signatures are compared or data that has been transferred is verified. If you are really interested, the chatter between AVRDUDE and the programmer is the red text at the bottom of the Arduino IDE. The white text is the commands being sent by the IDE to AVRDUDE if you didn't know.