I have got my hands on a AVR Dragon programmer and on-chip debugger. This is a low cost unit for the ATMEL 8 and 32bit microcontrollers. I was wanting to program some ATTINY85 microcontrollers (to make TV-B-Gones for a Nottinghack workshop amongst other things). I got mine from Farnell electronics and it was around £40 ish.

The first thing to do was to download and install AVR studio from ATMEL. This is an IDE (Integrated Development Environment), which is free to download, but only for Windows at the moment, I think. I am using Windows 7 but will also sort out using this for Linux (I use Ubuntu on my other machine).

I installed AVR Studio 5.0 (the most current version). This went smoothly.

I then plugged in the AVR dragon board to a USB port. The device driver installation went OK.

Reading the Dragon manual, the board has connectors for JTAG, ISP and HV programming. I will be using ISP (In-System Programming). The board does not have a socket for the device, but there is an area to add a ZIF (zero insertation force) DIP socket. I ordered a 40pin ZIF socket from ebay.

The connections for the different microprocessors will be different, so check the documentation for the correct wiring connections. I will add the ZIF socket and have a number of different connector leads to allow me to program various microprocessors. To start with I will use  breadboard to try and upload code (I’ll add the ZIF socket when it arrives).

This shows the AVR dragon with breakout wires to a breadboard. I will use a ZIF socket in the future. Make sure you get the pins correct on the ATTINY chip (I got them reversed, so took a while to sort that out)

The strip board has header plugs underneath. I will use a different strip board connector for different microcontrollers, when the ZIF socket has arrived.

Once we have the microcontroller correctly wired up we can run the AVR studio. I already had the .hex code for the device (from the adafruit website). When you start up AVR Studio 5, you select a new project. Then click on ‘AVR assembler project’ and click OK. You then choose which device you would like to program (in this case scroll down to the ATTiny85 and click OK).

We need to load in the .hex file, so go to File -> Open -> File. Then select the .hex file you would like to use. This will open as a tab in the workspace. It will be filled with hex code, so all a bit gibberish unless you really are one with the machines.

I then clicked on Tools -> AVR Programming.

You enter in the programmer (if your AVR Dragon is plugged in then it will be in the list of tools), the device (again the ATTiny85) and the interface (ISP in this case). This should be OK.

To check it is all working OK then click on the Read Device ID button. The device ID should be a unique identifier. This did not work for me the first time, so I had to lower the ISP clock frequency below the suggested 1MHz. I went right down to the lowest and it then read the device ID. Increasing the frequency still worked, but I left it around halfway (64kHz, I think). This was probably due to my crazy long wires to the breadboard. Hopefully with the local ZIF socket I can use the higher frequency, but its only a difference of half a second or so.

Next step is to click on ‘Memories’. Use the flash box (as that is where the code will go) and navigate to the correct .hex file. Then click on ‘Program’. This will erase then program then verify the code and takes a few seconds. You should get the message:

And then the microcontroller is programmed and should work. I plonked it in the breadboard circuit below and it worked! Yey!

Successfully programmed a .hex file onto an ATTiny85. Here it is running the TV-B-Gone code, but with a visible LED, as a test.

This shows the output waveform to the LED – it is the OFF code for a certain type of TV and shows that the IC has been correctly programmed.

UPDATE 25/1/12: I have added a ZIF socket for easy prgramming. I have also finished the stripboard and header plug board which means I can prgram any of the ATtiny 25/45/85 range. Other stripboards would be required for different micrcontrollers.

 

2 responses to “Using the AVR Dragon programmer

  1. Please help me, I am starting a phone repair workshop for first time, my urgent problems are opareting software or drives for my Dragon, ATF & SPT Flashingboxes.
    Please help me!

    The need one.

Leave a Reply

Your email address will not be published. Required fields are marked *