The old println("!!!"); problem solved?

Hello guys

I've been working for some time on a project and on my final days to finally finish it, my mega 2560r3 stopped working. =(
After some research i did noticed that I had the serial.println("!!!"); to blame for.

I know this is an old question, and it happened to alot of people, saw alot of posts regarding the timeout from the AVR but found no actual solution for a timeout cause from "!!!". Only solutions are to reprogram the chip? I would really like to avoid this since i would need to buy proper material and time is coming short for me right now.

I tried the loop back and the serial communication seems to be in order.
The led on the board blinks once upon start up and then stays on forever.

As I've read a simple reset or unplugging the arduino and upload new sketch would solve the situation. In my case, uploading new sketch is not possible, time out everytime.

Its a pretty old question, hard for me to believe there isnt a solution out there somewhere... :frowning:

Thanks for any tips you might have for me

The problem as I recall is that the mega bootloader code will choke and hang if there are three consecutive ! characters in the sketch you are trying to upload, or even three consecutive data byte value of the same value in the hex code of the sketch being uploaded.

The easier fix is just to remove one of the ! characters in your sketch. The better solution is to burn a newer version of the mega bootloader onto your board and that problem will go away. It also solves the problem with the older mega bootloader not handling watch dog timer interrupts correctly. I believe the latest arduino IDE distribution includes both the new 'fixed' bootloader as well as the older version.


Thanks for the quick answer. Yeah i read and tried even to run a very simple program but it didnt work.

Just to be sure, to burn a new version I would need a AVR programmer yeah? There isnt any way to do it simpler? All of I can think of useful material that i have, is a FTDI usb-to-serial converter. Is it a pretty straightforward proccess? I'm not going over my head here?


There isn't a problem with the chip as such. Just don't upload something with "!!!" in it.

I had the serial.println("!!!"); to blame for.

Don't do that. It isn't good English. :slight_smile:

simple solutions


or functionized 

void Exclamation(int n)
  for (int i = 0; i< n; i++) Serial.print('!');

Question arises if there are three ! in memory due to 3 variables declared will it fail too?

char a = '!';
char b = '!';
char c = '!';

void setup()
  Serial.println("triple ! test");
void loop()

Works on an UNO, while they are adjacent in the AVRDUDE stream

avrdude: Recv: . [88] . [1f] . [99] . [1f] . [1a] . [94] i [69] . [f7] ` [60] . [95] p [70] . [95] . [80] . [95] . [90] . [95] . [9b] . [01] . [ac] . [01] . [bd] . [01] . [cf] . [01] . [08] . [95] . [ee] . [0f] . [ff] . [1f] . [05] . [90] . [f4] . [91] . [e0] - [2d] . [09] . [94] . [f8] . [94] . [ff] . [cf] t [74] r [72] i [69] p [70] l [6c] e [65]   [20] ! [21]   [20] t [74] e [65] s [73] t [74] . [00] . [0a] d [64] o [6f] n [6e] e [65] . [00] [u]! [21] ! [21] ! [21][/u] . [00] . [00] . [00] . [00] . [02] . [02] . [a7] . [02] . [98] . [01] . [c9] . [01] . [a9] . [01] . [f2] . [01] . [00]

Make them const then. :slight_smile:

Or get the latest bootloader.

English is not my native language, I'm sorry if I used that expression in wrong way :smiley:

Well, I got tired of using my own resources to try and fix the problem, and i got an AVR programmer and I just uploaded new bootloader.

Thanks for the help though!