Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
Posted: Fri Oct 20, 2023 1:06 pm
Hello everyone,
I have an ongoing project that targets ESP32S2 modules. Most of them are equipped with internal PSRAM, but some are not.
I would like to publish a firmware update that leverages on PSRAM to add more functions. This update is targeted to all devices, but those who don't have PSRAM should just cut out the most RAM-intensive functions.
I planned to do this via the CONFIG_SPIRAM_IGNORE_NOTFOUND. The issue is that devices without a PSRAM require a disproportionate amount of internal RAM to initialize the WiFi.
By inspecting the amount of free RAM I can see that, when no PSRAM is either present or enabled, the amount of free RAM goes from 129992 bytes to 77404 bytes when invoking `esp_wifi_init` (default configuration). However, if I enable the PSRAM and instruct the processor to ignore it if not present the same functions uses twice as much RAM (from 126288 bytes to 19172 bytes).
The only options modified between the two cases are CONFIG_ESP32S2_SPIRAM_SUPPORT and CONFIG_SPIRAM_IGNORE_NOTFOUND.
Why the difference in required RAM when the PSRAM is enabled but not present?
I have an ongoing project that targets ESP32S2 modules. Most of them are equipped with internal PSRAM, but some are not.
I would like to publish a firmware update that leverages on PSRAM to add more functions. This update is targeted to all devices, but those who don't have PSRAM should just cut out the most RAM-intensive functions.
I planned to do this via the CONFIG_SPIRAM_IGNORE_NOTFOUND. The issue is that devices without a PSRAM require a disproportionate amount of internal RAM to initialize the WiFi.
By inspecting the amount of free RAM I can see that, when no PSRAM is either present or enabled, the amount of free RAM goes from 129992 bytes to 77404 bytes when invoking `esp_wifi_init` (default configuration). However, if I enable the PSRAM and instruct the processor to ignore it if not present the same functions uses twice as much RAM (from 126288 bytes to 19172 bytes).
The only options modified between the two cases are CONFIG_ESP32S2_SPIRAM_SUPPORT and CONFIG_SPIRAM_IGNORE_NOTFOUND.
Why the difference in required RAM when the PSRAM is enabled but not present?