Hello all, am puzzled - have read all reboot-related questions but cannot solve mine yet.
On my mega I have a 1600 lines piece of SW running, and all is well. Added external power 12V 5A to the socket, and still all is well. Made all serial communication conditional with one global parameter debug_print "if (debug_print) then serial.print(...);" in order to be able to disable all serial comms.
I even made the serial.begin conditional if debug_print=0.
Now when the USB and external power are both plugged in, all is well. I disable all serial print, so nothing to see when I look at the serial monitor. It runs perfectly for hours and hours.
However, when I start the Mega with external power only (so USB unplugged) then after about 15 minutes of uptime it starts to reboot each 15 secs. I measure input (12V) and on board (4,8V).
While it is doing the reboots I can plug the USB in again and reboot stops immediately (even if I use no monitor on my Windows screen).
When I then unplug the USB again, reboot restarts immediately, each 15 secs.
Then I plug the USB in again: reboot stops immediately.
As you may have guessed: I will want to run the sketch in the field without a PC attached.... In the sketch I disabled all serial.print communication. What does the USB port provide to the Mega to stop the reboots?
The external power seems to be ok and stabile, because it should have priority over the USB power, and together they work nicely.
Hope you can help.