Page 1 of 1

ESP32-C3 does not start with USB Serial console output enabled

Posted: Wed Nov 03, 2021 3:08 pm
by ysba90
Hello,

I'm working in an application in which I'd like to keep UART0 free to communicate with another device, so I don't want to print console output in this port.

Also, I'd like to have console output for debuging purposes in USB Serial/JTAG Controller. However, when I enable the option "Channel for console output" in menuconfig, the device seems to be stalled until I open the virtual serial port. When the port is opened, the device runs normally and prints to the USB virtual serial console.

This problem only occurs when setting "USB Serial/JTAG Controller" in "Channel for console output". Setting any other option, no problem occurs ("Default: UART0", "Custom UART" or "None").

In the USB Serial/JTAG Controller Console documentation page, at the "Limitations" section (https://docs.espressif.com/projects/esp ... light=jtag), it says something that ESP32-C3 chip would stall if it receives bytes that are not read. But it do not mention what would happen if the application is trying to write console output to USB port when there is no other device attached to it.

Is this a normal behavior, or I may be missing something?

As a workaroud, I redirected my debuging console output to a Custom UART because I have some spare gpios. However I'd like to understand why USB issue ie happening.

Thank you.

Yuri

Re: ESP32-C3 does not start with USB Serial console output enabled

Posted: Thu Nov 04, 2021 7:46 am
by ESP_Sprite
It's a known bug in esp-idf; we merged a fix for it to our internal master branch two days ago and as soon as it passes the CI, it'll be in master. If you can't wait, I think this patch, albeit somewhat hacky, fixes the issue.

Re: ESP32-C3 does not start with USB Serial console output enabled

Posted: Thu Nov 04, 2021 12:47 pm
by ysba90
Hello, I'm glad this issue is being addressed. Fortunately I can wait. I'll keep up with master branch to test this fix as soon as it's available. Thank you very much.

Re: ESP32-C3 does not start with USB Serial console output enabled

Posted: Fri Nov 05, 2021 5:01 pm
by rainman
You made my day Jero :)
I've spent half of the day in hardware checks of our circuit trying to understand why the code was not working when connected via the onboard battery. Everything was looking good from the power point of view, in fact, the only difference was that the internal USB serial was not connected. (Yeah, I know, I didn't think to switch to the uart serial).

Will wait for the fix release and use the linked patch in the meantime.

Cheers and have a nice week end

Re: ESP32-C3 does not start with USB Serial console output enabled

Posted: Fri Nov 05, 2021 8:55 pm
by ysba90
Just for the record, I've applied the suggested diff patch and it worked. Thank you.