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

flash max number of writing ?

Hello !

I have read in DevZone, but still not sure regarding nRF52832 .

For nRF52832 and page size 4k, and regarding only writing zero-bits.

Can I in same page perform total 6144 number of 32-bits writings (6 times each 32-bit address) without erase that 4k page?

Edit: "corrected to 6 times".

Best regards Lennart Vedin for tss.se

  • In the Flash we use, after the flash is erased, all bits in the flash are set to '1'.

    When you write something to the flash memory address, the data is stored by writing 0's of that data to the given flash memory address but the 1's are not toggled. So this would mean that you could only write once to a memory address in flash before you need to erase the whole page again. So you cannot write 6144 words at different times to a 4092 bytes (1023 words) page without any erase operations done.

    That is the reason flash endurance is given only in erase cycles and not so much in write cycles

  • This is a general feature of Flash memory - not specific to Nordic.

    It is the erasing which causes the wear - not the writing of zeros.

    See the pencil-and-paper analogy here: https://www.violinsystems.com/all-flash-storage/how-flash-storage-works/

    The way so-called wear-levelling schemes work is to write to different locations in the page, and only do an erase when the whole page has been used up.

    https://en.wikipedia.org/wiki/Wear_leveling

    In the Nordic SDK, FDS manages this for   you:

    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_fds.html

  • In the Flash we use, after the flash is erased, all bits in the flash are set to '1'.

    That's universal to all flash used by all microcontrollers - not just Nordic.

    When you write something to the flash memory address, the data is stored by writing 0's of that data to the given flash memory address but the 1's are not toggled

    Indeed.

    this would mean that you could only write once to a memory address in flash before you need to erase the whole page again

    Not quite.

    You can write again to the same location,  but only to change more ones to zeros - you cannot write zeros back to ones. 

    Back at the pencil-and-paper analogy, it's like you can change a 'P' to an 'R' - by just adding the extra stroke - but you cannot change the 'R' to a 'P' without erasing.

    This can be useful, for example, in having a bitmap to show you which addresses in Flash are "dirty" - you just clear another bit each time another address is used.

    That is the reason flash endurance is given only in erase cycles

    Indeed.

  • I see I'm not really clear in my question, because most of answers aim "you cannot write 1". I know that's for all flash. And I do not aim writing '1'. But I have read that also writing zero-bits has some kind of limitations for writing-operations, or can I write one single zero-bit each time by 32768 write-operation to fill the 4k with zeros ? 

    I aim perform similar as following for a 4k page without erase:

    1. Writing a 14-bit value (bit 0 to 13 ) into each 32-bit address, leaving all other 18 bits unmodified.  I.e. 1024 write operations.

    2. Writing a 14-bit value (bit 16 to 29 ) into each 32-bit address, leaving all other 18 bits unmodified.  I.e. 1024 write operations.

    3. Writing a zero into bit 14 for each 32-bit address leaving all other 31 bits unmodified.  1024 write operations.

    4. Writing a zero into bit 15 for each 32-bit address leaving all other 31 bits unmodified.  1024 write operations.

    5. Writing a zero into bit 30 for each 32-bit address leaving all other 31 bits unmodified.  1024 write operations.

    6. Writing a zero into bit 31 for each 32-bit address leaving all other 31 bits unmodified.  1024 write operations.

    In total it is 6144 write-operating, writing one or several zero-bits into the page. (and I correct, it is actually 6 write-operations in each 32-bit address)

    I need to have this confirmed by Nordic (e.g. Torbjørn Øvrebekk) , or we might have an issue later (too late).

    Best regards Lennart Vedin for tss.se

  • Again, it's the Erase which causes the wear - not the writing of ones to zeros.

    But you can only ever write any one bit from '1' to '0' once - so it is still the same number as the number of erase cycles!

Related