← index #16457Issue #14257
Related · high · value 1.162
QUERY · ISSUE

1.24 breaks USB OTG support

openby dcmcshanopened 2024-12-19updated 2025-01-07
bugport-esp32

Port, board and/or hardware

ESP32S3

MicroPython version

1.23 / 1.24

Reproduction

Instll kernel, reset, see if it boots

Expected behaviour

Boots

Observed behaviour

Loading firmware 1.24 does not boot using USB-OTG. I don't have serial port. Just USB-OTG, so need kernel to default that on.

Loading firmware 1.23 works as expected.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

esp32-s3: When using USB CDC, UART 0 will still print console output.

closedby xlin350opened 2024-04-05updated 2024-07-06
bugport-esp32

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

esp32 port, ESP32_GENERIC_S3, ESP32-S3-WROOM-1-N16R2 WIFI Module with Quad SPIRAM

MicroPython version

MicroPython v1.22.2 on 2024-02-22; Generic ESP32S3 module with ESP32S3

IDE: Thonny

Reproduction

I'm currently using the built-in usb peripheral in the esp32s3 to connect to my pc, and connecting gpio1 and gpio2 ((which are not, in fact, specified)) to a ch340-based usb-ttl converter that connects to my pc to use as a debugger:

# The codes below raised error
from machine import UART
uart = UART(0, baudrate=115200, tx=1, rx=2)  # UART0
uart.write('Hello, UART!')

I then also tested the adoption of uart1 as follows:

# The codes below run well
from machine import UART
uart = UART(1, baudrate=115200, tx=1, rx=2)  # UART1
uart.write('Hello, UART!')

Expected behaviour

They have completely different phenomena. When I used UART1, no matter which two GPIOs I used for tx and rx (in this sample, I still used GPIO 1 and 2), the serial commands I sent were printed correctly on the serial port monitor like following:
1111111

Observed behaviour

When I initialize the UART instance, if I use UART0, then no matter which two GPIOs I use for tx and rx, the serial monitor will show some garbled code and will not show the serial commands I send, like:
2222222222
It looks like the gibberish is some Thonny IDE information printed by UART0, I don't know why this is happening as I am currently using the built-in USB connection and using CDC for debugging, and I have looked at the micropython source code, and it looks like UART0shouldn't be used to output debugging information in this case.

Additional Information

I looked at the micropython source code and there are these macro definition lines in port/esp32/uart.h:

#ifndef MICROPY_HW_ENABLE_UART_REPL
#define MICROPY_HW_ENABLE_UART_REPL (!CONFIG_USB_OTG_SUPPORTED && !CONFIG_ESP_CONSOLE_USB_CDC && !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG)
#endif

It looks like if I use USB_CDC, CONFIG_ESP_CONSOLE_USB_CDC will be set to 1, and then MICROPY_HW_ENABLE_UART_REPL will be set to 0, so it shouldn't print the REPL message inside UART0?
And, it is also defined in port/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.h as follows:
#define MICROPY_HW_ENABLE_UART_REPL (1)
I'm wondering if I try to set this to 0 and then recompile the micropython firmware, will the bug or problem I described above be fixed?

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied