esp32/network: Use non-PSRAM Wi-Fi settings if PSRAM fails to initialise #12968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In ESP-IDF, enabling SPIRAM in menuconfig sets a Kconfig option called Wi-Fi Cache TX Buffers and switches the default TX Buffer type to Dynamic. These settings use 54,528 bytes of heap at runtime.
Not a problem if PSRAM is available, but it's quite a lot of RAM to use up if PSRAM failed to initialise! As we use the same config for PSRAM & no-PSRAM devices now, this either causes Wi-Fi to fail to initialise (seen on S2) or will eat quite a lot of RAM (seen on S3).
Original ESP32 has separate builds for SPIRAM vs "no SPIRAM", so this doesn't change anything there.
The difference in free IDF Heap between an ESP32-S3 build (PSRAM fails to initialise) is 54,528 bytes after Wi-Fi initialises. Building MicroPython with Kconfig set to disable PSRAM (and Wi-Fi settings restored to default) shows another 1856 bytes free at boot, unsure what this is used for (probably not Wi-Fi related).
Closes #12750.
This work was funded through GitHub Sponsors.