Hi there,
I'm working on omap3530 (beagleboard )nand flash driver.The read,write functions work well but the hw ecc can't work.
I ues hamming code for 16bit nand flash,2k page size.
The reasult from GPMC_ECCj_RESULT is always 0,but the ECCPOINTER in GPMC_ECC_CONTROL is right, my code is as follows:
send read cmd(0);
omap_send_address;
send read cmd(0x30);
omap_delay(30000);
for (i = 0, index = 0; ecc_steps=4; ecc_steps--, i+=3, index += 512/2) {
set(0x80,GPMC_ECC_CONFIG);//hamming code,ECC calculated on 16 columns,chip select0
set(0x101,GPMC_ECC_CONTROL);//clear all result registers and select result register1
set(0x3fcff000,GPMC_ECC_SIZE_CONFIG);//this is from UBOOT.Size0,size1 is 512bytes and Selects size0 for result register1
set(0x81,GPMC_ECC_CONFIG);//ECC Enable
for (j = 0; j < 512/2; j++)
{
nand_data[j] = read16(GPMC_NAND_DATA_0);
omap_delay(10);
}
val = readu32(GPMC_ECC1_RESULT);
*ecc_code++ = val&0x0000000f;
*ecc_code++ = (val$0x00ff0000)>>16;
*ecc_code++ = (((val) & 0x00000F00)>>8) | (((val) & 0x0F000000)>>24) << 4;
}
val read from result register1 is always 0 but the ECCPOINTER is from 1 to 2 every 512bytes I read.
why the result register1 is always 0?Please give me some advices,thanks a lot!