Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Serial Monitor displaying null characters for seconds before actual data #1730

Open
joseportillodev opened this issue Apr 9, 2024 · 1 comment

Comments

@joseportillodev
Copy link

joseportillodev commented Apr 9, 2024

OS: MacOS Sonoma 14.4.1
VSCode: 1.88.0 (Universal)
Arduino IDE: 2.3.3-nightly-20240305
Arduino VSCode Extension: v0.6.0
Serial Monitor VSCode Extension: v0.11.0

Bug:
Using the serial monitor with an ESP8266 board (Wemos D1 Mini clone) and a simple test application, it displays a huge amount of null/garbled chars, during several seconds, before displaying the actual data sent by the ESP8266 to the computer.
On many occasions, after the aforementioned huge amount of null/garbled chars, the pane displays some chunk of data (one line or a part of it) repeatedly before actual data.

Notes:

  • This happens the first time you connect the serial cable to the board and hit the "Start Monitoring" button.
  • This happens right after uploading the sketch (every time).
  • This does not happen if you press the reset button on the board (you'll see same garbled characters and some bootloader output indicating reset cause).
  • Once this "junk characters phase" finishes, the Serial Monitor pane displays the correct data below it.
  • Scrolling up or down the screen through this phase makes scrolling highly slow and stuttering.

When uploading the sketch to the ESP8266, the Arduino extension disconnects the Serial Monitor, performs the sketch upload, and connects the Serial Monitor back. On connection, the pane displays a few more seconds of junk characters and I can finally see the sketch output.

Steps:

  • Open Serial Monitor pane on VSCode, select proper port and baudrate. Click "Start Monitoring". Junk scrolls up the screen for a few seconds.
  • Upload minimal test application. The Arduino extension automatically disconnects the Serial Monitor, performs the sketch upload, and connects the Serial Monitor back. On connection, the pane displays a few more seconds of junk scrolling up the screen.

Sample sketch:

void setup() {
    // LED ON
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);
    delay(1000);

    // Setup serial port
    Serial.begin(115200);
    Serial.println(F("\r\nESP8266 TEST APPLICATION v1.0 | Build " __DATE__ " " __TIME__));
    Serial.println(ESP.getFullVersion());
}

void loop() {
    static int i;
    
    Serial.printf("Loop: %u\r\n", i++);
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    delay(1000);
}

Expected output (sketch banner and loop traces):
Captura de pantalla 2024-04-09 a las 15 07 53

What actually happens:
Captura de pantalla 2024-04-09 a las 15 08 35
...a few seconds later...
Captura de pantalla 2024-04-09 a las 15 08 07

According to the timestamps, only one second has elapsed and only one huge line of <null?> chars has been "inserted" into the pane view.
After a few seconds of wait time, you'll see the application banner and at least 15~20 loop traces appear instantly.

Quick demo video (start Monitoring after connecting board to computer)
https://github.com/microsoft/vscode-arduino/assets/166513883/e988952a-326d-47ea-b21f-103d1b6c00c9

Quick demo video (upload sketch)
https://github.com/microsoft/vscode-arduino/assets/166513883/d5fcb701-e565-4776-8261-8cfa9a9f1a67

Thank you!
Jose

@joseportillodev
Copy link
Author

joseportillodev commented Apr 9, 2024

Just one more screenshot, showing the "repeating piece of data" issue.
(just clicked Start Monitoring while the board was connected and the sketch running)

Captura de pantalla 2024-04-09 a las 16 44 03

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant