You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ESP32s3 hangs on stdout if USB cable connected but CDC not attached #18000
HEAD as of 8c47e44 with the suggested USB fix from #17560 applied – otherwise USB is not reliable for me as I'm using macOS. Same behaviour with official release version of 1.26 though.
Code should run, blinking the LED as soon as power is applied – either from USB or externally – and continue to run if the USB cable is connected or disconnected, whether or not a serial console is attached.
Observed behaviour
Power up from USB: LED blinks for about 20 seconds and then controller locks solid and mpremote cannot attach to it
Power up from USB and attach mpremote immediately: LED blinks and Hello world! appears repeatedly on the console ad infinitum
Power up from USB, attach mpremote watch for a bit and then detach serial console leaving USB cable connected: LED blinks for a few seconds after detaching terminal and then controller locks solid
Power up from external power: LED blinks ad infinitum
Power up from external power, wait a bit and then connect a USB cable without attaching to the serial: locks solid a few seconds after connecting the cable
It looks like connecting the USB is starting some kind of serial buffering that is exhausted after 255 bytes and hangs the controller.
Ah, yes, can confirm that @projectgus's #17960 fixes the issue(s) for me.
@dpgeorge: what are the chances of a 1.26.1 with this in it? Sadly, 1.26 is unusable for me at the moment and the ESP32 PCNT support meant I was so close to being able to run my code on stock MicroPython… 😉
Activity
dpgeorge commentedon Aug 28, 2025
Can you please try #17960? It has a newer TinyUSB and a fix to use
tx_overwritabe_if_not_connected.jonathanhogg commentedon Aug 28, 2025
Ah, yes, can confirm that @projectgus's #17960 fixes the issue(s) for me.
@dpgeorge: what are the chances of a 1.26.1 with this in it? Sadly, 1.26 is unusable for me at the moment and the ESP32 PCNT support meant I was so close to being able to run my code on stock MicroPython… 😉
dpgeorge commentedon Aug 28, 2025
OK, that's great, thanks for confirming.
A high chance! We probably also need #17999 (fixes a similar issue with Windows).
Rai-Sp commentedon Aug 29, 2025
A simple workaround:
Change line 98 in micropython/shared/tinyusb/mp_usbd_cdc.c from
if (!tusb_inited()) {
to
if (!tusb_inited() || !tud_cdc_connected()) {
This may not be a good solution, but it WORKS.
For me, it's not a problem, that everything printed is lost, while no terminal is connected.