This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52532 max number of write times in one block

Primarily addressed Torbjørn Øvrebekk, Nordic.

Refer document  nRF52832 Product Specification v1.4

I read " The same block in the Flash can only be written nWRITE number of times before an erase must be performed " where nWRITE is 181 and block is 512 bytes.

I did perform 4096 number of write zero operations bit by bit with successfully read back same data one by one, and all bits was successfully zeros after restart. I could repeat this process. Was I just "lucky" ?

Do I MUST erase after 181 writing, it mean I cannot even perform two write operations for all the 32-bits in one block without erase ?

  • Hey Lennart,

    I did perform 4096 number of write zero operations bit by bit with successfully read back same data one by one, and all bits was successfully zeros after restart. I could repeat this process. Was I just "lucky" ?

    No, this is the expected behavior of any flash memory, where the erased state of any byte is 0xFF, if you write zeroes bit-by-bit the state changes from 0xFF to 0xFE to 0xFD, etc, and you will be able to read out the correct state of the memory. 
    Now if you do the inverse, erase a byte, write it to 0x00, and then try to write any other value to the byte, you should see that it cannot change state from 0x00. 
     

    Do I MUST erase after 181 writing, it mean I cannot even perform two write operations for all the 32-bits in one block without erase ?

    Flash writing to zero is an operation where one drains a charge from a transistor gate, who has been previously charged during the erase procedure. This is why any flash memory cell's erased state are all ones and not zeroes. 

    As one block of flash contains 512kB of memory cells, if you write to each byte, one-by-one, you should after a few hundred bytes start to see data corruption as the memory cell's write-circuit fails, I believe due to insufficient charge somewhere in its circuitry.

    We guarantee safe operation for 181 such writes before one needs to erase the block, and thereby re-charging the memory cell's circuits. 

    I suggest you read up on NOR flash and Block erasure

    Cheers,
    Håkon. 

  • Tack Håkan !

    Is my conclusion correct. If I write zero bits or other data in any order more than 181 times it is expected to typical be read back correctly, but not any guarantee ?

    Of cause always consider only writing zero-bits. 

    A following question is: If I write more than 181 times and for each write operation read back the value to confirm the read back is correct, is it then guarantee that the writing did work without any future corruption ?

    Tack och hej  Lennart

  • I wrote in my previous post that each block was 512kB, it's actually 512bytes.
    This 512byte block can be written to 181 times before it needs to be erased. One 512byte block consists of 128 4byte words. Each 4byte word can only be written to twice, this means that if you only write one byte at a time you can only use half of the words, and therefore only half of the 512 byte block. 

    There are 8 blocks of 512byte in each 4kB page, and one can only erase a page, not individual blocks. 

    Lennart said:
    Is my conclusion correct. If I write zero bits or other data in any order more than 181 times it is expected to typical be read back correctly, but not any guarantee ?

    It is undefined behavior, we do not know what will happen. At best you will only get data corruption, at worst it will impact flash endurance, etc.  

    Lennart said:
    A following question is: If I write more than 181 times and for each write operation read back the value to confirm the read back is correct, is it then guarantee that the writing did work without any future corruption ?

     We do not know, it's undefined.

  • Ok thank you !

    TSS.se sell 100.000 loggers annually now, so we will only apply defined behavior. Also I have no time to learn all, just to apply something working. I really appreciate your help. 

    I get everything you wrote but not "Each 4byte word can only be written to twice", this result in 256 possible write operations for all of the 512b block, but the limit specify max181 times.

    My question is then:

    Can I write all the 512b block, 256 times divided in 16-bits word if writing max two times each 32-bit word? 

    Or is the limit that I shall never write more than two times to the same 32-bit word AND max 181 times in total ?

  • Lennart said:
    Or is the limit that I shall never write more than two times to the same 32-bit word AND max 181 times in total ?

    Correct!


Related