trabucayre / openFPGALoader

Universal utility for programming FPGA
https://trabucayre.github.io/openFPGALoader/
Apache License 2.0
1.18k stars 251 forks source link

Programming of QSPI-flash (connected to arbitrary GPIO-pins of a MAX10 device) with openFPGALoader / spiOverJtag #435

Open TrioKross opened 7 months ago

TrioKross commented 7 months ago

Hello,

first of all : Thank you for this great project! Good learning stuff, a very useful tool ... and fun :-)

Goal :

My goal is to use openFPGALoader for programming a QSPI-flash (connected to arbitrary GPIO-pins of a MAX10 device) via "spiOverJtag"-bride!

Things found out (so far...) :

(please correct if wrong or misunderstood!)

a) openFPGALoader supports this feature for Cyclone (IV, V, 10 ...) families

b) MAX10 devices don't have an "ASMI hard logic block"!

c) "spiOverJtag"-bride (based on "altera_parallel_flash_loader") needs to be generated for MAX10 devices:

Questions :

Let's suppose the MAX10 is already programmed/running a "spiOverJtag"-bridge (based on "altera_parallel_flash_loader"):

(Further/Next step would/could be to integrate the new bridge into openFPGALoader to load it temporarily into MAX10-SRAM before programming the QSPI-flash...)

Notes :

Thanks in advance for your help/comments/hints

trabucayre commented 7 months ago

Thanks! For spiOverJtag it's not really based on altera_parallel_flash_loader. In fact it uses virtual jtag in one side and altserial_flash_loader in another side:

In fact you can use the logic and remove spi flash module to directly connect SPI signals to your flash with a constraints file correctly configured. openFPGALoader know how to deal with FPGA logic but have no idea about module required to access SPI flash on cyclone devices.

MAX10 is a work in progress. Unfortunately there is no docs on how to program device (or flash it) this is why currently it's required to use an svf file.

TrioKross commented 7 months ago

Thanks for your reply.

I was thinking of creating a new variant of "altera_spiOverJtag.v" (=> "max10_spiOverJtag" ?), which uses "virtual jtag" on one side and "altera_parallel_flash_loader" on the other side. [Parallel Flash Loader IP UG]

As mentioned before "altserial_flash_loader" is not appropriate for MAX10, because of the missing "ASMI hard logic" in MAX10 devices. But "altera_parallel_flash_loader" has a "soft-logic" block for QSPI-flash interface. This interface needs to be connected to GPIO-pins, which is user-defined and therefore not as "generic" as the ASMI of the Cyclone devices.

Steps required:

1) Generate a new bridge image "max10_spiOverJtag" (svf - not rbf!)

2) Load/program "max10_spiOverJtag" to MAX10-device

3) Write/program QSPI-Flash (with arbitrary data)

Something similar is done here (using the Quartus Programmer): [Program POF (linux image) into Quad SPI Flash] (although a "Linux rootfs Image" is written to the QSPI-flash instead of a FPGA configuration image)

One question is whether openFPGALoader is already compatible to "altera_parallel_flash_loader" (regarding SPI/QSPI-flash programming - and NOT regarding the "Autoload-bridge to MAX10" functionality), as it certainly is for "altserial_flash_loader"?

Please let me know what you think about that.

Thanks again!