WIFI + PSRAM - Settings Clarification

SimonWillis
Posts: 1
Joined: Thu Jul 01, 2021 9:09 am

WIFI + PSRAM - Settings Clarification

Postby SimonWillis » Thu Jul 01, 2021 10:02 am

Hi There,

I have an application that is fairly large in size and is beginning to cause wifi to fail with a "wifi: m f null" error (and not much else). I've started adjusting the memory allocation for wifi and have had success in improving the wifi stability. I'd just like to clarify what is written in the ESP documentation as I find it a little contradictory and I want to make sure I have the settings correct for maximum stability (speed is less of a concern for our application).

Reference (screenshot below): https://docs.espressif.com/projects/esp ... sing-psram

I have by settings as follows:
  • SPIRAM allocation is set to the SPIRAM_USE_MALLOC option. My understanding is that this makes the Wifi TX buffer dynamic
  • SPIRAM_TRY_ALLOCATE_WIFI_LWIP is set.
  • I have set SPIRAM_MALLOC_RESERVE_INTERNAL to 98K which I calculated as my FreeRTOS stacks + wifi TX and RX buffers (12 * 1600 * 2) for wifi dynamic buffer sizes of 12 (both TX and RX).
  • I have configured the wifi buffers as per the documentation guide for memory saving (https://docs.espressif.com/projects/esp ... parameters). This is giving me 48K free on the internal heap.
  • I have IRAM optimisation disabled.
I tested the settings used in the PSRAM table and it appeared to work OK and gave me 73K free on the internal heap. However, I'm a little concerned on it since some of the buffer sizes are recommended to be very large and I'm concerned we may overflow the internal heap (see my questions below).
PSRAM Table.png
PSRAM Table.png (163.9 KiB) Viewed 5768 times
It would be very much appreciated if someone could clarify the following for me:
  • Why is WIFI_DYNAMIC_RX_BUFFER_NUM set to such a large size? Is this buffer being stored in PSRAM? If so, I assume this means we
    can ignore it in the calculation for SPIRAM_MALLOC_RESERVE_INTERNAL.
  • In the Memory Saving column it suggests setting static RX BUFFER size to 4 with AMPDU enabled (WIFI_RX_BA_WIN). HOwever, the documentation suggests AMPDU should be disabled with an RX BUFFER size less than 6.
  • Why is it recommend to increase the LWIP buffers to 65K (maximum value)? Are these stored on PSRAM?
  • Finally, why do the IRAM_OPT rows have numbers in them? These are booleans.
Thanks in advance for any help you may provide. I hope this helps others.

gd_code
Posts: 9
Joined: Tue Sep 07, 2021 2:56 pm

Re: WIFI + PSRAM - Settings Clarification

Postby gd_code » Tue Sep 21, 2021 2:14 pm

Hi,

It would be great as some of these questions could be answered by the ESP WiFi team, as I agree that documentation on this is quite contradictory.

Kind regards,
gd_code

ns1668
Posts: 50
Joined: Tue Mar 16, 2021 2:00 pm

Re: WIFI + PSRAM - Settings Clarification

Postby ns1668 » Thu Sep 23, 2021 12:31 pm

I would also like a response from the espressif dev team to the questions above.

math045d
Posts: 1
Joined: Mon Dec 04, 2023 10:19 am

Re: WIFI + PSRAM - Settings Clarification

Postby math045d » Mon Dec 04, 2023 10:24 am

Did anyone gain further knowledge about this worth noting ? :)

I am experiencing stability issues while sending large files (10 - 50MB) (random sudden blocks/race condition type scenario) from ESP32S3 with PSRAM enabled, to an AWS bucket.

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: WIFI + PSRAM - Settings Clarification

Postby DrMickeyLauer » Sat Mar 23, 2024 10:46 pm

This is one of the areas where I really wish ESP-IDF configurability was less fine grained. With these options, it‘s combinatorial explosion to check what works best. Perhaps three choices of performance/ram pressure ranks would have been better.

Who is online

Users browsing this forum: No registered users and 157 guests