Programming AVR microcontrollers using an ARM dongle
The short version is:
- You can program an AVR using a FTDI based ARM JTAG dongle
- Connect TCK (9) to SCK, TDI (5) to MOSI, and TDO (13) to MISO
- Use this patched copy of avrdude 5.8
- Run using avrdude -c signalyzerlite -p m48 -e -U flash:w:program.hex or similar
AVRDUDE is a nice command line based program that lets you program Atmel AVR based microcontrollers using the SPI based in circuit programming protocol. The very first versions used the parallel port to drive the processor but machines with parallel ports are getting rare.
FTDI make a range of USB to Serial adapters were later expanded to add bitbang and then Multi-Protocol Synchronous Serial Engine (MPSSE) modes. MPSSE is interesting as it can be used to do JTAG, I2C, and SPI and is readily available in FT2232D based ARM JTAG wigglers such as:
The Signalyzer is affordable at $39 US and has reasonable shipping to New Zealand.
All use the standard 20 pin ARM JTAG IDC header which, according to http://hri.sourceforge.net/tools/jtag_faq_org.html, has the following pins:
|1 - Vddh (+3.3v)||2 - Vddh (+3.3v)|
|3 - nTRST||4 - GND|
|5 - TDI||6 - GND|
|7 - TMS||8 - GND|
|9 - TCK||10 - GND|
|11 --------||12 - GND|
|13 - TDO||14 - GND|
|15 - nRST||16 - GND|
|17---------||18 - GND|
|19---------||20 - GND|
The FTDI chip has the following interesting pins:
|Pin||MPSSE name||Xverve pin||ATMEGA48 pin|
The AVR works as a slave in programming mode so TCK connects to SCK, TDI to MOSI, TDO to MISO, and TMS to RESETn.
Ville Voipio and Hannes Weisbach did the work on adding FTDI support. Their original patch against the CVS version of avrdude is available on the avrdude website. I updated this to the 5.8 release and added the definition for the Signalyzer.
The performance is quite good. A small 810 byte program for a ATMEGA48 using the default settings flashes in 0.73 s and verifies in 0.23 s for a total run time of 1.39 s.