This is a bad idea: Serial.print("!!!");

I have an old sparkfun 6dof razor imu which I was playing with, trying to get this code to work:

But it would not upload, it hanged/crashed the programmer so I had to unplug the FTDI and restart arduino.

After spending one hour adding everything in the project back function by function I now understand the problem:
Serial.print("!!!");

The presence of this line alone is what caused my troubles. Perhaps it's an escape sequence for the FTDI chip?

Just wanted to get the info out there, couldn't find a writeup of this problem.

My setup: Mac OSX 10.7.3, Arduino 1.0 (sw), Arduino Mega Pro, FTDI usb->serial board from dealextreme

Some versions of the bootloader have a "monitor" mode that is activated by sending three consecutive '!' characters. This monitor mode allows you to read and write memory from a serial console. Unfortunately the idiot person who implemented the code didn't put in any protection to prevent the monitor from being triggered during memory upload! If your bootloader has this "feature" (typically the Mega and other larger processors) you have to remember to never use three '!' characters in a row. :frowning:

Ah, that's what caused it!

Thank you for a very good explanation :slight_smile:

...maybe it could be a good feature for the arduino environment to check for this in the hex to be uploaded. But then again the fault is, as you say, in the bootloader code...