Thursday, February 6, 2014

AVR Dragon

I've been having some fun times with an Atmel AVR Dragon. I've been borrowing an awesome JTAG ICE MkII for a few years, can't afford to buy one for my very own. My fallback has been a fine Pololu AVR programmer. Here are my initial impressions for anyone considering getting an AVR Dragon.

Using a programmer made by the chip-maker means, in my experience, time saved with less hassle. And this is a really useful little device, more so than the JTAG ICE. It has JTAG, debugWire 6-pin ISP, a high voltage programming header (to unbrick a chip for which you set the wrong fuses), a prototyping area, and so far, it's been pretty easy and trouble-free to use.

Best of all, the Atmel AVR Dragon is inexpensive for a debugger / programmer. You can get one for $50 from Newark.

Upon arrival, and after removing stickers from Newark, the AVR Dragon comes in a surprisingly attractive, glossy box with a cool Asian-motif dragon on the front. Ok, sure, it's just a box but I like it, what can I say? I think I'll keep it.

The AVR Dragon is just a board. It isn't enclosed in a swoopy, blue, injection-molded plastic case like the JTAG ICE or AVR ISP.  At one end is a full size USB B (ugh) and on the other end is a prototyping area.

Prototyping Area

In this area you can install a ZIF socket---you may need to clearance the box to keep using it---or a regular socket so that you can program various AVR devices. You can install a 40-pin DIP socket or 28-pin DIP. It occurs to me that you could install both by using single-row sockets in each of the 40-pin spots.

The Dragon manual explains how to use the prototyping area and provides a device connection sheet showing you how to connect your AVR to the correct programming header's pins (ISP, JTAG, or High Voltage Programming).

Basically you jumper from the appropriate programming and power headers to the appropriate pins on the 2x40-pin Device header. Like a switchboard operator of old.

For example, to program an ATtiny13, 25, 45, or 85 with HV programming:

Reproduced from AVR Dragon manual for educational purposes
Just connect VCC to the JTAG header, connect and 7 more pins to the Device header. In case you're wondering what all these pins are and do, there's a pin header reference on the bottom of the board.

Device Support

You can find the list of supported devices here. I typically use ATmega328P and family, ATtiny13, ATtiny85 and siblings, ATtiny84 and family, and ATtiny2313 and ATtiny4313. ISP and debugWire is supported on all of these (the chips themselves lack JTAG). There is a known issue with ATtiny84 parallel programming, unfortunately, when DWEN is enabled. I believe that means if the chip gets stuck in debugWire, rescue parallel programming with the Dragon won't work.

Other commonly used MCUs are supported: ATmega32U4, ATmega1280, ATmega2560, ATmega644, ATmega324,  and loads more. 

I don't see the ATtiny841 listed. It's the new Tiny from Atmel for which I'm building a breakout board soon. Bummer.

ISP and Programming

The board has a 6-pin header pre-populated and labelled "ISP" for In-System Programming. I wasn't paying attention and used the VCC/GND 6-pin header and fried my chip. You won't do that because you pay closer attention than I do, right? And also, I just warned you.

Once you have the cables hooked up, avrdude (on Linux) requires no drivers to program your chips. I love this feature after fighting with serial devices on Linux many times over the last year. I'm running Mint 14 and avrdude programming has gone well.

On Windows you do need to install a driver but that's easy to do and I did just that on a VirtualBox Windows 7 virtual machine I use. Sometimes it's nice to program using the chip-maker's IDE and I often fire up AVR Studio 4 in a VM to do this. I also played a bit with Atmel Studio 6. In the case of Studio 4, it's a simple matter of clicking connect, selecting Dragon and USB in the dialog, and you're good to go.

Easy Upgrade, Easy Fix

AVR Studio 4 prompts you if the attached device has updated firmware available. I went ahead and told it to update but ran into some problems and had to kill the AVR Studio process.

At this stage, my Dragon was stuck in bootloader mode and showed up as AVRBLDR and I couldn't use it to flash anything. Fortunately the fix was trivally simple. I simply launched Studio 4 again, and selected AVR Dragon Upgrade from the Tools menu. The firmware was successfully updated, no problem. All of this was done in my Windows 7 virtual machine.

HV Programming

Though I've not yet tried it, one very useful feature is the ability to perform high voltage programming. If you brick your chip by setting fuses that use an external crystal, but none exists on your target board, you can no longer use ISP. HV programming can save the day.

I have previously used an HV Rescue Shield attached to an Arduino for this task, but it's nice not to have to drag out the Arduino and Rescue Shield. I'll already have the Dragon out and in-use.


I've not had a chance to play with JTAG or debugWire so I'll post up about that at a later time.


So far, so good. The Dragon is a relatively low cost programmer/debugger capable of high voltage parallel programming, in-system programming, JTAG and debugWire on-chip debugging. It's worked well so far on Linux and Windows.

It's made by the chip-maker which in my experience can save a little time and hassle, though your mileage may vary.

The prototyping area may work for some once you set up the jumpers for your particular chip. If you switch between MCU families regularly it might not be too convenient.

I hope to be able to use this as my one and only programmer/debugger for the families of chips I usually work with.

I'd love to hear your thoughts and experiences on the AVR Dragon. Post a comment?

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.