I'm experiencing an issue with the USB-CDC where the Serial Port hangs (on Windows 11) when closed. This happens frequently enough to be more than inconvenient, but not every time. I would estimate once in every 5 close operations. This is happening during a production test & provisioning, hence is slowing down the process.
To demonstrate the issue:
I'm running esp-idf v6.0.2 example "usb_serial_jtag_echo" on an ESP32-S3.
https://github.com/espressif/esp-idf/tr ... _jtag_echo
I can use RealTerm. I have hardware flow control turned off. If I simply toggle the port Open and Close repeatably, it will eventually hang on a Port Close Operation.
Examining a USB protocol log, it appears to be during a SET_CONTROL_LINE_STATE. (This is initiated by a ComPort.Close() call in Windows). The logs also shows the response takes exactly 30 seconds - and this is when the Windows application resumes from the hang.
If there someway of mitigating this issue? I note it is a SET_CONTROL_LINE_STATE with the payload 0x03. I believe that is setting DTR (bit 0) and RTS (bit 1).
ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)
-
Craig_2026
- Posts: 2
- Joined: Tue Aug 11, 2026 5:25 am
-
MicroController
- Posts: 2705
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)
This might be resetting the chip, see e.g. viewtopic.php?t=45978#p148790I note it is a SET_CONTROL_LINE_STATE with the payload 0x03. I believe that is setting DTR (bit 0) and RTS (bit 1).
-
Craig_2026
- Posts: 2
- Joined: Tue Aug 11, 2026 5:25 am
Re: ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)
Thanks for your suggestion. We have a buzzer on board, so I've made it beep at start-up, hence a check if it is rebooting. It doesn't appear to be the case.This might be resetting the chip, see e.g. viewtopic.php?t=45978#p148790I note it is a SET_CONTROL_LINE_STATE with the payload 0x03. I believe that is setting DTR (bit 0) and RTS (bit 1).
The USB packet analysis suggests we do get a reply back (after 30 seconds), hence the USB stack on the device is still initialized/hasn't been rebooted.
Last edited by Craig_2026 on Tue Aug 11, 2026 9:55 am, edited 1 time in total.
-
Craig_2026
- Posts: 2
- Joined: Tue Aug 11, 2026 5:25 am
Re: ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)
Further to the first post, I have created a simple c# console app to open the serial port, wait 1 second, close the serial port, wait 1 second and repeat. (Source attached).
When the serial port is closed, we time the call.
Output.txt shows the console output. In summary, it appears to be happening about each 7 to 8 tries. When it times out, the delay is always 30 seconds.
When the serial port is closed, we time the call.
Output.txt shows the console output. In summary, it appears to be happening about each 7 to 8 tries. When it times out, the delay is always 30 seconds.
- Attachments
-
- Program.cs.txt
- (2.1 KiB) Downloaded 1 time
-
- Output.txt
- (1.82 KiB) Downloaded 1 time
Who is online
Users browsing this forum: No registered users and 0 guests