AnsweredAssumed Answered

iMX6Q NAND Boot issue in WinCE

Question asked by Keshava G N on Jan 11, 2013
Latest reply on Nov 28, 2015 by leo yanfeng

Hi all,

 

I'm trying to boot eboot.nb0 from NAND. (Micron, MT29F4G08ABBDA) in WinCE7.

Processor: i.MX6Q

 

I have successfully booted u-boot.bin from NAND using kobs-ng tool in linux.

Also, if i use modified eboot.nb0 instead of u-boot.bin in kobs, it is booting without any problem.

 

But when i use MFGTool (in WinCE) for flashing eboot.nb0, it is not booting.

 

Following is the nanddump output when i am using kobs (linux) for flashing:

 

FCB:

0x00000000: 00 00 00 00 00 00 00 00 00 00 00 00 cf fc ff ff

0x00000010: 46 43 42 20 00 00 00 01 50 3c 19 06 00 00 00 00

0x00000020: 00 08 00 00 40 08 00 00 40 00 00 00 00 00 00 00

0x00000030: 00 00 00 00 00 00 00 00 04 00 00 00 00 02 00 00

0x00000040: 00 02 00 00 04 00 00 00 0a 00 00 00 03 00 00 00

0x00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x00000070: 00 00 00 00 00 02 00 00 00 0b 00 00 01 01 00 00

0x00000080: 01 01 00 00 00 01 00 00 cf 07 00 00 00 00 00 00

0x00000090: 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x000000a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x000000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x000000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

 

DBBT:

 

 

0x00080000: 00 ff ff ff ff ff ff ff ff ff 00 00 00 00 44 42

0x00080010: 42 54 00 00 00 01 00 00 00 00 00 00 00 00 00 00

0x00080020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x00080030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

 

and eboot.nb0 at Page 200.

 

Here, why we are getting first 12 bytes as zeros? (METADATA_SIZE is set to 10). Why two additional zeros?

 

In WinCE (Using MFGTool):

 

FCB:

[Metadata: ff ff ff ff ff ff fe ff ff ff ] (only 10 bytes of metadata)

75      b8      fe      ff

46      43      42      20

0       0       0       1

50      3c      19      6

0       0       0       0

0       8       0       0

40      8       0       0

40      0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

4       0       0       0

0       2       0       0

0       2       0       0

4       0       0       0

a       0       0       0

3       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

d8      f9      8a      d9

11      0       0       0

0       2       0       0

40      3       0       0

40      1       0       0

40      1       0       0

0       1       0       0

cf      7       0       0

0       0       0       0

0       8       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

0       0       0       0

44      cd      ab      ef

d4      84      a9      ef

ff      ff      ff      ff

ff      ff      ff      ff

ff      ff      ff      ff

 

DBBT:

 

 

0       0       0       0

44      42      42      54

0       0       0       1

0       0       0       0

0       0       0       0

 

and eboot.nb0 at 200 page.

 

Following is the nandtype info structure:

//MT29F4G08ABBDAHC

    {

       {NAND, 4096, 2048 * 64, 64, 2048},    //FlashInfo   fi;

       {0x2C, 0xAC, 0x90, 0x15},                    //BYTE        NANDCode[NANDID_LENGTH]

        3,                                          //BYTE        NumBlockCycles

        5,                                          //BYTE        ChipAddrCycleNum

        8,                                          //BYTE        DataWidth

        1,                                          //BYTE        BBMarkNum

        {0},                                        //BYTE        BBMarkPage

        6,                                          //BYTE        StatusBusyBit

        0,                                          //BYTE        StatusErrorBit

        64,                                         //WORD        SpareDataLength

        0x70,                                       //BYTE        CmdReadStatus

        0x00,                                       //BYTE        CmdRead1

        0x30,                                       //BYTE        CmdRead2

        0x90,                                       //BYTE        CmdReadId

        0xff,                                       //BYTE        CmdReset

        0x80,                                       //BYTE        CmdWrite1

        0x10,                                       //BYTE        CmdWrite2

        0x60,                                       //BYTE        CmdErase1

        0xD0,                                       //BYTE        CmdErase2

        {80, 60, 25, 6}                            //NANDTiming  timings

}

 

Following is the BootBlock structure:

 

typedef struct _BootBlockStruct_t

{

    UINT32    m_u32Checksum;         //!< First fingerprint in first byte.

    UINT32    m_u32FingerPrint;      //!< 2nd fingerprint at byte 4.

    UINT32    m_u32Version;          //!< 3rd fingerprint at byte 8.

    union

    {

        struct

        {         

            NAND_Timing_t   m_NANDTiming;                   //!< Optimum timing parameters for Tas, Tds, Tdh in nsec.

            UINT32        m_u32Reserved;                  //mx28 needs a dword reservation

         

            UINT32        m_u32DataPageSize;              //!< 2048 for 2K pages, 4096 for 4K pages.

            UINT32        m_u32TotalPageSize;             //!< 2112 for 2K pages, 4314 for 4K pages.

            UINT32        m_u32SectorsPerBlock;           //!< Number of 2K sections per block.

            UINT32        m_u32NumberOfNANDs;             //!< Total Number of NANDs - not used by ROM.

            UINT32        m_u32TotalInternalDie;          //!< Number of separate chips in this NAND.

            UINT32        m_u32CellType;                  //!< MLC or SLC.

            UINT32        m_u32EccBlockNEccType;         //!< Type of ECC, can be one of BCH-0-20

            UINT32        m_u32EccBlock0Size;             //!< Number of bytes for Block0 - BCH

            UINT32        m_u32EccBlockNSize;             //!< Block size in bytes for all blocks other than Block0 - BCH

            UINT32        m_u32EccBlock0EccType;         //!< Ecc level for Block 0 - BCH

            UINT32        m_u32MetadataBytes;             //!< Metadata size - BCH

            UINT32        m_u32NumEccBlocksPerPage;       //!< Number of blocks per page for ROM use - BCH

            UINT32        m_u32EccBlockNEccLevelSDK;      //!< Type of ECC, can be one of BCH-0-20

            UINT32        m_u32EccBlock0SizeSDK;          //!< Number of bytes for Block0 - BCH

            UINT32        m_u32EccBlockNSizeSDK;          //!< Block size in bytes for all blocks other than Block0 - BCH

            UINT32        m_u32EccBlock0EccLevelSDK;      //!< Ecc level for Block 0 - BCH

            UINT32        m_u32NumEccBlocksPerPageSDK;    //!< Number of blocks per page for SDK use - BCH

            UINT32        m_u32MetadataBytesSDK;          //!< Metadata size - BCH

            UINT32        m_u32EraseThreshold;            //!< To set into BCH_MODE register.

            UINT32        m_u32BootPatch;                 //!< 0 for normal boot and 1 to load patch starting next to FCB.

            UINT32        m_u32PatchSectors;              //!< Size of patch in sectors.

            UINT32        m_u32Firmware1_startingSector;  //!< Firmware image starts on this sector.

            UINT32        m_u32Firmware2_startingSector;  //!< Secondary FW Image starting Sector.

            UINT32        m_u32SectorsInFirmware1;        //!< Number of sectors in firmware image.

            UINT32        m_u32SectorsInFirmware2;        //!< Number of sector in secondary FW image.

            UINT32        m_u32DBBTSearchAreaStartAddress;//!< Page address where dbbt search area begins

            UINT32        m_u32BadBlockMarkerByte;        //!< Byte in page data that have manufacturer marked bad block marker, this will

                                                            //!< bw swapped with metadata[0] to complete page data.

            UINT32        m_u32BadBlockMarkerStartBit;    //!< For BCH ECC sizes other than 8 and 16 the bad block marker does not start

                                                            //!< at 0th bit of m_u32BadBlockMarkerByte. This field is used to get to the

                                                            //!< start bit of bad block marker byte with in m_u32BadBlockMarkerByte.

            UINT32        m_u32BBMarkerPhysicalOffset;    //!< FCB value that gives byte offset for bad block marker on physical NAND page.

 

 

  UINT32  m_u32BCHType;

  UINT32  m_u32TMTiming2_ReadLatency;

  UINT32  m_u32TMTiming2_PreambleDelay;

  UINT32  m_u32TMTiming2_CEDelay;

  UINT32  m_u32TMTiming2_PostambleDelay;

  UINT32  m_u32TMTiming2_CmdAddPause;

  UINT32  m_u32TMTiming2_DataPause;

  UINT32  m_u32TMSpeed;

  UINT32  m_u32TMTiming1_BusyTimeout;

  UINT32  m_u32DISBBM;

  UINT32  m_u32BBMark_spare_offset;

  UINT32  m_u32Onfi_sync_enable;

  UINT32  m_u32Onfi_sync_speed;

  UINT32  m_u32Onfi_syncNANDData;

  UINT32  m_u32DISBB_Search;

 

 

        } FCB_Block;

        struct

        {                         

            UINT32        m_u32NumberBB;                    //!< # Bad Blocks stored in this table for NAND0.

            UINT32        m_u32Number2KPagesBB;           //!< Bad Blocks for NAND0 consume this # of 2K pages.

        } DBBT_Block;

    };

} BootBlockStruct_t;

 

Following are the values i'm assigning (Which are equal to linux):

FCB

  m_u32FingerPrint = 0x20424346

  m_u32Version = 0x01000000

  m_u32Reserved = 0

  m_NANDTiming.m_u8DataSetup = 80

  m_NANDTiming.m_u8DataHold = 60

  m_NANDTiming.m_u8AddressSetup = 25

  m_NANDTiming.m_u8DSAMPLE_TIME = 6

  m_u32PageDataSize = 2048

  m_u32TotalPageSize = 2112

  m_u32SectorsPerBlock = 64

  m_u32NumberOfNANDs = 0

  m_u32TotalInternalDie = 0

  m_u32CellType = 0

  m_u32EccBlockNEccType = 4

  m_u32EccBlock0Size = 512

  m_u32EccBlockNSize = 512

  m_u32EccBlock0EccType = 4

  m_u32MetadataBytes = 10

  m_u32NumEccBlocksPerPage = 3

  m_u32EccBlockNEccLevelSDK = 0

  m_u32EccBlock0SizeSDK = 0

  m_u32EccBlockNSizeSDK = 0

  m_u32EccBlock0EccLevelSDK = 0

  m_u32NumEccBlocksPerPageSDK = 0

  m_u32MetadataBytesSDK = 0

  m_u32EraseThreshold = 0

  m_u32Firmware1_startingPage = 512

  m_u32Firmware2_startingPage = 2816

  m_u32PagesInFirmware1 = 91

  m_u32PagesInFirmware2 = 91

  m_u32DBBTSearchAreaStartAddress = 256

  m_u32BadBlockMarkerByte = 1999

  m_u32BadBlockMarkerStartBit = 0

  m_u32BBMarkerPhysicalOffset = 2048

  m_u32BCHType = 0

  m_NANDTMTiming.m_u32TMTiming2_ReadLatency = 0

  m_NANDTMTiming.m_u32TMTiming2_PreambleDelay = 0

  m_NANDTMTiming.m_u32TMTiming2_CEDelay = 0

  m_NANDTMTiming.m_u32TMTiming2_PostambleDelay = 0

  m_NANDTMTiming.m_u32TMTiming2_CmdAddPause = 0

  m_NANDTMTiming.m_u32TMTiming2_DataPause = 0

  m_NANDTMTiming.m_u32TMSpeed = 0

  m_NANDTMTiming.m_u32TMTiming1_BusyTimeout = 0

  m_u32DISBBM = 0

DBBT

  m_u32Checksum = 0x00000000

  m_u32FingerPrint = 0x54424244

  m_u32Version = 0x01000000

 

 

 

 

In WinCE, it is not at all booting.

 

Where is the mistake?

If metadata size difference is the problem , how i can solve it? ( I have also tried by changing METADATA_SIZE = 12, which increases metadata size, but not booting.)

What are those two extra bytes in linux (kobs)?

 

Please help.

 

Thanks.

 

Regards,

Keshava G N

Outcomes