Upload Timeout Error on Mega 2560 - Not Sure What Changed

phear_me:
Anyone have a verified and working fix? I've had my Arduino for about 4 hours and just got hit with this (and I'm not using any !!! in my code, which was allegedly the cause of the issue). This has been going on for months now and I gotta be honest - I'm pretty frustrated that the (presumably bootloader) issue still seems to be unfixed.

I did put a string containing "!!!!!!!!" in my code. Deleted it but no luck, same timeout error. Uploaded the Blink example (think this resetted the memory or something) and uploaded my original code again and it works again.

weird? or not?

I am having the same problem when trying to upload my program. Every time I try to upload it says 'time out' or 'time out communicating with programmer'. I have been reading through all the advices you guys gave, but I'm not that experienced with adjusting the code of the Arduino software, so I have no idea what to do.

I have to report my findings with Arduino Mega 2560. I struggled hours with these
"avrdude: stk500v2_ReceiveMessage(): timeout", "avrdude: ser_recv(): read error: Device not configured"
error messages that started haunt me just when I was adding some new data to my program.

First I though that I had too much data (although I had only 18Kb). Removing the new data solved the issue. Then I started to look deeper in to the issue. Finally I managed to track this down to very weird root cause:

When ever a sequence of "0x21, 0x21, 0x21" is added to PROGMEM and this variable is referenced like:
const unsigned char bug[3] PROGMEM = {0x21,0x21,0x21};
pgm_read_byte(&bug[0]);
Uploading fails!!

If I change one of those 0x21s to something else, everything works like a charm again. This has to be some sequence that causes Arduino somehow to get stuck... Just unbelievable but true.

My setup is:
Arduino 1.0.1
Arduino Mega 2560 (ok it is from DE...)
AVRISP mkII (same happens with AVR ISP)
Mac OS 10.6.8

So if you have weird upload problems, just check your code for this sequence...

I am using Mac OS 10.6.8 too, but where can I change the program of the arduino software? On my windows pc I can find the boards.txt file, but in my mac I can't find it and I don't know how to change it.

aleffe,
This is a known issue and is being addressed in a future 2560 bootloader. See here for details:
http://code.google.com/p/arduino/issues/detail?id=392

Josephiah: it looks like the communication is flakey for some reason, maybe the power is cutting in and out (or there's a short appearing and disappearing). Is it possible the board was damaged somehow (either physically or with too much current / voltage)? Do you see the same behavior with nothing connected to the board?

Hi Mellis, thanks for your reply.

You're right about the communication - doing the loop-back test gives intermittent results, giving back some characters typed in, but by no means all. Certainly no visible damage, and I'm not aware of having done anything which might have zapped the wrong pin (though I guess anything's possible!)

Do you have any other suggestions for things I can try, or is it time to buy another Mega? Seems a shame given that the rest of the board appears to be functioning okay.

Cheers,
Jo

(Another possible symptom: with just the board plugged in on its own, the TX light is now staying lit solidly except for when trying to load something, which is a bit weird. In normal operation of my setup I expect TX to flicker in response to inputs on A0-A7, and otherwise to remain off. Grounding the analog inputs makes TX go off. So there's some kind of unwanted interaction happening in there somewhere. Sigh)

I receive this same error, but only if I plug an Ethernet shield onto my Mega 2560.

Ie. if I just test out the basic blink example, it uploads and works correctly. If I then unplug the device, add on the Ethernet shield, plug back in, and attempt to upload the same blink sketch, I receive this avrdude errors.

I'm new to Arduino... Are these issues in any way related to everyone else's?

Any news about this topic or we are just spent 30 € on a official arduino not working boards ?!

I had this problem with a custom 2560 based 8u2 board I have. I was going through a USB hub. Connected directly to the USB port and the problem resolved itself. Doesn't apply to everyone, but definitely try it.

I have the same problem. Uploading a program via USB gives me timeout error on Mega2560.
I found one workaround for this.
When I burn bootloader with ISP programmer, I can upload sketch via USB only 1 time. When uploading second time, I get timeout. Then I take my ISP programmer and burn Mega2560 new bootloader. Then I can upload sketch once again.
Fu**ing annoying.

Josephiah:
(Another possible symptom: with just the board plugged in on its own, the TX light is now staying lit solidly except for when trying to load something, which is a bit weird. In normal operation of my setup I expect TX to flicker in response to inputs on A0-A7, and otherwise to remain off. Grounding the analog inputs makes TX go off. So there's some kind of unwanted interaction happening in there somewhere. Sigh)

Unpredictable results are normal when reading from floating pins.

Same problem, here. Went to a friend's place and successfully demoed the Uno and then tried the Mega. Nothing. The L13 led flashed slowly around once a second but never saw the TX or RX lights flash. Tried repeatedly and double checked the COM port.

We purchased the Mega R3 from RS components for $60 recently and it appears genuine with the white screen printing on the back.

Shields_Arduino:
Same problem, here. Went to a friend's place and successfully demoed the Uno and then tried the Mega. Nothing. The L13 led flashed slowly around once a second but never saw the TX or RX lights flash. Tried repeatedly and double checked the COM port.

We purchased the Mega R3 from RS components for $60 recently and it appears genuine with the white screen printing on the back.

I think that the developers think we have cheap copies...

After a couple hours of trying to "brick" my board by uploading and disconnecting when uploading, disconnecting the board randomly, or just flashing it bunch of times i couldn't "brick" it again. Then i took my board and i was sending some data using putty (while TX connected to RX). Then i looked on the led pins TX and RX and they both flashed together. It was a sign that my board was ok.
Next step was to tuch the components. I first touched the mega2560 chip softly. My tx pin stopped flashing ! but the RX was still flashing. It was a sign that something shorted out... Then i tried to use the FIX that i mentioned above, and the board unbricked. Next step was to throw the board on a table from 2-3 cm height.. The board again bricked, and i was able to fix it again using the FIX i mentined.... That leaves me to think that something on our mega2560-s is making a short when under pressure... I will give it a closer inspection as soon i get the magnifier. :astonished:

SUMMARY: If your board "bricks" when putting a pressure on it, only your serial communication will be faulty, but you will still be able to use the program flashed on the board itself. I am looking if someone can confirm what i've found out...

I forgot to mention that we also tried the boards.txt fix - changing the protocol to wiring and this did not help. We even restarted the Arduino IDE several time with the wiring protocol line but still no action.

xvjeko - this is very interesting and we are all waiting for David Mellis to throw some light on this. What you have described sounds like one of two things - bad soldering or incorrect fuses in either the 2560 or the USB chip. Since all the boards were tested at the factory, something must have happened since. Bad soldering can cause this -talking about intermittent open circuits caused by a poor solder mix or not enough paste. Remember that solder paste must always be kept in a fridge when not being used. The other option of having fuses not set correctly can also cause intermittent operation - such as the brown out enable not turned on. A third scenario is faulty Atmel chips which is a small possibility -luckily Atmel is very open about Erratas do these can be easily checked.

Anyway, sounds like a lot of Arduino users have the same problem, so a workaround would be nice.

Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.

Ragnar:
Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.

Awesome, im so glad i got rid of my uno for a mega!

Way to go Arduino, now i cant do anything.

Same issue here. same on mac/ubuntu/and win 7

I was warned not to get a mega and now i see why

automagp68:

Ragnar:
Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.

Awesome, im so glad i got rid of my uno for a mega!

Way to go Arduino, now i cant do anything.

Same issue here. same on mac/ubuntu/and win 7

I was warned not to get a mega and now i see why

sad

OK, picked up the Mega2560 from my friend last night, and tested it out on the Lenovo Win7 32bit desktop and HP Win7 64bit laptop, and it works fine on both. The only variation from the Uno is the driver takes a long time to load (2-3 minutes - OK maybe not that long in the big scheme) and opening the serial monitor takes a while to reset the Mega - maybe 5 seconds. The Mega works well on our LED and LCD shield and takes only slightly longer to load.

So the issue looks like a Dell issue. Maybe if anyone has a dead Mega2560, please report the make, model, operating system, and any other details which are show when you right click on My Computer and select Properties.