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

Latest version breaks serial monitor - interferes with manual reset of ESP32. #1458

Closed
clarkbremer opened this issue Feb 13, 2022 · 12 comments
Closed
Labels
serial Issues with serial ports

Comments

@clarkbremer
Copy link

clarkbremer commented Feb 13, 2022

With the latest version of the extension (0.4.11), the serial monitor interferes with a manual reset of my Arduino board (an ESP32). It behaves as if the boot button is being held low (GPIO0 in my case). So a manual reset causes it to enter boot mode instead of just running the code. Seems DTR is being left low when it should not be.

It works fine if I disconnect the USB cable. And it works fine if I roll back to 0.4.10.

FYI: Version 0.4.10 still requires user to manually push the boot button to upload new code. This worked correctly in version 0.4.9 - upload worked without having to push any buttons. That's the desired behavior, of course.

Version: 1.63.2 (user setup)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Feb 13, 2022
@benmcmorran
Copy link
Member

Thanks for the report @clarkbremer! We made some fairly significant changes to the serial communication infrastructure in 0.4.11 to address false positives with antivirus scanners, and I'm guessing this is fallout from that work.

To clarify, do you expect DTR to always be high, or are there cases where you'd want DTR to be low from the serial monitor? Also which Espressif hardware are you using? I have a few of these development boards that I can test with.

@benmcmorran benmcmorran added needs-more-info More details about this issue are needed for it to be actionable. serial Issues with serial ports and removed triage New issues that have not been reviewed. labels Feb 17, 2022
@clarkbremer
Copy link
Author

clarkbremer commented Feb 17, 2022

I'm using a pretty standard ESP32: https://www.amazon.com/gp/product/B0718T232Z/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

The DTR line is wired to the "BOOT" input (GPIO0). So if you reset the board, and this is low, it will enter "programming" mode, and give a message like this: rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)) waiting for download. The new version of your code holds this line low all the time. So it will reboot after you program it, as it should, but any reset after that with the USB cable connected, and it will get stuck in "program" mode.

The only time DTR should go low is when you are trying to upload code to the device.

Also, Version 4.10 was also a regression from 4.9. It does not make DTR go low at all. So you have to do the equivalent with the button on the board. I'm currently using 4.9, and it works properly.

For proper operation of software upload:

  • Pull CTS low (reset the board using EN pin)
  • Pull DTR Low (indicate program mode using GPIO0 pin).
  • Raise CTS to allow board to boot.
  • Delay some time? Until the upload starts, at least.
  • Raise DTR, so that next time it resets, it won't enter program mode.

@benmcmorran
Copy link
Member

Thanks for all that info! That should be enough for me to investigate this.

@benmcmorran benmcmorran added investigating and removed needs-more-info More details about this issue are needed for it to be actionable. labels Feb 17, 2022
@vlastahajek
Copy link

vlastahajek commented Feb 21, 2022

I can confirm DTR (GPIO 0) is kept low when Serial console is open. The issue is also for ESP8266 dev boards.

@vlastahajek
Copy link

Additional info: Serial console should not control signals for reset and boot. Reboot is done by unloading. Opening the serial console shouldn't reset the device. Or, this could be at least configurable.

@hoekma
Copy link

hoekma commented Feb 26, 2022

I am also not able to use serial monitor. Rolled back to 4.1.0 and it also does not work. I checked my issue from September #1338 that was closed. I have not been able to use VSCode for Arduino development for a looooong time because of the constant instability. Being able to monitor serial is a "must have" to develop on Arduino with VSCode. Can this be added to the highest priority stability testing on all platforms before each release of the plugin?

@benmcmorran
Copy link
Member

@clarkbremer @vlastahajek @hoekma Can you uninstall the Arduino extension and try installing the appropriate VSIX from this CI build? It includes this change which should keep DTR, RTS, and CTS high while the serial monitor is active. It worked with my ESP32 Dev Module, but let me know if you see any issues.

@benmcmorran benmcmorran added needs-more-info More details about this issue are needed for it to be actionable. and removed investigating labels Mar 23, 2022
@clarkbremer
Copy link
Author

clarkbremer commented Mar 24, 2022

Tested with ESP32 Dev Module and also an Arduino Pro Mini. Both worked fine. Noticed that on the pro mini, opening the serial port resets the board, but the Arduino IDE behaves the same way, so I guess that's OK.

@benmcmorran
Copy link
Member

Thanks for verifying! I'll get this merged and in the next release.

@benmcmorran benmcmorran added fixed-pending-release Fix is merged and will be included in the next release. and removed needs-more-info More details about this issue are needed for it to be actionable. labels Mar 24, 2022
@vlastahajek
Copy link

I can confirm the fix works ok also for ESP8266 based boards.

@gcampbell-msft
Copy link
Contributor

This issue has been fixed in the latest release of this extension, which is available in the VS Code extension marketplace.

@gcampbell-msft gcampbell-msft removed the fixed-pending-release Fix is merged and will be included in the next release. label May 3, 2022
@jamargevicius
Copy link

I'm using a ESP32-S3-WROOM device and find both the nRTS and nDTR lines are pulled low when I invoke the Serial Monitor after a code download. I can download code fine when selecting the board "ESP32S3 Dev Module", but now have to select the board "ESP32 Dev Module" if I want to use the Serial Monitor. This has to be a software bug somewhere. I can only find the ESP32-S3 support via the Arduino 1.8, but not the Arduino 2. In Arduino 1.8, in File/Preferences/Additional Board Manager, I put: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json, https://dl.espressif.com/dl/package_esp32_index.json .... the github package has the S3 support. In Arduino 2, I haven't located anything that supports the S3.

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

6 participants