I can hardly believe what happened today; so I hope someone can help me to explain what has happened.
I have an Arduino sketch which I have been running on an UNO for days without problems. As the final solution uses a MEGA 2560 I switched to the MEGA today.
The system exists out of the MEGA powered via the Jack and connected with serial pin 0 and 1 to the serial port of a router (a hacked linksys WRT54GL). No other connections are made.
All worked fine for several hours but then the mega stopped responding.
I connected the mega to the USB port of my PC. The mega was recognized but the serial communication was dead. I tried several times to upload a sketch without success.
I had bootloaded a new bootloader to the mega with the arduino ISP and Arduino IDE 1.0.2 before. I tried to upload the bootloader again and it failed. I retried a couple of times but gave up.
At that time I was thinking that the serial pins of the mega were broken and I considered the board broken =(.
I did a final try to upload the bootloader with avrdude and a AVR ISP which worked on the first try with this command
C:\Users\IBM_ADMIN>D:\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CD:\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM11 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m -F
When I plugged the mega in the USB of my PC and opened a serial monitor I saw Serial messages flooding the monitor. So the Mega was magically repaired and my sketch was still running .
So it seems as if the bootloader got corrupted. Once in this stage I can understand the behavior and why the sketch runs after the bootloader has been fixed.
If the bootloader is broken and the mega went in watchdog I can even think of a reason why the Arduino as ISP didn’t work. 8)
As I would not like this to happen in the future: I would like to know:
->How can a Arduino -only connected to the serial port- corrupt the mega so bad a bootloader burn is needed?
->What can I do to avoid this in the future?
PS I burnt the bootloader available at Arduino-stk500v2-bootloader/goodHexFiles at master · arduino/Arduino-stk500v2-bootloader · GitHub to the MEGA
This bootloader fixes the “!!!” and watch dog timer issues.