ESP32 SPI RAM not initialized

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Iyassou
Posts: 34
Joined: Sun Jun 26, 2016 9:15 am

ESP32 SPI RAM not initialized

Post by Iyassou » Sat Sep 07, 2019 7:04 am

Hello.

I'm having trouble flashing an ESP32 board, the ESP32-DEVKITC 32U, with SPIRAM supporting firmware.
I'm using the 2019-05-29, SPIRAM support build and flashing using esptool.py.

The commands I used and their outputs:

1) Erasing the flash first

Code: Select all

python esptool.py --chip esp32 --port COM13 erase_flash
- Response:

Code: Select all

esptool.py v2.8-dev
Serial port COM13
Connecting.....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:0a:c4:c0:ec:80
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 8.4s
Hard resetting via RTS pin...
2) Writing the firmware

Code: Select all

python esptool.py --chip esp32 -p COM13 --baud 460800 write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 esp32spiram-20190529-v1.11.bin
- Response:

Code: Select all

esptool.py v2.8-dev
Serial port COM13
Connecting.......
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:0a:c4:c0:ec:80
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 1221600 bytes to 743973...
Wrote 1221600 bytes (743973 compressed) at 0x00001000 in 17.3 seconds (effective 563.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

It seems that the firmware has been successfully flashed, and I indeed get the REPL, however the bit of text preceeding the REPL prompt indicates that the SPI RAM hasn't been initialised:

ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4

load:0x3fff001c,len:4928
ho 0 tail 12 room 4
load:0x40078000,len:10188
load:0x40080400,len:6736
entry 0x400806e8

E (500) spiram: SPI RAM enabled but initialization failed. Bailing out.
I (501) cpu_start: Failed to init external RAM; continuing without it.
I (504) cpu_start: Pro cpu up.
I (507) cpu_start: Application information:
I (512) cpu_start: Compile time: 07:47:57
I (517) cpu_start: Compile date: May 29 2019
I (523) cpu_start: ESP-IDF: v3.3-beta1-268-g5c88c5996
I (529) cpu_start: Starting app cpu, entry point is 0x40082e48
I (0) cpu_start: App cpu up.
I (540) heap_init: Initializing. RAM available for dynamic allocation:
I (546) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (553) heap_init: At 3FFB9DD0 len 00026230 (152 KiB): DRAM
I (559) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (565) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (572) heap_init: At 40097B1C len 000084E4 (33 KiB): IRAM
I (578) cpu_start: Pro cpu start user code
I (149) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

E (10) spiram: SPI RAM not initialized
MicroPython v1.11 on 2019-05-29; ESP32 module with ESP32
Type "help()" for more information.
>>>



Is there anything I'm missing when flashing the firmware? Is the problem with the board I've got?

Thanks.

User avatar
Roberthh
Posts: 1572
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 SPI RAM not initialized

Post by Roberthh » Sat Sep 07, 2019 9:20 am

The ESP32-DEVKITC 32U is equipped with a ESP32U WROOM module, which has not SPIRAM. The WROVER modules have SPIRAM. So better use the non-SPIRAM firmware. The performance is better for your device.

Iyassou
Posts: 34
Joined: Sun Jun 26, 2016 9:15 am

Re: ESP32 SPI RAM not initialized

Post by Iyassou » Sat Sep 07, 2019 9:38 am

I see. So are the 32Mbits of SPI flash mentioned in the Overview section of this datasheet referring to some other flash storage? Do you know what it is used for?

User avatar
Roberthh
Posts: 1572
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 SPI RAM not initialized

Post by Roberthh » Sat Sep 07, 2019 1:18 pm

The SPI flash of the ESP32U mentioned in the data sheet is used for the firmware. It is stored there and executed from there. Flash memory and RAM are two different memory types, and SPI is a method to connect the memory to the CPU core. The WROOM modules only have flash memory integrated in a chip which is connected by SPI, in addition to the RAM inside the ESP32. The WROVER modules have SPI flash, the ESP32 internal RAM and a SPI connected (ESP32-)external RAM.

The SPIRAM firmware image tries to locate the SPI RAM, and since it is not present, you get the error message. This test and the code is generated by the firmware you have loaded to the SPI flash. Since there is no SPI RAM, the firmware uses only the internal RAM.

Iyassou
Posts: 34
Joined: Sun Jun 26, 2016 9:15 am

Re: ESP32 SPI RAM not initialized

Post by Iyassou » Sat Sep 07, 2019 1:21 pm

I understand now. Thanks for typing out this explanation.

Post Reply