Help! Upload to Mega 2560 starts and freezes. No errors reported

I am using Mega 2560 , Windows 7 and ArduinoIDE 1.6.5
All hardware and software uploads fine and works fine (!) whenever I upload and run any examples or my own previous version of code.
Now, after making many changes to my previously ran code, I compiled with no errors and trying to upload - it freezes at about 80% and never finishes.
Now after I try to reset the board and to upload something else - upload does not start : reporting the communication error ... this is understandable as previous upload was partially done... bootloader does not start... only after I power OFF/ON again (USB OFF/ON), I can upload anything else... but not my new code!
Strange as it seems - this happens only to this my updated code... as if the upload "knows" the code it is uploading :slight_smile:

Power checked: precise 5.00v on the board bus drawn from USB, no fluctuations.
all hardware connections stay the same between running examples and running my code (RTC module, MicroSD card, audio buzzer and few of my modules connected to Mega by galvanically isolated I2C interface),

sizes of the program code 28k (well under 256k for Mega) and RAM used 1.5KB (under 8KB RAM space).
What else there to check?
Did anything like this happen before ?
Am I in a Twilight Zone?
Vlad

Remove the !!! from your new code.

Sorry, remove what ?

The three (or more) consecutive exclamation marks ("!!!") somewhere in your code (placed at about 80% of the total code, most probably in a string constant).

Some bootloaders enter debug mode when they see this pattern.

YeeeeeeeeeeeH !!! (Three exclamation marks )
How did you know? How I suppose to know? Did I miss this "feature" in Arduino IDE guide?
Does IDE uploader or Arduino bootloader use !!! as a sign of the end of transmission?
If so why didn't it end with CRC error reporting afterwards? Why freezing?
I 'd like to understand what happened and how could I've known upfront...

Whandall and Lambert, where do you live? - I owe you a pack of beer (here goes 3 exclamation marks:)

!!!Vlad/eBirdman!!!

More information about the exclamation mark feature wiki.nottinghack.org.uk/wiki/Arduino

I live in Germany.

Whandall, that would be a long drive to deliver beer from Tennessee, USA :slight_smile:

The "feature" apparently not documented in any "must read" user guide related to uploading to Arduino... This trap has been known since 2010 and never fixed neither documented for a new user! ...waiting for any !!! in binary file to freeze ... And no way to figure what is wrong as there are no error messages... It's like intentionally coding a virus knowing that sooner or later somebody will fall for it...

Nasty

Thank you again for those links

The interesting thing is the Arduino IDE has the fixed bootloader, which was fixed long ago. You can burn a fresh bootloader onto your Mega2560 by using another Arduino as an ISP programmer. For some reason, when new Mega2560 boards are produced, they keep on using the old bootloader.

THank you. A bug report should be filed even though I bet it was already reported in the past before it was fixed

There was already a bug report, and it was already fixed. Of course there is nothing to do about some manufacturers who just go on blindly making new cards with the old bootloader. Even if you contact the dealer you bought your card from, there is only a slight chance the word would make it back to the person loading the bootloaders as the cards are made.