Activities on Serial (0) on start up freezes Arduino Mega

Hi everybody,

I have a problem with a arduino project. I’m using a Arduino Mega to send serial data via ethernet to a server. Everything is working like it should. Except one thing:

When the Arduino is connected to the serial data source @Serial"0" and this source sends data while start up, the Arduino freezes. When I connect the data source after start up, everything is working. Serial 1-3 works on start up, but I need all 4 hardware serials.

Anybody has a hint for me?

Thanks a lot.

Serial0 is connected to the communication with the PC and at startup the bootloader checks in case the PC is trying to upload code.

Assuming your Mega is not connected to the PC at startup, the bootloader may still be confused. Can you prevent activity on Serial0 during the startup period?

If you can live without the bootloader you could upload your programs using ICSP.