Page 1 of 3

No REPL on ESP32-S2

Posted: Mon Jun 21, 2021 7:15 am
by alexmus
Hello all,

I'm pretty new to Micropytohn firmware building process, but I tried to build the GENERIC_S2 esp32 port from current Micropython master and I was able to get a micropython.bin firmware executable.

Once deployed on my board (a simple standalone esp32-s2-wroom already checked with espressif examples) I have no REPL on UART0 (RX module pin 37 and TX module pin 38) but only the following:

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x12b0
load:0x4004c000,len:0x8c4
load:0x40050000,len:0x2ca4
entry 0x4004c1a8

I have no panic at 0x4004c1a8 so I think the firmware is running, but I'm not sure, any suggestion?

Here my deployment command:

esptool.py esp32s2 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 micropython.bin

Here my IDF SDK version:

ESP-IDF v4.4-dev-4-g73db14240-dirty

Thanks in advance
Alex

Re: No REPL on ESP32-S2

Posted: Mon Jun 21, 2021 10:15 pm
by haybarry
Hi Alexmus,

The ESP32S2 build seems to send REPL to the native USB port, not the UART port where you programmed the ESP32S2 from.

I have my S2 currently running MP 1.15 with USB Data Positive (White Wire) connected to ESP32S2 Pin 19 and USB Data Negative (Green Wire) connected to ESP32S2 Pin 20.

It connects as /dev/ttyACM1 on my RPi.

Cheers

Barry

Re: No REPL on ESP32-S2

Posted: Sun Jun 27, 2021 12:58 pm
by wangshujun@tom.com
I also encounter the same problem. After compiling and enabling USB, the repl of serial port will no longer respond

Re: No REPL on ESP32-S2

Posted: Wed Jun 30, 2021 2:13 pm
by wangshujun@tom.com
Try the following modifications to make USB and UART work at the same time:
1. main.c
83 line
#if CONFIG_USB_ENABLED
usb_init();
#endif
uart_init();

2. mphalport.c
121 line
#if CONFIG_USB_ENABLED
usb_tx_strn(str, len);
#endif
for (uint32_t i = 0; i < len; ++i) {
uart_tx_one_char(str);
}

After modification, UART and CDC can be opened at the same time by using the serial assistant.

but,use thonny opening any one, the other serial port can only output and can not input .

Re: No REPL on ESP32-S2

Posted: Wed Jun 30, 2021 4:20 pm
by hcet14
Hi alexmus,

did you try firmware from here https://micropython.org/download/esp32/? Is your HW ok?

Re: No REPL on ESP32-S2

Posted: Sun Jul 11, 2021 4:38 am
by wangshujun@tom.com
According to the previous modification, if only UART is connected and USB is not connected, the repl speed of UART will be very slow and not practical


wangshujun@tom.com wrote:
Wed Jun 30, 2021 2:13 pm
Try the following modifications to make USB and UART work at the same time:
1. main.c
83 line
#if CONFIG_USB_ENABLED
usb_init();
#endif
uart_init();

2. mphalport.c
121 line
#if CONFIG_USB_ENABLED
usb_tx_strn(str, len);
#endif
for (uint32_t i = 0; i < len; ++i) {
uart_tx_one_char(str);
}

After modification, UART and CDC can be opened at the same time by using the serial assistant.

but,use thonny opening any one, the other serial port can only output and can not input .

Re: No REPL on ESP32-S2

Posted: Tue Jul 13, 2021 1:09 am
by wangshujun@tom.com
Please try this firmware
esp12k is esp32s2 module
https://github.com/wangshujun-tj/mpy-Framebuf-boost

Re: No REPL on ESP32-S2

Posted: Sat Sep 25, 2021 7:31 pm
by jlb
Hello, I have this same issue .
firmware seems to load but I get the following message when I open terminal :
--> A fatal error occurred: This chip is ESP32-S2 not ESP32. Wrong --chip argument?
is it possible to run Micropython on esp32S2 model??
do I have to upgrade esptool, I have version 2.8?
Do I set the target somehow I thought that esptool automatically does this.

Thank you fro any suggestions.
Jeff

Re: No REPL on ESP32-S2

Posted: Sun Sep 26, 2021 12:34 pm
by bjames28
Hi,

I am not sure, but your problem seems very similar to what I had (esp32-ca-mb with esp32S2)
Try the solution described below, and give feedback if it works:

viewtopic.php?f=18&t=10151&start=10#p61272

Re: No REPL on ESP32-S2

Posted: Sat Oct 16, 2021 1:31 pm
by leosok
wangshujun@tom.com wrote:
Tue Jul 13, 2021 1:09 am
Please try this firmware
esp12k is esp32s2 module
https://github.com/wangshujun-tj/mpy-Framebuf-boost
Thank you! This absolutely works on my board! Now I'd like to find out why my own build (from 1.17 master) does not.