Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20678 Discussions

How to use NAND in HPS baremetal program?

altera33
Beginner
1,439 Views

is there any c-code examples for HPS HWLib NAND API? My simple code is reading 0xFF whatever i wrote.

I'm using MT29F8G08ABACAH4-IT. The linux driver is able to read/write this FLASH.

ALT_PRINTF("NAND: Initializing NAND.\n"); status = alt_nand_init(ALT_NAND_BOOTSTRAP_INHIBIT_B0P0_LOAD_DISABLE, ALT_NAND_BOOTSTRAP_512B_DEVICE_DISABLE, init_nand, (void *)&param);   if (status != ALT_E_SUCCESS) ALT_PRINTF("NAND: Error initializing NAND.\n"); //alt_nand_ecc_enable(ALT_NAND_ECC_8_BIT_CORRECTION); alt_nand_ecc_disable();   for(int k=0;k<NAND_PAGE_SZ;k++) nand_buf[k]=k; status = alt_nand_write_page(0, 1, (uint32_t *)nand_buf); if (status != ALT_E_SUCCESS) ALT_PRINTF("NAND: Error writing NAND.\n"); memset(nand_buf,0,NAND_PAGE_SZ); status = alt_nand_read_page(0, 1, (uint32_t *)nand_buf); if (status != ALT_E_SUCCESS) ALT_PRINTF("NAND: Error reading NAND.\n"); else for(int k=0;k<NAND_PAGE_SZ;k++) if(nand_buf[k]!=k) { ALT_PRINTF("NAND:R/W Error @%d.\n",k); break; }

 

0 Kudos
3 Replies
EBERLAZARE_I_Intel
959 Views

Hi,

 

Which FPGA board you are using? There are lists of supported flash devices (such as NAND) that is known to work and tested and working by Intel;

 

For Cyclone V/ Arria V:

https://www.intel.com/content/www/us/en/programmable/support/support-resources/supported-flash-devices-for-cyclone-v-and-arria-v-soc.html

 

For Arria 10:

https://www.intel.com/content/www/us/en/programmable/support/support-resources/supported-flash-devices-for-arria-10-soc.html

 

Here is a Bare Metal User Guide, the guide will provide examples of how to create and debug Bare Metal projects using the ARM® DS-5 Altera Edition included in the Altera® SoC Embedded Design Suite (SoC EDS) User Guide:

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_bm.pdf

 

Regards.

altera33
Beginner
960 Views

Hi,

 

we have our own board and as i WROTE above the HW interface is working. The Linux driver works properly and we can read/write this NAND Flash.

Therefore i have a feeling, that you are an automatic answering bot, because all your proposals have nothing to do with my questions. Is it a quality level of Intel support meanwhile?

My only question was : "is there any c-code example for HPS HWLib NAND API?"

 

Regards,

 

0 Kudos
EBERLAZARE_I_Intel
959 Views

Hi,

 

Sincere apology, HWLib for NAND is not available for Cyclone V. But HWLib for SPI is available in the Quartus installation file.

 

To reach the available HWLib lists, go to Quartus installation directory> /embedded/examples/software.

 

Regards.

Reply