Page 1 of 1

ESP32-S3 USB serial controller as first class interface?

Posted: Mon Feb 07, 2022 4:19 am
by davidzuhn
I would very much like to see the USB/JTAG controller serial interface be a full replacement for a UART interface, allowing me to remove the CP2102 from my design and simplifying the BOM.

When I try to use this interface the way that I use the UART interface, it seems like the USB serial is a secondary target (not fully functional or tested). This work is done with the espresso ESP32-S3-DevKit and using esp-idf v5.0-dev-1452-g93106c9348 (reported by git described). I'm using a Mac running macOS 12.2.

Using the getting-started/hello_world example, everything works just fine using both devices (USB serial controller = /dev/tty.usbmodem21401, UART = /dev/tty.SLAB_USBtoUART)

Using the system/console/basic example, when building for target esp32s3, but with no other changes to the sdkconfig file, I get the following when using "idf.py monitor -p /dev/tty.usbmodem21401":

Code: Select all

....
I (325) example: Command history enabled

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.

Your terminal application does not support escape sequences.

Line editing and history features are disabled.

On Windows, try using Putty instead.

Done
and the device does not accept input. The similar command using the UART device (in the same window) works just fine and I get console interaction as I have become accustomed to when using the UART.

Additionally, when compiling the same example on Raspberry Pi 4 (aarch64, Debian bullseye), the console app when run through the USB/JTAG controller (/dev/ttyACM0) get this far:

Code: Select all

...
I (273) sleep: Enable automatic switching of GPIO sleep configuration
I (280) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (326) example: Command history enabled

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
and hangs with no further output and no response to keyboard input. Ctrl-] doesn't exit, and only killing the idk_monitor.py script gets me back to the shell. Using the UART device (/dev/ttyUSB0) works as expected.

And then back on the Mac when I configure the build with ESP_CONSOLE_USB_SERIAL_JTAG=y, the build (again, of the system/console/basic example) fails with:

Code: Select all

/Users/zoo/esp32/esp-idf-latest-20220204/examples/system/console/basic/main/console_example_main.c: In function 'app_main':
/Users/zoo/esp32/esp-idf-latest-20220204/components/console/esp_console.h:91:18: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
     .baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE, \
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zoo/esp32/esp-idf-latest-20220204/examples/system/console/basic/main/console_example_main.c:69:49: note: in expansion of macro 'ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT'
     esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zoo/esp32/esp-idf-latest-20220204/components/console/esp_console.h:91:18: note: each undeclared identifier is reported only once for each function it appears in
     .baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE, \
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zoo/esp32/esp-idf-latest-20220204/examples/system/console/basic/main/console_example_main.c:69:49: note: in expansion of macro 'ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT'
     esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On a lark, I tried compiling examples/system/console/basic using USB CDC (ESP_CONSOLE_USB_CDC=y), which fails to compile:

Code: Select all

/Users/zoo/esp32/esp-idf-latest-20220204/components/esp_system/port/soc/esp32s3/usb_console.c:77:1: error: static assertion failed: "usb_osglue_*_int is not multicore capable"
 _Static_assert(SOC_CPU_CORES_NUM == 1, "usb_osglue_*_int is not multicore capable");
 ^~~~~~~~~~~~~~
Are these issues that are expected to be resolved before the chip goes into full production?

Re: ESP32-S3 USB serial controller as first class interface?

Posted: Mon Feb 07, 2022 4:34 am
by chegewara

Re: ESP32-S3 USB serial controller as first class interface?

Posted: Mon Feb 07, 2022 2:35 pm
by davidzuhn
The system/console_usb example is using USB managed by the main CPU and not the new-to-the-ESP32-{C3,S3} USB/JTAG controller. It is also hardcoded to the ESP32-S2 (see the sdkconfig.defaults file). Removing that entry and attempting to build for the ESP32-S3 results in this:

Code: Select all

/Users/zoo/esp32/esp-idf-latest-20220204/components/esp_system/port/soc/esp32s3/usb_console.c:77:1: error: static assertion failed: "usb_osglue_*_int is not multicore capable"
 _Static_assert(SOC_CPU_CORES_NUM == 1, "usb_osglue_*_int is not multicore capable");
 ^~~~~~~~~~~~~~
(Same as I reported in the original message when defining ESP_CONSOLE_USB_CDC=y).

Re: ESP32-S3 USB serial controller as first class interface?

Posted: Mon May 23, 2022 4:59 pm
by michalk
I have this need, and am interested if you found a solution.

Re: ESP32-S3 USB serial controller as first class interface?

Posted: Mon May 23, 2022 8:39 pm
by ESP_igrr
Hi all,

USB_SERIAL_JTAG support has been recently added to the console/basic example, please see the updated instructions here: https://github.com/espressif/esp-idf/tr ... erial_jtag

We will be backporting this update to release/v4.4 as well.

Re: ESP32-S3 USB serial controller as first class interface?

Posted: Mon May 23, 2022 8:49 pm
by michalk
I am porting my application to the ESP32-S3 from the Teensy. With the DevKitC, I can use two USB cables and program over one, and get the serial console over the other (with UART). Now, I need to get a serial port working natively on the ESP.

I am using the Arduino framework in Platformio, and do not have any experience with the ESP-IDF. I've cloned the repo with the serial examples, but it won't compile in Platformio. I'm not sure if I should port my code to ESP-IDF, or try to make the serial console work in Arduino framework. Some pointers would be appreciated if Platformio is even viable for this.