[ESP32-S2] Enable UART REPL instead of USB

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

[ESP32-S2] Enable UART REPL instead of USB

Post by rx8pilot » Mon Feb 21, 2022 11:21 pm

I have created a custom board with ESP32-S2-WROVER-I. Using an external serial adaptor for programming. I am new to ESP32 and Micropython, but a mid-skill-level programmer for many other microcontrollers.

The GENERIC-S2 port compiled just fine, but it appears to be setup for USB REPL. I can see the system boots, but no interaction on UART.
Next, I tried to simply delete the .usb line in mpconfigboard.h

Code: Select all

set(IDF_TARGET esp32s2)

set(SDKCONFIG_DEFAULTS
    boards/sdkconfig.base
    boards/sdkconfig.usb
)

if(NOT MICROPY_FROZEN_MANIFEST)
    set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
endif()
It compiles without error, but the microcontroller panics during boot, endless reboots. So, I put the .usb line back in and tried to modify the sdkconfig.usb file:

Code: Select all

CONFIG_USB_ENABLED=n
CONFIG_USB_CDC_ENABLED=n
CONFIG_USB_CDC_RX_BUFSIZE=256
CONFIG_USB_CDC_TX_BUFSIZE=256
Again, it compiles without errors but panics the microcontroller. Clearly I am just hacking away at this blindly.
Is anyone able to point me in the right direction to get the REPL on the UART?
Last edited by rx8pilot on Thu Feb 24, 2022 2:07 am, edited 1 time in total.

rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

Re: Enable UART REPL instead of USB

Post by rx8pilot » Tue Feb 22, 2022 4:30 am

UART0 Output:
Looping on boot, but only when I take out the USB lines or change the sdkconfig.board file.

Hard to say if I am doing something wrong, or if I am fighting a bug.

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4002547a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0xf48
load:0x4004c000,len:0xaec
load:0x40050000,len:0x2bd4
entry 0x4004c1b0
Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x400d27c2  PS      : 0x00060333  A0      : 0x8008635c  A1      : 0x3ffd5b90
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x3ff9ffe0  A5      : 0x0000040e
A6      : 0x3ffd5bc0  A7      : 0x3ffc7ebc  A8      : 0x00000000  A9      : 0x3ffd5b60
A10     : 0x00000000  A11     : 0x0000040e  A12     : 0x40026a54  A13     : 0x00000000
A14     : 0x3ffd5bc0  A15     : 0x3fffde84  SAR     : 0x00000014  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000008  LBEG    : 0x40026a54  LEND    : 0x00000000  LCOUNT  : 0x40026521


Backtrace:0x400d27bf:0x3ffd5b900x40086359:0x3ffd5bc0 0x400861dc:0x3ffd5bf0




ELF file SHA256: cf70f28091c5e26c

Rebooting...
I tried reverting back to 1.18 but that has not yet been any help.

rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

Re: [ESP32-S2] Enable UART REPL instead of USB

Post by rx8pilot » Thu Mar 10, 2022 2:08 am

There was a bug in the the UART init function.

The latest release seems to have solved it. :D

Post Reply