Mega 2560 - serial communication problem

If Arduino scetch on Mega includes serial.begin(XXXX) -line, the program hangs easily.

If some data is sent to serial port right after opening it on PC, Arduino program hangs.
But if the port is opened, some wait delay applied and then data sending started. Program works nicely.
So Mega needs some time to get back on track after port is opened from computer side. In other case scetch will hang/crash.

Same phenomenon doesn't occur on Duemilanove.

This same topic is discussed on my Project related thread**, but I decided to post this also here since it seems to be a low level problem.

**Arduino Forum

This one is solved in the other thread. See the link above

Thank you, thank you!!!
This problem was driving me nuts. Did as you suggested by putting a delay in the Processing code after opening the port and now everything works. :slight_smile:

how much delay did you have to add to get this to work?

I'm trying to use serial1 on the Mega2560 and not having any luck yet.