Using AVR Dragon To Program AVR Chips

by Noel on March 6, 2012

In an earlier post, I wrote about AVR programming using Mac OSX. The last part in that procedure was the compiling of the C code to a HEX file.

Now how do you get the HEX file and upload it to your AVR microprocessor? You will need some sort of a programmer to do that.

Today I’m using one of the top choices for programming AVR chips, and that is the AVR Dragon. Thanks to Element14 for sending an AVR dragon for review.

What I like about the AVR dragon is that you can program your AVR microprocessor using several methods such as JTAG, HVP, PDI, or ICSP. It also allows debugging of all AVRs via JTAG, PDI, or DebugWire. Pretty impressive indeed.

In this article, I would try and discuss more about ICSP programming. ICSP stands for in-circuit serial programming. This means even if your AVR is already soldered on your board, as long as you’ve provided an ICSP connector for programming, you can upload your HEX files to your AVR chip.

How you do “wire” an ICSP connector, here’s a diagram I found from

photo credit:

Once you get your AVR dragon, there will be provisions for putting in some IC sockets where you can plug-in and program your AVR chips. In my case, I added a ZIF socket so I can put in my AVRs with ease. There are also provisions for male or female headers. I just used male headers instead.

Before actually burning your HEX files, here’s where a lot of newbies like me made a mistake. Unlike PIC where perhaps you use a pickit2 for programming, you need to provide power to your AVR chip in order for you to successfully program your AVR microcontroller. In PIC, you don’t have to. The power is provided by pickit.

Now of to the actual burning of your HEX files. You will need AVRdude to do this. You can invoke AVRdude via the command line and just pass on certain parameters like the hex file you wanted to “burn”.

In my example, here’s what I used.

avrdude -p m328p -c dragon_isp -P usb -e -U flash:w:Blink.cpp.hex

Now let’s discuss a bit about those parameters passed on to avrdude.

-c This parameter is where you specify the programmer you will use. In our case we’ll be using “dragon_isp”.

-p means the part number/code of your AVR processor. In my case I’m using m328p as I’m using Atmega328P.

To list the available part “codes”. You can type this at the command line.

avrdude -c dragon_isp

and it will show a list of AVR chips and the corresponding code for that.

-P usb tells avr dude to look for our AVR programmer in one of the USB ports.

-e is for performing chip erase

-U is for specifying the memory type, and the filename. The syntax is this

-U :r|w|v:[:format]

So here’s the screenshot of me burning the arduino bootloader to my Atmega328P chip using AVR dragon.

Here’s a photo of the setup

I’ve created a rig where I can easily burn bootloaders on Atmega328 chips. There’s an ISP connector and I have a 6pin cable connector to connect my rig to my AVR dragon.

Products Used:

AVR Dragon USA (via newark) – $49

AVR Dragon (Element14 Philippines) – PHP3,350

Leave a Comment

Previous post:

Next post: