def test_adrv9002_rx_data(test_dma_rx, iio_uri, classname, channel, use_rx2): import adi sdr = adi.adrv9002(iio_uri) if sdr._rx_dma_mode == "combined" and use_rx2: pytest.skip("Combined DMA mode does not have RX2 ADC") elif sdr._rx_dma_mode == "split" and channel > 0: pytest.skip( "Split DMA mode does not have more than one channel per ADC") sdr.digital_gain_control_mode_chan0 = "automatic" sdr.digital_gain_control_mode_chan1 = "automatic" test_dma_rx(iio_uri, classname, channel, use_rx2)
def test_adrv9002_cw_loopback_split_dma(test_cw_loopback, iio_uri, classname, channel, param_set, use_tx2rx2): import adi sdr = adi.adrv9002(iio_uri) # it's safe to only look at TX as we cannot TX in MIMO and RX in split mode if sdr._tx_dma_mode == "combined" and use_tx2rx2: pytest.skip("Combined DMA mode does not have RX2/TX2 ADC/DDS") elif sdr._tx_dma_mode == "split" and channel > 0: pytest.skip( "Split DMA mode does not have more than one channel per ADC/DDS") test_cw_loopback(iio_uri, classname, channel, param_set, use_tx2rx2, use_tx2rx2)
def test_adrv9002_tx_data(test_dma_tx, iio_uri, classname, channel, use_tx2): import adi # The point here is to skip tests that do not make sense. For combined DMA # we do not have any tx2/rx2 devices so that the test would fail with tx2/rx2 flags. # For split mode, we just have one complex channel per device so that the tests with # channel > 0 would also fail. This logic is also used in the rest of the DMA # tests. sdr = adi.adrv9002(iio_uri) if sdr._tx_dma_mode == "combined" and use_tx2: pytest.skip("Combined DMA mode does not have TX2 DDS") elif sdr._tx_dma_mode == "split" and channel > 0: pytest.skip( "Split DMA mode does not have more than one channel per DDS") test_dma_tx(iio_uri, classname, channel, use_tx2)
def test_adrv9002_stream_profile_write_both(iio_uri): import adi sdr = adi.adrv9002(iio_uri) sdr.write_stream_profile(lte_5_cmos_stream, lte_5_cmos_profile)
import time import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal sdr = adi.adrv9002(uri="ip:192.168.86.58") sdr.digital_gain_control_mode_chan0 = "Gain_Compensation_manual_control" sdr.digital_gain_control_mode_chan1 = "Gain_Compensation_manual_control" sdr.interface_gain_chan0 = "-12dB" sdr.interface_gain_chan1 = "-12dB" sdr.rx_ensm_mode_chan0 = "rf_enabled" sdr.rx_ensm_mode_chan1 = "rf_enabled" sdr.tx_hardwaregain_chan0 = -20 sdr.tx_ensm_mode_chan0 = "rf_enabled" sdr.tx_cyclic_buffer = True fs = int(sdr.rx0_sample_rate) # Set single DDS tone for TX on one transmitter sdr.dds_single_tone(-3000000, 0.9, channel=0) # Create a sinewave waveform # fc = 1000000 # N = 1024 # ts = 1 / float(fs) # t = np.arange(0, N * ts, ts) # i = np.cos(2 * np.pi * t * fc) * 2 ** 14 # q = np.sin(2 * np.pi * t * fc) * 2 ** 14 # iq = i + 1j * q
def test_adrv9002(iio_uri): dev = adi.adrv9002(iio_uri) assert dev del dev