FAL and NAND bad block management RRS feed

  • Question

  • Hi folks,

     I encountered that there aren't ways to rescue data from corrupted NAND sectors (block).

       There is ECC checking within FMD_ReadSector() and checksum allows to restore data with single corrupted databit. In this case, it's a good way to report about fault to upper level (from FMD to FAL) to prevent further data lost at the current sector and its "neighbours".
    I've examined WinCE Private folder (winceos\drivers\msflash) sources and found that FAL could mark the sector as BAD then FMD_WriteSector() or FMD_EraseBlock() return error.

      Could anyone enlighten me to resolve it?


    P.S. When does the "Compactor" start to work?


    Tuesday, September 7, 2010 8:11 AM

All replies

  • If the write/erase fails, that indicates a hardware failure.  The data that was intended to be written is then written to a sector in a different block, and any data in other valid sectors in that block are also copied out, then the block is marked bad.  You don't resolve an error like this, that block is faulty and forever after unavailable (this occasional failure is a characteristic of NAND technology and the driver is designed to handle it).

    The Compactor starts to run when the number of available sectors falls below some threshold (I don't know what that is offhand).  It consolidates dirty sectors into blocks, then erases those blocks to make more sectors available.  The compactor runs at Idle thread priority unless the available sector count falls below some other threshold, at which point the thread priority is boosted.

    Dean Ramsier eMVP BSQUARE Corporation
    Tuesday, September 7, 2010 12:52 PM
  • Hi Dean,

     It's clearly that you have been writing, but certain question is about the way to notify FAL level to move out the data from current block to another?

    I haven't found the solution, except to apply some external system utility.

    Tuesday, September 7, 2010 1:31 PM
  • The first threshold is the point where the number of dirty sectors is greater than the number of free sectors.  The second, priority-boosted threshold occurs when the number of free sectors falls below 2x the number of sectors per block.
    Tom Gensel PTG Systems, LLC
    Tuesday, September 7, 2010 3:07 PM
  • The FAL should move the data out of a block automatically when it marks the block bad.  That should happen when you return an error from the write or erase routines.  Note that a correctable ECC error that occurs on a read doesn't necessarily cause a block to be mapped out; it is the errors that happen on write/erase that should result in removing a block from the pool.

    Dean Ramsier eMVP BSQUARE Corporation
    Wednesday, September 8, 2010 1:11 PM