open
command fails to connect to boards with CH340 USB chip on Windows
#1000
Labels
os: windows
Specific to Windows operating system
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
The WCH CH340 USB to serial bridge chip is common on boards used by the Arduino community. The manufacturer of this chip recently released a new version of the Windows driver, which users are receiving via a Windows update.
🐛 The port is spuriously closed immediately after an
open
command under the following conditions:To reproduce
Equipment
Steps
A context menu will open.
The "USB-SERIAL CH340 (COM_n_) Properties" dialog will open.
3.9.2024.9
is shown in the "Driver Version" field of the dialog.An icon will appear in the Windows "notification area".
A menu will open.
The "Arduino Cloud Agent Debug Console" page will open in your browser.
open <port name> 9600
in the field at the bottom of the page.(where
<port name>
is the name of the serial port produced by the CH340 device)🐛 The port is opened, but then immediately closed:
Expected behavior
Port remains open until disconnected or a
close
command is executed.Cloud Agent version
d36d0e1
Operating system
Operating system version
Additional context
I found that the disconnection is caused by this code:
arduino-create-agent/serialport.go
Lines 158 to 165 in d36d0e1
Here is a derived minimal Go program that can be used to reproduce the fault:
This problem causes the Arduino Cloud Editor Serial Monitor to fail to connect to the port, with the following error notification:
The fault does not occur after I install the older versions 3.8.2023.2 and 3.7.2022.1 of the CH340 driver.
The fault does not occur when using
arduino-cli monitor
.The fault does not occur on my macOS and Linux machines.
The fault does not occur when using boards with other USB chips (FTDI FT232R, Silicon Labs CP2104, ATmega16U2 w/ Arduino firmware).
We are accustomed to seeing strange misbehavior associated with certain dodgy "CH340" chips when using the recent Windows driver versions (avrdudes/avrdude#1328). However, unlike those chips, the chips on the boards I used to reproduce the fault are labeled and from reputable manufacturers, and don't have any other problems with the latest drivers.
Originally reported at https://forum.arduino.cc/t/error-when-opening-serial-monitor-we-cant-find-the-device/1331419/1
Additional reports:
Issue checklist
The text was updated successfully, but these errors were encountered: