Currently, I am adapting a Win CE6 device to a new nand flash chip. The new nand has higher ecc requirements (4 bit / 512 bytes) and supports on chip ecc calculation.
Microsoft flash filesystem writes to sectors without erasing them. This happens when writing it's status information in SectorInfo->wReserved2. Here, only single bits are flipped to zero.
The problem is, with on-chip-ecc, the chip calculates an ecc also when the filesystem writes to wReserved2. But it can't write this ECC to the device properly, as this would require the sector to be erased, which the filesystem doesn't do.
There are also ecc-unprotected areas in the sparepart of the page, 15 bytes per page. I figured out to store the vital 6 bytes of SectorInfo twice (i.e. wReserved2 for sector status and dwReserved1 which is the logical sector number).
But when biterrors occur in one of these two copies, I still can't figure out which one is correct.
So, my questions:
any ideas on how to solve this using the unprotected 15 bytes?
can the flash filesystem be configured to support 'erase before write status information'
any other approach to this issue?
Thanks in advance for any help.
Regards, Timm.
It is solved. Stored dwReserved1 twice (each with parity bit, as it is written only once at sector initialization). Stored wReserved2 three times (as parity bit can't be applied here - flash filesystem writes to wReserved2 three times without erasing the sector, i.e. flipping single bits). If 2 copies are identical, they are assumed to be correct.