ESP32-S2 2nd usb-serial port
HI
At micropython for ESP32-S2, I'd like to have
secondary USB-serial port (like /dev/ttyACM1 on linux)
which directly maps to board's hardware serial port
RX/TX pins and if possible, few RS232 signaling lines.
Can this (easily) be done?
esp32s3 USB JTAG Serial interface should be enabled to access the mpy terminal
Problem Description
I want to use the built-in USB serial functionality comes with the ESP32-S3 SoC in addition to the UART interface (not simultaneously). However, I found that the firmwares (both v1.18 (2022-01-17) .bin and v1.18-473-g7883ae413 (2022-05-19) .bin do not support the serial over USB JTAG Serial interface. The sympton was that the device got reset as soon as I opened the USB serial port.
I compile my own firmware using the master branch
(7883ae413ddfa6181d784533b236658658383d0c) with
make -C mpy-cross
make -C ports/esp32 SER_C_MODULES=../../../examples/usercmodule/micropython.cmake FROZEN_MANIFEST=$(pwd)/ports/esp32/boards/manifest_test.py BOARD=GENERIC_S3_SPIRAM
make -C ports/esp32 submodules BOARD=GENERIC_S3_SPIRAM
make -C ports/esp32 BOARD=GENERIC_S3_SPIRAM
and flashed the firmware with
python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset --chip esp32s3 write_flash 0x0 bui
ld-GENERIC_S3_SPIRAM/bootloader/bootloader.bin 0x8000 build-GENERIC_S3_SPIRAM/partition_table/partition-table.bin 0x10000 build-GENERIC_S3_SPIRAM/micropython.bin
The USB serial no longer reset the board. However, the USB Serial terminal has no feedback: I can see from the UART terminal that the input was accepted (e.g., more >>> after hit the enter key) but nothing showed up in the USB Terminal.
Solution
I have added one line to micropython/ports/esp32/boards/GENERIC_S3_SPIRAM/sdkconfig.board file:
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
And the USB terminal works just fine. It is shared by the UART one but both side will see the same feedback consistently.
In addition, I have tried to comment out the line inmicropython/ports/esp32/boards/GENERIC_S3_SPIRAM/mpconfigboard.cmake:
set(IDF_TARGET esp32s3)
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
# boards/sdkconfig.usb
boards/sdkconfig.spiram_sx
boards/GENERIC_S3_SPIRAM/sdkconfig.board
)
And the USB terminal still works.
Below is the screen record of how two terminals are working simultaneously. The left panel (COM4) is CH340 USB Serial bridge and the right one (COM5) uses the internal USB JTAG Serial.

Recommendations
Add CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y to the esp32s3 boards so that the USB serial will be enabled.
Possible related issues
#8524