Forum Discussion

Pushpa's avatar
Pushpa
Icon for New Contributor rankNew Contributor
4 years ago

Cycone V SOC NAND FLASH READ API issue

Hello,

This is Pushpa...

I am working on cyclone V SOC with NAND flash boot Baremetal application development. NAND boot is happening fine. I have a requirement to read NAND flash and compute the checksum of the image.

I am using the API's provided for NAND flash interface, below are the functions used by me in my program.

unsigned int WRITE_BUFFER[4096], READ_BUFFER[4096];

alt_nand_flash_init(false,false,NULL,NULL);

alt_nand_flash_page_write(0x00800000,1,WRITE_BUFFER,2048);

alt_nand_flash_page_read(0x00800000,1,READ_BUFFER,2048);

I am writing known 32 bytes checksum value into the above address and trying to read back the same. Program is going in interrupt polling loop when its executing the below function inside alt_nand_flash_page_read() function. It is getting stuck inside interrupt polling and not coming out of it and even sometimes if it comes out of this interrupt polling function also read values are 0x00 or 0xFF not the expected values.

res=alt_nand_poll_for_status_register(interrupt_status_register, ALT_NAND_INT_STATUS_TIME_OUT | ALT_NAND_INT_STATUS_LOAD_COMP);

Anything is missing out in our program???, need guidance on the same. Requesting you to provide any example for NAND flash read and write using the altera API's which may help us in resolving the issue soon.

2 Replies

    • Pushpa's avatar
      Pushpa
      Icon for New Contributor rankNew Contributor

      Hello Aliff,

      alt_nand_flash_init status code is ALT_E_SUCCESS

      alt_nand_flash_page_write status code is also ALT_E_SUCCESS

      alt_nand_flash_page_read status returns 0xFFFFFFFF

      read operation is failing.

      How to access the command, address and data registers of NAND flash as we do in case of other interfaces like QSPI flash, i can directly send read write commands to the device and it works also.

      Where as in case of NAND flash, cyclone V datasheet does not explain much about accessing command, data and address registers. datasheet just explains what commands to send for particular operation but how to access those registers, so that we can do read write operation directly using the register addresses.gard

      Please guide.

      Regards

      Pushpa