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.
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.