Question
NAND memory read errors
Posted on January 11, 2014 at 23:08
Hello,
I will try with this forum as a last resort for my problem, namely getting my NAND memory to play with me.http://www.ic-on-line.cn/download.php?id=1915099&pdfid=5E619D21E0C125A4A94BC1A860068896&file=0459\h27ubg8t2btr-bc_6373736.pdfI don't have any experience with NAND before. I am using stm32f407VG with FSMC to communicate with the chip (168Mhz internal clk). My problem is reading the data on the NAND after i have programmed it.The thing is that sometimes (approx. 0.2%) I get unexpected value. Usually it is only one bit that is wrong (0x30 instead of 0x20, 0x38 instead of 0x8, A6 instead of A2 etc.). The 0.2% is not spread out at random. The first page (8192 bytes) is correct all the time when reading. I have seem a pattern though. It seems that I get no read errors at page 0, some errors on page 1, even more errors in 2 and so on.Also when I study one of these read errors I can see that about 50% of the time I get the correct value from the NAND memory (verified with oscilloscope). This also seems to be the case for all these problematic addresses.These are my thoughts:* I have tried with different blocks but I get the same problems (surely they cannot all be bad blocks??).* I have tried with a second board with same exact problem.* I have double and triple checked the pins/connection.* I know that FSMC works since I can use it for other peripherals with good result (but with another bank)* I understand the relevancy of the timing for the NAND memory and I suspected something wrong with this a long time but concluded that this is not likely my problem.* On the same FSMC bus I have another peripheral connected (ssd1963). I have the CS for this chip always high so there should not be any problems I think? This chip is not even initialized (since I would need FSMC with other setting/bank for this).* I am not using ECC since my board does not need to be very serious project. I just want to play around a little with NAND.Some code:p.FSMC_SetupTime = 0x1;
p.FSMC_WaitSetupTime = 0x2; p.FSMC_HoldSetupTime = 0xA; p.FSMC_HiZSetupTime = 0x1; FSMC_NANDInitStructure.FSMC_CommonSpaceTimingStruct = &p; FSMC_NANDInitStructure.FSMC_AttributeSpaceTimingStruct = &p; FSMC_NANDInitStructure.FSMC_Bank = FSMC_Bank2_NAND; FSMC_NANDInitStructure.FSMC_Waitfeature = FSMC_Waitfeature_Enable; FSMC_NANDInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b; FSMC_NANDInitStructure.FSMC_ECC = FSMC_ECC_Disable; FSMC_NANDInit(&FSMC_NANDInitStructure); FSMC_NANDCmd(FSMC_Bank2_NAND, ENABLE);&sharpdefine NAND_BASE 0x70000000&sharpdefine CMD_AREA (u32)(1<<16)&sharpdefine ADDR_AREA (u32)(1<<17)&sharpdefine DATA_AREA (u32)(0)&sharpdefine NAND_CMD (*((volatile uint8_t *)(NAND_BASE | CMD_AREA )))&sharpdefine NAND_ADDR (*((volatile uint8_t *)(NAND_BASE | ADDR_AREA )))&sharpdefine NAND_DATA (*((volatile uint8_t *)(NAND_BASE | DATA_AREA )))void hynix_read_byte_cmd(uint_32 address)
{ uint_16 column = 0; uint_16 page = 0; uint_16 block = 0; uint_16 plane = 0; column = address & 0x1FFF; // 13 bits (don't care about the 14:th bit for ECC memory) page = (address >> 13) & 0xFF; // 8 bits block = (address >> (13 + 8)) & 0x3FF; // 10 bits plane = (address >> (13 + 8 + 10)) & 0x1; NAND_CMD = 0x00; NAND_ADDR = (column >> 0) & 0xFF; NAND_ADDR = (column >> 8) & 0x1F; NAND_ADDR = page; NAND_ADDR = ((block << 1) & 0xFE) | plane; NAND_ADDR = (block >> 7); NAND_CMD = 0x30;}uchar hynix_read_byte()
{ return NAND_DATA;}I cant get my head around this problem. Perhaps someone with experience from NAND memories can give me some pointers on things that I need to consider.
Regards,
/rygelxvi #nand-fsmc #nand #nand