ADRV9002 Pyadi-iio Cyclic Buffer

Hello,

I am using the following script to run a transmit test on the ADRV9002.

sdr = adi.adrv9002(uri="ip:192.168.1.233")

sdr.tx_hardwaregain_chan0 = -40

sdr.tx_ensm_mode_chan0 = "rf_enabled"

Fs = 15360000
t = np.arange(0,0.1,1/Fs)

Fc = 5000000
fm = 20000
frm = np.cos(2 * np.pi * Fc * t + np.sin(2 * np.pi * fm * t)) * 2 ** 15
m = np.sin(2 * np.pi * fm * t) * 2 ** 15

frm.astype(complex)

sdr.tx_cyclic_buffer = True


for i in range(10000):
    sdr.tx(frm)

Despite defining the set up for "tx channel 0", I am only getting the expected TX RF output on TX2_OUT SMA and not the expected TX1_OUT SMA. 

Also, the only way I am able to get the transmit path to repeatedly transmit so I can view the results on a PXA is by looping the sdr.tx(frm) over and over again in a for loop. Is this the correct way to "constantly" transmit so that the output can be monitored continuously. Does the sdr.tx_cyclic_buffer = True do this somehow so that the sdr.tx does not have to be constantly looped? 

Thanks! 

-NT

Parents
  • 0
    •  Analog Employees 
    on Feb 8, 2021 8:21 PM
    Despite defining the set up for "tx channel 0", I am only getting the expected TX RF output on TX2_OUT SMA and not the expected TX1_OUT SMA. 

    Are you loading a profile? If you use IIO-Scope does this hold true with the DDS or the DAC Buffer outputs?

    Does the sdr.tx_cyclic_buffer = True do this somehow so that the sdr.tx does not have to be constantly looped? 

    Just set the tx_cyclic_buffer to True and do not loop. Just a single buffer needs to be passed. Note that if python exits or the sdr object is cleared the drivers will switch back to DDS mode.

    -Travis

  • Thanks for the response,

    Even after setting the tx_cyclic_buffer to True and passing the buffer once as shown below, the transmitter still does not constantly transmit the buffer, I see the TX data on the PXA only for a brief moment when the sdr.tx(frm) is called but it only shows a continuous transmission when looping the sdr.tx(frm) command. I also am not exiting Python or destroying the sdr object.

    sdr = adi.adrv9002(uri="ip:192.168.1.233")

    sdr.tx_hardwaregain_chan0 = -40

    sdr.tx_ensm_mode_chan0 = "rf_enabled"

    Fs = 15360000
    t = np.arange(0,0.1,1/Fs)

    Fc = 5000000
    fm = 20000


    frm = np.cos(2 * np.pi * Fc * t + np.sin(2 * np.pi * fm * t)) * 2 ** 15


    m = np.sin(2 * np.pi * fm * t) * 2 ** 15

    frm = frm.astype(complex)

    sdr.tx_cyclic_buffer = True
    time.sleep(1)
    sdr.tx(frm)


    while True:
        pass

    Thanks,

    -NT

  • 0
    •  Analog Employees 
    on Feb 8, 2021 11:24 PM in reply to travisfcollins

    Looks like it's remapping all the DMA functions to tx2.

    Can you try this branch: https://github.com/analogdevicesinc/pyadi-iio/tree/adrv9002-split-dma

    Still running through the tests on my side.

    -Travis

  • Thanks,

    When trying to run through the suggested test branch provided, I get a new error now when trying to connect via the sdr = adi.adrv9002(uri="192.168.1.233") listed below.

    sdr = adi.adrv9002(uri="ip:192.168.1.233")

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\adrv9002.py", line 88, in __init__
    remap(self._rx2, "rx_", "rx2_", type(self))

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\obs.py", line 55, in remap
    for func in dir(object_source)

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\obs.py", line 56, in <listcomp>
    if (getattr(object_source, func))

    TypeError: descriptor '__weakref__' for 'attribute' objects doesn't apply to 'obs' object

     

  • Correction, I am now running the adrv9002-split-dma branch, the error I am seeing now is

    when I try to run the sdr.tx(frm) command. I am in 'split" DMA mode and the "enabled" tx channel is channel "0"

    The error I get is:


    File "O:\Users\nTiberio\WDK\Python\Python_FM_SINAD\untitled16.py", line 72, in <module>
    sdr.tx(frm)

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\rx_tx.py", line 394, in tx

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\dds.py", line 82, in disable_dds

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\dds.py", line 122, in dds_enabled

    File "C:\Users\ntiberio\AppData\Local\Continuum\anaconda3\lib\site-packages\adi\dds.py", line 48, in __update_dds

    AttributeError: 'NoneType' object has no attribute 'channels'

  • 0
    •  Analog Employees 
    on Feb 9, 2021 6:24 PM in reply to nmt4781

    I cannot repeat this on my end. Can you run this and provide the output:

    import adi

    sdr = adi.adrv9002(uri=<your uri>)

    print(dir(sdr))

    print(sdr._txdac.name)

    for chan in sdr._txdac.channels:

        print(chan.id)

    -Travis

  • I was able to successfully run from the adrv9002-split-dma branch in the end and resolve the errors I listed above, the error was on my side as I was not properly "switching" to this branch. 

    I am now correctly transmitting out of the TX1_OUT SMA port and the TX cyclic buffer is now functioning as expected as well. 

    Thank you for the help.

    -NT

Reply Children