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

Serial Monitor not updating in real time #1396

Closed
BasselMalek opened this issue Dec 26, 2021 · 15 comments
Closed

Serial Monitor not updating in real time #1396

BasselMalek opened this issue Dec 26, 2021 · 15 comments
Labels
serial Issues with serial ports

Comments

@BasselMalek
Copy link

OS: Win10
Versions: Arduino IDE: 1.8.16 || Extension: 0.4.8
Sys info:
VSCode: 1.63.2
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0

Bug:
Whenever using the serial monitor with an Uno it never shows the output in real time, instead it only dumps it all after closing the serial monitor. To make it work i have to increase the delay in program to 300+ ms.

Steps:

  1. Upload any code using Serial.println()/print()
  2. open serial monitor
  3. no output
  4. close monitor
  5. all output appear

Log file:
rendererLog.txt

@siideffect
Copy link

I have the same issue:

OS = MacOS Catalina 10.15.7
Vscode ⬇️
Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:37:28.172Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 19.6.0

Arduino extension = v0.4.8

I tried investigating about this.
If i open the serial monitor with arduino ide, i get all the expected output.
If i open the serial monitor with visual studio code, it works correctly only if there is a high delay(1 second).
However, i noticed the serial monitor is working "well": the output console seems to freeze when outputting data, and prints all in blocks of 30 or so...but if i swap, from output to another window(terminal, problems or debug console) and then to output again in the vscode bottom panel, the expected data is there.
I ve tested this using a counter variable, and i noticed no Serial.println() are actually lost.
It s "just" a refreshing issue on the output console.

Arduino ide:
https://www.dropbox.com/s/rx58x1pnu8ieeyl/Schermata%202022-01-11%20alle%2022.21.58.png?dl=0
All working as expected

VS Code:
https://www.dropbox.com/s/ur6wl5r46towvr9/Schermata%202022-01-11%20alle%2022.23.34.png?dl=0
Opening the serial monitor results in empty console, but if i switch as i wrote above i can see the expected output ⬇️

https://www.dropbox.com/s/35xcao1ctg5rqx7/Schermata%202022-01-11%20alle%2022.24.42%20%282%29.png?dl=0

Its not a wrong baud rate settings, i ve read almost everything i could read about this issue... i m writing here because i ended up all my options.
Thanks for your attention and your help!

@gcampbell-msft
Copy link
Contributor

I've been able to repro this and am working on a fix.

@gcampbell-msft
Copy link
Contributor

We just released a new version, 0.4.9, that contains a fix for this issue. Let us know if any more issues come up!

@siideffect
Copy link

siideffect commented Jan 13, 2022

Thank you @gcampbell-msft for your help, but i do have some problem still.
The serial monitor stopped working since the 0.4.9. and now i m not able to see any output in the console.
Using arduino ide, all works as expected. I tried different baud rates, but thats not the problem.
Also, changing "views" as before, does not show anything.
As well, higher delay doesnt help anymore.
Actually my serial monitor is totally down on vscode.

https://www.dropbox.com/s/yyxzlo0y9ya7m64/Schermata%202022-01-13%20alle%2010.47.45.png?dl=0

@theficus
Copy link

@siideffect Same problem here. I opened bug #1418 to track this.

@gcampbell-msft
Copy link
Contributor

@siideffect Could you provide some example code of what you're running and also what board you are using? I'm not currently able to repro this issue.

@siideffect
Copy link

@siideffect Could you provide some example code of what you're running and also what board you are using? I'm not currently able to repro this issue.

Hi @gcampbell-msft , it was a simple gpio reading on a touch pin of a esp32 board, in the loop() function.
Nothing so complicated, just a continuous hitting to the Serial monitor with (and without) delay().
Test was developed on a Esp32 dev module board

@crackwitz
Copy link

crackwitz commented Jun 11, 2022

I'm running a simple sketch that emits a few lines about once or twice a second. the serial monitor seems to have real trouble showing these lines as they happen. there's a delay of upto a second... I'd really rather this thing show me data as soon as it comes in, instead of this apparent "polling". if you have to have a polling interval and the default has to be largeish, please make it configurable because I'd wanna dial that down to something more responsive.

@dumski
Copy link

dumski commented Jul 3, 2022

Yes, I can confirm that in version 4.1.2 problem still persists and it makes Arduino console almost impossible to use efficiently. Any plans of solving the problem? Cheers

@gcampbell-msft
Copy link
Contributor

@dumski @crackwitz, I just attempted to repro this issue with my own "Hello, World" program, and I wasn't able to repro. Could you possibly confirm what OS you all are on, what board, baud rate, etc?

In the meantime, we have a standalone Serial Monitor in Preview available now, if you want to try that out! https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-serial-monitor&ssr=false#overview.
We're considering transitioning the Arduino extension to use a new standalone Serial Monitor feature (linked above), we'd love your feedback on the new extension!

@crackwitz
Copy link

crackwitz commented Jul 5, 2022

Windows 10, random arduino nano, 115200. it's got nothing to do with that because those things work perfectly fine. Putty has no issues displaying the data instantly. regular Arduino also has no issues (well I can tell they're polling but they do it fast enough to be tolerable).

if this isn't an issue of polling when one shouldn't, then someone must have messed up some buffer handling.

since I got to use the serial monitor of esp-idf (for esp32 without arduino), my expectations were raised considerably. I expect something close to a proper terminal. the entry box presented in that standalone extension is at least comparable to regular arduino.

I'm gonna check that extra extension out... edit ok, it fails to scroll along with the feed (once I select something or scroll), and I can see lines being received in pieces of 32 bytes at a time. when I've got one line per second that is ~70 bytes long, and this thing displays half of that, makes a noticeable pause, then displays the rest of the line... you can probably imagine what I could say about that.

@gcampbell-msft
Copy link
Contributor

gcampbell-msft commented Jul 5, 2022

@crackwitz I'll look into the buffering on the new extension, feel free to post an issue about this on the vscode-serial-monitor issues page!

As for the failing to scroll along, there is an auto scrolling button present
image
in the standalone Serial Monitor that should allow you to keep up with new input.

edit Also, to make sure you have the most up-to-date version, you can switch to the pre-release version as well.

@crackwitz
Copy link

Ah, so that's what that does! It wouldn't give me a tooltip and I speculated that it means "line wrap". I'll open an issue.

@gcampbell-msft
Copy link
Contributor

@crackwitz Yes, unfortunately there's a bug that wouldn't show tooltips. It's been fixed and if you switch to the Pre-release version tooltips are restored, but we haven't done an official release of those fixes just yet.

@crackwitz
Copy link

crackwitz commented Jul 5, 2022

here's a little screen capture showing this extension at v0.4.12:
https://user-images.githubusercontent.com/7065108/177406211-2d3142b5-b52b-48f1-a2cf-51a489a6ef91.mp4

You'll notice the client-side timestamps keep up but the lines aren't presented properly. There is an apparent 500 ms timeout involved that causes the rest of the console buffer to show, or not show.

for comparison, three other methods: microsoft/vscode-serial-monitor#23

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

No branches or pull requests

7 participants