ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)

Craig_2026
Posts: 0
Joined: Tue Aug 11, 2026 5:25 am

ESP32-S3 USB CDC Hangs on Port Close (SET_CONTROL_LINE_STATE)

Postby Craig_2026 » Tue Aug 11, 2026 6:22 am

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.
RealTerm_CDC_HANG_ESP-IDF6.0.2.png
RealTerm_CDC_HANG_ESP-IDF6.0.2.png (26.14 KiB) Viewed 17 times
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).

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)

Postby MicroController » Tue Aug 11, 2026 9:32 am

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).
This might be resetting the chip, see e.g. viewtopic.php?t=45978#p148790

Who is online

Users browsing this forum: ChatGPT-User, Google [Bot], Qwantbot and 3 guests