Forum Discussion
Altera_Forum
Honored Contributor
20 years agoFlash EPCS access problem
Hi, I'm trying to write my FPGA configuration file on its EPCS16 flash using Nios processor. The final goal is to use Uart/Usb/Ethernet communication to download the FPGA configuration file...
Altera_Forum
Honored Contributor
20 years ago --- Quote Start --- originally posted by jérôme@Apr 28 2006, 04:19 AM the problem is that each access with 'alt_write_flash'[/b] function seems to erase the entire block/sector of the flash (which represent 0x10000 datas). Is there a solution to my problem ? Thanks, Jérôme <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14815) --- Quote End --- [/b] --- Quote End --- This is the nature of using most any flash device. For your situation, it makes sense to use the alt_write_flash_block() function. It won't automatically erase the flash....like alt_write_flash() does. In this way you could write to the flash in whatever data size you want and detect when a sector erase is necessary yourself. Something like the following should work if you implement it in a loop passing new "data" in with each pass:
if(new_flash_block != current_flash_block)
{
printf("\nFlash Block %d", new_flash_block);
alt_erase_flash_block(fd, (new_flash_block * regions->block_size),
regions->block_size);
current_flash_block = new_flash_block;
}
alt_write_flash_block(fd, (current_flash_block * regions->block_size),
target_addr, data, data_len); Cheers, - slacker