- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I use Cyclone V HPS on our custom board and try to work with NAND flash controller. The application is baremetal and hwlib is used. For now I can read device and manufacturer ID and do initialization. I can't perform read/write operation: I've done erasing-writing-reading but I've got zeroes. Here is my code:
uint32_t address = 0x10050000;
char testdatain = {1, 2, 3, 4};
char testdataout = { 0 };
if (status == ALT_E_SUCCESS)
{
printf("INFO: NAND initialization\n");
status = alt_nand_flash_init(false, false, NULL, NULL);
}
if (status == ALT_E_SUCCESS)
{
status = alt_nand_flash_block_erase(address, NULL, NULL);
}
if (status == ALT_E_SUCCESS)
{
status = alt_nand_flash_page_write(address, 1, testdatain, sizeof(testdatain));
}
if (status == ALT_E_SUCCESS)
{
status = alt_nand_flash_page_read(address, 1, testdataout, sizeof(testdataout));
if (status == ALT_E_SUCCESS)
{
for (int i=0; i<sizeof(testdataout); i++)
{
printf("byte# %d = %d\n", i, testdataout);
}
}
}
My point is it's someting wrong with addressing, because if I set address to 0x0, it is ok. Has anybody some working examples for NAND? Or some useful link? I can't find Altera examples on this topic. The only reference is function descriptions in alt_nand_flash.h file. Thanks in advance.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
serjjo, Did you figure out how to read & write the NAND flash? I need to do this as well.
Thanks Ron- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well... I have successfully programmed and am able to read the values from nand flash. But after programming when i check the status whether it is successfully programmed or not, the status register shows there is some error in programming. This happens only when I enable ECC. If I disable the ECC it works cool!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Naveen D S,
Thanks for responding. If you would be willing to share you code and any configuration tips, I would sure like to see it. Is this a bare-metal design? That is what I'm doing. Ron- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the micron Nand flash code which I downloaded from net. I have written a top level code for the nand controller. I have created a custom component using sopc builder (soft core processor nios 2). You can easily get the code from Micron technologies website. (I'm not sure what exactly "bare-metal design" is)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Bare-metal" code does not use an operating system. It is compiled directly for the target microcontroller. If you are writing for the Nios II soft processor, I don't think this would be called bare-metal, but I'm not certain. If you are using Linux, this is not bare-metal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Ron.
Nope. I'm not using linux. I am still stuck there. Status register still doesn't show me whether programming is successful or not. May be programming is successful... may be not. Else, I might not be reading the status register at the right time..- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page