AnsweredAssumed Answered

LPC111X family - maximizing flash write cycles

Question asked by David Smith on May 21, 2018
Latest reply on Jun 14, 2018 by Kerry Zhou

I want to maximize the number of write cycles to flash memory, utilizing IAP.


I understand the block and page formats for writing and erasing.


I propose: segment a 256-byte block of RAM into sixteen 16-byte subsections, and keep 16-bytes of data in one 16-byte data struct or string inside the first subsection, with all other data bytes as FF.

  • flash the first block access - only first subsection written
    • move data string to next block subsection (assuming less than 16) in RAM
    • zero previous location
  • flash next block access, incrementing until the last (16th) subsection in block is used
    • move data string back to subsection 0 in RAM
    • set all other locations to FF in RAM
    • ERASE BLOCK once
  • as the number of write/erase cycles exceeds some limiting value for that block, move to next block and start again. example: subsection 1 thru 16 each doing 2500 write/erase cycles (using that as a safe guardband from 10k).
  • as each block is exhausted, increment the block # and continue with the above subdivision of the block starting with subsection 1. Write all exhausted blocks to 00.


In one sector this should yield 16 x 2500 x 16 blocks = 640,000 write cycles instead of 10,000.



  • that writing 16 different times in same block before an erase is OK
    • data moves from FF -> data -> 00 (to encode the state of the subsection for next cold restart analysis) so no erase is needed as it moved through the subsections writing repeatedly to the same block
    • that the limit in erases is the 10K limit and writing each section with more 0 or more FF doesn't increase the wear


OK, so where have I gone terribly wrong?

Also, why have the links to the various APnotes for this sort of thing (like AN11008) gone to?