From 431dce9e8909678a19a1305ce0ff7330dbf21638 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 11 Mar 2024 14:21:17 +0800 Subject: [PATCH 01/13] tests: add hardware name adrv9371/5 Signed-off-by: Trecia Agoylo --- test/test_ad9371.py | 2 +- test/test_ad9375.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_ad9371.py b/test/test_ad9371.py index e8d86a2d1..7a8f465ab 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -3,7 +3,7 @@ import pytest -hardware = "ad9371" +hardware = ["ad9371", "adrv9371"] classname = "adi.ad9371" profile_path = dirname(realpath(__file__)) + "/ad9371_5_profiles/" diff --git a/test/test_ad9375.py b/test/test_ad9375.py index 7718fb752..88c9e56c8 100644 --- a/test/test_ad9375.py +++ b/test/test_ad9375.py @@ -3,7 +3,7 @@ import pytest -hardware = "ad9375" +hardware = ["ad9375", "adrv9375"] classname = "adi.ad9375" profile_path = dirname(realpath(__file__)) + "/ad9371_5_profiles/" From b52189041f8c723db7fd087ccac0c4f2659bdacd Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 11 Mar 2024 11:12:14 +0800 Subject: [PATCH 02/13] tests: update obs test for adrv9371 and adrv9009 Signed-off-by: Trecia Agoylo --- test/common.py | 7 +++++++ test/test_ad9371.py | 4 ++++ test/test_adrv9009_p.py | 3 +++ 3 files changed, 14 insertions(+) diff --git a/test/common.py b/test/common.py index 94d88b018..7ab136852 100644 --- a/test/common.py +++ b/test/common.py @@ -25,6 +25,9 @@ def pytest_configure(config): config.addinivalue_line( "markers", "obs_required: mark tests that require observation data paths" ) + config.addinivalue_line( + "markers", "no_obs_required: mark tests that require observation data paths" + ) config.addinivalue_line("markers", "lvds_test: mark tests for LVDS") config.addinivalue_line("markers", "cmos_test: mark tests for CMOS") @@ -73,6 +76,10 @@ def pytest_runtest_setup(item): pytest.skip( "Testing requiring observation disabled. Use --obs-enable flag to enable" ) + if obs and "no_obs_required" in marks: + pytest.skip( + "Testing requiring observation enabled. Skipping this test" + ) # Handle CMOS and LVDS tests cmos = item.config.getoption("--cmos") diff --git a/test/test_ad9371.py b/test/test_ad9371.py index 7a8f465ab..a93b2ecd6 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -477,6 +477,7 @@ def test_ad9371_rx_data(test_dma_rx, iio_uri, classname, channel): ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @@ -598,6 +599,7 @@ def test_ad9371_dds_loopback_for_obs( ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @@ -669,6 +671,7 @@ def test_ad9371_two_tone_loopback_with_10dB_splitter( ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @@ -743,6 +746,7 @@ def test_ad9371_dds_gain_check_vary_power_with_10dB_splitter( ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) diff --git a/test/test_adrv9009_p.py b/test/test_adrv9009_p.py index f50f68b96..d4a0da98c 100644 --- a/test/test_adrv9009_p.py +++ b/test/test_adrv9009_p.py @@ -378,6 +378,7 @@ def test_adrv9009_rx_data(test_dma_rx, iio_uri, classname, channel): ######################################## +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @@ -706,6 +707,7 @@ def test_adrv9009_dds_gain_check_agc_with_10db_splitter( ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @@ -835,6 +837,7 @@ def test_adrv9009_dds_gain_check_vary_power_with_10dB_splitter( ######################################### # TODO: Test, see what's its difference with dds_loopback, PROBLEMATIC # OSError: [Errno 5] Input/output error +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0]) From c11e05d6aa0c8f7fa133abecc12c1259643103a3 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Tue, 2 Apr 2024 11:17:40 +0800 Subject: [PATCH 03/13] tests: remove ad9371 orx2 tests Signed-off-by: Trecia Agoylo --- test/test_ad9371.py | 162 ++------------------------------------------ 1 file changed, 6 insertions(+), 156 deletions(-) diff --git a/test/test_ad9371.py b/test/test_ad9371.py index a93b2ecd6..64e24a688 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -251,90 +251,6 @@ obs_hardwaregain=0, obs_temp_comp_gain=-3, ), - obs_orx2_manual=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=0, - ), - obs_orx2_change_attenuation_10dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=-10, - tx_hardwaregain_chan1=-10, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=0, - ), - obs_orx2_change_rf_gain_10dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=10, - obs_temp_comp_gain=0, - ), - obs_orx2_change_rf_gain_5dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=5, - obs_temp_comp_gain=0, - ), - obs_orx2_change_temp_gain_up=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=3, - ), - obs_orx2_change_temp_gain_down=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=-3, - ), snf_orx1_manual=dict( ensm_mode="radio_on", tx_lo=2500000000, @@ -390,63 +306,7 @@ obs_gain_control_mode="manual", obs_hardwaregain=5, obs_temp_comp_gain=0, - ), - snf_orx2_manual=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_SN_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=0, - ), - snf_orx2_change_attenuation_10dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=-10, - tx_hardwaregain_chan1=-10, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_SN_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=0, - ), - snf_orx2_change_rf_gain_10dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_SN_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=10, - obs_temp_comp_gain=0, - ), - snf_orx2_change_rf_gain_5dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX2_SN_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=5, - obs_temp_comp_gain=0, - ), + ) ) @@ -519,7 +379,7 @@ def test_ad9371_dds_loopback( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1]) +@pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( "param_set, frequency, scale, peak_min", [ @@ -566,17 +426,9 @@ def test_ad9371_dds_loopback_with_10dB_splitter( (0, params_obs["obs_orx1_change_rf_gain_5dB"]), (0, params_obs["obs_orx1_change_temp_gain_up"]), (0, params_obs["obs_orx1_change_temp_gain_down"]), - (1, params_obs["obs_orx2_manual"]), - (1, params_obs["obs_orx2_change_rf_gain_10dB"]), - (1, params_obs["obs_orx2_change_rf_gain_5dB"]), - (1, params_obs["obs_orx2_change_temp_gain_up"]), - (1, params_obs["obs_orx2_change_temp_gain_down"]), (0, params_obs["snf_orx1_manual"]), (0, params_obs["snf_orx1_change_rf_gain_10dB"]), (0, params_obs["snf_orx1_change_rf_gain_5dB"]), - (1, params_obs["snf_orx2_manual"]), - (1, params_obs["snf_orx2_change_rf_gain_10dB"]), - (1, params_obs["snf_orx2_change_rf_gain_5dB"]), ], ) @pytest.mark.parametrize( @@ -638,7 +490,7 @@ def test_ad9371_two_tone_loopback( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1]) +@pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( "param_set, frequency1, scale1, peak_min1, frequency2, scale2, peak_min2", [(params["one_cw_tone_auto"], 1000000, 0.06, -41, 2000000, 0.12, -35)], @@ -711,7 +563,7 @@ def test_ad9371_dds_gain_check_vary_power( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1]) +@pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( "param_set, dds_scale", [ @@ -774,7 +626,7 @@ def test_ad9371_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1]) +@pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( "param_set", [ @@ -805,9 +657,7 @@ def test_ad9371_sfdr_with_10dB_splitter( "channel, param_set, sfdr_min", [ (0, params_obs["obs_orx1_change_attenuation_10dB"], 45), - (0, params_obs["snf_orx1_change_attenuation_10dB"], 30), - (1, params_obs["obs_orx2_change_attenuation_10dB"], 45), - (1, params_obs["snf_orx2_change_attenuation_10dB"], 30), + (0, params_obs["snf_orx1_change_attenuation_10dB"], 30) ], ) @pytest.mark.parametrize("use_obs", [True]) From 345aff44557108b37cfbfb2a2d96ee9a97154509 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 15 Jul 2024 15:17:01 +0800 Subject: [PATCH 04/13] ad937x: check first if decimation is enabled in project Signed-off-by: Trecia Agoylo --- adi/ad937x.py | 65 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/adi/ad937x.py b/adi/ad937x.py index f26d186da..980260929 100644 --- a/adi/ad937x.py +++ b/adi/ad937x.py @@ -170,45 +170,58 @@ def tx_rf_bandwidth(self): @property def rx_enable_dec8(self): """rx_enable_dec8: Enable x8 decimation filter in RX path""" - avail = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency_available", False, self._rxadc - ) - avail = avail.strip().split(" ") val = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency", False, self._rxadc - ) - return val == avail[1] + "voltage0_i", "sampling_frequency", False, self._rxadc + ) + avail = None + try: + avail = self._get_iio_attr_str( + "voltage0_i", "sampling_frequency_available", False, self._rxadc + ) + avail = avail.strip().split(" ") + return val == avail[1] + except KeyError: + return val == avail @rx_enable_dec8.setter def rx_enable_dec8(self, value): - avail = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency_available", False, self._rxadc - ) - avail = sorted(avail.strip().split(" ")) - val = int(avail[1] if value else avail[0]) - self._set_iio_attr("voltage0_i", "sampling_frequency", False, val, self._rxadc) + try: + avail = self._get_iio_attr_str( + "voltage0_i", "sampling_frequency_available", False, self._rxadc + ) + avail = sorted(avail.strip().split(" ")) + val = int(avail[1] if value else avail[0]) + self._set_iio_attr("voltage0_i", "sampling_frequency", False, val, self._rxadc) + except KeyError: + print("x8 decimation filter is not supported.") @property def tx_enable_int8(self): """tx_enable_int8: Enable x8 interpolation filter in TX path""" - avail = self._get_iio_attr_str( - "voltage0", "sampling_frequency_available", True, self._txdac - ) - avail = avail.strip().split(" ") val = self._get_iio_attr_str( "voltage0", "sampling_frequency", True, self._txdac - ) - return val == avail[1] + ) + avail = None + try: + avail = self._get_iio_attr_str( + "voltage0", "sampling_frequency_available", True, self._txdac + ) + avail = avail.strip().split(" ") + return val == avail[1] + except KeyError: + return val == avail @tx_enable_int8.setter def tx_enable_int8(self, value): - avail = self._get_iio_attr_str( - "voltage0", "sampling_frequency_available", True, self._txdac - ) - avail = sorted(avail.strip().split(" ")) - val = int(avail[1] if value else avail[0]) - self._set_iio_attr("voltage0", "sampling_frequency", True, val, self._txdac) - + try: + avail = self._get_iio_attr_str( + "voltage0", "sampling_frequency_available", True, self._txdac + ) + avail = sorted(avail.strip().split(" ")) + val = int(avail[1] if value else avail[0]) + self._set_iio_attr("voltage0", "sampling_frequency", True, val, self._txdac) + except KeyError: + print("x8 decimation filter is not supported.") @property def rx_sample_rate(self): """rx_sample_rate: Sample rate RX path in samples per second From bda546b0af8331cef880a305fa464d8151700539 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Wed, 17 Jul 2024 08:45:34 +0800 Subject: [PATCH 05/13] ad9371: update examples Signed-off-by: Trecia Agoylo --- examples/ad9371.py | 10 ++++++++-- examples/ad9371_dec8.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/ad9371.py b/examples/ad9371.py index 87c16454c..84a95db3e 100644 --- a/examples/ad9371.py +++ b/examples/ad9371.py @@ -3,14 +3,19 @@ # SPDX short identifier: ADIBSD import time - +import sys import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal +# Optionally pass URI as command line argument, +# else use default context manager search +my_uri = sys.argv[1] if len(sys.argv) >= 2 else None +print("uri: " + str(my_uri)) + # Create radio -sdr = adi.ad9371() +sdr = adi.ad9371(uri=my_uri) # Configure properties sdr.rx_enabled_channels = [0, 1] @@ -48,6 +53,7 @@ # Collect data fsr = int(sdr.rx_sample_rate) +print(fsr) for r in range(20): x = sdr.rx() f, Pxx_den = signal.periodogram(x[0], fsr) diff --git a/examples/ad9371_dec8.py b/examples/ad9371_dec8.py index 6e2e703b2..10ee9a0a9 100644 --- a/examples/ad9371_dec8.py +++ b/examples/ad9371_dec8.py @@ -3,14 +3,20 @@ # SPDX short identifier: ADIBSD import time +import sys import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal +# Optionally pass URI as command line argument, +# else use default context manager search +my_uri = sys.argv[1] if len(sys.argv) >= 2 else None +print("uri: " + str(my_uri)) + # Create radio -sdr = adi.ad9371(uri="ip:192.168.86.55") +sdr = adi.ad9371(uri=my_uri) # Configure properties sdr.rx_enabled_channels = [0, 1] @@ -65,4 +71,4 @@ plt.pause(0.05) time.sleep(0.1) -# plt.show() +plt.show() From 5e73ed9a7aefd6f9614057155a421ff82d136d34 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Wed, 17 Jul 2024 08:47:14 +0800 Subject: [PATCH 06/13] ad937x: fix tests Signed-off-by: Trecia Agoylo --- test/test_ad9371.py | 179 ++++++++++++++------------------------------ test/test_ad9375.py | 10 ++- 2 files changed, 65 insertions(+), 124 deletions(-) diff --git a/test/test_ad9371.py b/test/test_ad9371.py index 64e24a688..e76cb57f8 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -9,6 +9,9 @@ profile_path = dirname(realpath(__file__)) + "/ad9371_5_profiles/" test_profiles = [join(profile_path, f) for f in listdir(profile_path)] +# use 6in sma cables +# for obs setup, add only splitter to TX1->RX1/ORX1 + params = dict( one_cw_tone_manual=dict( ensm_mode="radio_on", @@ -17,28 +20,20 @@ gain_control_mode="manual", rx_hardwaregain_chan0=10, rx_hardwaregain_chan1=10, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=0, tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), one_cw_tone_auto=dict( ensm_mode="radio_on", tx_lo=2500000000, rx_lo=2500000000, gain_control_mode="automatic", - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=-10, tx_hardwaregain_chan1=-10, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_attenuation_5dB_manual=dict( ensm_mode="radio_on", @@ -47,14 +42,10 @@ gain_control_mode="manual", rx_hardwaregain_chan0=10, rx_hardwaregain_chan1=10, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=-5, tx_hardwaregain_chan1=-5, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_attenuation_10dB_manual=dict( ensm_mode="radio_on", @@ -63,42 +54,30 @@ gain_control_mode="manual", rx_hardwaregain_chan0=10, rx_hardwaregain_chan1=10, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=-10, tx_hardwaregain_chan1=-10, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_attenuation_0dB_auto=dict( ensm_mode="radio_on", tx_lo=2500000000, rx_lo=2500000000, gain_control_mode="automatic", - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=0, tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_attenuation_20dB_auto=dict( ensm_mode="radio_on", tx_lo=2500000000, rx_lo=2500000000, gain_control_mode="automatic", - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=0, rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=-20, tx_hardwaregain_chan1=-20, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_rf_gain_0dB_manual=dict( ensm_mode="radio_on", @@ -107,14 +86,8 @@ gain_control_mode="manual", rx_hardwaregain_chan0=0, rx_hardwaregain_chan1=0, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, - rx_temp_comp_gain_chan0=0, - rx_temp_comp_gain_chan1=0, tx_hardwaregain_chan0=0, tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_rf_gain_20dB_manual=dict( ensm_mode="radio_on", @@ -123,14 +96,14 @@ gain_control_mode="manual", rx_hardwaregain_chan0=20, rx_hardwaregain_chan1=20, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, - rx_temp_comp_gain_chan0=0, - rx_temp_comp_gain_chan1=0, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, + ), + change_rf_gain_10dB_manual=dict( + ensm_mode="radio_on", + tx_lo=2500000000, + rx_lo=2500000000, + gain_control_mode="manual", + rx_hardwaregain_chan0=10, + rx_hardwaregain_chan1=10, ), change_temp_gain_up=dict( ensm_mode="radio_on", @@ -139,14 +112,10 @@ gain_control_mode="manual", rx_hardwaregain_chan0=10, rx_hardwaregain_chan1=10, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=3, rx_temp_comp_gain_chan1=3, tx_hardwaregain_chan0=0, tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), change_temp_gain_down=dict( ensm_mode="radio_on", @@ -155,14 +124,10 @@ gain_control_mode="manual", rx_hardwaregain_chan0=10, rx_hardwaregain_chan1=10, - rx_quadrature_tracking_en_chan0=1, - rx_quadrature_tracking_en_chan1=1, rx_temp_comp_gain_chan0=-3, rx_temp_comp_gain_chan1=-3, tx_hardwaregain_chan0=0, tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, ), ) @@ -178,7 +143,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_TX_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, + obs_hardwaregain=30, obs_temp_comp_gain=0, ), obs_orx1_change_attenuation_10dB=dict( @@ -192,24 +157,10 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_TX_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, - obs_temp_comp_gain=0, - ), - obs_orx1_change_rf_gain_10dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX1_TX_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=10, + obs_hardwaregain=30, obs_temp_comp_gain=0, ), - obs_orx1_change_rf_gain_5dB=dict( + obs_orx1_change_rf_gain_20dB=dict( ensm_mode="radio_on", tx_lo=2500000000, tx_hardwaregain_chan0=0, @@ -220,7 +171,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_TX_LO", obs_gain_control_mode="manual", - obs_hardwaregain=5, + obs_hardwaregain=20, obs_temp_comp_gain=0, ), obs_orx1_change_temp_gain_up=dict( @@ -234,7 +185,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_TX_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, + obs_hardwaregain=30, obs_temp_comp_gain=3, ), obs_orx1_change_temp_gain_down=dict( @@ -248,7 +199,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_TX_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, + obs_hardwaregain=30, obs_temp_comp_gain=-3, ), snf_orx1_manual=dict( @@ -262,7 +213,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_SN_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, + obs_hardwaregain=30, obs_temp_comp_gain=0, ), snf_orx1_change_attenuation_10dB=dict( @@ -276,10 +227,10 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_SN_LO", obs_gain_control_mode="manual", - obs_hardwaregain=0, + obs_hardwaregain=30, obs_temp_comp_gain=0, ), - snf_orx1_change_rf_gain_10dB=dict( + snf_orx1_change_rf_gain_20dB=dict( ensm_mode="radio_on", tx_lo=2500000000, tx_hardwaregain_chan0=0, @@ -290,21 +241,7 @@ obs_quadrature_tracking_en=1, obs_rf_port_select="ORX1_SN_LO", obs_gain_control_mode="manual", - obs_hardwaregain=10, - obs_temp_comp_gain=0, - ), - snf_orx1_change_rf_gain_5dB=dict( - ensm_mode="radio_on", - tx_lo=2500000000, - tx_hardwaregain_chan0=0, - tx_hardwaregain_chan1=0, - tx_quadrature_tracking_en_chan0=1, - tx_quadrature_tracking_en_chan1=1, - sn_lo=2500000000, - obs_quadrature_tracking_en=1, - obs_rf_port_select="ORX1_SN_LO", - obs_gain_control_mode="manual", - obs_hardwaregain=5, + obs_hardwaregain=20, obs_temp_comp_gain=0, ) ) @@ -379,7 +316,7 @@ def test_ad9371_dds_loopback( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0]) +@pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set, frequency, scale, peak_min", [ @@ -422,17 +359,15 @@ def test_ad9371_dds_loopback_with_10dB_splitter( "channel, param_set", [ (0, params_obs["obs_orx1_manual"]), - (0, params_obs["obs_orx1_change_rf_gain_10dB"]), - (0, params_obs["obs_orx1_change_rf_gain_5dB"]), + (0, params_obs["obs_orx1_change_rf_gain_20dB"]), (0, params_obs["obs_orx1_change_temp_gain_up"]), (0, params_obs["obs_orx1_change_temp_gain_down"]), (0, params_obs["snf_orx1_manual"]), - (0, params_obs["snf_orx1_change_rf_gain_10dB"]), - (0, params_obs["snf_orx1_change_rf_gain_5dB"]), + (0, params_obs["snf_orx1_change_rf_gain_20dB"]), ], ) @pytest.mark.parametrize( - "frequency, scale, peak_min, use_obs", [(5000000, 0.25, -40.5, True)] + "frequency, scale, peak_min, use_obs", [(5000000, 0.25, -52.5, True)] ) def test_ad9371_dds_loopback_for_obs( test_dds_loopback, @@ -490,7 +425,7 @@ def test_ad9371_two_tone_loopback( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0]) +@pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set, frequency1, scale1, peak_min1, frequency2, scale2, peak_min2", [(params["one_cw_tone_auto"], 1000000, 0.06, -41, 2000000, 0.12, -35)], @@ -530,18 +465,18 @@ def test_ad9371_two_tone_loopback_with_10dB_splitter( @pytest.mark.parametrize( "param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_manual"], 0.5, 8.5, 9.5), - (params["one_cw_tone_manual"], 0.12, 20.5, 21.5), - (params["one_cw_tone_manual"], 0.25, 14.5, 15.5), - (params["one_cw_tone_auto"], 0.12, 10.5, 11.5), - (params["change_attenuation_5dB_manual"], 0.25, 19.5, 20.5), - (params["change_attenuation_10dB_manual"], 0.25, 24.25, 25.25), - (params["change_attenuation_0dB_auto"], 0.12, 3.5, 4.75), - (params["change_attenuation_20dB_auto"], 0.12, 20.75, 22), - (params["change_rf_gain_0dB_manual"], 0.25, 24.75, 26), - (params["change_rf_gain_20dB_manual"], 0.25, 5, 6), - (params["change_temp_gain_up"], 0.25, 14.5, 15.5), - (params["change_temp_gain_down"], 0.25, 14.5, 15.5), + (params["one_cw_tone_manual"], 0.5, 8.5, 10.5), + (params["one_cw_tone_manual"], 0.12, 20.5, 22.5), + (params["one_cw_tone_manual"], 0.25, 14.5, 16.5), + (params["one_cw_tone_auto"], 0.12, 10.5, 13.5), + (params["change_attenuation_5dB_manual"], 0.25, 19.5, 22.5), + (params["change_attenuation_10dB_manual"], 0.25, 24.25, 26.25), + (params["change_attenuation_0dB_auto"], 0.12, 2.5, 5.5), + (params["change_attenuation_20dB_auto"], 0.12, 20.75, 23.75), + (params["change_rf_gain_0dB_manual"], 0.25, 24.75, 26.75), + (params["change_rf_gain_20dB_manual"], 0.25, 5, 7), + (params["change_temp_gain_up"], 0.25, 14.5, 16.5), + (params["change_temp_gain_down"], 0.25, 14.5, 16.5), ], ) def test_ad9371_dds_gain_check_vary_power( @@ -563,25 +498,23 @@ def test_ad9371_dds_gain_check_vary_power( @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( - "param_set, dds_scale", + "channel, param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_manual"], 0.5), - (params["one_cw_tone_manual"], 0.12), - (params["one_cw_tone_manual"], 0.25), - (params["one_cw_tone_auto"], 0.12), - (params["change_attenuation_5dB_manual"], 0.25), - (params["change_attenuation_10dB_manual"], 0.25), - (params["change_attenuation_0dB_auto"], 0.12), - (params["change_attenuation_20dB_auto"], 0.12), - (params["change_rf_gain_0dB_manual"], 0.25), - (params["change_rf_gain_20dB_manual"], 0.25), - (params["change_temp_gain_up"], 0.25), - (params["change_temp_gain_down"], 0.25), - ], + (0, params["one_cw_tone_manual"], 0.5, 18, 20.75), + (1, params["one_cw_tone_manual"], 0.5, 8, 10.75), + (0, params["one_cw_tone_auto"], 0.12, 21, 23.25), + (1, params["one_cw_tone_auto"], 0.12, 11, 13.25), + (0, params["change_attenuation_5dB_manual"], 0.25, 29, 31.25), + (1, params["change_attenuation_5dB_manual"], 0.25, 19, 21.5), + (0, params["change_attenuation_0dB_auto"], 0.12, 11, 13.5), + (1, params["change_attenuation_0dB_auto"], 0.12, 2, 5.5), + (0, params["change_rf_gain_0dB_manual"], 0.25, 34, 36.5), + (1, params["change_rf_gain_0dB_manual"], 0.25, 24, 26.5), + (0, params["change_temp_gain_up"], 0.25, 24, 26.5), + (1, params["change_temp_gain_up"], 0.25, 14, 16.5), + ] ) -@pytest.mark.parametrize("min_rssi, max_rssi", [(10, 50)]) def test_ad9371_dds_gain_check_vary_power_with_10dB_splitter( test_gain_check, iio_uri, @@ -612,7 +545,7 @@ def test_ad9371_dds_gain_check_vary_power_with_10dB_splitter( params["change_attenuation_0dB_auto"], params["change_attenuation_20dB_auto"], params["change_rf_gain_0dB_manual"], - params["change_rf_gain_20dB_manual"], + params["change_rf_gain_10dB_manual"], params["change_temp_gain_up"], params["change_temp_gain_down"], ], @@ -626,7 +559,7 @@ def test_ad9371_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min @pytest.mark.obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0]) +@pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set", [ @@ -637,7 +570,7 @@ def test_ad9371_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min params["change_attenuation_0dB_auto"], params["change_attenuation_20dB_auto"], params["change_rf_gain_0dB_manual"], - params["change_rf_gain_20dB_manual"], + params["change_rf_gain_10dB_manual"], params["change_temp_gain_up"], params["change_temp_gain_down"], ], @@ -656,7 +589,7 @@ def test_ad9371_sfdr_with_10dB_splitter( @pytest.mark.parametrize( "channel, param_set, sfdr_min", [ - (0, params_obs["obs_orx1_change_attenuation_10dB"], 45), + (0, params_obs["obs_orx1_change_attenuation_10dB"], 30), (0, params_obs["snf_orx1_change_attenuation_10dB"], 30) ], ) diff --git a/test/test_ad9375.py b/test/test_ad9375.py index 88c9e56c8..485412192 100644 --- a/test/test_ad9375.py +++ b/test/test_ad9375.py @@ -161,6 +161,14 @@ tx_quadrature_tracking_en_chan0=1, tx_quadrature_tracking_en_chan1=1, ), + change_rf_gain_10dB_manual=dict( + ensm_mode="radio_on", + tx_lo=2500000000, + rx_lo=2500000000, + gain_control_mode="manual", + rx_hardwaregain_chan0=10, + rx_hardwaregain_chan1=10, + ), change_temp_gain_up=dict( ensm_mode="radio_on", tx_lo=2500000000, @@ -345,7 +353,7 @@ def test_ad9375_dds_gain_check_vary_power( params["change_attenuation_0dB_auto"], params["change_attenuation_20dB_auto"], params["change_rf_gain_0dB_manual"], - params["change_rf_gain_20dB_manual"], + params["change_rf_gain_10dB_manual"], params["change_temp_gain_up"], params["change_temp_gain_down"], ], From 3892190d3ee947edc6b32ac30fb1fb7edfb63d9b Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 29 Jul 2024 08:54:35 +0800 Subject: [PATCH 07/13] adrv9009: update obs lo attribute name Signed-off-by: Trecia Agoylo --- adi/adrv9009.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/adi/adrv9009.py b/adi/adrv9009.py index 13bb8c142..5282d07fb 100644 --- a/adi/adrv9009.py +++ b/adi/adrv9009.py @@ -38,7 +38,7 @@ def __init__(self, uri="", jesd_monitor=False, jesd=None): self._txdac = self._ctx.find_device("axi-adrv9009-tx-hpc") self._ctx.set_timeout(30000) # Needed for loading profiles if jesdadi and jesd_monitor: - self._jesd = jesd if jesd else jesdadi(uri=uri) + self._jesd = jesd if jesd else jesdadi(address=uri) rx_tx.__init__(self) self.obs = obs(self._ctx, self._rxobs, self._obs_channel_names) @@ -214,11 +214,11 @@ def obs_powerdown_en(self, value): @property def aux_obs_lo(self): """aux_obs_lo: Carrier frequency of ORx path""" - return self._get_iio_attr("altvoltage1", "AUX_OBS_RX_LO_frequency", True) + return self._get_iio_attr("altvoltage1", "frequency", True) @aux_obs_lo.setter def aux_obs_lo(self, value): - self._set_iio_attr("altvoltage1", "AUX_OBS_RX_LO_frequency", True, value) + self._set_iio_attr("altvoltage1", "frequency", True, value) @property def obs_quadrature_tracking_en(self): @@ -250,7 +250,6 @@ def obs_hardwaregain(self): @obs_hardwaregain.setter def obs_hardwaregain(self, value): - # if self.obs_gain_control_mode == "manual": self._set_iio_attr("voltage2", "hardwaregain", False, value) @property From b26812e2905ccf54a58d1cd534e61f221491c9ee Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 29 Jul 2024 09:00:03 +0800 Subject: [PATCH 08/13] adrv9009: fix tests Signed-off-by: Trecia Agoylo --- ...0_OR122p88_ORx_BW400_OR491p52_DC245p76.txt | 422 ++++++++++++++ test/test_adrv9009_p.py | 546 +++++++++--------- 2 files changed, 683 insertions(+), 285 deletions(-) create mode 100644 test/adrv9009_profiles/Tx_BW400_IR491p52_Rx_BW100_OR122p88_ORx_BW400_OR491p52_DC245p76.txt diff --git a/test/adrv9009_profiles/Tx_BW400_IR491p52_Rx_BW100_OR122p88_ORx_BW400_OR491p52_DC245p76.txt b/test/adrv9009_profiles/Tx_BW400_IR491p52_Rx_BW100_OR122p88_ORx_BW400_OR491p52_DC245p76.txt new file mode 100644 index 000000000..53f377b3b --- /dev/null +++ b/test/adrv9009_profiles/Tx_BW400_IR491p52_Rx_BW100_OR122p88_ORx_BW400_OR491p52_DC245p76.txt @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + -1 + 2 + 3 + -4 + -7 + 10 + 16 + -21 + -31 + 40 + 56 + -71 + -96 + 119 + 157 + -187 + -241 + 288 + 363 + -431 + -538 + 622 + 772 + -891 + -1105 + 1264 + 1582 + -1819 + -2335 + 2710 + 3697 + -4461 + -7201 + 9397 + 31111 + 31111 + 9397 + -7201 + -4461 + 3697 + 2710 + -2335 + -1819 + 1582 + 1264 + -1105 + -891 + 772 + 622 + -538 + -431 + 363 + 288 + -241 + -187 + 157 + 119 + -96 + -71 + 56 + 40 + -31 + -21 + 16 + 10 + -7 + -4 + 3 + 2 + -1 + 0 + + + + 265 + 146 + 181 + 90 + 1280 + 366 + 1257 + 27 + 1258 + 17 + 718 + 39 + 48 + 46 + 27 + 161 + 0 + 0 + 0 + 0 + 40 + 0 + 7 + 6 + 42 + 0 + 7 + 6 + 42 + 0 + 25 + 27 + 0 + 0 + 25 + 27 + 0 + 0 + 165 + 44 + 31 + 905 + + + + + + + + + + + + + + + + -25 + 14 + -13 + 1 + 19 + -52 + 60 + -65 + 4 + 233 + -1475 + 18937 + -1475 + 233 + 4 + -65 + 60 + -52 + 19 + 1 + -13 + 14 + -25 + 0 + + + + 152 + 162 + 181 + 90 + 1280 + 1307 + 1531 + 301 + 1435 + 148 + 972 + 6 + 48 + 47 + 36 + 205 + 0 + 0 + 0 + 0 + 51 + 0 + 0 + 6 + 24 + 0 + 0 + 6 + 24 + 0 + 25 + 27 + 0 + 0 + 25 + 27 + 0 + 0 + 165 + 44 + 15 + 905 + + + + 129 + 131 + 168 + 90 + 1280 + 2825 + 2289 + 0 + 1053 + 839 + 975 + 111 + 3 + 16 + 28 + 178 + 0 + 0 + 0 + 0 + 45 + 0 + 0 + 0 + 24 + 0 + 0 + 0 + 24 + 0 + 25 + 27 + 0 + 0 + 25 + 27 + 0 + 0 + 165 + 44 + 15 + 905 + + + + -107 + 419 + -302 + -398 + 990 + -471 + -1150 + 2212 + -598 + -4033 + 9267 + 21200 + 9267 + -4033 + -598 + 2212 + -1150 + -471 + 990 + -398 + -302 + 419 + -107 + + + + + + + + + + + + -25 + 14 + -13 + 1 + 19 + -52 + 60 + -65 + 4 + 233 + -1475 + 18937 + -1475 + 233 + 4 + -65 + 60 + -52 + 19 + 1 + -13 + 14 + -25 + 0 + + + + 243 + 143 + 181 + 90 + 1280 + 485 + 1275 + 37 + 1317 + 23 + 797 + 35 + 48 + 48 + 30 + 174 + 0 + 0 + 0 + 0 + 44 + 0 + 7 + 6 + 42 + 0 + 7 + 6 + 42 + 0 + 25 + 27 + 0 + 0 + 25 + 27 + 0 + 0 + 165 + 44 + 31 + 905 + + + + + + + + + + + + + + + + + + + 32 + -76 + 124 + -160 + 176 + -121 + -145 + 1031 + -3015 + 20138 + -3015 + 1031 + -145 + -121 + 176 + -160 + 124 + -76 + 32 + 0 + + + diff --git a/test/test_adrv9009_p.py b/test/test_adrv9009_p.py index d4a0da98c..6559d1b90 100644 --- a/test/test_adrv9009_p.py +++ b/test/test_adrv9009_p.py @@ -17,6 +17,9 @@ profile_path = dirname(realpath(__file__)) + "/adrv9009_profiles/" test_profiles = [join(profile_path, f) for f in listdir(profile_path)] +# use 6in sma cables +# for obs setup, add only splitter to TX1->RX1/ORX1 + params = dict( one_cw_tone_manual=dict( ensm_mode="radio_on", @@ -204,152 +207,152 @@ ), ) -# params_obs = dict( -# obs_tx=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_TX_LO", -# obs_hardwaregain=0, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_tx_change_attenuation_10dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=-10, -# tx_hardwaregain_chan1=-10, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_TX_LO", -# obs_hardwaregain=0, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_tx_change_rf_gain_10dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_TX_LO", -# obs_hardwaregain=10, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_tx_change_rf_gain_5dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_TX_LO", -# obs_hardwaregain=5, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_aux=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_AUX_LO", -# obs_hardwaregain=0, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_aux_change_attenuation_10dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=-10, -# tx_hardwaregain_chan1=-10, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_AUX_LO", -# obs_hardwaregain=0, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_aux_change_rf_gain_10dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_AUX_LO", -# obs_hardwaregain=10, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# obs_aux_change_rf_gain_5dB=dict( -# ensm_mode="radio_on", -# trx_lo=2500000000, -# rx_powerdown_en_chan0=1, -# rx_powerdown_en_chan1=1, -# obs_powerdown_en=0, -# tx_hardwaregain_chan0=0, -# tx_hardwaregain_chan1=0, -# tx_quadrature_tracking_en_chan0=1, -# tx_quadrature_tracking_en_chan1=1, -# aux_obs_lo=2500000000, -# obs_quadrature_tracking_en=1, -# obs_rf_port_select="OBS_AUX_LO", -# obs_hardwaregain=5, -# calibrate_rx_qec_en=1, -# calibrate_tx_qec_en=1, -# calibrate=1, -# ), -# ) +params_obs = dict( + obs_tx=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_TX_LO", + obs_hardwaregain=0, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_tx_change_attenuation_10dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=-10, + tx_hardwaregain_chan1=-10, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_TX_LO", + obs_hardwaregain=0, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_tx_change_rf_gain_10dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_TX_LO", + obs_hardwaregain=10, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_tx_change_rf_gain_5dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_TX_LO", + obs_hardwaregain=5, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_aux=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_AUX_LO", + obs_hardwaregain=0, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_aux_change_attenuation_10dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=-10, + tx_hardwaregain_chan1=-10, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_AUX_LO", + obs_hardwaregain=0, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_aux_change_rf_gain_10dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_AUX_LO", + obs_hardwaregain=10, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), + obs_aux_change_rf_gain_5dB=dict( + ensm_mode="radio_on", + trx_lo=2500000000, + rx_powerdown_en_chan0=1, + rx_powerdown_en_chan1=1, + obs_powerdown_en=0, + tx_hardwaregain_chan0=0, + tx_hardwaregain_chan1=0, + tx_quadrature_tracking_en_chan0=1, + tx_quadrature_tracking_en_chan1=1, + aux_obs_lo=2500000000, + obs_quadrature_tracking_en=1, + obs_rf_port_select="OBS_AUX_LO", + obs_hardwaregain=5, + calibrate_rx_qec_en=1, + calibrate_tx_qec_en=1, + calibrate=1, + ), +) ######################################### @@ -385,18 +388,13 @@ def test_adrv9009_rx_data(test_dma_rx, iio_uri, classname, channel): @pytest.mark.parametrize( "param_set, frequency, scale, peak_min", [ - (params["one_cw_tone_manual"], 2000000, 0.5, -42), - (params["one_cw_tone_manual"], 2000000, 0.12, -55), - (params["one_cw_tone_manual"], 2000000, 0.25, -48), - (params["one_cw_tone_slow_attack"], 1000000, 0.12, -44), - (params["one_cw_tone_slow_attack"], 2000000, 0.12, -44), - (params["one_cw_tone_slow_attack"], 500000, 0.12, -44), - (params["change_attenuation_5dB_manual"], 2000000, 0.25, -53), - (params["change_attenuation_10dB_manual"], 2000000, 0.25, -58), - (params["change_attenuation_0dB_slow_attack"], 1000000, 0.12, -35), - (params["change_attenuation_20dB_slow_attack"], 1000000, 0.12, -54), - (params["change_rf_gain_0dB_manual"], 2000000, 0.25, -59), - (params["change_rf_gain_20dB_manual"], 2000000, 0.25, -38), + (params["one_cw_tone_manual"], 2000000, 0.5, -50), + (params["one_cw_tone_slow_attack"], 2000000, 0.12, -55), + (params["change_attenuation_10dB_manual"], 2000000, 0.25, -65), + (params["change_attenuation_0dB_slow_attack"], 1000000, 0.12, -45), + (params["change_attenuation_20dB_slow_attack"], 1000000, 0.12, -65), + (params["change_rf_gain_0dB_manual"], 2000000, 0.25, -65), + (params["change_rf_gain_20dB_manual"], 2000000, 0.25, -45), ], ) def test_adrv9009_dds_loopback( @@ -420,23 +418,18 @@ def test_adrv9009_dds_loopback( @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( - "param_set, frequency, scale", + "param_set, frequency, scale, peak_min", [ - (params["one_cw_tone_manual"], 2000000, 0.5), - (params["one_cw_tone_manual"], 2000000, 0.12), - (params["one_cw_tone_manual"], 2000000, 0.25), - (params["one_cw_tone_slow_attack"], 1000000, 0.12), - (params["one_cw_tone_slow_attack"], 2000000, 0.12), - (params["one_cw_tone_slow_attack"], 500000, 0.12), - (params["change_attenuation_5dB_manual"], 2000000, 0.25), - (params["change_attenuation_10dB_manual"], 2000000, 0.25), - (params["change_attenuation_0dB_slow_attack"], 1000000, 0.12), - (params["change_attenuation_20dB_slow_attack"], 1000000, 0.12), - (params["change_rf_gain_0dB_manual"], 2000000, 0.25), - (params["change_rf_gain_20dB_manual"], 2000000, 0.25), + (params["one_cw_tone_manual"], 2000000, 0.5, -60), + (params["one_cw_tone_slow_attack"], 1000000, 0.12, -65), + (params["change_attenuation_5dB_manual"], 2000000, 0.5, -65), + (params["change_attenuation_10dB_manual"], 2000000, 0.5, -70), + (params["change_attenuation_0dB_slow_attack"], 1000000, 0.5, -40), + (params["change_attenuation_20dB_slow_attack"], 1000000, 0.5, -60), + (params["change_rf_gain_0dB_manual"], 2000000, 0.5, -70), + (params["change_rf_gain_20dB_manual"], 2000000, 0.5, -50), ], ) -@pytest.mark.parametrize("peak_min", [-50]) def test_adrv9009_dds_loopback_with_10dB_splitter( test_dds_loopback, iio_uri, @@ -453,39 +446,37 @@ def test_adrv9009_dds_loopback_with_10dB_splitter( ######################################## -# @pytest.mark.obs_required -# @pytest.mark.iio_hardware(hardware) -# @pytest.mark.parametrize("classname", [(classname)]) -# @pytest.mark.parametrize( -# "channel, param_set", -# [ -# (0, params_obs["obs_tx"]), -# (0, params_obs["obs_tx_change_attenuation_10dB"]), -# (0, params_obs["obs_tx_change_rf_gain_10dB"]), -# (0, params_obs["obs_tx_change_rf_gain_5dB"]), -# (0, params_obs["obs_aux"]), -# (0, params_obs["obs_aux_change_attenuation_10dB"]), -# (0, params_obs["obs_aux_change_rf_gain_10dB"]), -# (0, params_obs["obs_aux_change_rf_gain_5dB"]), -# ], -# ) -# @pytest.mark.parametrize( -# "frequency, scale, peak_min, use_obs", [(50000000, 0.25, -40.5, True)] -# ) -# def test_adrv9009_dds_loopback_for_obs( -# test_dds_loopback, -# iio_uri, -# classname, -# param_set, -# channel, -# frequency, -# scale, -# peak_min, -# use_obs, -# ): -# test_dds_loopback( -# iio_uri, classname, param_set, channel, frequency, scale, peak_min, use_obs -# ) +@pytest.mark.obs_required +@pytest.mark.iio_hardware(hardware) +@pytest.mark.parametrize("classname", [(classname)]) +@pytest.mark.parametrize( + "channel, param_set, peak_min", + [ + (0, params_obs["obs_tx"], -45), + (0, params_obs["obs_tx_change_attenuation_10dB"], -55), + (0, params_obs["obs_tx_change_rf_gain_10dB"], -35), + (0, params_obs["obs_tx_change_rf_gain_5dB"], -40), + (0, params_obs["obs_aux"], -45), + (0, params_obs["obs_aux_change_attenuation_10dB"], -55), + (0, params_obs["obs_aux_change_rf_gain_10dB"], -35), + (0, params_obs["obs_aux_change_rf_gain_5dB"], -40), + ], +) +@pytest.mark.parametrize("frequency, scale, use_obs", [(50000000, 0.25, True)]) +def test_adrv9009_dds_loopback_for_obs( + test_dds_loopback, + iio_uri, + classname, + param_set, + channel, + frequency, + scale, + peak_min, + use_obs, +): + test_dds_loopback( + iio_uri, classname, param_set, channel, frequency, scale, peak_min, use_obs + ) ######################################### @@ -560,26 +551,23 @@ def test_adrv9009_two_tone_loopback_with_10dB_splitter( ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( - "param_set", + "param_set, sfdr_min", [ - params["one_cw_tone_manual"], - params["one_cw_tone_slow_attack"], - params["change_attenuation_5dB_manual"], - params["change_attenuation_10dB_manual"], - params["change_attenuation_0dB_slow_attack"], - params["change_attenuation_20dB_slow_attack"], - params["change_rf_gain_0dB_manual"], - params["change_rf_gain_20dB_manual"], - params["change_trx_lo_1GHz_slow_attack"], - params["change_trx_lo_3GHz_slow_attack"], - params["change_trx_lo_5GHz_slow_attack"], + (params["one_cw_tone_manual"], 50), + (params["one_cw_tone_slow_attack"], 55), + (params["change_attenuation_5dB_manual"], 45), + (params["change_attenuation_10dB_manual"], 40), + (params["change_attenuation_0dB_slow_attack"], 50), + (params["change_attenuation_20dB_slow_attack"], 50), + (params["change_rf_gain_20dB_manual"], 50), + (params["change_trx_lo_1GHz_slow_attack"], 35), ], ) -@pytest.mark.parametrize("sfdr_min", [30]) def test_adrv9009_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min): test_sfdr(iio_uri, classname, channel, param_set, sfdr_min) @@ -590,22 +578,18 @@ def test_adrv9009_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_m @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( - "param_set", + "param_set, sfdr_min", [ - params["one_cw_tone_manual"], - params["one_cw_tone_slow_attack"], - params["change_attenuation_5dB_manual"], - params["change_attenuation_10dB_manual"], - params["change_attenuation_0dB_slow_attack"], - params["change_attenuation_20dB_slow_attack"], - params["change_rf_gain_0dB_manual"], - params["change_rf_gain_20dB_manual"], - params["change_trx_lo_1GHz_slow_attack"], - params["change_trx_lo_3GHz_slow_attack"], - params["change_trx_lo_5GHz_slow_attack"], + (params["one_cw_tone_manual"], 40), + (params["one_cw_tone_slow_attack"], 45), + (params["change_attenuation_5dB_manual"], 40), + (params["change_attenuation_10dB_manual"], 30), + (params["change_attenuation_0dB_slow_attack"], 50), + (params["change_attenuation_20dB_slow_attack"], 40), + (params["change_rf_gain_20dB_manual"], 45), + (params["change_trx_lo_1GHz_slow_attack"], 30), ], ) -@pytest.mark.parametrize("sfdr_min", [40]) def test_adrv9009_sfdr_with_10dB_splitter( test_sfdr, iio_uri, classname, channel, param_set, sfdr_min ): @@ -613,47 +597,48 @@ def test_adrv9009_sfdr_with_10dB_splitter( ######################################### -# @pytest.mark.obs_required -# @pytest.mark.iio_hardware(hardware) -# @pytest.mark.parametrize("classname", [(classname)]) -# @pytest.mark.parametrize("channel", [0, 1]) -# @pytest.mark.parametrize( -# "param_set", -# [ -# params_obs["obs_tx"], -# params_obs["obs_tx_change_attenuation_10dB"], -# params_obs["obs_tx_change_rf_gain_10dB"], -# params_obs["obs_tx_change_rf_gain_5dB"], -# params_obs["obs_aux"], -# params_obs["obs_aux_change_attenuation_10dB"], -# params_obs["obs_aux_change_rf_gain_10dB"], -# params_obs["obs_aux_change_rf_gain_5dB"], -# ], -# ) -# @pytest.mark.parametrize("sfdr_min", [45]) -# @pytest.mark.parametrize("use_obs", [True]) -# def test_adrv9009_sfdr_for_obs( -# test_sfdr, iio_uri, classname, channel, param_set, sfdr_min, use_obs -# ): -# test_sfdr(iio_uri, classname, channel, param_set, sfdr_min, use_obs) +@pytest.mark.obs_required +@pytest.mark.iio_hardware(hardware) +@pytest.mark.parametrize("classname", [(classname)]) +@pytest.mark.parametrize("channel", [0]) +@pytest.mark.parametrize( + "param_set", + [ + params_obs["obs_tx"], + params_obs["obs_tx_change_attenuation_10dB"], + params_obs["obs_tx_change_rf_gain_10dB"], + params_obs["obs_tx_change_rf_gain_5dB"], + params_obs["obs_aux"], + params_obs["obs_aux_change_attenuation_10dB"], + params_obs["obs_aux_change_rf_gain_10dB"], + params_obs["obs_aux_change_rf_gain_5dB"], + ], +) +@pytest.mark.parametrize("sfdr_min", [45]) +@pytest.mark.parametrize("use_obs", [True]) +def test_adrv9009_sfdr_for_obs( + test_sfdr, iio_uri, classname, channel, param_set, sfdr_min, use_obs +): + test_sfdr(iio_uri, classname, channel, param_set, sfdr_min, use_obs) ######################################### +@pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_slow_attack"], 0.12, 33.5, 41.5), - (params["change_attenuation_0dB_slow_attack"], 0.12, 24, 32), + (params["one_cw_tone_slow_attack"], 0.12, 35.5, 45.5), + (params["change_attenuation_0dB_slow_attack"], 0.12, 28.5, 38.5), (params["change_attenuation_20dB_slow_attack"], 0.12, 40, 45.5), - (params["change_trx_lo_1GHz_slow_attack"], 0, 35, 60), + (params["change_trx_lo_1GHz_slow_attack"], 0, 40, 45.5), (params["change_trx_lo_1GHz_slow_attack"], 0.9, 25, 35), - (params["change_trx_lo_3GHz_slow_attack"], 0, 35, 60), - (params["change_trx_lo_3GHz_slow_attack"], 0.9, 0, 22), - (params["change_trx_lo_5GHz_slow_attack"], 0, 35, 60), - (params["change_trx_lo_5GHz_slow_attack"], 0.9, 20, 25), + (params["change_trx_lo_3GHz_slow_attack"], 0, 40, 45.5), + (params["change_trx_lo_3GHz_slow_attack"], 0.9, 16, 26), + (params["change_trx_lo_5GHz_slow_attack"], 0, 40, 45.5), + (params["change_trx_lo_5GHz_slow_attack"], 0.9, 15, 25), ], ) def test_adrv9009_dds_gain_check_agc( @@ -677,20 +662,15 @@ def test_adrv9009_dds_gain_check_agc( @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( - "param_set, dds_scale, min_rssi", + "param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_slow_attack"], 0.12, 40), - (params["change_attenuation_0dB_slow_attack"], 0.12, 30), - (params["change_attenuation_20dB_slow_attack"], 0.12, 43.5), - (params["change_trx_lo_1GHz_slow_attack"], 0, 43.5), - (params["change_trx_lo_1GHz_slow_attack"], 0.9, 30), - (params["change_trx_lo_3GHz_slow_attack"], 0, 43.75), - (params["change_trx_lo_3GHz_slow_attack"], 0.9, 23), - (params["change_trx_lo_5GHz_slow_attack"], 0, 43.75), - (params["change_trx_lo_5GHz_slow_attack"], 0.9, 25), + (params["one_cw_tone_slow_attack"], 0.12, 38, 45), + (params["change_attenuation_0dB_slow_attack"], 0.12, 28, 45), + (params["change_trx_lo_1GHz_slow_attack"], 0.9, 25, 45), + (params["change_trx_lo_3GHz_slow_attack"], 0.9, 15, 45), + (params["change_trx_lo_5GHz_slow_attack"], 0.9, 15, 40), ], ) -@pytest.mark.parametrize("max_rssi", [50]) def test_adrv9009_dds_gain_check_agc_with_10db_splitter( test_gain_check, iio_uri, @@ -714,13 +694,13 @@ def test_adrv9009_dds_gain_check_agc_with_10db_splitter( @pytest.mark.parametrize( "param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_manual"], 0.5, 30, 40), + (params["one_cw_tone_manual"], 0.5, 35, 45), (params["one_cw_tone_manual"], 0.12, 40, 45), (params["one_cw_tone_manual"], 0.25, 35, 45), (params["change_attenuation_5dB_manual"], 0.25, 40, 45), (params["change_attenuation_10dB_manual"], 0.25, 40, 45), (params["change_rf_gain_0dB_manual"], 0.25, 40, 45), - (params["change_rf_gain_20dB_manual"], 0.25, 25, 35), + (params["change_rf_gain_20dB_manual"], 0.25, 25, 45), ( dict( trx_lo=1000000000, @@ -778,13 +758,11 @@ def test_adrv9009_dds_gain_check_vary_power( @pytest.mark.parametrize( "param_set, dds_scale, min_rssi, max_rssi", [ - (params["one_cw_tone_manual"], 0.5, 38, 45), + (params["one_cw_tone_manual"], 0.5, 35, 45), (params["one_cw_tone_manual"], 0.12, 43, 45), - (params["one_cw_tone_manual"], 0.25, 43, 45), + (params["one_cw_tone_manual"], 0.25, 42, 45), (params["change_attenuation_5dB_manual"], 0.25, 43, 45), (params["change_attenuation_10dB_manual"], 0.25, 43, 45), - (params["change_rf_gain_0dB_manual"], 0.25, 42.5, 44.5), - (params["change_rf_gain_20dB_manual"], 0.25, 34, 44), ( dict( trx_lo=1000000000, @@ -799,7 +777,7 @@ def test_adrv9009_dds_gain_check_vary_power( ), 0.5, 42.5, - 44.5, + 45, ), ( dict( @@ -814,8 +792,8 @@ def test_adrv9009_dds_gain_check_vary_power( calibrate=1, ), 0.5, - 36, - 43.5, + 30, + 45, ), ], ) @@ -835,12 +813,10 @@ def test_adrv9009_dds_gain_check_vary_power_with_10dB_splitter( ######################################### -# TODO: Test, see what's its difference with dds_loopback, PROBLEMATIC -# OSError: [Errno 5] Input/output error @pytest.mark.no_obs_required @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0]) +@pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set", [ @@ -897,6 +873,6 @@ def test_adrv9009_profile_write( def test_adrv9009_jesd(iio_uri): import adi - sdr = adi.adrv9009(uri=iio_uri, jesd_monitor=True) + sdr = adi.adrv9009(iio_uri, jesd_monitor=True) info = sdr._jesd.get_all_statuses() assert info From 5c15fc90f440ed5d3175a9726539787a3da2d2a6 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 29 Jul 2024 09:02:16 +0800 Subject: [PATCH 09/13] fix lint Signed-off-by: Trecia Agoylo --- adi/ad937x.py | 15 +++++++++------ examples/ad9371.py | 3 ++- examples/ad9371_dec8.py | 2 +- test/common.py | 4 +--- test/test_ad9371.py | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/adi/ad937x.py b/adi/ad937x.py index 980260929..4dfa425a6 100644 --- a/adi/ad937x.py +++ b/adi/ad937x.py @@ -171,12 +171,12 @@ def tx_rf_bandwidth(self): def rx_enable_dec8(self): """rx_enable_dec8: Enable x8 decimation filter in RX path""" val = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency", False, self._rxadc - ) + "voltage0_i", "sampling_frequency", False, self._rxadc + ) avail = None try: avail = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency_available", False, self._rxadc + "voltage0_i", "sampling_frequency_available", False, self._rxadc ) avail = avail.strip().split(" ") return val == avail[1] @@ -191,7 +191,9 @@ def rx_enable_dec8(self, value): ) avail = sorted(avail.strip().split(" ")) val = int(avail[1] if value else avail[0]) - self._set_iio_attr("voltage0_i", "sampling_frequency", False, val, self._rxadc) + self._set_iio_attr( + "voltage0_i", "sampling_frequency", False, val, self._rxadc + ) except KeyError: print("x8 decimation filter is not supported.") @@ -200,11 +202,11 @@ def tx_enable_int8(self): """tx_enable_int8: Enable x8 interpolation filter in TX path""" val = self._get_iio_attr_str( "voltage0", "sampling_frequency", True, self._txdac - ) + ) avail = None try: avail = self._get_iio_attr_str( - "voltage0", "sampling_frequency_available", True, self._txdac + "voltage0", "sampling_frequency_available", True, self._txdac ) avail = avail.strip().split(" ") return val == avail[1] @@ -222,6 +224,7 @@ def tx_enable_int8(self, value): self._set_iio_attr("voltage0", "sampling_frequency", True, val, self._txdac) except KeyError: print("x8 decimation filter is not supported.") + @property def rx_sample_rate(self): """rx_sample_rate: Sample rate RX path in samples per second diff --git a/examples/ad9371.py b/examples/ad9371.py index 84a95db3e..0071c0f4e 100644 --- a/examples/ad9371.py +++ b/examples/ad9371.py @@ -2,8 +2,9 @@ # # SPDX short identifier: ADIBSD -import time import sys +import time + import adi import matplotlib.pyplot as plt import numpy as np diff --git a/examples/ad9371_dec8.py b/examples/ad9371_dec8.py index 10ee9a0a9..9acc6636a 100644 --- a/examples/ad9371_dec8.py +++ b/examples/ad9371_dec8.py @@ -2,8 +2,8 @@ # # SPDX short identifier: ADIBSD -import time import sys +import time import adi import matplotlib.pyplot as plt diff --git a/test/common.py b/test/common.py index 7ab136852..f10903c2d 100644 --- a/test/common.py +++ b/test/common.py @@ -77,9 +77,7 @@ def pytest_runtest_setup(item): "Testing requiring observation disabled. Use --obs-enable flag to enable" ) if obs and "no_obs_required" in marks: - pytest.skip( - "Testing requiring observation enabled. Skipping this test" - ) + pytest.skip("Testing requiring observation enabled. Skipping this test") # Handle CMOS and LVDS tests cmos = item.config.getoption("--cmos") diff --git a/test/test_ad9371.py b/test/test_ad9371.py index e76cb57f8..b780d2c5f 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -243,7 +243,7 @@ obs_gain_control_mode="manual", obs_hardwaregain=20, obs_temp_comp_gain=0, - ) + ), ) @@ -513,7 +513,7 @@ def test_ad9371_dds_gain_check_vary_power( (1, params["change_rf_gain_0dB_manual"], 0.25, 24, 26.5), (0, params["change_temp_gain_up"], 0.25, 24, 26.5), (1, params["change_temp_gain_up"], 0.25, 14, 16.5), - ] + ], ) def test_ad9371_dds_gain_check_vary_power_with_10dB_splitter( test_gain_check, @@ -590,7 +590,7 @@ def test_ad9371_sfdr_with_10dB_splitter( "channel, param_set, sfdr_min", [ (0, params_obs["obs_orx1_change_attenuation_10dB"], 30), - (0, params_obs["snf_orx1_change_attenuation_10dB"], 30) + (0, params_obs["snf_orx1_change_attenuation_10dB"], 30), ], ) @pytest.mark.parametrize("use_obs", [True]) From aea0aca274ecd6371bfcbc1e8c914bb6acc21e08 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 16 Sep 2024 13:15:00 +0800 Subject: [PATCH 10/13] tests: update emu supported test Signed-off-by: Trecia Agoylo --- test/test_ad9371.py | 24 ++++++++++++------------ test/test_ad9375.py | 26 +++++++++++++++++--------- test/test_adrv9009_p.py | 30 +++++++++++++++--------------- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/test/test_ad9371.py b/test/test_ad9371.py index b780d2c5f..360f3b7fa 100644 --- a/test/test_ad9371.py +++ b/test/test_ad9371.py @@ -266,7 +266,7 @@ def test_ad9371_attr( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", range(2)) def test_ad9371_rx_data(test_dma_rx, iio_uri, classname, channel): @@ -275,7 +275,7 @@ def test_ad9371_rx_data(test_dma_rx, iio_uri, classname, channel): ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -314,7 +314,7 @@ def test_ad9371_dds_loopback( ######################################## @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -353,7 +353,7 @@ def test_ad9371_dds_loopback_with_10dB_splitter( ######################################## @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "channel, param_set", @@ -387,7 +387,7 @@ def test_ad9371_dds_loopback_for_obs( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -423,7 +423,7 @@ def test_ad9371_two_tone_loopback( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -459,7 +459,7 @@ def test_ad9371_two_tone_loopback_with_10dB_splitter( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -496,7 +496,7 @@ def test_ad9371_dds_gain_check_vary_power( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "channel, param_set, dds_scale, min_rssi, max_rssi", @@ -532,7 +532,7 @@ def test_ad9371_dds_gain_check_vary_power_with_10dB_splitter( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -557,7 +557,7 @@ def test_ad9371_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -584,7 +584,7 @@ def test_ad9371_sfdr_with_10dB_splitter( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "channel, param_set, sfdr_min", @@ -601,7 +601,7 @@ def test_ad9371_sfdr_for_obs( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("attr", ["profile"]) @pytest.mark.parametrize( diff --git a/test/test_ad9375.py b/test/test_ad9375.py index 485412192..65d9c2978 100644 --- a/test/test_ad9375.py +++ b/test/test_ad9375.py @@ -223,7 +223,7 @@ def test_ad9375_attr( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", range(2)) def test_ad9375_rx_data(test_dma_rx, iio_uri, classname, channel): @@ -233,6 +233,14 @@ def test_ad9375_rx_data(test_dma_rx, iio_uri, classname, channel): ######################################### @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) +@pytest.mark.parametrize("channel", range(2)) +def test_ad9375_tx_data(test_dma_tx, iio_uri, classname, channel): + test_dma_tx(iio_uri, classname, channel) + + +######################################### +@pytest.mark.iio_hardware(hardware, True) +@pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( "param_set, frequency, scale, peak_min", @@ -269,7 +277,7 @@ def test_ad9375_dds_loopback( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -304,7 +312,7 @@ def test_ad9375_two_tone_loopback( ######################################## -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -340,7 +348,7 @@ def test_ad9375_dds_gain_check_vary_power( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -364,7 +372,7 @@ def test_ad9375_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("attr", ["profile"]) @pytest.mark.parametrize( @@ -378,7 +386,7 @@ def test_ad9375_profile_write( # AD9375 ONLY ######################################## -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "attr, depends, values, tol, repeats", @@ -403,7 +411,7 @@ def test_ad9375_attr_with_depends( ######################################## -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "attr, depends", @@ -450,7 +458,7 @@ def test_ad9375_attr_readonly_with_depends( ######################################## -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "attr, depends, start, stop", @@ -504,7 +512,7 @@ def test_ad9375_attr_boolean( ######################################## -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "attr, value", [("tx_dpd_reset_en_chan0", 1), ("tx_dpd_reset_en_chan1", 1),], diff --git a/test/test_adrv9009_p.py b/test/test_adrv9009_p.py index 6559d1b90..6c1ded694 100644 --- a/test/test_adrv9009_p.py +++ b/test/test_adrv9009_p.py @@ -382,7 +382,7 @@ def test_adrv9009_rx_data(test_dma_rx, iio_uri, classname, channel): ######################################## @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -414,7 +414,7 @@ def test_adrv9009_dds_loopback( ######################################## @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -447,7 +447,7 @@ def test_adrv9009_dds_loopback_with_10dB_splitter( ######################################## @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize( "channel, param_set, peak_min", @@ -480,7 +480,7 @@ def test_adrv9009_dds_loopback_for_obs( ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -516,7 +516,7 @@ def test_adrv9009_two_tone_loopback( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -552,7 +552,7 @@ def test_adrv9009_two_tone_loopback_with_10dB_splitter( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -574,7 +574,7 @@ def test_adrv9009_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_m ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -598,7 +598,7 @@ def test_adrv9009_sfdr_with_10dB_splitter( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0]) @pytest.mark.parametrize( @@ -624,7 +624,7 @@ def test_adrv9009_sfdr_for_obs( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -658,7 +658,7 @@ def test_adrv9009_dds_gain_check_agc( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -688,7 +688,7 @@ def test_adrv9009_dds_gain_check_agc_with_10db_splitter( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -752,7 +752,7 @@ def test_adrv9009_dds_gain_check_vary_power( ######################################### @pytest.mark.obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -814,7 +814,7 @@ def test_adrv9009_dds_gain_check_vary_power_with_10dB_splitter( ######################################### @pytest.mark.no_obs_required -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("channel", [0, 1]) @pytest.mark.parametrize( @@ -855,7 +855,7 @@ def test_adrv9009_iq_loopback(test_iq_loopback, iio_uri, classname, channel, par ######################################### -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) @pytest.mark.parametrize("classname", [(classname)]) @pytest.mark.parametrize("attr", ["profile"]) @pytest.mark.parametrize( @@ -869,7 +869,7 @@ def test_adrv9009_profile_write( ######################################### @pytest.mark.skipif(skip_jesd, reason="JESD module not importable") -@pytest.mark.iio_hardware(hardware) +@pytest.mark.iio_hardware(hardware, True) def test_adrv9009_jesd(iio_uri): import adi From 77136eda5ef9a3656272f30a1dbb73d61e849143 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 16 Sep 2024 13:16:05 +0800 Subject: [PATCH 11/13] ci: run test without optional deps Signed-off-by: Trecia Agoylo --- .github/workflows/test.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8eacabe9..120c3dfe1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,9 +49,10 @@ jobs: bash ./.github/scripts/install_pydeps.sh sudo apt install -y python3-tk - - name: Test + - name: Test without optional dependencies run: | - pytest -vs --cov=adi --scan-verbose --emu --junitxml="results.xml" -k 'not prod' + pip uninstall -y paramiko + pytest -vs --scan-verbose --emu --junitxml="results.xml" -k 'not prod' - name: Report coverage if: (github.event_name != 'pull_request') && (matrix.python-version == 3.6) @@ -65,12 +66,6 @@ jobs: with: files: results.xml - - name: Test without optional dependencies - run: | - pip uninstall -y paramiko - pytest -vs --scan-verbose --emu --junitxml="results.xml" -k 'not prod' - - Lint: runs-on: ubuntu-latest strategy: From 2a58df20fc224390407d79285f5bf8acfaf6f082 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Tue, 22 Oct 2024 10:18:06 +0800 Subject: [PATCH 12/13] ad937x: updated dec8/int8 implementation Signed-off-by: Trecia Agoylo --- adi/ad937x.py | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/adi/ad937x.py b/adi/ad937x.py index 4dfa425a6..d529b4a78 100644 --- a/adi/ad937x.py +++ b/adi/ad937x.py @@ -170,18 +170,18 @@ def tx_rf_bandwidth(self): @property def rx_enable_dec8(self): """rx_enable_dec8: Enable x8 decimation filter in RX path""" - val = self._get_iio_attr_str( - "voltage0_i", "sampling_frequency", False, self._rxadc - ) - avail = None try: avail = self._get_iio_attr_str( "voltage0_i", "sampling_frequency_available", False, self._rxadc ) + except KeyError: + return False + else: avail = avail.strip().split(" ") + val = self._get_iio_attr_str( + "voltage0_i", "sampling_frequency", False, self._rxadc + ) return val == avail[1] - except KeyError: - return val == avail @rx_enable_dec8.setter def rx_enable_dec8(self, value): @@ -189,29 +189,33 @@ def rx_enable_dec8(self, value): avail = self._get_iio_attr_str( "voltage0_i", "sampling_frequency_available", False, self._rxadc ) + except KeyError: + if value: + print( + "x8 decimation filter is not supported. Using default sampling frequency." + ) + else: avail = sorted(avail.strip().split(" ")) val = int(avail[1] if value else avail[0]) self._set_iio_attr( "voltage0_i", "sampling_frequency", False, val, self._rxadc ) - except KeyError: - print("x8 decimation filter is not supported.") @property def tx_enable_int8(self): """tx_enable_int8: Enable x8 interpolation filter in TX path""" - val = self._get_iio_attr_str( - "voltage0", "sampling_frequency", True, self._txdac - ) - avail = None try: avail = self._get_iio_attr_str( "voltage0", "sampling_frequency_available", True, self._txdac ) + except KeyError: + return False + else: avail = avail.strip().split(" ") + val = self._get_iio_attr_str( + "voltage0", "sampling_frequency", True, self._txdac + ) return val == avail[1] - except KeyError: - return val == avail @tx_enable_int8.setter def tx_enable_int8(self, value): @@ -219,11 +223,15 @@ def tx_enable_int8(self, value): avail = self._get_iio_attr_str( "voltage0", "sampling_frequency_available", True, self._txdac ) + except KeyError: + if value: + print( + "x8 interpolation filter is not supported. Using default sampling frequency." + ) + else: avail = sorted(avail.strip().split(" ")) val = int(avail[1] if value else avail[0]) self._set_iio_attr("voltage0", "sampling_frequency", True, val, self._txdac) - except KeyError: - print("x8 decimation filter is not supported.") @property def rx_sample_rate(self): From 43cf048b3ef3ee7393139a92b6e3aca91ea9497b Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Tue, 22 Oct 2024 10:20:06 +0800 Subject: [PATCH 13/13] ci: add coverage flag Signed-off-by: Trecia Agoylo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 120c3dfe1..87232bab3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: - name: Test without optional dependencies run: | pip uninstall -y paramiko - pytest -vs --scan-verbose --emu --junitxml="results.xml" -k 'not prod' + pytest -vs --cov=adi --scan-verbose --emu --junitxml="results.xml" -k 'not prod' - name: Report coverage if: (github.event_name != 'pull_request') && (matrix.python-version == 3.6)