[Solved] ESP_ERR_NVS_NOT_ENOUGH_SPACE error

Hi I have an error recurrently on my esp32-wrover-(B|E).

Error saving 7 preferences to flash. Last error=ESP_ERR_NVS_NOT_ENOUGH_SPACE for key=233825507

I supposed that i have not enough space to store those switch and other sensor datas, but i have 4 Mb Flash and 8Mb psram.

I understand that it is possible to manual set ram sizes, but i’m not really sure to understand how. As here (Esp32-s3-wroom-1 N8R8 (Freenove) camera board with PSRAM working)

My boards are not described on platformio so i use esp32dev as board.
I added psram: in my yaml but can not set psram size.
Running information told me that it recognize only 4Mb:

[21:36:54][C][psram:020]: PSRAM:
[21:36:54][C][psram:021]:   Available: YES
[21:36:54][C][psram:024]:   Size: 4095 KB

building lines told me :

...
INFO Compiling app...
Processing garden-8relay-irrig-1 (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
...
Linking .pioenvs/garden-8relay-irrig-1/firmware.elf
RAM:   [=         ]  13.5% (used 44088 bytes from 327680 bytes)
Flash: [=======   ]  67.4% (used 1237537 bytes from 1835008 bytes)
Building .pioenvs/garden-8relay-irrig-1/firmware.bin

Do someone can help me ?

I don’t think the error is related to PSRAM.
What’s your code?

That error is to do with NVS (Non volitile storage I think) and may be related to certificates. I don’t use Certs or NVS (that I know of) so I can’t be of much help, but I did find this github issue thead that my shed light on your issue. Got ESP_ERR_NVS_NOT_ENOUGH_SPACE even when NVS shows a lot of free_entries (IDFGH-3251) · Issue #5247 · espressif/esp-idf · GitHub

If it is your NVS, perhaps this info might help you, providing you’re on linux and have esptool.py installed.

It tells how to clear your NVS partition and why it might be full.
Make sure you know your NVS partition size and location before running these commands.

If you need more NVS space, then you’ll have to include a custom partition table in your build code.

Maybe this the one, i will try as soon as i’m able to access it phisicaly.

ok so no psram problem,

maynarp guive me a path to a probable solution i will try it first.

For information I use integrated esphome in homeassistant with the arduino framework. i send you the code if maynard solution does not work.

:slight_smile:

this resolve my problem but not the full psram detection. i don’t know if i rename the thread title or i try to really solve the title.

to go deep in code i added the next to factory reset the nvs

button:
  - platform: factory_reset
    name: Restart with Factory Default Settings
    id: ${device_id}_factory_reset
    entity_category: "diagnostic"

and for information factory reset does not reset wifi datas when setted directly in code.