Page 1 of 1

NVS FLASH write / erase cycle calculation

Posted: Mon Jun 21, 2021 9:57 am
by streetec
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?

Re: NVS FLASH write / erase cycle calculation

Posted: Mon Jun 21, 2021 1:05 pm
by ns1668
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

Re: NVS FLASH write / erase cycle calculation

Posted: Tue Jun 22, 2021 6:21 am
by streetec
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