Mega 2560 upload problem Windows

Yes, I've searched the forum. I have a 2560 that is having the problem loading sketches that is described in many posts. Frankly, I've gotten totally lost trying to coordinate the various posts, tutorials and problem lists on how to correct this problem. Is there a comprehensive, or at least clear, description somewhere for Windows?

It's the problem where it starts downloading a sketch and then just hangs. If I switch the board type to a 1280 I can load the sketch, but that's only a workaround. Yes, it has worked many, many times before and I don't have "!!!" anywhere in the sketch.

Update: I'm mistaken, I can't upload it at all with my current sketch. It fails using the 1280 selection. I just thought it was working. It works fine with previous versions of my sketch, or any of the examples.

It works fine with previous versions of my sketch, or any of the examples.


Well to an outsider, that sounds like a sketch problem not a uploading problem. Does the IDE give an error when trying to upload that specific sketch? Perhaps you will have to post your code to get to the bottom of this. Other then the "!!!" problem with a early version of the 2560 bootloader, I don't recall anyone reporting a problem symptom as you have stated it.


Thanks for the quick questions!!

The problem is that I compile the sketch (which is around 28K right now) and after the compile when it is uploading to the board, the lights on the arduino flash a bunch, then quit flashing. The upload button on the IDE is still highlighted and it never (after going to the bathroom and washing my hands and having a corndog) finishes the upload. I click the stop button and it stops, but the port is tied up by the uploader. I unplug the usb port, plug it back, restart the ide, etc. Finally I can try to compile and upload again with the same results.

This happened after I added some code to the sketch (luckily saving the previous version) and wanted to try it out. So version -1 will compile, upload and run. Version now hangs forever.

Could I have some code in there that is the binary equivalent of !!! ? How the heck would I know?

Like I said, the examples and previous versions of the sketch I'm working on compile and upload fine. Other projects I have for other board versions work fine as well.

The problem sketch never actually loads, the board is still running version now-1

Could I have some code in there that is the binary equivalent of !!! ? How the heck would I know?

That has got to be it. "!!!" would be the equivalent to 0x21,0x21,0x21. Possible someone can point you to a binary editor that has search capabilities that you check your 'problem' sketch with. There is a way to look at the .hex file created by the compiler if you press shift and then the verify button. The .hex file is stored in a temporary folder location that the IDE prints out in the IDE output window. Then search through the file for three consecutive 0x21 bytes.

I'm pretty sure this is a result of the "!!!" problem. But in the past it's always been users comments using !!!, rather then the possibility of compiled code resulting in three consecutive 0x21 bytes.

Lets see what others might think?


Since nobody responded (well, at least not yet) and I wanted to get on with this and...well I just could stop myself from trying something. I modified the code in the problem sketch by simply moving some stuff around a bit.

It compiled and downloaded and worked just fine. No lockup in the actual download to the board.

However, this means I have no real proof of what the problem was. I am totally convinced that I hit the '!!!' bug and the board jumped into the monitor. If it happens again I'm going to save the hex file and then play with it later.

But that brings me back to the question of how to reflash the bootloader on the 2560. Is there a clear tutorial on this somewhere? The biggest problem with the web is too much information. I can find a thousand tries and techniques that are partial solutions just fine, but trudging through them to find the one that actually works and has up-to-date information is seemingly impossible.

Follow these instructions and use this picture Fixing Linux firmware issues on Arduino Mega 2560 | Wayne and Layne to help you get the board into DFU mode. Good luck!

Folks, help me understand something. As I see it there are two possible problems:

  1. The 8U2, which is programmed to be a usb to serial converter, may have a timing bug that seems to only cause problems if you're running a Linux machine. I couldn't find this problem reported for Windows or Mac.

  2. The 2560 bootloader problem that relates to "!!!" somewhere in the code that will also stop loading code to the board.

These are different problems with different solutions. So, now that I think I might, maybe be beginning to understand, how do I find the correct code to fix the second problem. I have verified that I definitely, for absolute certain, have problem number 2 and I think this problem can exhibit itself by the code (chaos theory prevails) having the equivalent of "!!!" in it somewhere like the reason I started this thread.

What I "think" (at this point I'm not certain that I can think reasonably anymore) I need to do is replace the bootloader, not fix the timing bug in the 8U2.

OK, after several hours of research which included finding and reading through several months of the developers mailing list, I'm convinced my description above is correct. There really are two unrelated problems with different fixes. The 8U2 problem has a patch, but the "!!!" problem does not have one yet. The bug has been isolated and a fix developed but it isn't tested and ready for general consumption.

The insidious part of this is that the "!!!" can exhibit itself through compiled code with no way to tell where it is; you just have to move code around until it goes away and you can go back to loading software. Also, people seem to confuse the two problems. If I'm correct, reprogramming the 8U2 will NOT fix the "!!!" problem as has been suggested on this thread and others. This leads to yet another level of frustration and confusion.

Anyway, now that I put my butt on the line with this, would one of the developers step up and correct me or verify what I said. It would be nice if those of us that have encountered the problems and frustration of having to flail around randomly until it magically starts working again, at least had a clear description and a consistent place to look.

Especially since one can't search for "!!!" on the forum.

Is there a solution for the !!! error yet? I have come across this suddenly in a Sketch that I am working on. By using the Verbose download I can confirm that my binary file contains three consecutive ! characters.


Hopefully there will be soon. I have been posting about this in the thread here follow it for my latest findings.

Thanks for posting the information on the 8U2 firmware bug. That was really annoying seeing that and sometimes it would take five or ten minutes to get a sketch loaded. I had assumed it was related to the '!!!' bug. Glad to know at least one bug is now addressed.