Error burning Arduino Mega bootloader with USBasp

Hi all,

Firstly, sorry if this is in the wrong place, and it is rather long.

I've been trying to connect to an Arduino Mega using a USBasp programmer in avrdude and I am consistently getting the following error.

I ran avrdude from terminal with the following command,

avrdude -c usbasp -p m2560 -v -P usb

To which I receive this error:

avrdude: Version 5.11.1, compiled on Nov  5 2012 at 11:07:24
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/george/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATMEGA2560
         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        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

I also ran the command with the -F flag, and I get the additional output:

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA2560 is 1E 98 01

Additional Information

  • I have checked the wiring and it is correct.
  • The USBasp has been successfully used to program an Arduino UNO.
  • I have also tried bridging the jumper J3 on the USBasp, with no success.
  • The Mega in question has been successfully used before, but for some unknown reason it stopped working.

Does anyone know what may be wrong (i.e do I need a new Mega?) ?

I'm running out of things to try.

Thanks in advance,
George.

gecgooden:

  • I have also tried bridging the jumper J3 on the USBasp, with no success.
  • The Mega in question has been successfully used before, but for some unknown reason it stopped working.

Does anyone know what may be wrong (i.e do I need a new Mega?) ?

Quite possibly. I just tried using avrdude v 5.10 with my usbasp and a mega2560 with

avrdude -c usbasp -p m2560 -v -P usb

and it did get the expected response, but surprisingly, only when I had the Slow Clock jumper set (which I assume is J3 on your device).

When it wasn't set, avrdude was complaining it couldn't find the usbasp programmer itself, rather than the atmega2560, which is unexpected, and I don't really understand. But I have found that when in doubt,the Slow Clock jumper generally gets results when things aren't otherwise working as expected, as in this case.

But since you have tried that, I can't think of anything else to suggest -- you seem to know what's what, and have covered the obvious things.

Sorry can't be more help, but I thought at least you should know the things you are trying should work, as a step in your troubleshooting.

Can you shed any light on the situation surrounding discovering it had stopped working in the first place?

Yeah, J3 is the Slow Clock jumper. I should have made that more clear.

The things I have tried are what I have found after a few days searching online for solutions.

In regards to when it stopped working, the board itself was used as a motherboard for a makerbot based 3d printer and I was installing and testing a new extruder (which is connected to a separate extruder controller through a RS485 connection) when the motherboard randomly shutdown and disconnecting from the serial port of the computer. Restarting didn't resolve the problem, and eventually exacerbated it.
So I decided to reinstall the firmware to see if that would fix it, and ran into the described error.

gecgooden:
Yeah, J3 is the Slow Clock jumper. I should have made that more clear.

Nah, that's fine. I've only got two jumpers on my variant, labled "S.C" and "PWR". Useful to know it's labeled J3 on some boards in case I'm trying to explain the S.C thing on a board with a different silkscreen.

gecgooden:
In regards to when it stopped working, the board itself was used as a motherboard for a makerbot based 3d printer and I was installing and testing a new extruder (which is connected to a separate extruder controller through a RS485 connection) when the motherboard randomly shutdown and disconnecting from the serial port of the computer. Restarting didn't resolve the problem, and eventually exacerbated it.
So I decided to reinstall the firmware to see if that would fix it, and ran into the described error.

Sounds kind of like hardware to me, I must say. If you were having trouble programming via USB Serial, I'd think it might just be the atmegaU8 chip that's gone. But if the atmega2560 isn't responding to direct ICSP, then it's probably hosed for some reason or another.

The only faint possibility that occurs is that it might have had a transient high voltage spike on the reset pin that set it into high voltage programming mode, and now it is in a confused state. The only way to test that theory is try to program it with a HVP, but unfortunately, unless you know someone with one (I think the Atmel Dragon can do HVP), they are more expensive to buy than a new mega2560.

And of course it may not be that at all. It's just that I was reading a thread recently where a design flaw on the Uno R2 had a deficient reset circuit that could result in these sort of mysteriously bricked devices.

Anyway, while a new genuine mega is still quite expensive, the clones are now dirt cheap, so perhaps that's the quickest solution to at least get you up and going, and you can try to breathe life into your current mega as new theories and inspiration strikes at your leisure.

Sorry I can't offer more help. Perhaps someone could chime in with a new idea so far not considered.