Vscode-arduino: Unable to get serial monitoring working

Created on 6 Nov 2018  路  22Comments  路  Source: microsoft/vscode-arduino

Im using the latest version of VS Code and the latest version of the extension. I can upload a sketch fine but when I open serial monitor I get "[Info] Opened the serial port - /dev/cu.Repleo-CH341-00001014" but no further data. If I then open Arduino IDE and open the Serial monitor there then the monitor starts working in VS Code.

Any ideas as to what I might look for to see where the problem is?

Thanks.

serial

Most helpful comment

I also experienced this issue. For me, it ended up being that the baud rate in my sketch did not match VSCode's default of 115200. After changing to 115200 in my sketch everything started working great. I believe you could also lower the baud rate to whatever your sketch is using in VSCode's settings if you prefer, but I have not tried this.

All 22 comments

@dreed47 Will this problem occur steadily, or it happen occasionally? I can not repro on this issue

Every time. The monitor won't work unless I manually open Arduino IDE and then manually open the serial monitor window in Arduino IDE. Then and only then will I start to see the monitor activity in VZ Code monitor window.

@dreed47 Can you have a try on v0.2.25? we add serial port support for Electron 3.0.

I have the exact same symptom here - every time I try it.

[Starting] Opening the serial port - /dev/cu.Repleo-CH341-00206214
[Info] Opened the serial port - /dev/cu.Repleo-CH341-00206214

This is 0.2.25 talking to a wemos d1 mini - installed arduino app is 1.8.8.

For me also - if I just open the arduino app and open the monitor to the same port - there's all the serial.print output just fine.

I am experiencing the same thing.
A further observation, is that when I open the serial monitor, I see a few lines of expected output, then it stops.
When I start the Arduino IDE monitor, the output starts flowing, but it seems like the serial communication is split between the two more or less randomly, resulting in garbled output. Closing the IDE window, VS Code shows the correct output until the serial connection is restarted.

Arduino IDE: 1.8.9
VS Code: 1.31.1
Arduino extension: 0.2.25

@adamal I try to repro this issue on Mac OS 10.14, but the serial monitor always work well , so can you tell me your detail steps? and which OS?

@czgtest , strange.
I am on macOS 10.14.3
The arduino code is from example 4 in a book that came with a starter kit. The book can be downloaded here: (direct download, 8mb)

I also experienced this issue. For me, it ended up being that the baud rate in my sketch did not match VSCode's default of 115200. After changing to 115200 in my sketch everything started working great. I believe you could also lower the baud rate to whatever your sketch is using in VSCode's settings if you prefer, but I have not tried this.

yes, install the driver for Arduino board ,then select the right port and baud rate, the serial monitor will work well.

I have the same problem with my esp32 and ftdi. The problem is caused by the DTR line pulled LOW keeping the esp32 in reset state. You have to let the dtr going back HIGH so that the esp32 can reboot.

Same problem. I'm using Arduino UNO. Baud rate is 9600 in vscode and in the sketch. Serial port opens but I don't see any output. As soon as I launch serial monitor in Arduino app output starts to appear in the Vscode as well.

I have a similar problem i am using VS Code 1.40.0 but the serial monitor is not opening as well as the select serial port button is also not working... i just manually added the port. Every time it popups and says Failed to open serial port COM4 due to error: + TypeError: Cannot read property 'close' of null and on the output of serial monitor it says [Starting] Opening the serial port - COM4 I am working on Windows 10 platform

@Shirsendu-Bairagi ,temporary solution, downgrade vscode to 1.39.2 or older and disable auto update until this issue solved. Work for me. solution from someone on github.

Same probleme here.
Cannot select the serial COM port and also get the error: Cannot get property 'close' on null when trying to open serial monitor.
Downgrading to version 1.42.1 fixes the problem.

OSX 10.15.3 - VSCODE 1.44.2 - Arduino extension 0.3.0
For me:
Setting baudrate to 9600 both in sketch and config settings does not work.
Setting baudrate to 115200 both in sketch and config setting works.

Similar issue, but neither baud rate works. Can get output in the IDE serial monitor at either baud rate.

its the

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }

part that doesn't work. the actual Serial.print seems to work, if I just skip waiting for the connection. my board is MKR WiFi 1010.

I am running into this problem today as well on my MacBook (macOS Catalina) + VS Code 1.46.1.


settings.json

My Arduino Due is configured for a baud rate of 9600 bps.

{
    "arduino.defaultBaudRate": 9600
}


Versions

  • macOS Catalina: 10.15.5
  • VS Code: 1.46.1
  • Arduino plug-in: 0.3.1
  • Arduino: 1.8.13

Here's the output. Sometimes the monitor prints a few lines after [Info] Opened, sometimes it does not:

[Starting] Opening the serial port - /dev/tty.usbmodem1442401
[Info] Opened the serial port - /dev/tty.usbmodem1442401

This appears to be fixed as of this morning. I was prompted to update and now Select Serial Port as well as Serial Monitor are both working.

its the

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }

part that doesn't work. the actual Serial.print seems to work, if I just skip waiting for the connection. my board is MKR WiFi 1010.

I found this too. The Arduino app must actually send something to the Arduino on connecting where as vscode does not.

i had the same problem and i solved it by changing the Baud Rate

ctrl+shift+p >> Arduino: Change Baud Rate

i changed it to 9600 and tested with this code:

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  Serial.println("hello\n");
  delay(500);
}

OS: Windows 10
VSCode version: 1.48
Arduino extension: v0.3.2
Arduino IDE: 1.8.13

This appears to be resolved, please reopen the issue if you're still have trouble with the serial monitor.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shizn picture shizn  路  24Comments

tranvan110 picture tranvan110  路  30Comments

Proladon picture Proladon  路  16Comments

liydu picture liydu  路  21Comments

rhit-jacksocr picture rhit-jacksocr  路  18Comments