Hi, I have a "problem" about writing to the nvs partition, every time I do the get on a key e.g. nvs_get_u64() and then dump the partition I see that it goes to add 64bytes, in the queue of the previous ones, which contain the key and the new value set (in this case 4bytes)
But is such behavior normal? Shouldn't it update the same key? Maybe it does this to not use the same memory blocks all the time?
duplicate nvs keys
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: duplicate nvs keys
Yep, that is normal and desired. The trick with flash is that it only allows for a certain amount of erase cycles per 4Kbyte page, so ideally you want to keep the amount of erases to a minimum. So what NVS does instead is to write the new value after all the old values, and later when you request the value it gives you the newest. Only when there's no space left, it'll collect all the old values into a page and erase that page to free up some space.
Who is online
Users browsing this forum: No registered users and 81 guests