Altera_Forum
Honored Contributor
19 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 on the board. I have implemented an EPCS_Controller on my Nios CPU using SOPC builder, and I'm using 'alt_flash_dev' drivers to access to it. I success to read flash datas. But I have some problems concerning write access : I can't write a block entirely (65536 bytes, I don't have enough memory to store such amount of datas), so I would like to write only part of a block, like this way : my_epcs = alt_flash_open_dev(epcs_controller_name);if(my_epcs) {
printf ("epcs opened successfully!");
ptr = 0;
while (ptr<3146000) { // fichier 3mo maxi
my_data = .. // store 0x2000 datas
ret_code = alt_write_flash(my_epcs, ptr, my_data, 0x2000);
ptr = ptr + 0x2000;
}
alt_flash_close_dev(my_epcs);
}
The problem is that each access with 'alt_write_flash' 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