ArduinoCore-avr icon indicating copy to clipboard operation
ArduinoCore-avr copied to clipboard

Feature Request: Add Support for AVR Dragon

Open sktrea opened this issue 7 years ago • 7 comments

Hi Could you add support for the Atmel (Microchip) AVR Dragon programmer? (moved from Arduino Issues #7269)

sktrea avatar Mar 02 '18 11:03 sktrea

I have an AVR dragon I tried to use with Arduino IDE a few years ago.

When you hit Burn Bootloader you're actually issuing two avrdude commands. the first one sets the fuses, and the second one loads the bootloader hex file. The problem I faced was that the programmer automatically reset itself after the fuses were sat. When the next command were executed immediately after, my computer couldn't find the USB device. If a small delay were added between the commands, it would work just fine.

MCUdude avatar Mar 09 '18 17:03 MCUdude

I remember we already saw and fixed the "second command sent too fast" issue maybe a couple of years ago. I can't find the commit, though, so maybe it's worth checking again if the fix is actually in place.

facchinm avatar Mar 12 '18 11:03 facchinm

I think this is the relevant issue report: https://github.com/arduino/Arduino/issues/2986. That issue was primarily about the AVRISP mkII but there is also discussion of what appears to be the same problem for the Dragon in the thread.

https://github.com/arduino/Arduino/issues/2986 (as it relates to the AVRISP mkII) was solved for me by the update to avrdude 6.3.0. I also was able to separately solve it by changing from the libusb-win32 to libusbK driver (even when using avrdude versions prior to 6.3.0). However, there is a report of the problem still occurring for the Dragon on that issue thread. I don't own a Dragon so I can't check it.

per1234 avatar Mar 12 '18 12:03 per1234

My Dragon have been laying in a drawer for a few years, and when I connected it to my PC last week, the power LED was just flickering (poor design..). Turned out the power circuity was faulty, and a bit of reflowing did the trick. My Dragon is now working just I just fine with Atmel Studio and Avrdude.

Here's the output when trying to burn bootloader to an ATmega32 using the Dragon in ISP mode:

/Users/Hans/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino12/bin/avrdude -C/Users/Hans/Documents/Arduino/hardware/MightyCore/avr/avrdude.conf -v -patmega32 -cdragon_isp -Pusb -e -Ulock:w:0x3f:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:0xd6:m -Ulfuse:w:0b10111111:m 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/Hans/Documents/Arduino/hardware/MightyCore/avr/avrdude.conf"
         User configuration file is "/Users/Hans/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : dragon_isp
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A200000F1A
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        255
  firmware version:              7.39
  hardware version:              1
S_MCU:
  boot-loader FW version:        255
  firmware version:              7.39
  hardware version:              2
Serial number:                   00:a2:00:00:0f:1a
Device ID:                       AVRDRAGON
         AVR Part                      : ATmega32
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    10    64    0 no       1024    4      0  9000  9000 0xff 0xff
           flash         33     6    64    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

         Programmer Type : DRAGON_ISP
         Description     : Atmel AVR Dragon in ISP mode
         Vtarget         : 5.0 V
         SCK period      : 8.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x1e9502 (probably m32)
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "{bootloader.extended_fuses}"
avrdude: writing efuse (0 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 0 bytes of efuse written
avrdude: verifying efuse memory against {bootloader.extended_fuses}:
avrdude: load data efuse data from input file {bootloader.extended_fuses}:
avrdude: input file {bootloader.extended_fuses} contains 0 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 0 bytes of efuse verified
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0b10111111"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0b10111111:
avrdude: load data lfuse data from input file 0b10111111:
avrdude: input file 0b10111111 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

/Users/Hans/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino12/bin/avrdude -C/Users/Hans/Documents/Arduino/hardware/MightyCore/avr/avrdude.conf -v -patmega32 -cdragon_isp -Pusb -Uflash:w:/Users/Hans/Documents/Arduino/hardware/MightyCore/avr/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_UART0_115200_16000000L.hex:i -Ulock:w:0x0f:m 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/Hans/Documents/Arduino/hardware/MightyCore/avr/avrdude.conf"
         User configuration file is "/Users/Hans/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : dragon_isp
avrdude: usb_open(): cannot read serial number "Input/output error"
avrdude: usb_open(): cannot read product name "Device not configured"
avrdude: usbdev_open(): Found [unnamed product], serno: [unknown]
avrdude: usbdev_open(): error claiming interface 0: Device not configured
avrdude: usbdev_open(): no usable interface found
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2107)

avrdude done.  Thank you.

Error while burning bootloader.

MCUdude avatar Mar 21 '18 18:03 MCUdude

This will be a nice feature to add.

mcuee avatar Jun 04 '22 08:06 mcuee

@per1234 made an awesome POC some years ago and got it working: https://github.com/per1234/InoAVRDragon

nmaas87 avatar Jun 04 '22 09:06 nmaas87

Unfortunately it does not seem to work in the 1.8.19 version of Arduino IDE. No AVR Dragon (workaround) programmer appear in the Tools > Programmer menu.

mcuee avatar Jun 04 '22 09:06 mcuee