Vscode-arduino: Unproper closing of Serial Monitor crashes extension

Created on 4 Dec 2018  ·  7Comments  ·  Source: microsoft/vscode-arduino

Issue Type: Bug

Plug in an Arduino - open serial monitor - press reset button on Arduino - not beeing able to upload a sketch to Arduino anymore

Extension version: 0.2.23
VS Code version: Code 1.29.1 (bc24f98b5f70467bc689abf41cc5550ca637088e, 2018-11-15T19:13:36.375Z)
OS version: Windows_NT x64 10.0.17134


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2592)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled|
|Memory (System)|15.92GB (11.94GB free)|
|Process Argv||
|Screen Reader|no|
|VM|50%|


serial

Most helpful comment

Having this issue when I physically unplug the Arduino without closing the serial port. The extension crashes immediately in this scenario. Using an Arduino Nano.

All 7 comments

@Staud14 Thank you for your feedback , we will investigate it.

@Staud14 I try to use DevKit AZ3166 and Huzzah Esp8266 device to do bellow steps , but this issue is not repro on . Can you see what am I missing?

Step:

  1. Open VS Code and install Arduino extension 0.2.23
  2. Open the sample application of iot-hub-feather-huzzah-client-app
    git clone https://github.com/Azure-Samples/iot-hub-feather-huzzah-client-app.git
    you can see the tutorial from https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started
  3. Plug in an Huzzah Esp8266 device to computer.
    Auto detect new plugged in board when connect Huzzah Esp8266 to computer in VSCode status

image

  1. Run command “Arduino: Open Serial Monitor” to open serial monitor
  2. Press reset button on Huzzah Esp8266 device
  3. then run command “Arduino: upload” to upload a sketh
    you can see the Serial Monitor will auto closed when run Arduino upload
    and Arduino upload will success in Arduino panel
    I can not see any crash .

image

To me it seems like you didn't miss anything. Maybe something went wrong when I installed some extensions.
When the error occured I wanted to programm an Arduino Nano but there shouldn't be anything different from your test setup.
Anyway thanks for looking into the issue.

Having this issue too. Interestingly, I was also using a Arduino Nano. When I switched to a Arduino Uno, it didn't happen. Neither are original boards, but the Uno appears as an Uno, whereas the Nano is detected as a "WeMos D1", though I use it as a Nano. Hope this helps.

I am having this problem in my old laptop (Core 2 Duo) with Linux on an Arduino Micro clone.

When you upload from vscode with the serial monitor open, first the extension closes the monitor, then uploads and finally tries to open the serial monitor again. The problem in my case at that last step is that the serial device /dev/ttyACM0 is not yet ready: the Arduino is either still booting after the upload or the system has not yet updated the filesystem permissions in the /dev/ttyACM0 device (it first appears as crw------ root root and then changes to crw-rw---- root dialout).
Therefore, in the Serial Monitor window I get a "[Starting] Opening the serial port - /dev/ttyACM0" followed by "[Error] Error: Error: permission denied: cannot open /dev/ttyACM0".

Even though the upload was actually successful, in the Arduino upload window, I never get a "[Done] Uploaded the sketch", the message "Arduino uploading..." stays in the status bar and the extension gets "stuck" and cannot be used to upload again until vscode is restarted.

In conclusion, there is a bug in case of error re-opening the Serial Monitor after a successful upload that leaves the upload command unfinished forever.

I would also suggest doing a few tries on the reopen with a little wait between them. When I replace the avrdude executable with my own script adding a sleep 2 (delay 2 seconds) after running avrdude, it just works fine.

I am attaching an animated gif with a successful upload followed by an upload showing the problem with the open serial monitor (I hope it works).

arduino-upload

This issue has been automatically marked as stale and closed because it has not had recent activity. Please feel free to open a new issue if you would like further discussion. Thank you for your contributions.

Having this issue when I physically unplug the Arduino without closing the serial port. The extension crashes immediately in this scenario. Using an Arduino Nano.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justin-romano picture justin-romano  ·  3Comments

clarkbremer picture clarkbremer  ·  6Comments

kerrsmith picture kerrsmith  ·  4Comments

shizn picture shizn  ·  4Comments

Hans007a picture Hans007a  ·  4Comments