AVR Dragon for burning sketches

I read on this forum a few confused posts about using AVR Dragon as an external programmer with Arduino IDE and thought my experience may be useful to someone.

AVR Dragon can be used as an external programmer with Arduino IDE, e.g. to burn sketches to Arduino-compatible hardware without the bootloader. For example, I use it to upload my sketch to an ATMega8L controlling an audio amplifier based on TI’s TAS5086 PWM processor. I use it under Mac OS X; I have heard, but not tested, that the same thing under Windows may be tricky because of USB driver incompatibility.

As expained in http://www.arduino.cc/en/Hacking/Programmer, I add the following three lines to the programmers.txt:

dragon.name=Atmel AVR Dragon in ISP mode
dragon.communication=usb
dragon.protocol=dragon_isp

(after that, AVR Dragon appears in the list of programmers in the “Tools → Burn Bootloader” menu), and either change the line

upload.using=bootloader

in the preferences.txt (which must be edited when the IDE is not running, or it will be overwritten) to

upload.using=dragon

to have Arduino IDE use AVR Dragon for all uploads, or add the line

atmega328.upload.using=dragon

to the appropriate section of boards.txt to use AVR Dragon only if “Arduino Duemilanove or Nano w/ ATmega32” is selected.

Either way, when I connect my Arduino Duemilanove to the AVR Dragon with an ISP cable, Arduino IDE uploads sketches flawlessly.

For some reason, I cannot burn the bootloader in the same way. avrdude sucessfully writes unlock bits with the following command:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cdragon_isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

but the attempt to actually burn the bootloader fails:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cdragon_isp -Pusb -Uflash:w:/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:i -Ulock:w:0x0F:m

avrdude: Version 5.4-arduino, compiled on Oct 9 2007 at 11:20:31
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is “/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf”
User configuration file is “/Users/*******/.avrduderc”
User configuration file does not exist or is not a regular file, skipping

Using Port : usb
Using Programmer : dragon_isp
avrdude: stk500v2_dragon_isp_open()
avrdude: usbdev_open(): did not find any USB device “usb”

If I copy-paste that last command into the terminal, it works just fine. I’d be grateful is someone let me know how to make it work from within the IDE.

Hi, did you found the solution ? I have the same problem directly programming with avrdude -p m328p -c dragon_isp -Pcom14

This sounds similar to the problem that occurs with the AVRISP mkII on Windows: https://github.com/arduino/Arduino/issues/2986 AVRDUDE resets the mkII between the fuse setting and burning the bootloader operations and doesn't delay long enough for the programmer to reinitialize after the reset.

Which version of AVRDUDE are you using? The version is shown in the console if you do an upload with File > Preferences > Show verbose output during > upload(check). The mkII problem was solved for me by using AVRDUDE 6.0.1 included with Arduino AVR Boards 1.6.12 and newer.

Here's a relevant comment from @hansibull/MCUdude:

I've been thinking about adding the AVR dragon as a programmer, but there's a bug in AVRdude thats resetting the Dragon right after the correct fuses have been burnt.