Hi all,
I've been trying to modify bootloader in Starterware_02_00_01_01, and i find a bug when i read the flash,my test code is attached bellow. The bugs lay in the function "NANDPageRead", when it is called, it reaches a error value "NAND_STATUS_READ_ECC_UNCORRECTABLE_ERROR" which returned by GPMCBCHECCCheckAndCorrect() called by "NANDPageRead".
The location of the bug when step into the function in my test code is :
NANDPageRead -> GPMCNANDECCCheckAndCorrect -> GPMCBCHECCCheckAndCorrect -> ELMErrLocProcessingStatusGet -> produce an error named "NAND_STATUS_READ_ECC_UNCORRECTABLE_ERROR"
void NandReadTest(void)
{
unsigned char blkdata[2048],eccdata[64];
NandStatus_t retVal;
NandInfo_t *nandInfo;
unsigned int currBlock = 128;
BlPlatformNANDSetup();
nandInfo = BlNANDConfigure();
while (NANDBadBlockCheck(nandInfo, currBlock) != NAND_BLOCK_GOOD)
{
currBlock++;// ignore bad block
}
if(currBlock > 2048)while(1);// error loop, the max block number is 2047
retVal = NANDPageRead(nandInfo,currBlock,0,blkdata,eccdata);// The bug existed here,and return value is
// "NAND_STATUS_READ_ECC_UNCORRECTABLE_ERROR"
if(retVal != NAND_STATUS_PASSED)
{
while(1);// Loop here caused by the bug!
}
}
I am confused by this bug,and not clear how to correct it,so any help will be appreciated,Thanks!