NVS minimal data storage

User avatar
Coffeeye
Posts: 7
Joined: Tue Nov 09, 2021 9:59 am

NVS minimal data storage

Postby Coffeeye » Mon Jan 02, 2023 2:07 pm

Hello,

due to what I understood from doc's data storage is 32bytes long. Can I use NVS in v4.4 to store data for example 8bytes long to save storage size or its irrelevant due to 32bytes long value storage ?

happy new year!
Programming in C and JS using ESP-IDF on esp32-d0wd-v3

ESP_jakob
Posts: 48
Joined: Mon Jun 01, 2020 6:28 am

Re: NVS minimal data storage

Postby ESP_jakob » Tue Jan 03, 2023 1:45 am

Hello,

In short: no, you cannot "only" use 8 bytes of data.

Each entry for integer types is 32 bytes long, because it contains the key (15 bytes + NULL), some additional meta data like e.g. the corresponding namespace, type, etc. and it also contains the data (8 bytes). Hence, every integer type entry uses 32 bytes, no matter what type.

If you use string or blob type entries, this is different, because the data is saved in the space adjacent to the entry in that case. Here you can indeed save data, but only multiples of 32 bytes. In other words, the size will in crease in 32-byte steps corresponding to the size of the data. For more information, please have a look at the NVS documentation: https://docs.espressif.com/projects/esp ... e-of-entry.

Best and happy new year, too,
Jakob

Who is online

Users browsing this forum: No registered users and 200 guests