Page 1 of 1

How many write/erase cycle on flash??

Posted: Fri May 01, 2020 7:34 am
by Zeni241
I want to take reading of a sensor every 5 minutes and save it on flash. Then every 24 hours I will send it to server via WiFi.
I read somewhere in this forum that there is a limit of about 10000 write/erase cycles on flash of ESP32 WROOM.
(ESP32 WROOM probably uses GD25Q32C and according to its datasheet its write/erase cycles limit is 100,000.).

This way my flash would be last only (10000)/(24*60/5)= 34.72 days (or 340 days according to GD25Q32C datasheet) weather I use NVS or FATFS or SPIFF.

Or "Wear Levelling API" will take care of it and situation is not so gloomy after all?

Re: How many write/erase cycle on flash??

Posted: Fri May 01, 2020 8:32 am
by WiFive
Yes wear leveling helps and you only erase when you run out of space not on every write

Re: How many write/erase cycle on flash??

Posted: Fri May 01, 2020 1:31 pm
by Zeni241
Thanks WiFive for response. Good clue, “erase only when run out of space” to reduce at least erase cycle.

Just wondering, do people often use this approach in production (save data on flash for a while for later uploading on server) :? :shock: ?

Just gathering courage to use this approach. :D :D

Re: How many write/erase cycle on flash??

Posted: Mon May 04, 2020 11:28 am
by urbanze
WiFive wrote:
Fri May 01, 2020 8:32 am
Yes wear leveling helps and you only erase when you run out of space not on every write
How many writes one simple nvs partition (4KB) with default wear leveling (4K) can do approximately? I need numbers and how to math this?!

[4K*4K*100K(flash write cycle)]/data_write_size(1B) = 1.6M writes ??

Re: How many write/erase cycle on flash??

Posted: Mon May 04, 2020 11:49 am
by WiFive
urbanze wrote:
Mon May 04, 2020 11:28 am
WiFive wrote:
Fri May 01, 2020 8:32 am
Yes wear leveling helps and you only erase when you run out of space not on every write
How many writes one simple nvs partition (4KB) with default wear leveling (4K) can do approximately? I need numbers and how to math this?!

[4K*4K*100K(flash write cycle)]/data_write_size(1B) = 1.6M writes ??
126(entries/page)*2(pages)*100k(erases)= 25.2M writes but probably not realistic because you have to copy too many entries when there are only two pages you could end up with as few as 200k writes