Hi this is franticAF and this is my first post.I'm working on board where an Altera Cyclone IV EP4CE6E22I7N is mounted (with attached flash memory EPCS4). A microcontroller is also present in order to perform reading/writing operation on FPGA internal registers. I always program FPGA by jtag usb blaster, loading a .jic file. Now i want to program FPGA using microcontroller, and i don't know where to start. Anyone could help me please? Is there any tutorial or VHDL code as example suitable for me? Thanks in advance.
This will depend on a couple of things:- How is the microcontroller connected to the FPGA? Can you drive DCLK, DATA0, nCONFIG signals of the FPGA from the MCU? - How are the FPGA MSEL pins connected? A simple way to accomplish this is to use the Passive Serial config mode and the SPI interface of the MCU (or bit-bang it if the MCU does not have SPI). If you send more details, it would be easier to find a solution.
--- Quote Start --- - How is the microcontroller connected to the FPGA? Can you drive DCLK, DATA0, nCONFIG signals of the FPGA from the MCU? --- Quote End --- No the MCU is not connected to the flash memory; it is connected to FPGA by i/O ports. --- Quote Start --- - How are the FPGA MSEL pins connected? --- Quote End --- MSEL0 pulled-down to gnd; MSEL1 pulled-up to VCC; MSEL2 pulled-down to GND. But this configuration could be changed mounting or not specific resistor. --- Quote Start --- A simple way to accomplish this is to use the Passive Serial config mode and the SPI interface of the MCU (or bit-bang it if the MCU does not have SPI). --- Quote End --- The MCU has SPI interface also connected to FPGA. Can you explain me better how use Passive Serial config? Is it possible to make the MCU write register in FPGA and then make FPGA write flash memory? How the data could be written? What is the better way?
- Can you control the DCLK, DATA0, and nCONFIG FPGA signals from the MCU?- If that is a yes, then you can configure the FPGA from the MCU. If no, you may not be able to configure the FPGA directly from the MCU. - If your config flash is connected to the FPGA only, then you will need to make the MCU change the flash content using some initial FPGA code - this will depend on how the MCU is connected to the FPGA. Passive Serial is a simple 1-bit configuration scheme that can be used to config the FPGA using an SPI-like protocol. You would usually make Quartus generate a .rbf file to use for streaming the config to the FPGA Again, if you can provide how the MCU is connected to the FPGA, I can help you better.
--- Quote Start --- Again, if you can provide how the MCU is connected to the FPGA, I can help you better. --- Quote End --- the MCU is connected to FPGA through 16 I/O pin (8 bit address + 8 bit data) for internal register parallel read/write operations and also the SPI interface of micro is connected to FPGA. Others signals are not connected to MCU. DATA0,DCLK only from flash to FPGA. nConfig,nstatus,conf_done unconnected.
Since the config signals are not connected to the MCU, your only other solution is to re-write to the flash through the FPGA. This can be accomplished using the Cyclone IV remote update feature. Since you already have an MCU, you do not need to have Nios running in the FPGA.I have never used remote update but it should do exactly what you want. You can read about it in the Cyclone IV manual. Also look up the ALTREMOTE_UPDATE megafunction.