Altera_Forum
Honored Contributor
16 years agoRead/Write CFI flash
I am using a Cyclone III starte board for some initial design. I am using the CFI flash for configuration and code storage, but I'd like to use unused space for non-volatile storage. I have tried the alt_read_flash/alt_write_flash but have not been able to read/write, even though the returned codes seem to indicate it worked. Is this due to the fact that my reset vector is in flash (exception is in sdram)? Can you not use it in this case?
a la the example given in the book:char temp ;
memset(temp, 0xAA, 131072);
flashfd = alt_flash_open_dev(CFI_FLASH_0_NAME);
if (flashfd)
{
alt_write_flash(flashfd, 0x00FE0000, temp, 131072) ;
}then I read by: char out_temp ;
alt_read_flash(flashfd, 0x00FE0000, out_temp, 131072);
alt_flash_close_dev(flashfd);but my temp is all FF's, leading me to believe the write is failing... Could it be the fact it is in 16-bit mode? What about the alt_cfi_flash_read/write commands? Are they to be used instead? I've checked other posts and it seems like it is initializing ok, and the CFI stuff is in order according to nios2-flash-programmer... Help? Thanks!