I made the switch from Altera to Xilinx a few years ago but haven’t updated the website much. I hope to write more tutorials like this one hoping it helps others who need it (& hopefully won’t have to struggle as much as I had to).
This tutorial uses DMA in Scatter/Gather (SG) mode and will only be used to collect data from the FPGA/PL and store it in memory where the PS/Zynq processor can access/read it.
Firstly, please follow this tutorial that shows you how to setup the DMA in a loop mode. The PS sends some info to the FIFO via a DMA and then receives the same info back in the PS (via the DMA) which confirms the DMA functions properly.
For my project, I only wanted the DMA to write data to memory so I modified somethings from the tutorial in the link. Below are the steps you need to follow.
- Select only Write channel
3. If you looked at the full block design you will see the connections running between the blocks. The only custom IP used is the packetgen_axi_v1. This block collects 1-bit data (from a pin, more on this later) and packs it into 32-bit words and transmits it to the FIFO over the AXI. It is very easy to write this custom IP but if you can’t email me and I’d be able to help you with it.
4. The din input to the custom IP comes from an external pin on the board which is connected to a RF front end. My project collects data from the front end and saves it in memory where the software can later easily access it.
5. Synthesize, Implement and Generate Bitstream for the project. Export the project and launch SDK. Create an application project with hello world.
6. Copy paste the example code from
7. Here you need to edit out all the parts of the code which involve Tx…
8. In the CheckData() loop instead of checking every individual value received value, just print it out. Also, my custom IP requires a ‘capture_start’ signal from the processor after which it starts collecting data and storing in memory. That collected data will be outputted by the CheckData() function.
9. I highly recommend understanding xaxidma.h header file and all the functions. It will help you customise your application.
10. Program your device and then run the SDK application and you should be able to see a successful run.
My next step is to implement a cyclic BD which will continously collect data for a certain period of time. I will post my progress shortly.
If you have any comments or suggestions please feel free to leave them below.