Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

Preserving sectors in an EPCS

Altera_Forum
Honored Contributor II
2,658 Views

Hello, 

 

I need to update the configuration device (EPCS4N) of a Cyclone II FPGA (EP2CF4848N). Sector number 7 was used to store information that is programmed during production. I would like to maintain the information stored in this sector, but saw that when I download the new configuration using a JIC file that the complete contents of the EPCS4 device is erased before the new configuration data is programmed. 

 

Are there any tools available that will allow me to only update the lower sectors, or to read out the top sector and then program it again after the update? 

 

 

Thanks, 

Richard.
0 Kudos
14 Replies
Altera_Forum
Honored Contributor II
1,383 Views

Are you certain the JIC method overwrites the entire device? You can use the NIOS flash programmer which will only erase the space required for the new data. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Yes I tested, after programming the new JIC file the sector that I am interested in is filled with 0xff. 

 

The problem with the Nios flash programmer is that I need a Nios core running on the FPGA. I do not have a valid Nios license to generate such a configuration, and also don't have any experience in using Nios.
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Hi Raz, 

 

In this case, you need to use altasmi_parallel megafunction to write into the EPCS from your FPGA in user mode. The correct file format to be written into the EPCS is RPD file. You need to generate RPD file using QII conversion tool- Convert Programming File. However, the default RPD file also overwrite the whole EPCS memory with unused memory set to '1'. You only need the portion of the RPD file that consists the configuration data. Therefore, you need to use external binary tool to crop away the unused data and sustain the useful configuration data within the RPD, namely modified-RPD. With this, you only begin to write the rpd file into the EPCS at memory location 0x0.  

 

In fact, you also can sector protect the EPCS memory using the altasmi_parallel megafunction. See details in the User Guide. 

altasmi_parallel: http://www.altera.com/literature/ug/mfug_asmi.pdf 

 

Please make sure the relevant inputs into the altasmi_parallel block are correct and hopefully you can get it done well. Please try to write simple data into the EPCS and read it out to confirm the altasmi_parallel megafunction is working well now before you proceed to write the entire configuration data into the EPCS for reconfiguration purpose.  

 

I hope this help out pretty well.  

 

Regards, 

KT
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Richard, have you had success with this? I am trying to achieve the same function currently. I store parameters to flash during production and want to update the configuration without overwriting these parameters. I too am not using the NIOS.

0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Hi Wahilakn, 

 

I managed to get it working. What I did was to compile a minimal NIOS core, upload this first to the FPGA using the quartus_pgm.exe, and then used the nios2-flash-programmer.exe utility to erase and program only parts of the EPCS device. 

 

This is a bit of a hack, but I did not find another way to do it. 

 

Regards, 

Richard.
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Sorry. I would have suggested this to you but I assumed you were trying to avoid NIOS. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

 

--- Quote Start ---  

Hi Wahilakn, 

 

I managed to get it working. What I did was to compile a minimal NIOS core, upload this first to the FPGA using the quartus_pgm.exe, and then used the nios2-flash-programmer.exe utility to erase and program only parts of the EPCS device. 

 

This is a bit of a hack, but I did not find another way to do it. 

 

Regards, 

Richard. 

--- Quote End ---  

 

Richard, 

 

I wanted to avoid NIOS if possible, but to maintain user flash, this seems to be the way to go. I am still using the ALTASMI_PARALLEL megafunction to do my reads and writes. I built a NIOS with the recommended peripherals according to the Nios II Flash Programmer User guide and added this to my project.  

 

So now the problem is that the Fitter fails. It cannot place a node:  

Error: Cannot place node "calibration:calibration_0|NIOS_FLSH_PRGMR:NIOS|epcs_flash_controller_0:the_epcs_flash_controller_0|tornado_epcs_flash_controller_0_atom:the_tornado_epcs_flash_controller_0_atom|internal_data0out" of type ASMI block 

 

Do you know if there is contention between the Nios and the ALTASM function? Perhaps I am missing a setting somewhere?  

 

Thanks, 

Kevin
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

I cannot get the ALTASMI megafunction and the Nios EPCS peripheral to get along. Perhaps I will use AS for the initial config of the EPCS. Then if I want to reconfigure the device after I have already written to the user portion of flash, I will use a separate project that just contains the Nios, program the FPGA using the sof via JTAG, then run the nios flash programmer to write the new config data to the EPCS device. Wow that sounds convoluted...

0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Yes it does sound convoluted. However, consider the following: 

 

1 - Your scheme is no more convoluted than using the Quartus programmer with the JIC method. The programmer downloads a special image to the FPGA which it can then use to communicate with to reprogram the flash. You'd basically be doing the same thing. 

2 - You don't have to use AS for the initial config. You could program your special image into the FPGA and use the nios2-flash-programmer for your initial config. No reason to maintain two processes. 

3 - I suspect your proposed method still yields a faster programming time with the NIOS over the AS method. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

I should ask as well. What data exactly do you need to read/write from/to the EPCS device from your firmware design? Is it just the user parameters or are you also doing remote field upgrades of the firmware through this mechanism? How much data do the user parameters consist of? 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Right now, I am only writing 8 bytes of data... calibration parameters that let me tune gain and offset of an analog signal after it has been sampled. This only needs to be done when the board is manufactured. If I produce new firmware, it should be loaded in the field without having to recalibrate, a procedure that can only be done in the manufacturing facility.

0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Well the reason I asked was to propose some alternatives. Seems like a lots of hassle for 8 bytes of data. You could ... 

 

1 - Remove the ASMI megafunction and let the NIOS write those values to the flash for you through the EPCS controller. You'd have to send a signal to the NIOS to let it know when you wanted it to write the data. And of course you'd have to write the little bit of C-code involved. This allows you to keep the NIOS in your permanent FPGA image. Also, I highly suspect you'd find other uses for the NIOS along the way. Once I started putting embedded processors in my FPGA designs, I became addicted. You'll never get as much use out of so few logic gates as with an embedded processor. 

 

2 - Add an EEPROM to the board for your parameter storage. 

 

Anyway, you know what you're doing. I'm just giving some ideas. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

Hi, 

 

 

I'm trying to operate the asmi_parallel megafunction to control an EPCS1 serial flash, through a Cyclone device. Now I can't even read the EPCS1 Silicon_ID through the asmi_parallel megafunction. I wrote a small state machine that only asserts the read_sid signal and reads the epcs_id field, but the busy signal is always at '1' , as if the machine never finishes working. EPCS_ID field is always 8'h00. I only raise the read_sid signal once and lowers it after one one clock or at another case after two clock cycles, but the busy is always at '1'. What could be the problem? 

I don't have a NIOS core in my system. 

 

 

Thanks, 

Eldad
0 Kudos
Altera_Forum
Honored Contributor II
1,383 Views

efargon, 

 

Are you using QuartusII 9.0 sp2 or QII 9.1 sp1 ? 

Did you set the "Dual-purpose pins" to "User defined I/O" 

ASMI works fine here.
0 Kudos
Reply