Description
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-S3
MicroPython version
MicroPython: 1.22.2
board: ESP32_GENERIC_S3
board_variant: SPIRAM_OCT
Reproduction
compile for the ESP32-S3 and try and use the pins for I2C. Using them results in a timeout or if doing a scan it takes the scan more than a minute to complete and returns an empty list.
Expected behaviour
for I2C to work using pins 19 and 20
Observed behaviour
I2C attached to pins 19 and 20 does not work I believe this issue is caused by the forced use of USB OTG. I have tried to turn it off by setting CONFIG_USB_OTG_SUPPORTED=n
in the ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.board
file and also removing boards/sdkconfig.usb
from the ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake
file. For whatever reason CONFIG_USB_OTG_SUPPORTED
still gets set to y
when being compiled.
Normally this wouldn't be an issue but because of this code in MicroPython
void mp_task(void *pvParameter) {
volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
#if MICROPY_PY_THREAD
mp_thread_init(pxTaskGetStackStart(NULL), MICROPY_TASK_STACK_SIZE / sizeof(uintptr_t));
#endif
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
usb_serial_jtag_init();
#elif CONFIG_USB_OTG_SUPPORTED
usb_init();
#endif
#if MICROPY_HW_ENABLE_UART_REPL
uart_stdout_init();
#endif
machine_init();
Pin 19 and 20 get forced into use for OTG instead of being something that user is able to selectively turn on. I believe that the ESP-IDF is overriding the setting CONFIG_USB_OTG_SUPPORTED=n
which is why I am not able to turn it off and because MicroPython is coded in a manner that forces those pins into being used for USB OTG at runtime results in my inability to use those pins for anything else.
I believe that this kind of a thing should be able to be turned on or off at the users discretion and it should be able to be done at runtime and not compile time. The CONFIG_USB_OTG_SUPPORTED
is simply a setting that should be used to have code compiled and not be used to determine if it should run code. That macro as it implies if whether or not a board supports OTG not that it should be used.
Additional Information
I have not managed to grasp why the OTG is having repl data sent to it.