I played a bit around with my Arduino Duemillanove and than I made a big mistake, I uploaded this sketch:
// WARNING: THIS CODE IS EVIL!!! DON'T UPLOAD IT TO YOUR ARDUINO!!!
void setup()
{
Serial.begin(9600);
}
void loop()
{
// [...] here was some code, which is really really fast executed
Serial.write("Hello World");
}
Now, I think you can see my mistake. Everytime when loop is called, it tries to write "Hello World" to the USB Serial.
Ok, that doesn't sound bad, It's much times worse than you think; I can't anymore connect to the socket of the Arduino, I tried to reboot it already hundreds of times, without any success.
My other problem is, that I haven't got any possiblity for reprogramming the ATmega with the Header PINs, because I haven't got any tools in this relation and I haven't got any other ATMega.
Unplug the USB cable.
Hold down the reset button of the Arduino.
Plug in the USB cable.
Click on the 'upload' button to upload a new sketch.
When you see "Binary sketch size" in the IDE, release the reset button of the Arduino.
I hope that will keep the Arduino from flooding the USB buffers before you can upload a sketch.
I suspect that the flood of characters from the Arduino sketch was interfering with the upload process. Even though avrdude will signal the Arduino to auto-reset if it doesn't flush the received USB data it won't see the expected replies. That's why you might need to keep the Arduino in Reset until the upload is ready.
Now that you know how to fix it you don't have to worry about getting stuck that way again.