CrossRoads:
"atmel ISP programmers like AVR dragon, and AVR ISP MK II, can't be used with the IDE to burn a bootloader."Baloney. I use my AVR ISP MK II all the time, here it is connected to a Mini2560 board burning a bootloader.
While the Atmel USB ISP devices definitely can program a bootloader using avrdude, as far as I've seen
it still cannot be done using the Arduino IDE and this has been an issue for many years.
Actually, it has never worked.
I now mostly use a USBasp device with my custom f/w which is much faster than the Dragon,
I occasionally use my dragon as well, but not with the arduino IDE using the avrdude it comes with.
To use the Arduino IDE requires using a custom version of avrdude with a fix.
The low level USB code in avrdude for the jtagMKII devices (which includes the dragon and MK II) resets the USB just before it exits for AVR dragon and MK II devices.
The result is that on back to back commands the 2nd command will fail.
Here is the full output from IDE version 1.8.5 attempting to burn a bootloader into an UNO type device that shows the issue and error on the 2nd avrdude command.
(The first avrdude command worked just fine)
home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cdragon_isp {program.extra_params} -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
[color=red]
avrdude: Version 6.3, compiled on Jan 17 2017 at 06:01:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/bill/.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: 00A20000756E
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
boot-loader FW version: 255
firmware version: 1.01
hardware version: 1
S_MCU:
boot-loader FW version: 255
firmware version: 1.09
hardware version: 7
Serial number: 00:a2:00:00:75:6e
Device ID: AVRDRAGON
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
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 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : DRAGON_ISP
Description : Atmel AVR Dragon in ISP mode
Vtarget : 4.0 V
SCK period : 8.00 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.15s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.06s
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: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xff instead of 0x3f (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.06s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDE"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.06s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDE:
avrdude: load data hfuse data from input file 0xDE:
avrdude: input file 0xDE 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 "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.06s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF 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.
[/color]
/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cdragon_isp {program.extra_params} -Uflash:w:/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m
[color=red]
avrdude: Version 6.3, compiled on Jan 17 2017 at 06:01:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/bill/Documents/devel/arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/bill/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : dragon_isp
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2107)
avrdude done. Thank you.
Error while burning bootloader.[/color]
So you can see the 2nd avrdude command failed because avrdude couldn't locate the device.
This is because the previous avrdude command reset the USB and the USB ISP device had not yet enumerated.
--- bill