none
imx51 NAND flash support in WinCE (Bad block handling) RRS feed

  • Question

  • Hi All,

    I'm facing problem with NAND flash driver iplementation in imx51. We use Samsung K9F2G08U0B NAND flash and the problem is that when flash driver get lodaed during WinCE startup it gets unloaded after reaching all blocks. Here is the log:

    4294786280 PID:400002 TID:f20002 +InitDeviceFileSystems

    4294786280 PID:400002 TID:f20002 FSDMGR!MountTable_t::RegisterVolumeName: Registered "$device" at index 6

    4294786280 PID:400002 TID:f20002 FSDMGR!MountTable_t::RegisterVolumeName: Registered "$bus" at index 7
    4294786280 PID:400002 TID:f20002 FSDMGR!MountTable_t::RegisterVolume: Registered volume at index 7 (Name="$bus", MountFlags=0x1)
    4294786280 PID:400002 TID:f20002 -InitDeviceFileSystems: status is 1
    4294787052 PID:400002 TID:f20002 OSAXST1: >>> Loading Module 'flashmdd.dll' (0x87F27E40) at address 0xC06D0000-0xC06FE000 in Process 'NK.EXE' (0x81EBDAA0)
    4294787739 PID:400002 TID:f20002 Kernel DLL 'flashmdd.dll' needs thread creation/deletion notification
    4294787739 PID:400002 TID:f20002 OSAXST1: >>> Loading Module 'flashpdd_nand.dll' (0x87F21378) at address 0xC0D60000-0xC0D77000 in Process 'NK.EXE' (0x81EBDAA0)
    4294787902 PID:400002 TID:f20002 OSAXST1: >>> Loading Module 'cspddk.dll' (0x87F214B0) at address 0xC0D10000-0xC0D20000 in Process 'NK.EXE' (0x81EBDAA0)
    4294787902 PID:400002 TID:f20002 NumberOfChip=1
    4294787902 PID:400002 TID:f20002 BBT_ReadOperation : dwStartBlock = 0x7FA, SectorAddr = 0x1FE81
    4294787902 PID:400002 TID:f20002 BBT_ReadOperation : dwStartBlock = 0x7FB, SectorAddr = 0x1FEC1
    4294787902 PID:400002 TID:f20002 INFO: Set NAND flash blocks [0x0 ~ 0x23f] as reserved.
    4294787902 PID:400002 TID:f20002 BLOCK_STATUS_READONLY
    4294787902 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    ...
    4294787902 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294787902 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294787902 PID:400002 TID:f20002 GetBlockBadStatus : bad block 0x1
    4294787902 PID:400002 TID:f20002 Info: Bad Block found: Block No. = 0x20
    4294787902 PID:400002 TID:f20002 Uncorrectable ECC error found during read! CS = 0, PageAddr=0x840, ECCResult=0xff00.
    4294787902 PID:400002 TID:f20002 FMD_GetBlockStatus : CSPNAND_ReadSector Error : Sector = 0x840
    4294787902 PID:400002 TID:f20002 BLOCK_STATUS_READONLY
    ...
    4294790153 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790153 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790153 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790153 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790153 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790253 PID:400002 TID:f20002 BLOCK_STATUS_RESERVED
    4294790253 PID:400002 TID:f20002 GetBlockBadStatus : bad block 0x1
    4294790253 PID:400002 TID:f20002 Info: Bad Block found: Block No. = 0x20
    4294790253 PID:400002 TID:f20002 Uncorrectable ECC error found during read! CS = 0, PageAddr=0x840, ECCResult=0xff00.
    4294790253 PID:400002 TID:f20002 FMD_GetBlockStatus : CSPNAND_ReadSector Error : Sector = 0x840
    4294790253 PID:400002 TID:f20002 Uncorrectable ECC error found during read! CS = 0, PageAddr=0x840, ECCResult=0xffff.
    4294790253 PID:400002 TID:f20002 FmdWrapperPdd::IoControl - ReadPhysicalSectors() failed.
    4294790253 PID:400002 TID:f20002 FlashPdd::ReadPhysicalSectors failed for sectors (0x840, 0x1).  Result = 31.
    4294790253 PID:400002 TID:f20002 Unknown: DEBUGCHK failed in file d:\yzkiqfe\private\winceos\DRIVERS\msflash\flashcommon\.\FlashPddHelper.cpp at line 301 
    4294876737 PID:400002 TID:f20002 OSAXST1: <<< Unloading Module 'flashpdd_nand.dll' (0x87F21378) at address 0xC0D60000-0xC0D77000 in Process 'NK.EXE' (0x81EBDAA0)

    Flash model is:

    1 Page = (2K + 64)Bytes
    1 Block = (2K + 64)B x 64 Pages = (128K + 4K) Bytes
    1 Device = (2K+64)B x 64Pages x 2,048 Blocks = 2,112 Mbits

    And NAND type def in header file:

    // NAND Flash Chip Size
    #define NAND_BLOCK_CNT          (2048)      // 2048 blocks
    #define NAND_PAGE_CNT           (64)        // Each Block has 64 Pages
    #define NAND_PAGE_SIZE          (2048)      // Each Page(Sector) has 64 Bytes
    #define NAND_SPARE_SIZE         (64)        // Each Page(Sector) has 64 Bytes of spare area
    #define NAND_BUS_WIDTH          (8)         // 8-bit bus


    // NAND Flash Chip
    #define NAND_NUM_OF_CS          (1)


    // NAND Flash Chip ID
    #define NAND_MAKER_CODE         (0xEC) // Maker code
    #define NAND_DEVICE_CODE        (0xDA) // Device code
    #define NAND_ID_CODE            ((NAND_DEVICE_CODE << 8) | NAND_MAKER_CODE)


    // NAND Flash Chip Operation Status
    #define NAND_STATUS_ERROR_BIT   (0)         // Status Bit0 indicates error
    #define NAND_STATUS_BUSY_BIT    (6)         // Status Bit6 indicates busy


    // SWAP BBI
    #define BBI_MAIN_ADDR           (464)       // !Bad block info address offset    
    #define BBI_NUM                 (1)
    BYTE    BBMarkPage[1] = {127};

    Any advice?



    • Edited by Pawel W Z Monday, March 26, 2012 4:20 PM
    Monday, March 26, 2012 10:29 AM

Answers

  • Problem solved. In this particular chip (Samsung K9F2G08U0B) Bad Block pages are in the first and second position in block (2 pages) not last (1 pages) as in different samsung nand chips.

    NAND def header file in \PLATFORM\COMMON\SRC\SOC\COMMON_FSL_V2\NAND\INC\K9F2G08U0B.h

    // SWAP BBI
    #define BBI_MAIN_ADDR           (464)       // !Bad block info address offset    
    #define BBI_NUM                 (2)
    BYTE    BBMarkPage[2] = {0, 1};

    • Marked as answer by Pawel W Z Tuesday, March 27, 2012 6:33 AM
    • Edited by Pawel W Z Tuesday, March 27, 2012 6:36 AM
    Tuesday, March 27, 2012 6:33 AM

All replies

  • Hi,

    i worked a lot with iMX28, but i think this info will be also usefull for you.

    As i understand you are using 2Gbit NAND (256MB)

    Please look ti the file image_cfg.h.

    File image_cfg.h include system defines for RAM and ROM memory. Variable
    IMAGE_BOOT_NANDDEV_RESERVED_SIZE
    should be changed according to the NAND chip type and size. NAND mapping:

    Block 000 NCB - Boot ControlBlock (4 blocks)

    Block 003 BBT - Bad Block Table (4 Blocks)

    Block 007 DBBT - Bad block table used by ROM (2 Blocks)

    Block 009 BOOT IMAGE - Eboot image (512 Blocks)

    Block 521 BOOTCFG - Boot configuration (1 Blocks)

    Block 522 UUID - Universally Unique Identifier (1 Blocks)

    Block 523 NKIMAGE - OS - WinCE Kernel (32 MB)

    Block XXX Flash File System

     So, variable IMAGE_BOOT_NANDDEV_RESERVED_SIZE should be set to the value:

    521 * block size (in bytes) + 32 * 1024 *1024
    Example 1:

    1G NAND, 2048 * 64 block size

    IMAGE_BOOT_NANDDEV_RESERVED_SIZE = 101842944 ~=98MB

    So, in file image_cfg.h it is needed to change:

    #define IMAGE_BOOT_NANDDEV_RESERVED_SIZE    (DWORD)((DWORD)(98
    * 1024 * 1024))

    It is necessary to rebuild eboot and NK. Also i recommend make low level format of the NAND from eboot (from new-builded eboot).


    Sergii Makovetskiy

    Monday, March 26, 2012 3:19 PM
  • Sergii,

    Thanks for your reply. Unfortunately my define for reserved size is based on NKimage size and looks like that:

    #define IMAGE_BOOT_NANDDEV_RESERVED_SIZE    (10*1024*1024) + IMAGE_BOOT_NKIMAGE_SIZE 

    I checked on another board and it always hang when bad block is reached. Same problem is in eboot when I'm trying to flash an image to NAND. It just break when any bad block is found during flashing.

    Monday, March 26, 2012 4:00 PM
  • Problem solved. In this particular chip (Samsung K9F2G08U0B) Bad Block pages are in the first and second position in block (2 pages) not last (1 pages) as in different samsung nand chips.

    NAND def header file in \PLATFORM\COMMON\SRC\SOC\COMMON_FSL_V2\NAND\INC\K9F2G08U0B.h

    // SWAP BBI
    #define BBI_MAIN_ADDR           (464)       // !Bad block info address offset    
    #define BBI_NUM                 (2)
    BYTE    BBMarkPage[2] = {0, 1};

    • Marked as answer by Pawel W Z Tuesday, March 27, 2012 6:33 AM
    • Edited by Pawel W Z Tuesday, March 27, 2012 6:36 AM
    Tuesday, March 27, 2012 6:33 AM