Post Go back to editing

ADRV9009 python Tx Customization error

Hi,

I am working on a python script to loop what I receive to the tx output. I am receiving the correct signal in the Rx but not outputting what I'm expecting, I'm assuming the device drivers are not configured correctly. When I try customizing the device drivers manually I get the following error:

sdr._ctrl.debug_attrs["adi,dig-clocks-device-clock_khz"].value=245760
KeyError: 'adi,dig-clocks-device-clock_khz'

I'm fairly new with pyadi-iio, any suggestion would be welcome.

Python script:

import adi
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal

sdr = adi.adrv9009_zu11eg("ip:192.168.1.31")

sdr._rxadc.set_kernel_buffers_count(1)
sdr.sample_rate = int(245760)
sdr.rx_enabled_channels = [3]
sdr.tx_enabled_channels = [1]
#sdr.trx_lo = 20000000000
sdr.trx_lo_chip_b = 1500000000
#sdr.rx_rf_bandwidth_chip = 10000000
#sdr.tx_rf_bandwidth_chip = 10000000
sdr.tx_hardwaregain_chan0 = -10
sdr.tx_hardwaregain_chan1 = -10
sdr.tx_hardwaregain_chan0_chip_b = -10
sdr.tx_hardwaregain_chan1_chip_b = -10
sdr.gain_control_mode_chan0 = "slow_attack"
sdr.gain_control_mode_chan1 = "slow_attack"
sdr.gain_control_mode_chan0_chip_b = "slow_attack"
sdr.gain_control_mode_chan1_chip_b = "slow_attack"
sdr.rx_buffer_size = 1000#2 ** 17
sdr._ctrl.debug_attrs["adi,dig-clocks-device-clock_khz"].value=245760
sdr._ctrl.debug_attrs["adi,dig-clocks-clk-pll-vco-freq_khz "].value=245760
sdr._ctrl.debug_attrs["adi,tx-settings-tx1-atten_md-b "].value= 0


sdr.tx_enabled_channels = [1]
sdr.rx_enabled_channels = [3]

for i in range (0, 10): # 10):
#raw_data = sdr.rx()
raw_data = sdr.rx()

rx_samples = sdr.rx()
data = np.array((rx_samples)*(2**14))


sdr.tx_cyclic_buffer = True # Enable cyclic buffersv
sdr.tx(data)

  • Can you list out all the debug_attrs?

    for at in sdr._ctrl.debug_attrs:

        print(at)

    sdr._ctrl.debug_attrs["adi,dig-clocks-device-clock_khz"].value=245760
    sdr._ctrl.debug_attrs["adi,dig-clocks-clk-pll-vco-freq_khz "].value=245760
    sdr._ctrl.debug_attrs["adi,tx-settings-tx1-atten_md-b "].value= 0

    Any direct attribute writes need to be strings.

    Note that these debug attr writes don't do anything until you call:

    sdr._ctrl.debug_attr["initialize"].value = '1'

    which will reset the device. So I would (1) set all by debug attrs, (2) call initialize, (3) set up remaining props.

    These debug attr updates need only to be done once and they will remove until a reboot happens.

    -Travis

  • Hi Travis,

    below is the output:

    radio_on
    gpio3v3
    bist_tone
    bist_framer_b_loopback
    bist_framer_a_loopback
    bist_framer_b_prbs
    bist_framer_a_prbs
    initialize
    adi,aux-pll-lo-frequency_hz
    adi,trx-pll-lo-frequency_hz
    adi,dig-clocks-rf-pll-phase-sync-mode
    adi,dig-clocks-rf-pll-use-external-lo
    adi,dig-clocks-clk-pll-hs-div
    adi,dig-clocks-clk-pll-vco-freq_khz
    adi,dig-clocks-device-clock_khz
    adi,tx-settings-dis-tx-data-if-pll-unlock
    adi,tx-settings-tx2-atten_md-b
    adi,tx-settings-tx1-atten_md-b
    adi,tx-settings-tx-atten-step-size
    adi,tx-settings-tx-channels
    adi,tx-settings-deframer-sel
    adi,tx-profile-tx-bbf3d-bcorner_khz
    adi,tx-profile-tx-dac3d-bcorner_khz
    adi,tx-profile-rf-bandwidth_hz
    adi,tx-profile-primary-sig-bandwidth_hz
    adi,tx-profile-tx-input-rate_khz
    adi,tx-profile-tx-int5-interpolation
    adi,tx-profile-thb3-interpolation
    adi,tx-profile-thb2-interpolation
    adi,tx-profile-thb1-interpolation
    adi,tx-profile-tx-fir-interpolation
    adi,tx-profile-dac-div
    adi,tx-profile-tx-fir-num-fir-coefs
    adi,tx-profile-tx-fir-gain_db
    adi,obs-settings-obs-rx-lo-source
    adi,obs-settings-obs-rx-channels-enable
    adi,obs-settings-framer-sel
    adi,orx-gain-control-orx2-min-gain-index
    adi,orx-gain-control-orx2-max-gain-index
    adi,orx-gain-control-orx1-min-gain-index
    adi,orx-gain-control-orx1-max-gain-index
    adi,orx-gain-control-orx2-gain-index
    adi,orx-gain-control-orx1-gain-index
    adi,orx-gain-control-gain-mode
    adi,orx-profile-orx-ddc-mode
    adi,orx-profile-rx-bbf3d-bcorner_khz
    adi,orx-profile-rf-bandwidth_hz
    adi,orx-profile-orx-output-rate_khz
    adi,orx-profile-rhb1-decimation
    adi,orx-profile-rx-dec5-decimation
    adi,orx-profile-rx-fir-decimation
    adi,orx-profile-rx-fir-num-fir-coefs
    adi,orx-profile-rx-fir-gain_db
    adi,rx-settings-rx-channels
    adi,rx-settings-framer-sel
    adi,rx-gain-control-rx2-min-gain-index
    adi,rx-gain-control-rx2-max-gain-index
    adi,rx-gain-control-rx1-min-gain-index
    adi,rx-gain-control-rx1-max-gain-index
    adi,rx-gain-control-rx2-gain-index
    adi,rx-gain-control-rx1-gain-index
    adi,rx-gain-control-gain-mode
    adi,rx-nco-shifter-band-bnco2-freq_khz
    adi,rx-nco-shifter-band-bnco1-freq_khz
    adi,rx-nco-shifter-band-binput-center-freq_khz
    adi,rx-nco-shifter-band-binput-band-width_khz
    adi,rx-nco-shifter-band-a-nco2-freq_khz
    adi,rx-nco-shifter-band-a-nco1-freq_khz
    adi,rx-nco-shifter-band-a-input-center-freq_khz
    adi,rx-nco-shifter-band-a-input-band-width_khz
    adi,rx-profile-rx-ddc-mode
    adi,rx-profile-rx-bbf3d-bcorner_khz
    adi,rx-profile-rf-bandwidth_hz
    adi,rx-profile-rx-output-rate_khz
    adi,rx-profile-rhb1-decimation
    adi,rx-profile-rx-dec5-decimation
    adi,rx-profile-rx-fir-decimation
    adi,rx-profile-rx-fir-num-fir-coefs
    adi,rx-profile-rx-fir-gain_db
    adi,tx-pa-protection-tx2-peak-threshold
    adi,tx-pa-protection-tx1-peak-threshold
    adi,tx-pa-protection-peak-count
    adi,tx-pa-protection-tx2-power-threshold
    adi,tx-pa-protection-tx1-power-threshold
    adi,tx-pa-protection-tx-atten-step
    adi,tx-pa-protection-avg-duration
    adi,tx2-atten-ctrl-pin-enable
    adi,tx2-atten-ctrl-pin-tx-atten-dec-pin
    adi,tx2-atten-ctrl-pin-tx-atten-inc-pin
    adi,tx2-atten-ctrl-pin-step-size
    adi,tx1-atten-ctrl-pin-enable
    adi,tx1-atten-ctrl-pin-tx-atten-dec-pin
    adi,tx1-atten-ctrl-pin-tx-atten-inc-pin
    adi,tx1-atten-ctrl-pin-step-size
    adi,rx2-gain-ctrl-pin-enable
    adi,rx2-gain-ctrl-pin-rx-gain-dec-pin
    adi,rx2-gain-ctrl-pin-rx-gain-inc-pin
    adi,rx2-gain-ctrl-pin-dec-step
    adi,rx2-gain-ctrl-pin-inc-step
    adi,rx1-gain-ctrl-pin-enable
    adi,rx1-gain-ctrl-pin-rx-gain-dec-pin
    adi,rx1-gain-ctrl-pin-rx-gain-inc-pin
    adi,rx1-gain-ctrl-pin-dec-step
    adi,rx1-gain-ctrl-pin-inc-step
    adi,fhm-mode-fhm-init-frequency_hz
    adi,fhm-mode-fhm-exit-mode
    adi,fhm-mode-fhm-trigger-mode
    adi,fhm-mode-enable-mcs-sync
    adi,fhm-mode-fhm-enable
    adi,fhm-config-fhm-max-freq_mhz
    adi,fhm-config-fhm-min-freq_mhz
    adi,fhm-config-fhm-gpio-pin
    adi,orx-lo-cfg-gpio-select
    adi,orx-lo-cfg-disable-aux-pll-relocking
    adi,gpio3v3-output-level-mask
    adi,gpio3v3-output-enable-mask
    adi,gpio3v3-source-control
    adi,arm-gpio-config-en-tx-tracking-cals-enable
    adi,arm-gpio-config-en-tx-tracking-cals-polarity
    adi,arm-gpio-config-en-tx-tracking-cals-gpio-pin-sel
    adi,arm-gpio-config-orx2-tx-sel1-pin-enable
    adi,arm-gpio-config-orx2-tx-sel1-pin-polarity
    adi,arm-gpio-config-orx2-tx-sel1-pin-gpio-pin-sel
    adi,arm-gpio-config-orx2-tx-sel0-pin-enable
    adi,arm-gpio-config-orx2-tx-sel0-pin-polarity
    adi,arm-gpio-config-orx2-tx-sel0-pin-gpio-pin-sel
    adi,arm-gpio-config-orx1-tx-sel1-pin-enable
    adi,arm-gpio-config-orx1-tx-sel1-pin-polarity
    adi,arm-gpio-config-orx1-tx-sel1-pin-gpio-pin-sel
    adi,arm-gpio-config-orx1-tx-sel0-pin-enable
    adi,arm-gpio-config-orx1-tx-sel0-pin-polarity
    adi,arm-gpio-config-orx1-tx-sel0-pin-gpio-pin-sel
    adi,jesd204-sysref-lvds-pn-invert
    adi,jesd204-sysref-lvds-mode
    adi,jesd204-des-eq-setting
    adi,jesd204-des-invert-lane-polarity
    adi,jesd204-ser-invert-lane-polarity
    adi,jesd204-ser-pre-emphasis
    adi,jesd204-ser-amplitude
    adi,jesd204-deframer-b-enable-manual-lane-xbar
    adi,jesd204-deframer-b-syncb-out-cmos-drive-level
    adi,jesd204-deframer-b-syncb-out-cmos-slew-rate
    adi,jesd204-deframer-b-syncb-out-lvds-pn-invert
    adi,jesd204-deframer-b-syncb-out-lvds-mode
    adi,jesd204-deframer-b-np
    adi,jesd204-deframer-b-syncb-out-select
    adi,jesd204-deframer-b-new-sysref-on-relink
    adi,jesd204-deframer-b-lmfc-offset
    adi,jesd204-deframer-b-deserializer-lane-crossbar
    adi,jesd204-deframer-b-deserializer-lanes-enabled
    adi,jesd204-deframer-b-external-sysref
    adi,jesd204-deframer-b-scramble
    adi,jesd204-deframer-b-k
    adi,jesd204-deframer-b-m
    adi,jesd204-deframer-b-lane0-id
    adi,jesd204-deframer-b-device-id
    adi,jesd204-deframer-b-bank-id
    adi,jesd204-deframer-a-enable-manual-lane-xbar
    adi,jesd204-deframer-a-syncb-out-cmos-drive-level
    adi,jesd204-deframer-a-syncb-out-cmos-slew-rate
    adi,jesd204-deframer-a-syncb-out-lvds-pn-invert
    adi,jesd204-deframer-a-syncb-out-lvds-mode
    adi,jesd204-deframer-a-np
    adi,jesd204-deframer-a-syncb-out-select
    adi,jesd204-deframer-a-new-sysref-on-relink
    adi,jesd204-deframer-a-lmfc-offset
    adi,jesd204-deframer-a-deserializer-lane-crossbar
    adi,jesd204-deframer-a-deserializer-lanes-enabled
    adi,jesd204-deframer-a-external-sysref
    adi,jesd204-deframer-a-scramble
    adi,jesd204-deframer-a-k
    adi,jesd204-deframer-a-m
    adi,jesd204-deframer-a-lane0-id
    adi,jesd204-deframer-a-device-id
    adi,jesd204-deframer-a-bank-id
    adi,jesd204-framer-b-enable-manual-lane-xbar
    adi,jesd204-framer-b-syncb-in-lvds-pn-invert
    adi,jesd204-framer-b-syncb-in-lvds-mode
    adi,jesd204-framer-b-over-sample
    adi,jesd204-framer-b-syncb-in-select
    adi,jesd204-framer-b-new-sysref-on-relink
    adi,jesd204-framer-b-lmfc-offset
    adi,jesd204-framer-b-serializer-lane-crossbar
    adi,jesd204-framer-b-serializer-lanes-enabled
    adi,jesd204-framer-b-external-sysref
    adi,jesd204-framer-b-scramble
    adi,jesd204-framer-b-np
    adi,jesd204-framer-b-f
    adi,jesd204-framer-b-k
    adi,jesd204-framer-b-m
    adi,jesd204-framer-b-lane0-id
    adi,jesd204-framer-b-device-id
    adi,jesd204-framer-b-bank-id
    adi,jesd204-framer-a-enable-manual-lane-xbar
    adi,jesd204-framer-a-syncb-in-lvds-pn-invert
    adi,jesd204-framer-a-syncb-in-lvds-mode
    adi,jesd204-framer-a-over-sample
    adi,jesd204-framer-a-syncb-in-select
    adi,jesd204-framer-a-new-sysref-on-relink
    adi,jesd204-framer-a-lmfc-offset
    adi,jesd204-framer-a-serializer-lane-crossbar
    adi,jesd204-framer-a-serializer-lanes-enabled
    adi,jesd204-framer-a-external-sysref
    adi,jesd204-framer-a-scramble
    adi,jesd204-framer-a-np
    adi,jesd204-framer-a-f
    adi,jesd204-framer-a-k
    adi,jesd204-framer-a-m
    adi,jesd204-framer-a-lane0-id
    adi,jesd204-framer-a-device-id
    adi,jesd204-framer-a-bank-id
    adi,aux-dac-values11
    adi,aux-dac-values10
    adi,aux-dac-values9
    adi,aux-dac-resolution9
    adi,aux-dac-vref9
    adi,aux-dac-values8
    adi,aux-dac-resolution8
    adi,aux-dac-vref8
    adi,aux-dac-values7
    adi,aux-dac-resolution7
    adi,aux-dac-vref7
    adi,aux-dac-values6
    adi,aux-dac-resolution6
    adi,aux-dac-vref6
    adi,aux-dac-values5
    adi,aux-dac-resolution5
    adi,aux-dac-vref5
    adi,aux-dac-values4
    adi,aux-dac-resolution4
    adi,aux-dac-vref4
    adi,aux-dac-values3
    adi,aux-dac-resolution3
    adi,aux-dac-vref3
    adi,aux-dac-values2
    adi,aux-dac-resolution2
    adi,aux-dac-vref2
    adi,aux-dac-values1
    adi,aux-dac-resolution1
    adi,aux-dac-vref1
    adi,aux-dac-values0
    adi,aux-dac-resolution0
    adi,aux-dac-vref0
    adi,aux-dac-enables
    adi,rxagc-agc-enable-fast-recovery-loop
    adi,rxagc-ip3-peak-exceeded-cnt
    adi,rxagc-ip3-over-range-thresh-index
    adi,rxagc-ip3-over-range-thresh
    adi,rxagc-agc-enable-ip3-optimization-thresh
    adi,rxagc-agc-enable-sync-pulse-for-gain-counter
    adi,rxagc-agc-reset-on-rxon
    adi,rxagc-agc-peak-thresh-gain-control-mode
    adi,rxagc-agc-change-gain-if-thresh-high
    adi,rxagc-agc-low-thresh-prevent-gain
    adi,rxagc-agc-slow-loop-settling-delay
    adi,rxagc-agc-rx2-attack-delay
    adi,rxagc-agc-rx1-attack-delay
    adi,rxagc-agc-gain-update-counter_us
    adi,rxagc-agc-rx2-min-gain-index
    adi,rxagc-agc-rx2-max-gain-index
    adi,rxagc-agc-rx1-min-gain-index
    adi,rxagc-agc-rx1-max-gain-index
    adi,rxagc-agc-peak-wait-time
    adi,rxagc-power-power-log-shift
    adi,rxagc-power-upper1-power-thresh
    adi,rxagc-power-upper0-power-thresh
    adi,rxagc-power-rx2-tdd-power-meas-delay
    adi,rxagc-power-rx2-tdd-power-meas-duration
    adi,rxagc-power-rx1-tdd-power-meas-delay
    adi,rxagc-power-rx1-tdd-power-meas-duration
    adi,rxagc-power-power-measurement-duration
    adi,rxagc-power-under-range-low-power-gain-step-recovery
    adi,rxagc-power-under-range-high-power-gain-step-recovery
    adi,rxagc-power-under-range-low-power-thresh
    adi,rxagc-power-under-range-high-power-thresh
    adi,rxagc-power-power-use-bbdc2
    adi,rxagc-power-power-use-rfir-out
    adi,rxagc-power-power-enable-measurement
    adi,rxagc-peak-hb2-thresh-config
    adi,rxagc-peak-hb2-ovrg-sel
    adi,rxagc-peak-hb2-overload-power-mode
    adi,rxagc-peak-hb2-gain-step-attack
    adi,rxagc-peak-hb2-gain-step-mid-recovery
    adi,rxagc-peak-hb2-gain-step-low-recovery
    adi,rxagc-peak-hb2-gain-step-high-recovery
    adi,rxagc-peak-hb2-lower-thresh-peak-exceeded-cnt
    adi,rxagc-peak-hb2-upper-thresh-peak-exceeded-cnt
    adi,rxagc-peak-hb2-under-range-high-thresh
    adi,rxagc-peak-hb2-under-range-mid-thresh
    adi,rxagc-peak-hb2-under-range-low-thresh
    adi,rxagc-peak-hb2-high-thresh
    adi,rxagc-peak-hb2-overload-thresh-cnt
    adi,rxagc-peak-hb2-overload-duration-cnt
    adi,rxagc-peak-enable-hb2-overload
    adi,rxagc-peak-apd-gain-step-recovery
    adi,rxagc-peak-apd-gain-step-attack
    adi,rxagc-peak-apd-lower-thresh-peak-exceeded-cnt
    adi,rxagc-peak-apd-upper-thresh-peak-exceeded-cnt
    adi,rxagc-peak-apd-low-gain-mode-low-thresh
    adi,rxagc-peak-apd-low-thresh
    adi,rxagc-peak-apd-low-gain-mode-high-thresh
    adi,rxagc-peak-apd-high-thresh
    adi,rxagc-peak-agc-under-range-high-interval
    adi,rxagc-peak-agc-under-range-mid-interval
    adi,rxagc-peak-agc-under-range-low-interval_ns
    adi,default-initial-calibrations-mask
    direct_reg_access

  • So the prop is there.

    Can you try printing the value from it then writing in a new string?

    -Travis