The AVR MCU programmer


Preface
How to build it...
Software
Usage
Requirements
Links

Preface

This programmer was designed for people, who want to do some engineering, not just saying to others, that "hey folks! See what I can do!!!". Therefore, it was designed for work, and not for blowing whistles and bells.

Why USB? I hear you ask... Well. Before this programmer, I made just mistakes. I was building 2-3 programmers for the PIC MCU. They were interfacing the parallel port of the PC. Which is crap. Once, I wanted to use the programmer on a SUN workstation, but it lacks support for low-level hardware access, so it was not working. In addition, I always had trouble with the parallel port. It has lot's of limitation. Cables no longer then 70cm... etc...

I said okay, and started to develop a programmer, which had operated on the serial line. Time passed by, and I said no. I went to Microchip, and bought a PIC programmer, which costs 400CHF. And it was just a box, and nothing else. It was not in circuit programmer.

I had a few project with the PIC, and then I saw the AVR. I said, okay, let's take a closer look. I started to search the Internet for a programmer. I had to say wow!! A programmer made out of 4 resistors, and 5 wires... that's cool. But, it was still for the parallel port. Then, I met the AVRUSB500 programmer from tuxraphics.org. This was exactly what I wanted to have. A few components, and you get a programmer. In addition, you can write your code in C for free on Unix. That's what you can't do with PIC16XXX.

So I started a reverse engineering from the original project. Why? I hear you ask again. Because the original project used through hole components, and lossy fixed cables, which I don't like. My design uses connectors all around. It's better, because after your 4th project, something will break.

The original project goal was the "solving the chicken and egg problem". Since this programmer consists of an MCU, this one has to be programmer too. So, another programmer should built for this one. Well, yes. It uses some bridge cable, and a special method for programming the MCU inside. The author says it takes 20 minutes to program it. Well, I said... I can build a programmer within 5 minutes, with the soldering iron heats up, this thing can be programmed in 1s, so why should I bother? I was not implemented the self programming feature into my project. Programming the MCU once was painless, and after this, it's working good.

So, if you are serious about MCU project, go ahead, build, and have fun with it!!! It's easy, it does not need any special skills. Well... you have to be extremely careful when you solder the FT232BM chip. After that, you'll get a programmer which works with any major platform such as BSD, Linux, Solaris, Windows!

How to build it

This requires high skills, and experience. If you don't have any, contact me, and order the kit from me.

Start with the FT232BM, and the ATmega8. It's the hardest part. After, you can go on, mount all other SMD resistors, capacitors. Finally, mount the connectors, the LED, etc..

After this you can make a 5 minute programmer, or the best way is to buy a pre-programmed ATmega8 soldered to the PCB. See contact at the end of this page. However, if you decide to program the MCU yourself, follow these steps.

  1. Crimp an RJ11 connector to a short 6 conductor ribbon cable, and solder it to the parallel port of your 5 minutes programmer (according to the specs of the programmer).
  2. On the usb500 programmer board, solder a wire through pin 2 of the RJ11 connector, and the RESET pin of the ATmega8.
  3. Connect a 5V supply to the screw terminal.
  4. Program the MCU.
  5. Remove the wire soldered to the RESET pin.
  6. Optionally, you can crimp another RJ11 to the other end of the cable (which was soldered to the 5 minutes programmer), so you gain a programing cable!
  7. That's it! You have it!

After the hardware is built, plug the programmer to the USB port. If you use Linux, see the /var/log/syslog logfile. Right after you plug the programmer in, you should see something like this among other things:

Feb 7 17:51:51 localhost kernel: ftdi_sio 4-2:1.0: usb_probe_interface
Feb 7 17:51:51 localhost kernel: ftdi_sio 4-2:1.0: usb_probe_interface - got id
Feb 7 17:51:51 localhost kernel: ftdi_sio 4-2:1.0: FTDI FT232BM Compatible converter detected
Feb 7 17:51:51 localhost kernel: usb 4-2: FTDI FT232BM Compatible converter now attached to ttyUSB0

You can see the tty device, where you can access your programmer.

Software

For C compiler, use GCC and friends. GNU make is your friend too! If you use windows, you can download the AVRstudio from Atmel's website.

Usage

To download your code to the target, use the avrdude program with your programmer. (links to all programs can be found down on this page) Avrdude needs to be configured to be able to use the programmer. This is done by adding the following lines to the avrdude.conf file. Replace /devfs/usb/tts/0 by your tty device.

# Overall avrdude defaults

default_serial     = "/dev/ttyUSB0";

# PROGRAMMER DEFINITIONS
programmer
  id    = "usb500";
  desc  = "Atmel AVR ISP V2 programmer by lekovacs@interware.hu";
  type  =  stk500v2;
;

To program the MCU run the following command:

avrdude -p m8 -c usb500 -e -U flash:w:MyCode.hex

Replace the MyCode.hex with your hex file.

Requirements for the target hardware

The pinout of the programming connector
pin # RJ12 (v1,v2)functionpin # AVR-ISP (v3)
1GND4,6,8,10
2RESET5
3MOSI1
4MISO9
5SCK7
6GND4,6,8,10

The RESET pin of the programming port must be connected to the RESET pin of the target MCU, and to VCC through a 10k resistor. Others straight to the target.

I suggest to place an RJ12 connector to the target board, and wire it up as it needed.

Avoid loading the MOSI, MISO, and SCK lines.

Links

Schematics and board layout
Firmware
Linux AVR environment and a 5 minutes programmer
avrdude
Atmel's website
The original article



Happy soldering!
by Levente
E-mail: lekovacs_AT_interware_DOT_hu
Updated on: 23.07.2007