Serial Monitor is the primary tool for Arduino IDE users to get runtime feedback from a sketch program. Since it is not intrusive and does not interfere with the usability of the other Arduino IDE UI components, the average user likely has the Serial Monitor open most of the time.
Putting the computer through a sleep/wake cycle while Serial Monitor is open causes loss of connection to the port.
π When in this state, Serial Monitor does not show data sent by the board and does not transmit messages the user sends from the message field. It does not give any indication of the lost connection to the user.
To reproduce
Upload a sketch that produces periodic serial output and also has an observable response to serial input:
unsigned long previousMillis;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
while (Serial.available() > 0) {
Serial.write(Serial.read());
delay(10);
}
} else if (millis() - previousMillis >= 1000) {
previousMillis = millis();
Serial.println("hello");
}
}
Open the Serial Monitor view.
Select "9600" from the baud rate menu.
π hello is printed in the Serial Monitor output field at 1 Hz.
Type foo in the Serial Monitor message field.
Press the Enter key.
π foo is echoed in the Serial Monitor output field.
Put the computer to sleep.
Wake the computer.
π hello is no longer printed in the Serial Monitor output field at 1 Hz, even though the TX LED on the Arduino board shows it is transmitting serial data.
π There is no indication of a lost connection in the Serial Monitor UI.
Type foo in the Serial Monitor message field.
Press the Enter key.
π The RX LED does not blink on the Arduino board to indicate serial data was received.
π foo is not echoed in the Serial Monitor output field.
Expected behavior
Putting computer through a sleep/wake cycle does not cause the loss of Serial Monitor's connection to the port.
I'm pleased to see this issue reported here, since it's one of those low-impact, but incredibly frequent bugs I encounter (not to mention a regression from 1.8.x) - has there been any progress on a fix?
Describe the problem
Serial Monitor is the primary tool for Arduino IDE users to get runtime feedback from a sketch program. Since it is not intrusive and does not interfere with the usability of the other Arduino IDE UI components, the average user likely has the Serial Monitor open most of the time.
Putting the computer through a sleep/wake cycle while Serial Monitor is open causes loss of connection to the port.
π When in this state, Serial Monitor does not show data sent by the board and does not transmit messages the user sends from the message field. It does not give any indication of the lost connection to the user.
To reproduce
Upload a sketch that produces periodic serial output and also has an observable response to serial input:
hello
is printed in the Serial Monitor output field at 1 Hz.foo
in the Serial Monitor message field.foo
is echoed in the Serial Monitor output field.hello
is no longer printed in the Serial Monitor output field at 1 Hz, even though the TX LED on the Arduino board shows it is transmitting serial data. π There is no indication of a lost connection in the Serial Monitor UI.foo
in the Serial Monitor message field.foo
is not echoed in the Serial Monitor output field.Expected behavior
Putting computer through a sleep/wake cycle does not cause the loss of Serial Monitor's connection to the port.
-OR-
The loss of the connection is clearly communicated to the user (related issue: https://github.com/arduino/arduino-ide/issues/1508).
Arduino IDE version
Original report
d68bc4a (with serial-monitor 0.13.0)
Last verified with
8f8b46f (with serial-monitor 0.13.0)
Operating system
Operating system version
Additional context
I was not able to reproduce the issue on my Linux (Ubuntu 22.04) machine.
The fault does not occur under the same conditions when using
arduino-cli monitor
, the Arduino CLI gRPC interface with grpcurl, or Arduino IDE 1.8.19When the
arduino.cli.daemon.debug
setting is enabled, I see this in the logs from the time the PC is put to sleep:But there is no equivalent log output to indicate an attempt to start the monitor process again after the PC wakes.
The fault occurs both with boards that have a dedicated USB chip (e.g., Uno) and boards with native USB (e.g., Leonardo).
Originally reported at: https://forum.arduino.cc/t/ide-disconnect-form-the-board-after-pc-suspension/1092323
Additional reports
Workaround
Issue checklist