Limited number of KEYS for NVS partition

Kowshik_Bevara
Posts: 20
Joined: Wed Mar 02, 2022 2:39 pm

Limited number of KEYS for NVS partition

Postby Kowshik_Bevara » Mon Apr 03, 2023 4:38 am

Hi,

In the partition table, I assigned 32KB to NVS in ESP32S3, but while using the NVS I tried to create 1000+keys with the value of 2 bytes and I got an error saying NOT enough space for storage. Considering each key to be of 2 bytes it accumulates to be only 2000 bytes.

As per my understanding, it seems that storing keys also consumes some space but even if I consider 4 bytes for each key it takes 4000 bytes more.

Does this mean that there is a limit to the number of keys in the NVS partition? If so why is that?

Please help me understand the way that NVS storage is being used.

Thanks in Advance.

ESP_Sprite
Posts: 9715
Joined: Thu Nov 26, 2015 4:08 am

Re: Limited number of KEYS for NVS partition

Postby ESP_Sprite » Mon Apr 03, 2023 6:08 am

Not only the value gets stored, the key as well, as well as some other metadata. Aside that, each page (sector) of NVS can only store a limited amount of values. See the NVS doc page for how exactly it works.

Who is online

Users browsing this forum: No registered users and 273 guests