NVS FLASH write / erase cycle calculation

streetec
Posts: 4
Joined: Thu Sep 24, 2020 12:50 pm

NVS FLASH write / erase cycle calculation

Postby streetec » Mon Jun 21, 2021 9:57 am

Hi,
I am currently struggeling to calculate the expected lifetime of my flash.

I am using the NVS flash library and would like to store the runtime of my device every 1 - 5 minutes, depending on the lifetime of the flash. I don't want to wear out the flash within a short time just in order to monitor the devices runtime.

In my NVS Flash, I have 10 entries (primitve types).
10 entries x 32 bytes per entry + 2 bytes padding = 322 bytes
A NVS Page by default is 4kB large(?), so the data will fit 4kB / 322B = 12 times into one page.
NVS Partition is 128k big (0x20000), so 32 pages will fit in a the partition.
The partition is expected to be 100k times eraseable.

In total, there can be 32 x 12 x 100k writes = 38.4M

Is this calculation correct?

ns1668
Posts: 50
Joined: Tue Mar 16, 2021 2:00 pm

Re: NVS FLASH write / erase cycle calculation

Postby ns1668 » Mon Jun 21, 2021 1:05 pm

I would go with 10k erases based on posts I've seen from the espressif team.
There may be some overhead for the NVS API and also the wear levelling, but I'm not sure exactly so can't comment.
So maybe 3.5 million

streetec
Posts: 4
Joined: Thu Sep 24, 2020 12:50 pm

Re: NVS FLASH write / erase cycle calculation

Postby streetec » Tue Jun 22, 2021 6:21 am

Hi,
thanks for the answer.
OK if I go from 10k erase cycles, I get somewhat around 3.5 million, so the calculation itself is correct?

Just want to be double safe as I could not interpret the documentation 100%

thanks a lot

Who is online

Users browsing this forum: Alexa [Bot], hetal-mpc, spenderIng and 121 guests