- PYNQ version & Board name & Tool Version
pynq version 2.7
board name: ZCU111
I am trying to transfer data into the dac and receive back in the adc. However, the data does not come back. it is random data that is being store at the dma. I did an overlay with the dma along, and it works fine. it does not work when i add the data converters.
here is the dma setup:
ADC setup:
DAC setup:
overlay setup.pdf (135.8 KB)
code used:
from pynq import Overlay
from pynq import allocate
import numpy as np
import xrfclk
import xrfdc
# Set the reference clock frequency
xrfclk.set_all_ref_clks(409.6)
# Load the overlay
ol = Overlay('/home/xilinx/jupyter_notebooks/Own_experiments/assets/rf_data_wrapper1.bit')
# DMA RX
dma_read = ol.axi_dma_0.recvchannel
# DAC setup
dac_tile = ol.usp_rf_data_converter_0.dac_tiles[1]
dac_tile.DynamicPLLConfig(1, 409.6, 1228.8)
dac_block = dac_tile.blocks[2]
event = xrfdc.EVNT_SRC_TILE
dac_block.MixerSettings['Freq'] = 900
dac_block.MixerSettings['PhaseOffset'] = 0.0
dac_block.MixerSettings['EventSource'] = event
dac_block.UpdateEvent(event)
dac_tile.SetupFIFO(True)
# DMA TX
dma_write = ol.axi_dma_0.sendchannel
# ADC setup
adc_tile = ol.usp_rf_data_converter_0.adc_tiles[0]
adc_block = adc_tile.blocks[0]
event = xrfdc.EVNT_SRC_TILE
adc_block.MixerSettings['Freq'] = 900
adc_block.MixerSettings['PhaseOffset'] = 0.0
adc_block.MixerSettings['EventSource'] = event
adc_block.UpdateEvent(event)
adc_tile.SetupFIFO(True)
# Buffer length and sine wave parameters
buffer_length = 1500
amplitude = 32767 # Half of the maximum value for a 16-bit DAC
frequency = 250
sample_rate = 10000
# Generate time values
t = np.arange(0, buffer_length/sample_rate, 1/sample_rate)
sine_wave = amplitude * np.sin(2 * np.pi * frequency * t)
# Allocate buffers for DMA transfer
input_buffer = allocate(shape=(buffer_length,), dtype=np.float32)
output_buffer = allocate(shape=(buffer_length,), dtype=np.float32)
# # Copy the scaled data to the input buffer
# input_buffer[:] = scaled_data
# Copy the sine wave to the input buffer
input_buffer[:] = sine_wave
# Start DMA transfers
dma_write.start()
dma_read.start()
dma_write.transfer(input_buffer)
dma_read.transfer(output_buffer)
dma_write.wait()
dma_read.wait()
for i in range(10):
print(output_buffer[i])
I try sending fix data, and it doesn't work either.
if anyone can help me i will appreciated.