ESP32-S2 Saola, enabling PSRAM causes wifi init to fail with ESP_ERR_NO_MEM

godzilla2
Posts: 19
Joined: Wed Apr 28, 2021 5:15 am

ESP32-S2 Saola, enabling PSRAM causes wifi init to fail with ESP_ERR_NO_MEM

Postby godzilla2 » Mon Aug 02, 2021 10:10 pm

I just enabled external SPI ram on my ESP-32S2 Saola, and it is causing wifi init to fail with a 'no memory error'.

I've made the change in the Visual Studio Code config editor, and it appears to change this line:
CONFIG_ESP32S2_SPIRAM_SUPPORT=y

but also automatically changes these lines:
-CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
+CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y

I imagine this change from a dynamic buffer to static buffer is causing the issue.

Things Ive tried:
1. undoing the wifi buffer change in sdkconfig. It just gets reverted when I click build.
2. reducing my own application's ram usage by ~2 KB. maybe it wasn't enough? My application typically has 16KB of free ram (low water mark), so its hard to image enabling PSRAM evaporated all of that ram.
3. having the PSRAM allocatable with malloc, with heap_caps, or memory mapped. No difference.

This seems like a bug.

godzilla2
Posts: 19
Joined: Wed Apr 28, 2021 5:15 am

Re: ESP32-S2 Saola, enabling PSRAM causes wifi init to fail with ESP_ERR_NO_MEM

Postby godzilla2 » Mon Aug 02, 2021 10:14 pm

I also just tried this setting:

CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
"Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory"

and tried bumping this setting:
-CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
+CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=64768

No difference. Wifi init still fails with No Memory error.

godzilla2
Posts: 19
Joined: Wed Apr 28, 2021 5:15 am

Re: ESP32-S2 Saola, enabling PSRAM causes wifi init to fail with ESP_ERR_NO_MEM

Postby godzilla2 » Mon Aug 02, 2021 10:16 pm

More details:

OS: Mac OS 11.5
IDF: esp-idf-4.4, master. June 25, 2021. commit:8e3e65a47

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 Saola, enabling PSRAM causes wifi init to fail with ESP_ERR_NO_MEM

Postby chegewara » Thu Aug 05, 2021 9:23 am

When you enable PSRAM some internal memory is used as a cache buffer.

Who is online

Users browsing this forum: No registered users and 26 guests