-->
Page 1 of 1

Doubt about flash memory operation

PostPosted: Mon Aug 17, 2020 4:46 pm
by jorgele
Hi all!
I've read that only around 10,000 write cycles are guaranteed for flash memory, although it can be a lot more. But this question arises: if I write 10,000 times to a sector, would only that sector, or all memory be corrupted? Because I need to record a variable around 100,000 times without risk, and I have to because where I am going to use my system, the power supply is unpredictable and if there is a power outage I need to be sure what the last value of the variable was once the system restarts. I think I could change the sector every time I get close to the 10,000 writes limit, but I don't know if that would solve this problem.
(I'm not worried about losing some sectors during the life I estimate for the system.) I appreciate your help.

Re: Doubt about flash memory operation

PostPosted: Tue Aug 18, 2020 6:03 pm
by davydnorris
Have a look at the little library I wrote that implements a journal style object store - you can allocate as many sectors as you want and then read and write to them. The library will only erase sectors when required and implements wear levelling, which will extend the life of your flash.

https://www.esp8266.com/viewtopic.php?f=166&t=19530