Flash Endurance on nRF52

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,BLOCKvalue (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?

  • Hi

    For nRF52832 flash, you have 10.000 erase/write cycles, see the absolute maximum ratings in the ps

    It is actually the erase that causes the wear of the flash. Write does not cause the wear, but you can not write to a flash section if it already written unless you erase it first. That is why we mention write/erase cycles. When you erase a page, you will cause wear to every bit in that flash page. Then you can write words one by one to the flash page, but you will only cause another wear when you again erase the page.

    The Flash data storage library implements Basic wear leveling of the flash

    Update 19.8.2016 My understaning is this: Writing one word to a flash block counts as one write to that flash block. Writing two words to a flash block counts as two writes to that flash block. So if you write a whole 512 byte block, no matter if you write one word at once or the whole block at once, that will count as 128 writes to that flash block. In that case you are within the n_WRITE = 181 write limit, so that should be fine. There is however a description in section 11.1 that describes how to write less than one word to flash, actually writing multiple times to the same 4 byte address in flash, then you need to have the n_WRITE = 181 limitation in mind.

    Flash wearing: If you erase a page, you are causing wearing on that page. If you erase all flash, then you are causing wearing on all flash pages in flash. If you erase the same page 10,000 times, that flash page is no longer guaranteed to work. The other flash pages are still guaranteed to work if they have been erased less than 10,000 times.

    So with perfect wear leveling, you can perform page erase 10,000 * 128 = 1,280,000 times, since there are 512/4=128 pages in nRF52832 QFAA/CIAA flash memory. Similarly, with perfect wear leveling, you can write 10,000 erases/page * 128 pages * 8 blocks/page * 181 writes/block = 1,853,440,000 times to nRF52832 QFAA/CIAA flash memory.

    Note that flash page can most likely be erased much more than 10,000 times, but 10,000 times is the minimum.

  • Hi Stefan,

    if wear only happens during erase operations, can you please explain me the meaning of the n_WRITE parameter? Will it have any impact on my implementation?

    Especially concerning the two scenarios I mentioed, can you confirm that they will work reliably for at least 10.000 erase cycles?

    Is it true that in scenario (2), with one page, I can count 4096 bytes * 8 bit * 10000 erase cycles = 327,68 million events during system lifetime?

  • Thanks for the update. So this means that both my scenarios / use cases fail to comply with the product specification.

    Is there any information what happens if I exceed the n_WRITE = 181 limitation? Will it damage the flash? Will it reduce the guaranteed erase cycles? Why is this limitation there at all, if wear is only caused by erasing a page?

    And how does things work with the nRF51? According to the product specification. there is no n_WRITE limitation on the nRF51. (At least I could not find any.)

  • nRF51 has a different flash, therefore the specs are different. I think this n_WRITE limitation was not present in nRF51 flash.

    I dont know what will happen if you exceed the 181 write cycles on a single block. If you violate it, it is at your own risk. I can imagine though that data in the block can no longer be guaranteed to be correct if you violate this limit.

  • Our flash guy told me for different flash that if I write multiple times to erased place it can influence non written neighbor bits. So first you help the flash when you do not program 0 over 0 multiple times. Eg data are 111 you write 110 result is 110, now you can write 101 and result is 100. You shall not write 100 on second try. The result would be same but you would program 0 into last bit 2nd time. Now to the nWrite - if you program 010 multiple times it can happen that you end up with 000 instead of 010. It helps when you do not program 0 over 0, but I think even if you would program "1" million times you also might end up with 0...