Hello, NXP Support Team.
The current product I'm working on poses a potential flash wear-off problem. The PC software has a set of configuration data it tends to unconditionally write to the LPC5528-based device upon each connection. Each such "generic" write consumes a certain number of erase/program cycles, because the software writes data to logically independent regions of the flash page (you may treat them as "files" of some sort).
So every time the PC connects it consumes, let's say, 20 to 30 erase/program cycles. Seems not too much taking into account claimed endurance of 100000 cycles at least. But if that happens 10 times a day, that poses a significant threat to completely wear off the flash before the product becomes obsolete.
So I'm thinking about the following scenario:
- erase a page;
- write a first chunk of data;
- check if there is enough erased space, if not go to 1;
- write the next chunk;
- go to 3;
Each "write" is performed by reading out the page content and "ORing" it with a new chunk (of course with a distinct offset) and writing it back. Something like this:
FLASH_Read(pageBuf, sizeof pageBuf);
memcpy(pageBuf + offset, newChunk, sizeof newChunk);
FLASH_Write(pageBuf, sizeof pageBuf);
My question is: "Will it really help me to preserve the erase/page resource?".
The impact of "over-programming" the flash memory is not explained good enough in the user manual. It's just said in the ECC section, that: "Due to the presence of ECC, over-programming an already programmed word will likely result in inconsistent parity bits; for this reason, it is not allowed to program a memory word without erasing it first."
And yes, I'm familiar and have already run into the issues, which cause the Bus Faults when reading such "over-programming" data, like it is described in this post. It's fine, because Flash API deals with it just fine returning exactly what I expect.
Thanks for your answers.