Page 1 of 1

Flash memory durability (SPIFFS)

Posted: Mon Jan 10, 2022 7:13 pm
by esp1979
Hello all,

i have a question to the durability of the flash memory:

Is it true that the flash memory of the ESP32 can slowly break after about 100000 write cycles?
And if yes: What exactly means "write cycles"?

Following example:

I want to save 300 measurings a day (e.g. temperature measurings) in a file.
For each day a new file is created named with the current date.

So e.g. for today i would have a file called "2021-01-10.bin"

If i then

open the file
append the new measuring by file.write
close the file

and do this 300 times.
Would that be 300 write cycles?

This would mean that i would have 109500 write cycles a year (300 * 365).
And that would mean, that the flash memory would be defective after about a year.
Is this correct?

Best wishes
Daniel


Thank you for your help and a good healthy new year to everybody!

Daniel

Re: Flash memory durability (SPIFFS)

Posted: Tue Jan 11, 2022 8:04 pm
by esp1979
Hi,

really no one that can help ;-(

Best wishes
Daniel

Re: Flash memory durability (SPIFFS)

Posted: Wed Jan 12, 2022 1:27 am
by ESP_Sprite
Technically, it's 100000 erase cycles per sector, meaning that each (4K large) sector can only be erased up to that amount of times before a flash cell may break. The thing is that flash filesystems like spiffs will do wear leveling, in other words: every time you write a file, it will do that to a different (set of) sector(s). I am not intimately familiar with the workings of spiffs, so my numbers could be off, but as an indication: say you have a spiffs that is 1 megabyte in size, or 256 4K erase sectors. Assuming your file is small, and spiffs only needs to erase one sector per erase/create/write cycle, this means it can do this 100000 times for each erase sector, but it has 256 sectors to spread the load over, which means 25600000 times in total.

Re: Flash memory durability (SPIFFS)

Posted: Wed Jan 12, 2022 8:09 am
by esp1979
OK, that sounds good.
Thank you for your detailed answer.

Best wishes
Daniel