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?
Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
PSRAM has some quirks that make it different from internal memory: e.g. it 'disappears' when the cache is disabled, which happens e.g. when flash is being written to and DMA'ing to and from it works a bit different. For that reason, a bunch of stuff needs to be put in IRAM where without PSRAM, it could stay in flash memory. That uses up some RAM.
Re: Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
Are you able to connect to Wifi with non PSRAM module?
Re: Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
Thank you @ESP_Sprite for the clarification. Does this mean that in order to support PSRAM I must be ready to allocate about 60KB more RAM in order to use WiFi, no matter what? I didn't even tick the option to try and allocate the WiFi stack on PSRAM. I would be happy with just using PSRAM for my application's needs and only if present.ESP_Sprite wrote: PSRAM has some quirks that make it different from internal memory: e.g. it 'disappears' when the cache is disabled, which happens e.g. when flash is being written to and DMA'ing to and from it works a bit different. For that reason, a bunch of stuff needs to be put in IRAM where without PSRAM, it could stay in flash memory. That uses up some RAM.
Yes.Alberk wrote: Are you able to connect to Wifi with non PSRAM module?
Re: Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
I have made some experiments but found no way to avoid the RAM expense if the SPI chip isn't present.
Isn't it possible at all to only enable it if found?
Isn't it possible at all to only enable it if found?
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Excessive internal memory allocation for WiFi when PSRAM is enabled but not present
No, sorry, it's mostly a compile-time thing.
Who is online
Users browsing this forum: Baidu [Spider] and 252 guests