Page 1 of 1

ESP32 C3 dual UART or over native USB?

Posted: Mon Aug 26, 2024 11:22 am
by okw123
I just designed a custom board with ESP32 C3 (chip, not module) with a UART-to-RS232 module connected to U0RX/U0TX (pin27/28).
The problem is, I need print for debug messages, but this automatically ends up on the same U0RX/TX. I use Aruindo IDE and/or PlatformIO. As I read in the datasheet, C3 only have 1 hardware UART?
I have experience with ARM, and they have RTT (Real Time Transfer). Over RTT I can print debug messages without sacrificing a UART resource or dedicate extra pins. Anything like this possible over the native USB interface (gpio18/19)?

Re: ESP32 C3 dual UART or over native USB?

Posted: Tue Aug 27, 2024 12:01 am
by ESP_Sprite
The native USB interface will show up as a serial port; it's indeed intended for debugging as you describe. Just change your menuconfig configuration (under 'logging' iirc) to make the USB-serial-JTAG the primary log output. However.... the C3 actually has *two* UARTs, so you can also simply use the 2nd one for your device while keeping the 1st one for logging. Maybe you're thinking it only has one because the pinout only indicates one set of TX/RX pins? The ESP32 can route most peripherals to any GPIO pin, so the 2nd UART doesn't have a dedicated set of pins.

Re: ESP32 C3 dual UART or over native USB?

Posted: Tue Aug 27, 2024 7:19 pm
by lbernstone
The configuration for arduino-esp32 has the console sent to both the usb-cdc and uart0. Changing this requires recompiling the sdk. If you can use different pins on uart1 as ESP_Sprite suggested, that would be easiest. Otherwise, you can look into using Arduino as an ESP-IDF component.