I have an Arduino Due reading data off of several sensors. These sensor values get embedded into a 15-byte message (13 bytes of data followed by a checksum followed by a special character).
I'm using pyserial to parse these messages on the computer side. The problem is that whenever the Due gets power cycled (unplugging and plugging in the USB) the messages become incoherent. The messages appear incoherent in miniterm as well. Resetting the Due does not fix the problem, however if I simply click the "tools" menu in the IDE, the messages immediately become coherent again. This works with the IDE in either arduino-1.0 or arduino-1.5.
What callback is occurring whenever I expand the "tools" menu in the Arduino IDE that can explain this behavior?
By the way, I'm using the USB-to-serial chip connected to the first UART of the MCU (RX0 and TX0) [aka the "programming port"], not the native USB host pins on the ARM chip.
What callback is occurring whenever I expand the "tools" menu in the Arduino IDE that can explain this behavior?
The IDE scans all the serial ports, opens ones that are not open that might have an Arduino connected, and tries to talk to the Arduino. If it gets a response, the port is added to the list of available ports.
Your problem appears to be that you are not opening the serial port correctly.
All of the parameters that can be queried (baudrate, stop bit, parity, rcs, dtr, flow control) remain unchanged between when it's not working and when it's working. I don't know what else I can do to set up the connection in pyserial.
Also, I just discovered that issuing "stty -F /dev/ttyACM0 57600 raw" in another terminal window (while pyserial is running) immediately fixes the issue.