1
\$\begingroup\$

I am attempting to burn a bootloader on a ATmega32U4 aka. Arduino Micro which is not succeeding. I am using a AVR Dragon with ISP interface.

avrdude -c dragon_isp -p m32u4 -P usb -U flash:w:Caterina-Micro.hex -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m -U lock:w:0x2f:m

When this commando is executed i get bunch of following errors:

savrdude: stk500v2_jtagmkII_recv(): failed

OS: OSX Mavericks

avrdude: v6.1

UPDATE

When i set the -B flag with 200 it clearly starts burning the bootloader, but is this due to a hardware flaw? It takes more than 3 minutes to burn.

avrdude -c dragon_isp -p m32u4 -P usb -U flash:w:Caterina-Micro.hex -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m -U lock:w:0x2f:m -v -B 1000
avrdude: Device signature = 0x000100
avrdude: Expected signature for ATmega32U4 is 1E 95 87
         Double check chip, or use -F to override this check.

Or:

avrdude -c dragon_isp -p m32u4 -B 1000

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.26s

avrdude: Device signature = 0x1e9587
avrdude: safemode: Verify error - unable to read efuse properly. Programmer may not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

And:

avrdude -c dragon_isp -p m32u4 -B 200000

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 2.46s

avrdude: Device signature = 0x1e9587
avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)
avrdude done.  Thank you.
\$\endgroup\$
2
\$\begingroup\$

When used in ISP mode, the AVR Dragon behaves similar to an AVRISP mkII (or JTAG ICE mkII in ISP mode), so all device-specific comments will apply there. In particular, the Dragon starts out with a rather fast ISP clock frequency, so the -B bitclock option might be required to achieve a stable ISP communication.

http://linux.die.net/man/1/avrdude

       -B bitclock
               Specify the bit clock period for the JTAG interface or the ISP clock (JTAG ICE only).  The
               value is a floating-point number in microseconds.  The default value of the JTAG ICE results
               in about 1 microsecond bit clock period, suitable for target MCUs running at 4 MHz clock and
               above.  Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to
               default values when the programming software signs off from the ICE, so for MCUs running at
               lower clock speeds, this parameter must be specified on the command-line.  You can use the
               'default_bitclock' keyword in your ${HOME}/.avrduderc file to assign a default value to keep
               from having to specify this option on every invocation.

http://www.nongnu.org/avrdude/user-manual/avrdude_4.html

It sounds like the Dragon is sending data faster over ISP than the ATmega can manage. This is quite likely when you are running the ATmega from the default clock source. The -B parameter is the way to solve these issues.

datasheet paragraph 6.2.1:

The device is shipped with Low Power Crystal Oscillator (8.0 - 16MHz) enabled and with the fuse CKDIV8 programmed, resulting in 1.0MHz system clock with an 8MHz crystal.

\$\endgroup\$
  • \$\begingroup\$ I cant really figure out what the bitclock should be set to? I am using a 16MHz external oscillator. \$\endgroup\$ – JavaCake Feb 10 '15 at 13:43
  • \$\begingroup\$ See my changes. If you didn't change the fuses, your AVR is clocked at 16 / 8 = 2 MHz. Check the datasheet for maximum SPI rate at a given system clock. \$\endgroup\$ – jippie Feb 10 '15 at 13:47
  • \$\begingroup\$ I made a trial and error by only reading, and i hat to go somewhere near 200000 before it was able to read the device signature correct and check the fuses. \$\endgroup\$ – JavaCake Feb 10 '15 at 13:51
  • \$\begingroup\$ See my last update. If i excecute the commando again afterwards it fails. \$\endgroup\$ – JavaCake Feb 10 '15 at 13:52
  • \$\begingroup\$ I don't have experience with specific numbers for the bitclock. So I can't help in sizing @JavaCake \$\endgroup\$ – jippie Feb 10 '15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.