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
The ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6 chips have native USB device peripherals.
On many boards that use these chips (like Espressif's own ESP32-C6-DevKitC, ESP32-S2-DevKitC and ESP32-S3-DevKitC) there are two USB connectors: one going directly to the MCU's USBD peripheral, and one going to a USB/UART bridge chip that's connected to UART0's TXD and RXD pins. Other boards that have a single USB port often connect that directly to the MCU chip.
There are some boards with these chips (including Espressif's ESP32-C3-DevKitC) that use just the UART connection; in Espressif's case the first two revisions of the -C3 chips had broken USB-serial-JTAG controllers so they wired to the UART by default (you can rotate two resistors on this board to use the native USB instead).
The mpconfigboard.h files for all four of these chips' GENERIC ports enable the REPL over UART0:
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.#defineMICROPY_HW_ENABLE_UART_REPL (1)
Enabling MICROPY_HW_ENABLE_UART_REPL disables the use of UART0 as a regular UART peripheral, and provides a redundant REPL on the UART USB connector.
However, this prevents use of that UART for other purposes (especially for debug or log output).
It seems to me that MICROPY_HW_ENABLE_UART_REPL should not be enabled for those boards that have both connectors.
If there are any ESP32-S2, ESP32-S3, ESP32-C3, or ESP32-C6 boards that lack the direct USB connection, perhaps these boards should be defined separately, and the ESP32_S2_GENERIC, ESP32_S3_GENERIC, ESP32_C3_GENERIC, and ESP32_C6_GENERIC ports should not enable MICROPY_HW_ENABLE_UART_REPL.
I know that there was a time where there were two different pre-compiled builds available for some boards (the ESP32-C3?), one with _USB appended that used the direct USB and one that did not. Maybe the GENERIC builds should use direct USB and we could have _GENERIC_NO_USB builds for those boards that only provide a UART USB connector?
PR #15727 contains a lively discussion about the various options for enabling the REPL on USB on these chips. The other REPL options are:
MICROPY_HW_USB_CDC for native USB-CDC which defaults to 1 on supported SoCs (currently ESP32-S2,S3).
MICROPY_HW_ESP_USB_SERIAL_JTAG to use the serial/JTAG peripheral which defaults to 1 on supported SoCs that don't have native USB-CDC enabled.
ports/esp32/uart.h has this logic:
// Whether to enable the REPL on a UART.#ifndefMICROPY_HW_ENABLE_UART_REPL#defineMICROPY_HW_ENABLE_UART_REPL (!MICROPY_HW_USB_CDC && !MICROPY_HW_ESP_USB_SERIAL_JTAG)
#endif
ports/esp32/mpconfigport.h enables MICROPY_HW_USB_CDC for all builds that set MICROPY_HW_ENABLE_USBDEV.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6 chips have native USB device peripherals.
On many boards that use these chips (like Espressif's own
ESP32-C6-DevKitC
,ESP32-S2-DevKitC
andESP32-S3-DevKitC
) there are two USB connectors: one going directly to the MCU's USBD peripheral, and one going to a USB/UART bridge chip that's connected toUART0
'sTXD
andRXD
pins. Other boards that have a single USB port often connect that directly to the MCU chip.There are some boards with these chips (including Espressif's
ESP32-C3-DevKitC
) that use just the UART connection; in Espressif's case the first two revisions of the -C3 chips had broken USB-serial-JTAG controllers so they wired to the UART by default (you can rotate two resistors on this board to use the native USB instead).The
mpconfigboard.h
files for all four of these chips'GENERIC
ports enable the REPL overUART0
:Enabling
MICROPY_HW_ENABLE_UART_REPL
disables the use ofUART0
as a regular UART peripheral, and provides a redundant REPL on the UART USB connector.However, this prevents use of that UART for other purposes (especially for debug or log output).
It seems to me that
MICROPY_HW_ENABLE_UART_REPL
should not be enabled for those boards that have both connectors.If there are any ESP32-S2, ESP32-S3, ESP32-C3, or ESP32-C6 boards that lack the direct USB connection, perhaps these boards should be defined separately, and the
ESP32_S2_GENERIC
,ESP32_S3_GENERIC
,ESP32_C3_GENERIC
, andESP32_C6_GENERIC
ports should not enableMICROPY_HW_ENABLE_UART_REPL
.I know that there was a time where there were two different pre-compiled builds available for some boards (the ESP32-C3?), one with
_USB
appended that used the direct USB and one that did not. Maybe theGENERIC
builds should use direct USB and we could have_GENERIC_NO_USB
builds for those boards that only provide a UART USB connector?PR #15727 contains a lively discussion about the various options for enabling the REPL on USB on these chips. The other REPL options are:
ports/esp32/uart.h
has this logic:ports/esp32/mpconfigport.h
enablesMICROPY_HW_USB_CDC
for all builds that setMICROPY_HW_ENABLE_USBDEV
.Beta Was this translation helpful? Give feedback.
All reactions