PYNQ 3.0.1
Vivado 2022.1
RFSoC 4x2
Hi everyone,
Summary: I’m having trouble sending data from the DMA to the DAC, and I don’t know if my issue is purely code, or both code and hardware.
I’d like to give a little context so that readers know my level of knowledge. I’m an undergraduate student researcher that has temporarily taken over a project for a grad student. The student I took over for was stuck on sending a signal from the DMA to the DAC for viewing on oscilloscope, and I’m trying to clear that hurdle.
Coming into this, I had some basic Verilog and Altera experience, and I’ve spent the last two months trying in earnest to learn PYNQ, Vivado, AXI, and Zynq UltraScale+. I think I have a passable knowledge at this point, but I still feel very much like a beginner. I’ve understood the tutorials and guides I’ve worked through, but I’m having a lot of trouble synthesizing it all into a working design. Unfortunately, I’ll be ending my time with this project next week as classes start back up. I’ve been spending recent weeks combing through these forums for similar issues and trying to incorporate those solutions into my work. Since I’m running out of time, though, I’ve reached the point where I think the only way I’ll solve this problem is to ask for (probably too much) help on my entire design.
The Hardware:
Most of my block diagrams crash my board for reasons that I don’t understand. They often fail at one of these three lines of code:
ol = Overlay(‘filename’)
dma = ol.axi_dma_0
dac = ol.usp_rf_data_converter_0
This morning, however, I was able to finally produce an initial design that didn’t crash on these assignments. Additionally, I was then able to then modify that design to add an ILA module (all of my previous working designs break with the addition of the ILA).
However, I don’t know if this design is conceptually sound for the task of sending a repeating signal from the DMA to the DAC. This design is based on marioruiz’s DMA ILA troubleshooting tutorials, with the RF Data Converter in-place of the loopback FIFO. My understanding is that the DAC tiles on the RFSoC 4x2 contain a FIFO, so this swap seems sound to me.
I’m including some screenshots of settings, but if there is a potential problem not shown in them, I’m including the .tcl file later in this post.
RF DC settings
MPSoC PL clock settings
Additionally, I had to modify the DMA read channel parameters so that the bus width matched my DAC AXIS input.
The software:
I have less confidence in my software design than in my hardware. In particular, I don’t know what lines I need to include to make the DAC receive and output the data that the DMA produces.
My current code is as follows and runs correctly up to the indicated position.
from pynq import Overlay, allocate, PL
import numpy as np
PL.reset()
ol = Overlay(‘dma_to_dac_wrapper.bit’)
dma = ol.axi_dma_0
dma_send = ol.axi_dma_0.sendchannel
dac = ol.usp_rf_data_converter_0
data_size = 1000
input_buffer = allocate(shape=(data_size,), dtype=np.uint32)
for i in range(data_size):input_buffer[i] = np.random.randint(0, 2**14)
The code works correctly up until this point. In the DMA loopback ILA post linked above, when the DMA sends data, we have to be sure to prompt the DMA to receive the data so that the FIFO does not get filled and hang the code. I’m assuming a similar operation is needed for the DAC since I do see code hanging if I use dma_send.transfer() only, but I’m unsure of what that DAC-receiving code should be. I’ve tried both read() and write() commands that I see listed in the help() output, but I’ve yet to be successful with them.
while True:
dma_send.transfer(input_buffer)
# dac.read() # ??
# dac.write(?,?) # ??
dma_send.wait()
Assuming my hardware is correct, can anyone suggest what I might be missing from my code that will allow me to send a repeating output from DMA to DAC that will be observable on an oscilloscope?
Any help on what is surely my plethora of issues with my design would be deeply appreciated.
This zip contains the .tcl, .bit, .hwh, and .ipynb files that I’ve been working with.
DMA_to_DAC.zip (770.3 KB)