Two Arduino Megas which can't be uploaded to...

I at the moment have two Arduino Mega 2560's which can't be uploaded to, though the last sketch uploaded (which happens to be the blink sketch in both cases) runs fine. I have access to another Arduino Uno for ISP programming. I used the absolutely wonderful code found here: http://www.gammon.com.au/forum/?id=11635 to write a new bootloader onto both Megas, and though that did seem to help for one of the Megas (I achieved one successful upload but no more) I'm now kind of stuck and could really use some help. The hardware on both Megas should be fine (one randomly stopped taking uploads and the other stopped when the Ethernet shield stacked on top overheated), but there's obviously some severe software corruption. I'd also not like to have to go and once again buy another. I'll try and give you as much pertinent information as I can.

OS: Windows 7 Home premium
IDE: Arduino 1.0.1

Mega 2560 #1:

  • the upload bar just freezes, I've tried letting it upload for a few hours but to no avail, it just keeps saying uploading. When turning on verbose messages during uplaod this is the kind of thing that keeps coming up every half a minute or so:
    avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
    avrdude: Recv:
    avrdude: stk500v2_ReceiveMessage(): timeout

  • Interestingly enough, through the command line avrdude I simply get:
    avrdude: ser_open(): can't open device "\.\com6": Access is denied.

  • This issue had occurred randomly about a month back and as I urgently needed one I'd went out and bought another, but now I'm trying to see if I can even salvage one of them.

  • Reprogramming using Gammon's bootloader had no effect.

  • Lastly, neither the Tx or Rx lights ever flash, though the LED keeps blinking away in the manner of the blink sketch.

Mega 2560 #2:

  • This Mega was being used underneath an Ethernet Shield which overheated. I promptly removed the Mega and it still ran the lengthy code I had been using for my project but would not be uploaded to. I would get a message along the lines of: (was going over the char limit so used ... to abbreviate)

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36

System wide configuration file is "C:\Users\Gaurav\Desktop\Gaurav\summer job\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf"

Using Port : \.\COM11
Using Programmer : stk500v2
Overriding Baud Rate : 115200
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
...
avrdude: Recv: . [14]
avrdude: stk500v2_getsync(): got response from unknown programmer , assuming STK500
avrdude: stk500v2_getsync(): found STK500 programmer
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
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


same results for hfuse, efuse, and lock.


calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500V2
Description : Atmel STK500 Version 2.x firmware
Programmer Model: STK500
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
...
avrdude: Recv: . [86]
avrdude: stk500v2_command(): warning: unknown, code 0x90
avrdude: Send: . [1b] . [03] . [00] . [02] . [0e] . [03] . [91] . [86]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [86]
avrdude: stk500v2_command(): warning: unknown, code 0x91
avrdude: Send: . [1b] . [04] . [00] . [02] . [0e] . [03] . [92] . [82]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [82]
avrdude: stk500v2_command(): warning: unknown, code 0x92
Hardware Version: 21
Firmware Version Master : 21.21
avrdude: Send: . [1b] . [05] . [00] . [02] . [0e] . [03] . [9a] . [8b]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [8b]
avrdude: stk500v2_command(): warning: unknown, code 0x9a
Topcard : Unknown
avrdude: Send: . [1b] . [06] . [00] . [02] . [0e] . [03] . [94] . [86]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [86]
avrdude: stk500v2_command(): warning: unknown, code 0x94
Vtarget : 0.0 V
avrdude: Send: . [1b] . [07] . [00] . [02] . [0e] . [03] . [98] . [8b]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [8b]
avrdude: stk500v2_command(): warning: unknown, code 0x98
avrdude: Send: . [1b] . [08] . [00] . [02] . [0e] . [03] . [95] . [89]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [89]
avrdude: stk500v2_command(): warning: unknown, code 0x95
avrdude: Send: . [1b] . [09] . [00] . [02] . [0e] . [03] . [96] . [8b]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [8b]
avrdude: stk500v2_command(): warning: unknown, code 0x96
avrdude: Send: . [1b] . [0a] . [00] . [02] . [0e] . [03] . [97] . [89]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [89]
avrdude: stk500v2_command(): warning: unknown, code 0x97
SCK period : 22.8 us
Varef : 2.1 V
Oscillator : 167.564 kHz

avrdude: Send: . [1b] . [0b] . [00] . [03] . [0e] . [02] . [9e] . [01] . [80]
avrdude: Recv: . [1b]
...
avrdude: Recv: . [80]
avrdude: stk500v2_command(): warning: unknown, code 0x9e
avrdude: Send: . [1b] . [0c] . [00] . [0c] . [0e] . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00] ? [3f]
avrdude: Recv: . [1b]
...
avrdude: Recv: ? [3f]
avrdude: stk500v2_command(): unknown status 0xc8
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: Send: . [1b] . [0d] . [00] . [03] . [0e] . [11] . [01] . [01] . [0a]
avrdude: Recv: . [1b]
...
avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode

avrdude done. Thank you.

-When I used Gammon's code it seemed to work, I even uploaded the blink sketch to it successfully. However, I stupidly plugged it into the messed-up Ethernet shield, and then it went back to way it was and now even Gammon's code won't work. Neither the tx or rx lights flash though the LED does blink away to the tune of the blink sketch.

  • When using avrdude to override the -F check yesterday I got something along the lines of "device signature=0x000000." But I tried to play with the baud rate and a bunch of other stuff now i just get "not in sync: resp=0x30"

My instinct is to try and do a force erasure of the chips and bootload again, or it could be something hardware related but I doubt it. Sorry for the lengthy post, but I'm really quite stuck here and have spent the last few days exhausting other avenues. I know my shield is gone, but if I could save even one of these Megas that would be great. At least it got me to learn about AVRISP and avrdude! :slight_smile:

So by changing the programmer from arduino to stk500v2 I was able to reproduce yesterday's results for Mega number 2. I used the following command:

avrdude -C "C:\Users\Gaurav\Dekstop\Gaurav\summer job\arduino-1.0.1\hardware\tools\avr\etc\avrdude.conf" -c stk500v2 -p m2560 -P com11 -F

to get:

avrdude: stk500v2_getsync(): can't communicate with device: resp = 0x01

avrdude:stk500v2_command(): unknown status 0xc8
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
avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode()

avrdude done. Thank you.

I'm really stuck here, any help would be much appreciated.

I realized that both Megas gave proper device signatures and responses to the arduino uno acting as their programmer when using Gammon's code. This led me to believe that it could be a usb-to-arduino connection problem and so I looked into resetting the atmega16u2 chip on both boards. I uploaded the usb serial hex file within the arduino firmware directory to Mega #2 without a hitch, but it still has exactly the same problem with exactly the same behavior. Interestingly enough, Mega #1 simply won't go into DFU mode.

I'm pretty much giving up and buying yet another Mega, it seems they can't be saved, though for the life of me I don't know why.