I've encountered a curious issue with a new Arduino Mega R3 that I've not yet been able to solve.
When I open the 'serial monitor' with the new Arduino connected, it takes about 9 seconds after the window has opened for the Arduino to reset. However, it resets immediately if I press the reset button.
For instance, with the below sketch it takes ~9 seconds until "hello" comes through, followed by the stream of data after 1s:
If I upload the blink sketch, the LED starts blinking immediately after the upload but again suffers this delay if I open the serial monitor.
The delay itself isn't a huge issue but none of my C++ programs can connect through serial and I suspect these problems are linked. It works with my other Arduinos.
Any help/suggestions/comments would be much appreciated
I think this is because the re-enumeration of the com ports. The old arduinos with FTDI chips had some options in the driver to avoid this, right now I always see how my arduino mega 2560 resets when I do some stuff over the serial port (open/close, etc).
I found the thread detailing your old issues and subsequent modifications: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237179908
I applied your fix and Serial Monitor now connects immediately but seems to be lacking any form of reset.
Following the above, I realised that my Unos are version 3. I tried them and they don't have any delay even without the above mod. As a result I'm thinking there might be a hardware issue on my Mega, maybe with the reset capacitor or something.
However, the reason I was looking in to this was because my serial connections in C++ were failing with the new board. I tried this with the Uno R3s and these didn't work either. As a result, I figured the two issues aren't connected and after a few hours of investigations, I've found that the serial library I'm using doesn't like COM ports numbered above '4'. Changing the port number of the devices to 3 or 4 solves the connection issue on all boards.