First, information about how you can use the AVR-Dragon with the Arduino IDE:
Using the AVR Dragon with the Arduino IDE
AVR Dragon
Modifying the box
You can cut a slot for the USB and anchor the Dragon AVR using the opposite tab
Using the Dragon as ISP
The ISP header is marked on the Dragon PCB
In order to use the AVR Dragon with the Arduino IDE, you need to edit the internal programmers.txt file to add an entry for the Dragon. On Mac OS and Arduino 1.0.1, the file is present at:
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/programmers.txt
Quit all running instances of the Arduino IDE, open the file with your favorite text editor and add the following:
dragon.name=Atmel AVR Dragon in ISP mode dragon.communication=usb dragon.protocol=dragon_isp
You should now be able to select the AVR Dragon in:
Tools > Programmer > AVR Dragon in ISP Mode
Sometimes you can find problems in Windows 10 becouse the system doesn’t detect the AvrDragon. You can use ZADIG to install de libusb-win32 driver.
Now the AVR Dragon Driver is found in the Device list.
Restoring Arduino MEGA Bootloader with ATMEL Studio
22 January 2016
After programming an Arduino MEGA board using Atmel Studio, the bootloader in the Arduino will be overwritten by the program loaded to the Arduino. The instructions that follow show how to restore the bootloader of an Arduino MEGA 2560 using an Atmel AVRISP mkII or AVR Dragon and Atmel Studio. When the bootloader is restored, the Arduino will be able to be programmed using the Arduino IDE software via the USB port.
1. Locate the Arduino MEGA Bootloader File
Locate the bootloader hexadecimal or hex file for the Arduino MEGA 2560 which is included with the Arduino IDE software. After downloading the Arduino IDE software and unzipping it, open the Arduino IDE folder which is in the form arduino-<Arduino IDE Version Number> and locate the bootloader file called stk500boot_v2_mega2560.hex as described below.
For example, in Arduino IDE version 1.6.7, the hex file is found in arduino-1.6.7hardwarearduinoavrootloadersstk500v2 as shown in the image below. This is just to show the location of the file – we will need to navigate to this file from within Atmel Studio.
2. Connect the Programmer
USING COMMAND WINDOW
You can use command window to program the device bootloader:
set path=%path%;C:UsersusuarioAppDataLocalArduino15packagesarduino oolsavrdude6.3.0-arduino9in
avrdude -C./avrdude.conf -v -patmega2560 -cdragon_isp -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m
REM Wait until AVRDragon is redetected and after 5 seconds press space bar
pause
avrdude -C./avrdude.conf -v -patmega2560 -cdragon_isp -Uflash:w:./stk500boot_v2_mega2560.hex:i -Ulock:w:0x0F:m
You can also can program the blinking example:
avrdude -C./avrdude.conf -v -patmega2560 -cdragon_isp -Uflash:w:./Blink_MEGA.ino.with_bootloader.hex:i -Ulock:w:0x0F:m
USING AVR STUDIO
Connect the programming device, such as the AVRISP mkII or AVR Dragon to the PC USB port and to the ICSP header of the Arduino MEGA 2560, then power the Arduino from its own USB cable.
Start Atmel Studio and click the Device Programming icon on the top toolbar or select Tools → Device Programming from the top menu.
In the Device Programming dialog box, select the Tool (AVRISP mkII or AVR Dragon), Device(ATmega2560) and Interface (ISP) then the click the Apply button. To test that Atmel Studio can communicate with the AVR on the Arduino board, click the Read button under the Device signature heading.
3. Program the Bootloader using Atmel Studio
Click Memories in the left pane of the Device Programming dialog box. Click the […] button found at the right of the box under the Flash label to browse for the bootloader file.
Navigate to and select the hexadecimal bootloader file called stk500boot_v2_mega2560.hexfound in the Arduino IDE software sub-folder hardwarearduinoavrootloadersstk500v2. Click the file in the dialog box and then click the Open button as shown in the image below.
Click the Program button in the Device Programming dialog box to load the bootloader to the ATmega2560 AVR. Close the dialog box when done by clicking the Close button.
4. Test the Bootloader using Arduino IDE
After loading the bootloader to the Arduino MEGA 2560, test the Arduino to make sure that the correct bootloader was loaded and that the board works with the Arduino IDE USB programming.
If you broke the track between the two RESET-EN pads to use the board with the debugger, first solder the pads together before continuing.
Unplug the USB cable from the Arduino board to power it down and then unplug the programmer from the Arduino board ICSP header. After a few seconds, plug the Arduino MEGA 2560 board back into the PC using a USB cable.
Open the Arduino IDE and select the correct board and port under Tools → Board and Tools → Port. Also make sure that ATmega2560 is selected under Tools → Processor.
Open the Blink example sketch from the top menu under File → Examples → 01.Basics → Blink. Load the Blink sketch to the Arduino MEGA 2560 from the Arduino IDE using the Uploadbutton on the Arduino IDE toolbar.
If everything is working, the Arduino IDE will compile and load the sketch and the L LED on the Arduino MEGA will blink on and off continually.
You can also add a Button in ATMEL Studio to USE AVRdude programming tool from Arduino Studio :
Tool ->External Tool-> Add NEW (Title: Send to Arduino Mega)
Command: f:SWElectronicaArduinoIDEarduino-1.6.12hardware oolsavrinavrdude.exe
Arguments: -C”f:SWElectronicaArduinoIDEarduino-1.6.12hardware oolsavretcavrdude.conf” -v -patmega2560 -cwiring -PCOM5 -b115200 -D -Uflash:w:”$(ProjectDir)Debug$(TargetName).hex”