Easiest way to transfer data between CPU and FPGA?

Hi, I'm working on a prototype using the Vidor4000. I need to write data to some registers on the FPGA and then send data back to the CPU, I don't care about performance, I just need a method that is easy to setup and use as I don't have much experience with fpgas.
I found another thread here where it was suggested to use the JTAG with the jtag_host.cpp library from VidorGraphics and the Virtual JTAG IP on the FPGA, but without having experience with hardware and FPGAs I found it difficult to understand the only documentation that I could find online (the Intel IP sheet).
Is there a more straightforward way just to read and write some 32 bits registers?

Welcome leonardopanseri, JTAG would probably be the best, JTAG has been around for a long time and is very reliable. Simple and inexpensive would be a few switches and some resistors but definitely slow. Try this link and follow the links it gives you, that should get you to the point it all becomes understandable.

Thanks for the answer, but I don't see any links in your message?

Are you in fact working with this?

Arduino MKR Vidor 4000 — Arduino Official Store

Yes, the Vidor 4000 is the board I am working with.

I really am no expert, but isn't it so that you program the FPGA via the onboard microcontroller? If so, doesn't this approach indicate how the microcontroller code interacts with the FPGA? Or is it just setting up the FPGA by writing to the FPGA configuration memory, without means for interacting with the FPGA when running that configuration?

Give this a try.

As far as I understand it the JTAG is primarily used to configure the board (set parameters and upload the bitstream) and the JTAG pins are not directly accessible by FPGA designs, but through an IP developed by Intel it should be possible to implement a custom communication protocol using the JTAG pins.

Thanks, I will have a look at it.

This may need some library writing but there should be enough "examples".
Basically reference design has simplified jtag to avalon bridge for access mailbox in FPGA side.
If you create own design for FPGA then you can use jtag to avalon bridge and use MCU to access those registers.

Hi, after seeing this post it seems like the JTAG_Interface library is exactly what you need: A simple and straight-forward way to upload the FPGA code and besides that a way to talk to the FPGA while the code is running.

It does not use USB-Blaster at all, it embeds the bitstream in the Arduino code and then seamlessly uploads it when the program starts (In my opinion the way to go). It should be very straight-forward, please tell me if you have any problems.

I had exactly the same issue and after a loong, loong time of development I finally got it to work a year ago and now I reworked basically everything. Yes, it uses JTAG. It is a protocol which allows you to completely manage the FPGA microcontroller, so the bitstream is uploaded via JTAG. After that, things stop. Now my library uses JTAG to set up something called a Virtual JTAG state machine, which allows it to exchange data with a Virtual JTAG instance in the FPGA internal code. I developed a protocol around that, which makes it very easy to exchange data in a fool-proof way. As it uses JTAG internally, it does not occupy any other pins.

And besides that uploading the bitstream is very easy, as well as the conversion. Take a look at the ByteReverser GUI. You can try my library and please tell me if something is not working.

Here is my post announcing the library (which is now even part of the library manager):

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.