Nav:  [home][elec][pdev] > [usb-atmelprg]
 
Go:  [index] [circuit] [firmware] [software] [levelcv] [openocd]
← [What are these? Why?]

USB-AtmelPrg: Wolfgang's Universal Interface Cable

USB-AtmelPrg is my self-developed USB-based "universal" interface "cable" providing all features I need when designing with programmable devices (AVR 8-bit RISCs via SPI, XILINX CPLDs and 32-bit ARMs via JTAG port). These pages describe all you need to build and use this device including host software and full circuit diagrams.

Purpose and Features

For an overview on what programmable devices are, what an interface cable is and why you need it, please see the parent page. If you don't understand the name USB-AtmelPrg, read about its history.

Basically, USB-AtmelPrg is my self-developed USB-based "universal interface cable" connecting a host computer to the programmable device such as a microcontroller or a CPLD. Most such cables on the market are proprietary and expensive. In contrast, USB-AtmelPrg is inexpensive and free and still provides all functionality I need.

Here is a list of features:

  • Programming and verifying AVR microcontrollers (Atmel's 8-bit RISCs; see supported devices) flash, EEPROM and fuses via usual SPI (supports in-system programming).
  • JTAG support: Query IDs and execute SVF files (currently limited to one device per chain), e.g. to in-system program CPLDs.
  • USB-AtmelPrg can be used as JTAG cable backend for OpenOCD, e.g. to in-system program and debug ARM microcontrollers such as the AT91SAM7.
  • Host software for Linux featuring readline support with command completion.
  • Plug-n-play: USB-based, can run from USB power; no need for legacy devices.
  • 5V logic, external level converter adds 3.3V capability.
  • Allows to supply the programmable device with 5V (or 3.3V with level converter).
  • It's free: Software, firmware and electronic circuit diagrams are available for download for private (non-commercial) use.
  • More features are added as I need them -- and you can add features yourself!

Note: USB-AtmelPrg is actually a USB to JTAG and SPI converter board but still I call it "interface cable" because in the end, it's just a very thick cable with a USB plug on one end and a SPI/JTAG plug on the other end.

Interface Cable Circuit

Programmer in blue translucent box [9kb]
[click to enlarge: 58kb JPG]

The circuit is a quick and simple design fitting nicely onto a 5x8 cm two-layer board ("1/4 Euro board") and has lots of additional connectors for debugging and integration into other setups.

The complete design and more description can be found on the circuit page.

The image on the left shows the interface "cable" board built into a blue translucent box. This setup allows only USB-powered operation which is sufficient in most cases. Actually, this interface cable box turned out to be very handy.

Firmware for the Interface Cable

The circuit makes use of an ATMega8 AVR RISC microcontroller which itself needs to be programmed before the electronics in the interface cable is fully operational. This is a quirk anybody who likes to build this own USB-AtmelPrg has to be aware of. This means that you already need a working programmer for an Atmega8 chip to build the USB-AtmelPrg interface cable (which in turn, once operational, can be used to program further such microcontrollers).

In theory, it should be possible to program the ATMega8 controller in the cable circuit using the "bitbang" mode of its own USB controller but this has not been tested yet. Hence, if you do not have any means to program an ATMega8 controller, and do not want to experiment with "bitbang mode programming", you cannot build a USB-AtmelPrg interface cable.

Wonder how I got mine running in the first place? See history.

External Level Converter for 3.3V Logic Devices

Level converter [11kb]
[click to enlarge: 129kb JPG]

With 3.3V logic becoming increasingly popular it may be nice to have a way for in-system programming of 3.3V devices. This level shifter can be inserted between the USB-AtmelPrg interface cable and the programmable device without requiring any change to USB-AtmelPrg's internal circuit. The level converter contains a low-drop regulator and makes use of the 5V supply already available to USB-AtmelPrg, so no external 3.3V source is required. Optional 5V or 3.3V power supply is provided for the device to be programmed. The only disadvantage: It has no tristate outputs (no High-Z).

The level shifter is cheap and easy to build; the full circuit diagram is available. More...

Host Software for USB-AtmelPrg: usb-atmelprg, OpenOCD

There is not just a single piece of software for the USB-AtmelPrg interface cable but what software to apply depends on what you want to do:

  • usb-atmelprg is the main program for flashing AVR RISC microcontrollers and sending SVF files over the JTAG port.
  • OpenOCD (Open On-Chip Debugger) can use USB-AtmelPrg as JTAG interface cable to program and debug ARMs such as the AT91SAM7 series.

All this software is available for free and runs natively under Linux; OpenOCD also supports Windows.

For Those Interested: Some Remarks on USB-AtmelProg's History

For quite some time, I was using my home-made parallel-port based programmer which merely existed as a put-together circuit scattered over several boards (which can be seen in the image below showing USB-AtmelPrg during testing connected to the parport-based AVR programmer). As this is not really a movable plug-n-play system and since the parallel ports are slowly vanishing from the mainboards (and laptops), a better solution had to be found.

One day during the time I was working for the quantum optics group at the LMU where I designed AVR-RISC-based devices and programmed them at home, (while walking for lunch) it was decided that a better programmer finally needed to be built: One for me and one for the university... And that's the date of birth of USB-AtmelPrg and also explains how this interface cable got its name "USB-AtmelPrg".

Nearly a year later, I wanted to program and use a CPLD from XILINX and decided to additionally implement SVF downloading so that the CPLD could be programmed via its JTAG port. (This works because JTAG has 3 output and 1 input line just as the SPI used to talk to AVRs.) Furthermore, I added the external 3.3V level converter since the 3.3V XC9500XL family is much cheaper than 5V XC9500 family.

Again a year later, I saw that Reichelt (a german electronics distributor) sells 32-bit ARM microcontrollers with integrated flash and SRAM for below EUR 10. Having occasionally thought about how to upgrade to a highly integrated microcontroller offering more computing power than usual AVRs, I deciced to take a look at the AT91SAM7S64. Therefore, I patched OpenOCD so that it can use the USB-AtmelPrg cable to program and debug the attached ARM.

Testing the USB-based programmer [11kb]
[click to enlarge: 200kb JPG]

Prototype: This image shows the USB-based programmer during software development and testing. The main 3 connections are: The USB cable to the host PC, the 9-pin SUB-D connecting the programmer with the AVR-RISC device to be programmed (applying an ATMega8515 in this case) and finally the 3-wire connection (3 thin white cables) to the parport-based programmer (which is needed to download firmware on the USB programmer's ATMega8 controller).
The clock generator (bottom right) and the stuff on the black board with holes are not needed.


[home] [site map]
Valid HTML 4.01!
Copyright © 2005-2007 by Wolfgang Wieser
Last modified: 2007-11-06 00:54:20