# PARTICULAR PURPOSE ARE DISCLAIMED. # # IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY # RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import time import adi import matplotlib.pyplot as plt from scipy import signal dev = adi.ad9081("ip:analog.local") # Configure properties print("--Setting up chip") # Set NCOs dev.rx_channel_nco_frequencies = [0] * 4 dev.tx_channel_nco_frequencies = [0] * 4 dev.rx_main_nco_frequencies = [1000000000] * 4 dev.tx_main_nco_frequencies = [1000000000] * 4 dev.rx_enabled_channels = [0] dev.tx_enabled_channels = [0] dev.rx_nyquist_zone = ["odd"] * 4
def test_ad9081(iio_uri): dev = adi.ad9081(iio_uri) assert dev del dev
cor = np.correlate(chan0_tmp, chan1_tmp, "full") # plt.plot(np.real(cor)) # plt.plot(np.imag(cor)) # plt.plot(np.abs(cor)) # plt.show() i = np.argmax(np.abs(cor)) m = cor[i] sample_delay = len(chan0_tmp) - i - 1 phases.append(np.angle(m) * 180 / np.pi) delays.append(sample_delay) return (np.mean(phases), np.mean(delays)) uri = "ip:10.44.3.53" dev = adi.ad9081(uri) mux_txffh = genmux(uri, device_name="mux-txffh") mux_rxffh = genmux(uri, device_name="mux-rxffh") mux_rxnco = genmux(uri, device_name="mux-rxnco") mux_txnco = genmux(uri, device_name="mux-txnco") N_NCOS = 16 # Total number of CDDCs/CDUCs NM_RX = len(dev.rx_main_nco_frequencies) NM_TX = len(dev.tx_main_nco_frequencies) dev.tx_main_nco_frequencies = [500000000] * 4 dev.tx_main_ffh_gpio_mode_enable = 0 dev.tx_main_ffh_mode = ["phase_coherent"] * NM_TX
# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY # RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import sys import adi import matplotlib.pyplot as plt import numpy as np url = "ip:analog-2.local" if len(sys.argv) == 1 else sys.argv[1] trx = adi.ad9081(url) tdd = adi.tdd(url) trx.rx_channel_nco_frequencies = [0] * 4 trx.tx_channel_nco_frequencies = [0] * 4 trx.rx_main_nco_frequencies = [2450000000] * 4 trx.tx_main_nco_frequencies = [2450000000] * 4 trx.rx_enabled_channels = [0] trx.tx_enabled_channels = [0] trx.rx_nyquist_zone = ["odd"] * 4 N_rx = 2**15 trx.rx_buffer_size = N_rx
import adi uri = "ip:analog.local" sdr = adi.ad9081(uri) ctx = sdr._ctx dev = ctx.find_device("axi-ad9081-rx-hpc") # Select components of interest adc = 2 # Can be 0,1,2,3 (0,1 for AD9082) cddc = 0 # Can be 0,1,2,3 fddc = 0 # Can be 0,1,2,3,4,5,6,7 jtx = 0 # Can be 0,1 (Link 0, Link 1) dac = 0 # Can be 0,1,2,3 fduc = 0 # Can be 0,1,2,3,4,5,6,7 # RX ADC_COARSE_PAGE = 0x18 FINE_DDC_PAGE = 0x19 JTX_PAGE = 0x1A # TX PAGEINDX_DAC_MAINDP_DAC = 0x1B PAGEINDX_DAC_CHAN = 0x1C # Paging helpers def set_bit(val, index, bit): # print('{:b}'.format(val)) mask = 1 << index val &= ~mask if bit: