Hi, after some research and reading several posts (especially this one), I am still confused about the Flash endurance on the nRF52.
In the product specification for the nRF51288 (chapter 6: Absolute Maximum ratings), there is a foot note on the Flash Endurance value:
Flash endurance is 20,000 erase cycles. The smallest element of flash that can be written is a 32 bit word.
On the nRF52, flash endurance is only 10,000 cycles. But the foot note that restricts this value to erase cycles it missing in the nRF52 product specification. In the post mentioned above, Hung Bui states the following:
So 10000 erase/write cycle mean you can do 10000 erase and 10000 write.
Now, what does 10000 write mean? When I have a look at the Flash drivers, it seems like Flash is written in separate 32 bit words. So it shouldn't make a difference if I write a whole page (4096 bytes) in one batch or if I write 4 bytes let's say every week or each time a specific event happens. The wear on the flash should be the same. Is this correct?
In regard of this fact, how is the n_WRITE,BLOCK
value (which is 181) to be interpreted? If I write a whole block on the nRF52 (512 bytes = 128 words of 32 bit), did I already use 128/181 write operations? Or is this considered 1/181 write operation?
By the way, in nRF52 product specification 1.1 chapter 11.1, the n_WRITE
parameter is not blue anymore (no link) and can easily be missed when looking over the document.
Here are two scenarios concerning flash endurance that I have some trouble with (as we want to make sure to get reliable values):
(1) I use one page for storing my dynamic data. My data is 32 bits wide and must not be 0. Starting with the first word in the Flash page, each time my data changes, I set the previous word to 0 and write my new data into the next word. So each word will be written exactly two times until the page is full. Then I will erase the page and start with the first word again. Upon system reset, I walk through the page and scan for the first 32 bit word that is not 0, which I use to initialize my system. Is this scenario guaranteed to work for 10000 erase cycles, which would allow for 1024*10000 changing data values? If not, will be the critical point be the erase/write cycles or the n_WRITE
limit (each word is written exactly two times)?
(2) I use one page to count special events. For each event, I set one bit to 0. This way, I will write each 32 bit word exactly 32 times before I move on to the next word. Is this scenario guaranteed to work reliably, or will it exceed the n_WRITE
limit? If it works, how many safe erase operations can I perorm? Will it be still 10000?