MicroPython 1.18 on ESP32-S3

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
detlevo
Posts: 6
Joined: Sat Feb 12, 2022 2:12 pm

MicroPython 1.18 on ESP32-S3

Post by detlevo » Sat Feb 12, 2022 2:25 pm

Hello,

I have an Espressif ESP32-S3-DEVKITC-1-N8R8. After flashing latest MicroPython firmware, the board does not boot. I get the following output:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x2b (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0xf60
load:0x403b6000,len:0x978
load:0x403ba000,len:0x2c80
entry 0x403b616c
W (25) bootloader_random: RNG for ESP32-S3 not currently supported
W (216) bootloader_random: RNG for ESP32-S3 not currently supported
E (223) psram: PSRAM ID read error: 0x00ffffff
E (223) spiram: SPI RAM enabled but initialization failed. Bailing out.

The board has 8MB of PSRAM and the SPIRAM variant of MPy for this board seems to be compiled for 2MB RAM only (i.e. SPI Mode QUAD). According the datasheet, this board has SPI Mode OCT). Tried to change this and compile MPy 1.18 myself using IDF 4.4, but the resulting firmware crashed. Any help is appreciated to get this board working.

Detlev

detlevo
Posts: 6
Joined: Sat Feb 12, 2022 2:12 pm

Re: MicroPython 1.18 on ESP32-S3

Post by detlevo » Sat Feb 12, 2022 5:27 pm

Hello again,

I have to reply to my own post because I got the issue resolved. There were actually several issues.

1. In order to support 8MB SPIRAM I changed the file 'sdkconfig.spiram_sx' to support Octal SPI mode by changing the line
CONFIG_SPIRAM_MODE_QUAD=y
to read
CONFIG_SPIRAM_MODE_OCT=y

2. In order to get the MPy REPL I removed the line including sdkconfig.usb from 'mpconfigboard.cmake'.

3. In order to get a non-crashing firmware guild, I had to use ESP-IDF v4.4-beta1. Neither the final release nor the RC1 release produced a functional firmware.

4. Contrary to the web-site I had to flash it to address 0x0 as indicated by the make result.

Hope this is useful for others facing the same issues I had with this particular board.

Regards,
Detlev

mwalimu
Posts: 6
Joined: Sat Jul 02, 2016 5:55 pm

Re: MicroPython 1.18 on ESP32-S3

Post by mwalimu » Sat Feb 12, 2022 7:32 pm

I followed your instructions and got:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0xf60
load:0x403b6000,len:0x978
load:0x403ba000,len:0x2c80
entry 0x403b616c
W (25) bootloader_random: RNG for ESP32-S3 not currently supported
W (215) bootloader_random: RNG for ESP32-S3 not currently supported

Any ideas about what is going on?

rira
Posts: 2
Joined: Sun Feb 13, 2022 2:16 pm

Re: MicroPython 1.18 on ESP32-S3

Post by rira » Sun Feb 13, 2022 2:34 pm

Hi mwalimu,

I have an ESP32-S3-DEVKITC-1-N32R8V (WROOM2) board and experienced a lot of the issues that others describe in this forum as well. While the instructions reported by #detlevo and #automate1717 were very helpful, I kept running into some memory issues with my board probably due to the 32 MB flash. Below are the instructions to get micropython working on this board although with the caveat that only 16 of the 32 MB of Flash will be enabled. I hope this helps others with similar boards.

#built requirements
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

#allow current user read/write access to USB over serial port
sudo usermod -a -G dialout $USER

~/$ mkdir ~/esp
~/$ cd ~/esp

~/esp$ git clone --recursive -b v4.4-beta1 https://github.com/espressif/esp-idf.git
~/esp$ cd esp-idf
~/esp/esp-idf$ ./install.sh esp32s3
~/esp/esp-idf$ . ./export.sh
~/esp/esp-idf$ cd ..

~/esp$ mkdir mpy
~/esp$ cd mpy
~/esp/mpy$ git clone git://github.com/micropython/micropython --depth=1
~/esp/mpy$ cd ~/esp/mpy/micropython/ports/esp32/boards/

edit sdkconfig.spiram_sx
Change CONFIG_SPIRAM_MODE_QUAD=y -> CONFIG_SPIRAM_MODE_OCT=y

~/esp/mpy/micropython/ports/esp32/boards$ cd GENERIC_S3_SPIRAM/
edit mpconfigboard.cmake
comment out: boards/sdkconfig.usb -> # boards/sdkconfig.usb

~/esp/mpy/micropython/ports/esp32/boards/GENERIC_S3_SPIRAM$ cd ~/esp/mpy/micropython
~/esp/mpy/micropython$ make -C mpy-cross
~/esp/mpy/micropython$ cd ~/esp/mpy/micropython/ports/esp32/

edit Makefile
edit line: BOARD ?= GENERIC -> BOARD ?= GENERIC_S3_SPIRAM
edit line: idf.py $(IDFPY_FLAGS) build -> idf.py $(IDFPY_FLAGS) menuconfig

~/esp/mpy/micropython/ports/esp32$ make submodules
~/esp/mpy/micropython/ports/esp32$ make

in menuconfig -> serial flasher config:
enable Octal Flash
Set Flash size to 16 (later to 32 but current;y not supported)
After flashing -> reset

in menuconfig -> Partition Table:
custom partition table = partitions-16MiB.csv

press S to save and Q to Quit

~/esp/mpy/micropython/ports/esp32$ make erase
~/esp/mpy/micropython/ports/esp32$ make deploy

~/esp/mpy/micropython/ports/esp32$ screen /dev/ttyUSB0 115200

detlevo
Posts: 6
Joined: Sat Feb 12, 2022 2:12 pm

Re: MicroPython 1.18 on ESP32-S3

Post by detlevo » Sun Feb 13, 2022 3:18 pm

I get the same output. The warning just says, that the random number generator is not supported. After these outputs MPy should be running and you should be able to get a REPL prompt. Maybe you have to hit the Return key first.

Just tried it with a self-compiled firmware with USB and that stops exactly with the output shown (i.e. no MPy REPL). Are you sure you removed the line 'boards/sdkconfig.usb' from 'mpconfigboard.cmake'?

mwalimu
Posts: 6
Joined: Sat Jul 02, 2016 5:55 pm

Re: MicroPython 1.18 on ESP32-S3

Post by mwalimu » Tue Feb 15, 2022 12:37 am

When I make this change ->edit line: idf.py $(IDFPY_FLAGS) build -> idf.py $(IDFPY_FLAGS) menuconfig

I get this error message:

Traceback (most recent call last):
File "makeimg.py", line 59, in <module>
partition_table = load_partition_table(arg_partitions_bin)
File "makeimg.py", line 37, in load_partition_table
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'build-GENERIC_S3_SPIRAM/partition_table/partition-table.bin'
make: *** [Makefile:35: all] Error 1

Post Reply