I'm loading and saving two structs from/to flash each boot. This will quickly add up to > 10k saves, so I need to implement some kind of wear management. I'm not sure what the best option is. I don't want to add extra power-consuming overhead, so I'm leaning toward lower-level operations. But I'm not sure what's supported by which library.
Option 1: Use nvs_set_blob, but change the key every 10k saves. Is this even guaranteed to move the write to a new sector?
Option 2: Use wl_mount, wl_write. Seems straightforward, but I'm lacking examples. Are there any examples out there of using this technique? I'm not sure how the partitions work, and how to ensure the wl is actually working.
Option 3: Use FATfs. This seems to be a lot of overhead, and I'd have to transfer from file to struct and back. I'd rather just write the struct bytes. But maybe this is the only option?
Questions: which options can be made to work? Are there any examples out there of using option #1 or #2?
Thanks in advance for any and all help!
Loading and saving structs to flash every reboot - use nvs, wl, or fat API?
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Loading and saving structs to flash every reboot - use nvs, wl, or fat API?
I'd simply chuck it into NVS. No need to change the key, the wear-leveling algorithm works regardless of what key(s) are being written.
Re: Loading and saving structs to flash every reboot - use nvs, wl, or fat API?
Thanks for your answer! Are you sure that nvs_set_blob uses wear leveling? It is really hard to tell from the documentation.
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Loading and saving structs to flash every reboot - use nvs, wl, or fat API?
Yes, all NVS functions use wear levelling.
Who is online
Users browsing this forum: MicroController and 250 guests