Page 1 of 1

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

Posted: Tue Aug 11, 2026 6:22 am
by Craig_2026
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 20 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).

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

Posted: Tue Aug 11, 2026 9:32 am
by MicroController
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