Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20638 Discussions

Any explanation of APPLYCFG bit of SDRAM control register in Cylcone V

Altera_Forum
Honored Contributor II
1,212 Views

hello. 

 

 

I've been working on transferring data from HPS SDRAM to FPGA using DE1-SoC 

 

 

I followed the steps from this link https://support.criticallink.com/redmine/projects/mityarm-5cs/wiki/important_note_about_fpgahps_sdram_bridge 

 

 

these are the notes from above link. 

 

------------------------------------------------------------------------ 

Important Note about FPGA/HPS SDRAM Bridge (2013-12-13) 

 

 

Altera has recently disclosed an implementation requirement related to the use of the FPGA to HPS SDRAM bridges. Until more formal technical notes are published at Altera, this page will be maintained to outline the understood issue for the benefits of MitySOM-5CSX customers. 

Configuration of the FPGA to HPS SDRAM (fpga2sdram) AXI bridges involves the following major steps: 

 

 

First, the FPGA ports on the fpga2sdram peripheral must be placed in reset. This is accomplished by writing a zero to the FPGAPORTRST register in the SDRAM Controller control group. 

 

 

Second, the FPGA must be configured with an image that includes the configuration of the fpga2sdram ports. The FPGA fabric asserts configuration input ports at the input to the fpga2sdram bridges. The configuration ports affect such things as the width of the port as well as the direction, etc. When the FPGA is not configured, these configuration inputs are not defined. 

 

 

Third, once the configuration inputs are set, the configuration must be then latched / applied to the fpga2sdram bridge peripheral. this is accomplished by writing a one to the applycfg bit in the staticcfg register in the sdram controller control group. this bit can only be written to while the sdram ddr interface is guaranteed to be completely idle (including transfers from the arm cores, dmas, etc.). 

 

 

Finally, the FPGA ports on the fpga2sdram peripheral can be taken out of reset based on your configuration. This is accomplished by writing ones to the appropriate bits in the FPGAPORTRST register in the SDRAM Controller control group. 

If these steps are not followed, attempting to use an FPGA port on the HPS SDRAM bridge controller may result in critical failure -- the HPS subsystem may freeze and effectively lock up the processor. 

 

 

As a consequence to the note bolded in step 3, the fpga2sdram controller cannot be practically configured while most high level operating systems are running (linux, windows, android, etc.). Altera has provided the capability to set the configuration bit in step three with a macro command in their (and Critical Link's) u-Boot port. This is accomplished by copying a small routine to on-chip RAM that disables caches and asserts the APPLYCFG bit and then returns operation to the typical DDR space. 

 

 

Therefor, if you have an FPGA design that utilizes the fpga2sdram controller, you must program the FPGA in u-Boot following an FPGA / power on reset situation. 

Once the SDRAM controller is properly configured, the FPGA ports may be reset and enabled (steps 1 and 4) as often as necessary in order to facilitate reloading of the FPGA -- as long as the new fpga2sdram port configuration matches the original configuration. This will allow for reconfiguration of an FPGA while running linux, if necessary. 

 

 

-------------------------------------------------------------- 

 

 

as a matter of fact, the data transfer works well, I followed all the steps. 

 

 

But I really do wonder about that 'APPLYCFG' bit in staticcfg register. 

 

 

according to Cyclone V manual, http://people.ece.cornell.edu/land/courses/ece5760/de1_soc/cv_5_hps_tech_ref.pdf 

 

 

(11. SDRAM Controleer Subsystem -> SDRAM Contorller Address Map and Register Definitions -> staticcfg (0xffc2505c)) 

 

 

this is the description of the 'APPLYCFG' bit : "write with this bit set to apply all the setting loaded in SDR registers to the memory interface. This bit is write-only and always returns 0 if read" 

 

 

So this is my understanding, even though I modify the value at SDR registers, those modifications are not applied or effected to memory interface before APPLYCFG bit is set. So all SDR registers value effects to SDRAM configuration all at once by setting 1 APPLYCFG bit at staticcfg registers. 

 

 

but I wonder about my understanding, because I can set and unset fpgaportrst register after APPLYCFG had been set once, and that setting does affect to SDRAM configuration. 

 

 

So my question is, I don't know what "write with this bit set to apply all the setting loaded in SDR registers to the memory interface..." means... 

 

 

APPLYCFG -> apply configuration, what configuration exactly????
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
455 Views

Hii  

 

Im working in a project in which i need to transfer data from hps DDR3 to FPGA (using DE1-SOC board ) You say that the data trasnfer works well for you 

 

"as a matter of fact, the data transfer works well, I followed all the steps". 

 

plz can you send to me your project. i was trying to do that for 2 month using HPS and MSGDMA cores but it doesn't work.
0 Kudos
Reply