NVS wear levelling question

chucrut
Posts: 15
Joined: Tue Oct 18, 2022 10:04 pm

NVS wear levelling question

Postby chucrut » Mon Jan 09, 2023 12:55 pm

I'm trying to understand how NVS wear levelling works, but the official documentation doesn't give much detail.

I can write and read a value 100.000 times? Wear levelling depends on the NVS free partition size?

Many thanks for your help!

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: NVS wear levelling question

Postby ESP_igrr » Mon Jan 09, 2023 9:45 pm

Yes, you should be able to perform 100k write operations. In fact, that would work even without wear levelling, as most flash chips are rated for 100k erase cycles per sector.

Assuming that you are writing an integer, NVS will use one 32-byte entry to store it. Each NVS page (flash sector) can contain 126 entries. Assuming that no other values are being written and that 1 page is free (+1 scratch page), there will be one erase cycle per 126 write operations. So you can theoretically get up to 100k*126 write operations for 100k erase operations.

Who is online

Users browsing this forum: No registered users and 129 guests