diff --git a/adi/fmc_4p_vna.py b/adi/fmc_4p_vna.py index 584c17b7b..066a059c2 100644 --- a/adi/fmc_4p_vna.py +++ b/adi/fmc_4p_vna.py @@ -32,16 +32,17 @@ # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import numpy as np +from adi.ad4858 import ad4858 +from adi.ad5686 import ad5686 from adi.ad9083 import ad9083 +from adi.ad9173 import ad9173 from adi.adf4371 import adf4371 from adi.adl5960 import adl5960 from adi.admv8818 import admv8818 from adi.adrf5720 import adrf5720 from adi.gen_mux import genmux from adi.one_bit_adc_dac import one_bit_adc_dac -from adi.ad9173 import ad9173 -from adi.ad5686 import ad5686 -from adi.ad4858 import ad4858 + class fmc_4p_vna(adrf5720, ad9083, admv8818, genmux, adf4371, adl5960, one_bit_adc_dac): """ FMCVNA Scalable 4-port Vector Network Analyzer Board """ @@ -51,15 +52,15 @@ class fmc_4p_vna(adrf5720, ad9083, admv8818, genmux, adf4371, adl5960, one_bit_a def __init__(self, uri): self.lo = adf4371(uri) self.rfin_attenuator = adrf5720(uri, device_name="adrf5720-rfin") - self.lo_attenuator = adrf5720(uri, device_name="adrf5720-lo") + self.rfin2_attenuator = adrf5720(uri, device_name="adrf5720-rfin2") self.bpf = admv8818(uri, device_name="admv8818") self.rfin_mux = genmux(uri, device_name="mux-rfin") self.lo_mux = genmux(uri, device_name="mux-adf4371") self.freq_src_sel_mux = genmux(uri, device_name="mux-freq-src-sel") - self.rfin_freq_src_sel_mux = genmux(uri, device_name="mux-rfin-freq-src-sel") + self.rfin_low = genmux(uri, device_name="mux-rfin-low") self.hsdac = ad9173(uri) self.ad4858 = ad4858(uri) - self.ad5732 = ad5686(uri) + # self.ad5732 = ad5686(uri) for i in range(1, 5): self.frontend[i - 1] = adl5960(uri, device_name=f"adl5960-{i}") diff --git a/examples/4p_vna.py b/examples/4p_vna.py index be174b230..9d44abe5d 100644 --- a/examples/4p_vna.py +++ b/examples/4p_vna.py @@ -92,6 +92,7 @@ def spec_est(x, fs, ref=2 ** 15, plot=False, title=""): return ampl, freqs + def ad4858_plot(x, plot=False, title=""): if plot: @@ -109,6 +110,7 @@ def ad4858_plot(x, plot=False, title=""): return r_avg + def ad4858_capture(): channels = [] x = vna.ad4858.rx() @@ -132,16 +134,12 @@ def ad4858_capture(): # Capture all 8 channels vna.ad4858.rx_enabled_channels = [0, 1, 2, 3, 4, 5, 6, 7] vna.ad4858.rx_buffer_size = 128 -#fs_ad4858 = int(vna.ad4858.rx_sample_rate) +# fs_ad4858 = int(vna.ad4858.rx_sample_rate) # ADRF5720 -vna.lo_attenuator.attenuation = 6 +vna.rfin2_attenuator.attenuation = 6 vna.rfin_attenuator.attenuation = 6 -# AD5732R values between -8192...8191 - -vna.ad5732.channel[0].raw = 0 -vna.ad5732.channel[1].raw = 0 vna.lo_mux.select = "rf8" vna.rfin_mux.select = "d1" @@ -149,7 +147,7 @@ def ad4858_capture(): vna.lo.rfaux8_vco_output_enable = False vna.freq_src_sel_mux.select = "rf_dac0_direct" -vna.rfin_freq_src_sel_mux.select = "rf_dac1_direct" +vna.rfin_low.select = "d1" # vna.hsdac.modulation_switch_mode # 0 = Mode 0 @@ -167,6 +165,7 @@ def ad4858_capture(): vna.hsdac.main0_nco_frequency = 100000000 vna.hsdac.main1_nco_frequency = 100000000 + # push shifted DC the out of spectrum if_frequency = fs @@ -211,10 +210,9 @@ def ad4858_capture(): # vna.lo.rfaux8_vco_output_enable = True # vna.lo.rf16_frequency = f - vna.bpf.band_pass_center_frequency = int(f / 1e6) vna.hsdac.main0_nco_frequency = int(f) - #vna.hsdac.main1_nco_frequency = int(f) + # vna.hsdac.main1_nco_frequency = int(f) print("ADL5960-", i, "CT2 REG 0x21 =", vna.frontend[0].reg_read(0x21)) # ADMV8818 should update automatically as long as the LO doubler is not used @@ -233,10 +231,11 @@ def ad4858_capture(): "MHz", ) - print (ad4858_capture()) + print(ad4858_capture()) for r in range(2): i = int(r / 2) + 1 + vna.gpio_hi_low_sel = 0 vna.rfin_mux.select = f"d{i}" x = vna.rx() if r & 1: @@ -248,11 +247,12 @@ def ad4858_capture(): for r in range(2): i = int(r / 2) + 1 + vna.gpio_hi_low_sel = 1 vna.rfin_mux.select = f"d{i}" x = vna.ad4858.rx() if r & 1: dir = "Reflected" else: dir = "Forward" - - ad4858_plot(x[r], plot=True, title=f"AD4858 {dir} Port-{i} f={f} Hz") \ No newline at end of file + + ad4858_plot(x[r], plot=True, title=f"AD4858 {dir} Port-{i} f={f} Hz")