This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NAND Boot failed.

Hi.

We are producing network camera with dm368

Sometimes NAND boot failed is occured!!

serail log as followings

------------------------------------------------------
DM36x initialization passed!
TI UBL Version: 1.50
Booting Catalog Boot Loader
BootMode = NAND
Starting NAND Copy...
Valid magicnum, 0xA1ACED66, found in block 0x00000008.
No valid boot image found!
NAND Boot failed.
Aborting...
-----------------------------------------------------

flashutil version : flash_utils_dm36x_1.1.0 ( IPNC RDK 2.6 )
nandflash : MT29F1G08ABAEAH4

I insert debug code to ubl and I found 1 bit error in uboot region

The UBL code detect ecc error and try to correct but

ecc_state return number 5 in NADFSR and return ERROR;

so print NAND Boot fialed.

following is device_nand.c in UBL

static Uint32 DEVICE_NAND_ECC_correct(NAND_InfoHandle hNandInfo, Uint8 *data, Uint8 *readECC)
{
VUint32 temp, corrState, numE;
Uint32 i;
Uint16 addOffset, corrValue;
Uint16* syndrome10 = (Uint16 *)readECC;

// Clear bit13 of NANDFCR
temp = AEMIF->NANDERRADD1;

// Load the syndrome10 (from 7 to 0) values
for(i=8;i>0;i--)
{
AEMIF->NAND4BITECCLOAD = (syndrome10[i-1] & 0x000003FF);
}

// Read the EMIF status and version (dummy call)
temp = AEMIF->ERCSR;

// Check if error is detected
temp = (AEMIF->NAND4BITECC1 & 0x03FF03FF) | (AEMIF->NAND4BITECC2 & 0x03FF03FF) |
(AEMIF->NAND4BITECC3 & 0x03FF03FF) | (AEMIF->NAND4BITECC4 & 0x03FF03FF);
if(temp == 0)
{
return E_PASS;
}

// Start calcuating the correction addresses and values
AEMIF->NANDFCR |= (0x1U << DEVICE_EMIF_NANFCR_4BITECC_ADD_CALC_START_SHIFT);

// Loop until timeout or the ECC calculations are complete (bit 11:10 == 00b)
i = NAND_TIMEOUT;
do
{
temp = (AEMIF->NANDFSR & DEVICE_EMIF_NANDFSR_ECC_STATE_MASK)>>10;
i--;
}
while((i>0) && (temp != 0x0));

// Read final correction state (should be 0x0, 0x1, 0x2, or 0x3)
corrState = (AEMIF->NANDFSR & DEVICE_EMIF_NANDFSR_ECC_STATE_MASK) >> DEVICE_EMIF_NANDFSR_ECC_STATE_SHIFT;

if ((corrState == 1) || (corrState > 3))
{
return E_FAIL; <== corrState is 5 so return error
}
else if (corrState == 0)
{
return E_PASS;
}
else

ECC_STATE meanning is following in EMIF User Guide

1-8 ECC_STATE ECC correction state while performing 4-bit ECC Address and Error Value Calculation
0h No errors detected

1h Errors cannot be corrected (5 or more)
2h Error correction complete
3h Error correction complete
4h Reserved
5h Calculating number of errors
6h - 7h Preparing for error search
8h Searching for errors
9h - Bh Reserved
Ch - Fh Calculating error value

What's the detailed meanning of the ECC_STATE
and Why ECC_STATE is set to 5
and How can I Fix this problem?

  • Hi JongUK,

    That is because you are using an old vesion Uboot which does not correct ECC errors.

    To fix it, DEVICE_NAND_ECC_correct() function needs to be modified as below:

    // Start calculating the correction addresses and values
      AEMIF->NANDFCR |= (0x1U << DEVICE_EMIF_NANDFCR_4BITECC_ADD_CALC_START_SHIFT);

      /*
       * loop without any of the correction calculations having taken place.\r
       * So wait till ECC_STATE reads less than 4.\r
       */
      do
      {
        temp = (AEMIF->NANDFSR >> 8) & 0xf;
      }while (temp < 4);

      // Loop until timeout or the ECC calculations are complete (bit 11:10 == 00b)
      i = NAND_TIMEOUT;
      do
      {
        temp = (AEMIF->NANDFSR & DEVICE_EMIF_NANDFSR_ECC_STATE_MASK)>>10;
        i--;
      }
      while((i>0) && (temp != 0x0));

    Highlighted text needs to be added.

    Please see Sudhakar Rajashekhara's answer in  http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/p/182730/708236.aspx#708236 for detail.

    Ivy

  • Hi Ivy Liu

    Thank you for your reply

    I modify UBL Code and then the problem is solved

    Thank you..

  • Hi,

    I've made the same fix in UBL 1.5, but still get the error.

    Is it possible to get this error even though we made the fix ?

    Thanks,

    Ran

  • Hi Ran,

    With this fix, you should not have the same problem.
    Please add some debug code to UBL to check what is the problem.
    And please check the header of your UBoot to make sure the Magic Number is correct.

    Best Regards,
    Ivy
  • Hi Ivy,

    Thank you very much for your reply !

    I am quite sure that the correct UBL image with the fix was flashed.

    Is it possible that there are boards that the ecc algorithm can't fix even after this fix added in code ?

    Regards,

    Ran