Storing data from sensors at PYNQ-Z2


I am using PYNQ-Z2 for data acquisition from sensors. To obtain data I am using a custom VHDL module which communicates with sensors via SPI. After that the data is transferred to PS where using a jupyter notebook I can convert it to physical values and write to a txt file.

I tried two approaches to do that:

  1. Data readed from sensors is transferred to PS continuously during measurements. Issue with that approach is that sending data to a jupyter notebook is too slow and it is skipping some samples from sensors. Solution for that could be use of DMA but it generates few question marks in my head:
  • Can I actually connect a custom VHDL module to DMA in vivado?

  • Using this approach at jupyter Notebook I was able to read samples with frequency 3 kHZ. One sample is 72 bits. Is there a way to estimate how much the DMA can accelerate the reading process?

  • I am not sure how the DMA works with FPGA. Could I read the data directly from the VHDL module or first I should write it to some memory?

  1. Data readed from sensors is written to a FIFO so I don’t have a problem with losing samples anymore. However, the issue with that is I am already using all available BRAM blocks and FIFO is getting full too fast. I know I can not use BRAM to store a data so I thought to use other memories available on the board:
  • 512MB DDR3 is dynamic memory and I believe it is mostly used for PS so using it with PL it is not a way, but maybe I am wrong?
  • 16MB Quad-SPI Flash I think this is the best option but, can I still use it while the jumper on board is in position SD?
  • Can I use a MicroSD card to store the data while the same card has a PYNQ-Z2 image?

So to sum up I would like to save data from sensors to a txt file with the highest possible frequency but it does not have to be in real time. With this post I would like to ask about advice in which direction I should go. As you probably figured it out I have little experience so any direction which I will follow will take some time therefore I would like to choose it right. I will appreciate any suggestions, comments and materials.

Best regards.

1 Like

You can write directly to the DDR3 from the PL using the AXI HP ports.

This is a HLS tutorial on AXI masters, but it may help you understand what you can do.
If you don’t want to use HLS, you could use a VHDL AXI master controller.
You need to allocate a (contiguous) memory buffer in DRAM, and send the address of this buffer to your PL IP.

This is probably what you want to do.