Page 1 of 1

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

Posted: Mon Aug 02, 2021 10:10 pm
by godzilla2
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.

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

Posted: Mon Aug 02, 2021 10:14 pm
by godzilla2
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.

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

Posted: Mon Aug 02, 2021 10:16 pm
by godzilla2
More details:

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

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

Posted: Thu Aug 05, 2021 9:23 am
by chegewara
When you enable PSRAM some internal memory is used as a cache buffer.