Skip to content

Commit

Permalink
Merge pull request analogdevicesinc#266 from HRosete/fmcomms2-3
Browse files Browse the repository at this point in the history
Mirror AD9361's and AD9364's Manual Tests
  • Loading branch information
tfcollins authored Nov 10, 2021
2 parents b8e66f3 + 905d5ab commit 25cdd05
Show file tree
Hide file tree
Showing 3 changed files with 520 additions and 35 deletions.
293 changes: 278 additions & 15 deletions test/test_ad9361_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,116 @@
hardware = ["packrf", "adrv9361", "fmcomms2", "ad9361"]
classname = "adi.ad9361"

params = dict(
one_cw_tone_manual=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="manual",
gain_control_mode_chan1="manual",
rx_hardwaregain_chan0=0,
rx_hardwaregain_chan1=0,
tx_hardwaregain_chan0=0,
tx_hardwaregain_chan1=0,
),
one_cw_tone_slow_attack=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="slow_attack",
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan0=-10,
tx_hardwaregain_chan1=-10,
),
change_attenuation_20dB_slow_attack=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="slow_attack",
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan0=-20,
tx_hardwaregain_chan1=-20,
),
change_attenuation_0dB_slow_attack=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="slow_attack",
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan0=0,
tx_hardwaregain_chan1=0,
),
change_sampling_rate_60MSPS_slow_attack=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=60710000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="slow_attack",
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan0=-10,
tx_hardwaregain_chan1=-10,
),
change_sampling_rate_15MSPS_slow_attack=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=15000000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="slow_attack",
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan0=-10,
tx_hardwaregain_chan1=-10,
),
change_attenuation_10dB_manual=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="manual",
gain_control_mode_chan1="manual",
rx_hardwaregain_chan0=0,
rx_hardwaregain_chan1=0,
tx_hardwaregain_chan0=-10,
tx_hardwaregain_chan1=-10,
),
change_attenuation_5dB_manual=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="manual",
gain_control_mode_chan1="manual",
rx_hardwaregain_chan0=0,
rx_hardwaregain_chan1=0,
tx_hardwaregain_chan0=-5,
tx_hardwaregain_chan1=-5,
),
change_rf_gain_5dB_manual=dict(
tx_lo=2300000000,
rx_lo=2300000000,
sample_rate=30720000,
tx_rf_bandwidth=18000000,
rx_rf_bandwidth=18000000,
gain_control_mode_chan0="manual",
gain_control_mode_chan1="manual",
rx_hardwaregain_chan0=5,
rx_hardwaregain_chan1=5,
tx_hardwaregain_chan0=0,
tx_hardwaregain_chan1=0,
),
)


#########################################
@pytest.mark.iio_hardware(hardware)
Expand Down Expand Up @@ -45,7 +155,7 @@ def test_ad9361_loopback_attr(


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1, [0, 1]])
def test_ad9361_rx_data(test_dma_rx, iio_uri, classname, channel):
Expand All @@ -61,38 +171,49 @@ def test_ad9361_tx_data(test_dma_tx, iio_uri, classname, channel):


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1])
def test_ad9361_loopback(test_dma_loopback, iio_uri, classname, channel):
test_dma_loopback(iio_uri, classname, channel)


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0])
@pytest.mark.parametrize(
"param_set",
"param_set, sfdr_min",
[
dict(
sample_rate=4000000,
tx_lo=1000000000,
rx_lo=1000000000,
gain_control_mode_chan0="slow_attack",
tx_hardwaregain_chan0=-20,
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan1=-20,
)
(
dict(
sample_rate=4000000,
tx_lo=1000000000,
rx_lo=1000000000,
gain_control_mode_chan0="slow_attack",
tx_hardwaregain_chan0=-20,
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan1=-20,
),
40,
),
(params["one_cw_tone_manual"], 23),
(params["change_attenuation_10dB_manual"], 37),
(params["change_attenuation_5dB_manual"], 29),
(params["change_rf_gain_5dB_manual"], 23),
(params["one_cw_tone_slow_attack"], 23),
(params["change_attenuation_20dB_slow_attack"], 43),
(params["change_attenuation_0dB_slow_attack"], 23),
(params["change_sampling_rate_60MSPS_slow_attack"], 51),
(params["change_sampling_rate_15MSPS_slow_attack"], 52),
],
)
@pytest.mark.parametrize("sfdr_min", [40])
def test_ad9361_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min):
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("channel", [0, 1])
@pytest.mark.parametrize(
Expand Down Expand Up @@ -125,7 +246,149 @@ def test_ad9361_sfdr(test_sfdr, iio_uri, classname, channel, param_set, sfdr_min
gain_control_mode_chan1="slow_attack",
tx_hardwaregain_chan1=-20,
),
params["one_cw_tone_manual"],
params["change_attenuation_10dB_manual"],
params["change_attenuation_5dB_manual"],
params["change_rf_gain_5dB_manual"],
params["one_cw_tone_slow_attack"],
params["change_attenuation_20dB_slow_attack"],
params["change_attenuation_0dB_slow_attack"],
params["change_sampling_rate_60MSPS_slow_attack"],
params["change_sampling_rate_15MSPS_slow_attack"],
],
)
def test_ad9361_iq_loopback(test_iq_loopback, iio_uri, classname, channel, param_set):
test_iq_loopback(iio_uri, classname, channel, param_set)


#########################################
@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_manual"], 0.12, 23.25, 25.25),
(params["one_cw_tone_manual"], 0.25, 17, 20),
(params["one_cw_tone_manual"], 0.25, 17, 20),
(params["one_cw_tone_manual"], 0.06, 28, 31.5),
(params["change_rf_gain_5dB_manual"], 0.25, 21, 23),
(params["change_attenuation_10dB_manual"], 0.25, 25, 28),
(params["change_attenuation_5dB_manual"], 0.25, 21, 24),
],
)
def test_ad9361_dds_gain_check_vary_power(
test_gain_check,
iio_uri,
classname,
channel,
param_set,
dds_scale,
min_rssi,
max_rssi,
):
test_gain_check(
iio_uri, classname, channel, param_set, dds_scale, min_rssi, max_rssi
)


#########################################
@pytest.mark.iio_hardware(hardware, True)
@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.06, 42.75, 45.75),
(params["change_attenuation_20dB_slow_attack"], 0.06, 53.75, 56.75),
(params["change_attenuation_0dB_slow_attack"], 0.06, 32, 35),
],
)
def test_ad9361_dds_gain_check_agc(
test_gain_check,
iio_uri,
classname,
channel,
param_set,
dds_scale,
min_rssi,
max_rssi,
):
test_gain_check(
iio_uri, classname, channel, param_set, dds_scale, min_rssi, max_rssi
)


#########################################
@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",
[
(params["one_cw_tone_manual"], 2000000, 0.12, -45),
(params["one_cw_tone_manual"], 2000000, 0.25, -40),
(params["one_cw_tone_manual"], 2000000, 0.06, -50),
(params["change_attenuation_10dB_manual"], 2000000, 0.25, -48),
(params["change_attenuation_5dB_manual"], 2000000, 0.25, -43.5),
(params["change_rf_gain_5dB_manual"], 2000000, 0.25, -34),
(params["one_cw_tone_slow_attack"], 500000, 0.06, -41.5),
(params["one_cw_tone_slow_attack"], 1000000, 0.06, -41.5),
(params["one_cw_tone_slow_attack"], 2000000, 0.06, -41.5),
(params["one_cw_tone_slow_attack"], 2000000, 0.12, -41.5),
(params["one_cw_tone_slow_attack"], 3000000, 0.25, -41.5),
(params["one_cw_tone_slow_attack"], 4000000, 0.5, -41.5),
(params["change_sampling_rate_60MSPS_slow_attack"], 2000000, 0.06, -41.5),
(params["change_sampling_rate_15MSPS_slow_attack"], 2000000, 0.06, -41.5),
(params["change_attenuation_20dB_slow_attack"], 1000000, 0.06, -43),
(params["change_attenuation_0dB_slow_attack"], 1000000, 0.06, -43),
],
)
def test_ad9361_dds_loopback(
test_dds_loopback,
iio_uri,
classname,
param_set,
channel,
frequency,
scale,
peak_min,
):
test_dds_loopback(
iio_uri, classname, param_set, channel, frequency, scale, peak_min
)


#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0])
@pytest.mark.parametrize(
"param_set, frequency1, scale1, peak_min1, frequency2, scale2, peak_min2",
[(params["one_cw_tone_slow_attack"], 1000000, 0.06, -20, 2000000, 0.12, -40,)],
)
def test_ad9361_two_tone_loopback(
test_dds_two_tone,
iio_uri,
classname,
channel,
param_set,
frequency1,
scale1,
peak_min1,
frequency2,
scale2,
peak_min2,
):
test_dds_two_tone(
iio_uri,
classname,
channel,
param_set,
frequency1,
scale1,
peak_min1,
frequency2,
scale2,
peak_min2,
)
Loading

0 comments on commit 25cdd05

Please sign in to comment.