Go Down

Topic: AVR Dragon for burning sketches (Read 5591 times) previous topic - next topic

alexcp

Feb 08, 2011, 08:35 pm Last Edit: Feb 08, 2011, 09:50 pm by alexcp Reason: 1
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:

[font=Courier]dragon.name=Atmel AVR Dragon in ISP mode
dragon.communication=usb
dragon.protocol=dragon_isp[/font]

(after that, AVR Dragon appears in the list of programmers in the "Tools -> Burn Bootloader" menu), and either change the line

[font=Courier]upload.using=bootloader[/font]

in the [font=Courier]preferences.txt[/font] (which must be edited when the IDE is not running, or it will be overwritten) to

[font=Courier]upload.using=dragon[/font]

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

[font=Courier]atmega328.upload.using=dragon[/font]

to the appropriate section of [font=Courier]boards.txt[/font] 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. [font=Courier]avrdude[/font] sucessfully writes unlock bits with the following command:

[font=Courier]/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[/font]

but the attempt to actually burn the bootloader fails:

[font=Courier]/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"[/font]

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.

Go Up