This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Writing to NAND Flash on Phytec LPC3250 board

Hi,

I am having troubles writing some data to the NAND flash of Phytec LPC3250 board. I am using the Bootloader_NAND project which is given by Keil. This project has the ReadPage_HW function to read the NAND flash and boots from the SDRAM.

I changed this project by adding a ProgramPage_HW function, which is also defined in the FlashHW.c file, in the project.

The program first FINDS THE CORRECT BLOCK and then I write the data I want to that block of the NAND flash. Then, while reading the data, the correct block search is restarted but this time the previous block is shown to be corrupted and the next block is given as correct. Therefore, I cannot read it.

Let me examplify:

FindBlock(0,1)                              // Correct block find is restarted
FindBlock(0,0)                              // The correct block is found to be 0x4000
WriteData(healthy_block, data);            // Data is written

After I reset, I execute the following codes:

FindBlock(0,1)                              // Correct block find is restarted
FindBlock(0,0)                              // The correct block is found to be 0x8000
ReadData(healthy_block);                    // Data is read wrong, I had written to 0x4000

Now, even if I read 0x4000, I always read wrong data, whihc proves that the block is really corrupted. Each time the healthy block is shifted by block size. At first I had 0x4000 as the correct block now I have 0x100000.

ps: the piece of code generating this is:

if(MLC_ISR & 0x40)
  return (NAND_ECC_ERROR)

MLC_ISR & 0x40 occurs and the ECC error results in corrupted blocks.

What can be the problem for this? Is there anything I should do to prevent this problem.
Thanks for your helps..