-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Delay with ESP32-S3 USB HW JTAG CDC if no Serial Monitor is open. #9043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The S3, C3, C6 and H2 that have HW CDC JTAG USB port may cause a delay when using HWCDC in The USB CDC buffer gets full and the Arduino HW CDC layer will timeout, by default 100ms, until give up trying to send the CDC data. As a workaround, it is necessary to use Example: void setup() {
Serial.begin(); // USB HW CDC doesn't need any baudrate
Serial.setDebugOutput(true); // sends all log_e(), log_i() messages to USB HW CDC
Serial.setTxTimeoutMs(0); // sets no timeout when trying to write to USB HW CDC
} |
see espressif/arduino-esp32#9043 " The S3, C3, C6 and H2 that have HW CDC JTAG USB port may cause a delay when using HWCDC in Serial by activating CDC on Boot and selecting the USB Mode for Hardware CDC and JTAG. This happens when no USB application in USB Host side is started to receive the data sent by the ESP32xx. The USB CDC buffer gets full and the Arduino HW CDC layer will timeout, by default 100ms, until give up trying to send the CDC data. As a workaround, it is necessary to use HWCDC::setTxTimeoutMs(timeout_ms) and set it to zero. "
@SuGlider Can this also cause similar issues on the USB CDC layer used on the ESP32-S2? |
It shoud not affect the ESP32-S2 because it uses OTG USB based on TinyUSB software layer. The S3 has both, the OTG USB and the HW JTAG CDC. |
see espressif/arduino-esp32#9043 " The S3, C3, C6 and H2 that have HW CDC JTAG USB port may cause a delay when using HWCDC in Serial by activating CDC on Boot and selecting the USB Mode for Hardware CDC and JTAG. This happens when no USB application in USB Host side is started to receive the data sent by the ESP32xx. The USB CDC buffer gets full and the Arduino HW CDC layer will timeout, by default 100ms, until give up trying to send the CDC data. As a workaround, it is necessary to use HWCDC::setTxTimeoutMs(timeout_ms) and set it to zero. "
@TD-er @softhack007 @Djelibeybi The original issue is related to the JTAG/HW CDC Serial peripheral from ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2. One issue is that when USB cable is unplugged, The second issue is that It won't work properly when the sketch waits for the CDC to be connected using a Serial Monitor, using a code like These and some other issues were fixed by the PR #9275 When USB is unplugged, nothing will block any HW CDC writing or flushing.
It has been fixed for arduino core 3.0.0-RC1 and it is available in the master branch. Check the PR examples. |
related to Testing ESP-S3-BOX3 GFX/TouchScreen Arduino drivers:
I also just realised that there is an effect with
Serial.print()
in the ESP-BOX-3 when the GFX demo sketch is run with no openSerial Monitor
. This is a sort of delay in everySerial.print()
from loop, related to some issue with the USB HW JTAG CDC driver.In order to avoid it, it is necessary to disable
Serial
, by commenting out theSerial
initialization:Originally posted by @SuGlider in #8978 (comment)
The text was updated successfully, but these errors were encountered: