I am having 2, probably related, problems on an Arduino MEGA.
My project is for a model railway so uses the LocoNet Library. The project used lots of configuration data which I'm trying to upload to via the LocoNet from a PC.
For most part the code works but is never able to complete all 3744 bytes. The point at which communications stops is very variable and I have not been able to track down why.
I am sure though that there is a bug somewhere.
After the serial communications stops it is possible to restart it.
The problem it that unplugging a device from the LocoNet and reconnecting it causes the Mega to reset. Every time until after a power down cycle.
This seems like something in RAM has been corrupted or a stray pointer problem.
Is there a way to detect what might be causing the reset. If I knew that I might be able to trace it back further to the actual bug.
I am using the BaseStream to capture the data from the PC. I'm wondering if at one point something is writing past the end of the buffer.
I hope this makes sense to someone.