ESP32 S3 with native USB in CDC, device restarts when the desktop app opens the virtual COM port
Posted: Fri Jun 20, 2025 3:58 pm
I have two projects: both use the ESP32S3, and both utilise the native USB as the virtual serial communication with specific desktop applications.
One project is developed in IDF, and the other in Arduino.
In both projects, we have set up the native USB in CDC mode.
In IDF, using the sdkconfig: Component config -> ESP System Settings -> Channel for console output - [USB Serial/JTAG Controller]
In Arduino, using the platformio.ini file, setting the build_flags as -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MSC_ON_BOOT=0
In both projects we have the same problem.
If we connect the USB cable to the device, it starts the booting and arrives in a stable status.
When the desktop application opens the COM port, the device restarts.
After the restart is complete, the application can start communicating with the device.
How is it possible to avoid this behaviour?
Is this a problem with the ESP32 USB setup or with the source code on the desktop app?
Consider that different apps produce the same problem. Also the free YAT terminal app.
Example:
1) Connect the USB cable between the PC and the board (the USB cable also provides power to the board): the device reboots and enters a stable state.
2) Set the COM port in the YAT Terminal, in 115200@8N1, without flow control
3) Open the connection and the device starts a restart
Thanks
One project is developed in IDF, and the other in Arduino.
In both projects, we have set up the native USB in CDC mode.
In IDF, using the sdkconfig: Component config -> ESP System Settings -> Channel for console output - [USB Serial/JTAG Controller]
In Arduino, using the platformio.ini file, setting the build_flags as -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MSC_ON_BOOT=0
In both projects we have the same problem.
If we connect the USB cable to the device, it starts the booting and arrives in a stable status.
When the desktop application opens the COM port, the device restarts.
After the restart is complete, the application can start communicating with the device.
How is it possible to avoid this behaviour?
Is this a problem with the ESP32 USB setup or with the source code on the desktop app?
Consider that different apps produce the same problem. Also the free YAT terminal app.
Example:
1) Connect the USB cable between the PC and the board (the USB cable also provides power to the board): the device reboots and enters a stable state.
2) Set the COM port in the YAT Terminal, in 115200@8N1, without flow control
3) Open the connection and the device starts a restart
Thanks