Hello,
I am testing the ad9081_tdd_example code: https://github.com/analogdevicesinc/pyadi-iio/blob/a5eb253aa30678fead58dae7df06b9a7dce3c1be/examples/ad9081_tdd_example.py#L14
My hardware setup is ZCU102 + AD9081 Evaluation board. I run the above code on the VMware Ubuntu 20.04.
But there are some errors:
pci@pci-virtual-machine:~/Documents$ /bin/python3 /home/pci/Documents/ad9081.py
Traceback (most recent call last):
File "/home/pci/Documents/ad9081.py", line 72, in <module>
rx_sig = trx.rx()
File "/home/pci/.local/lib/python3.8/site-packages/adi/rx_tx.py", line 293, in rx
data = self.__rx_complex()
File "/home/pci/.local/lib/python3.8/site-packages/adi/rx_tx.py", line 258, in __rx_complex
x = self.__rx_buffered_data()
File "/home/pci/.local/lib/python3.8/site-packages/adi/rx_tx.py", line 235, in __rx_buffered_data
self.__rxbuf.refill()
File "/home/pci/.local/lib/python3.8/site-packages/iio.py", line 1003, in refill
_buffer_refill(self._buffer)
File "/home/pci/.local/lib/python3.8/site-packages/iio.py", line 62, in _check_negative
raise OSError(-result, _strerror(-result))
TimeoutError: [Errno 110] Connection timed out
The following is the complete code:
# Copyright (C) 2021 Analog Devices, Inc.
#
# SPDX short identifier: ADIBSD
import sys
import adi
import matplotlib.pyplot as plt
import numpy as np
url = "ip:192.168.0.101" if len(sys.argv) == 1 else sys.argv[1]
trx = adi.ad9081(url)
tdd = adi.tdd(url)
trx.rx_channel_nco_frequencies = [0] * 4
trx.tx_channel_nco_frequencies = [0] * 4
trx.rx_main_nco_frequencies = [2450000000] * 4
trx.tx_main_nco_frequencies = [2450000000] * 4
trx.rx_enabled_channels = [0]
trx.tx_enabled_channels = [0]
trx.rx_nyquist_zone = ["odd"] * 4
N_rx = 2 ** 15
trx.rx_buffer_size = N_rx
trx.tx_cyclic_buffer = True
# Automatically enabled by TDD device tree
# trx.tx_ddr_offload = 1
# Generate TX signal
fs = int(trx.tx_sample_rate)
A = 0.5 * 2 ** 14 # -6 dBFS
B = fs / 2.5 # 100 MHz wide pulse @ 250 MS/s; 200 MHz @ 500 MS/s
N = 2 ** 14
T = N / fs
t = np.linspace(-T / 2, T / 2, N, endpoint=False)
tx_sig = A * np.sinc(B * t)
tx_sig_2 = A * np.exp(2j * np.pi * B * t)
tdd.en = False
# Setup TDD
tdd.frame_length_ms = 40.0
tdd.burst_count = 0
tdd.dma_gateing_mode = "rx_tx"
tdd.en_mode = "rx_tx"
tdd.secondary = False
tdd.en = True
# We only need to "trigger" the buffer, it doesn't need to stay high in this use case.
# The secondary values are disabled and unused
#
# Primary Secondary
# on off on off
tdd.tx_dma_raw = [1010, 1020, 0, 0]
tdd.rx_dma_raw = [10, 20, 0, 0]
# Send off TX data
trx.tx(tx_sig)
rx_t = np.linspace(0, N_rx / fs, N_rx, endpoint=False)
for r in range(40):
rx_sig = trx.rx()
if r == 20:
trx.tx_destroy_buffer()
trx.tx(tx_sig_2)
plt.clf()
plt.plot(1000000 * rx_t, np.abs(rx_sig))
plt.legend(["RX Signal", "TX Signal"])
plt.xlabel("t / µs")
plt.ylabel("Amplitude")
plt.draw()
plt.pause(0.10)
plt.show()
Could you give me some advice? Thanks!
Best,
Dongyu