Post Go back to editing

sometime pyadi receives on only first 2 channel instead of all 4 channel on FMCOMMS5

Category: Software
Product Number: FMCOMMS5 with ZC702

Run below code on ZC702 with Aug 3 2022 image:

import time
import adi

sdr = adi.FMComms5("ip:127.0.0.1")

record_duration = 0.25 * 1e-3
rx_lo = 2412000000
rx_gain = 30
rx_rf_bandwidth = 20000000
sample_rate = 20000000

sdr.sample_rate = sample_rate
sdr.rx_rf_bandwidth = rx_rf_bandwidth
sdr.rx_rf_bandwidth_chip_b = rx_rf_bandwidth

sdr.rx_lo = rx_lo
sdr.rx_lo_chip_b = rx_lo

gain_control_mode = "manual"
sdr.gain_control_mode_chan0 = gain_control_mode
sdr.gain_control_mode_chan1 = gain_control_mode
sdr.gain_control_mode_chip_b_chan0 = gain_control_mode
sdr.gain_control_mode_chip_b_chan1 = gain_control_mode

sdr.rx_hardwaregain_chan0 = rx_gain
sdr.rx_hardwaregain_chan1 = rx_gain
sdr.rx_hardwaregain_chip_b_chan0 = rx_gain
sdr.rx_hardwaregain_chip_b_chan1 = rx_gain

sdr.rx_enabled_channels = [0, 1, 2, 3]

# this is buffer size in samples for one channel
rx_buffer_size = int(record_duration * sample_rate)
sdr.rx_buffer_size = rx_buffer_size

time.sleep(1) # reserve for FPGA to response

data = sdr.rx()

for idx in range(10):
print("%5d+%5dj %5d+%5dj %5d+%5dj %5d+%5dj" % (
np.real(data[0][idx]), np.imag(data[0][idx]),
np.real(data[1][idx]), np.imag(data[1][idx]),
np.real(data[2][idx]), np.imag(data[2][idx]),
np.real(data[3][idx]), np.imag(data[3][idx])))

sdr.rx_destroy_buffer()
Four running result are shown as below:
analog@analog:~/workspace/fmcomms5_py $ python3 fmcomms5_py_source.py
-2+ 1j 1+ 0j -3+ -10j -1041+-1041j
-1+ 0j -3+ -1j -3+ -10j -1041+-1041j
0+ 2j -2+ 0j -3+ -10j -1041+-1041j
0+ -1j 1+ 0j -3+ -10j -1041+-1041j
0+ 0j 1+ 2j -3+ -10j -1041+-1041j
-1+ 0j -1+ 1j -3+ -10j -1041+-1041j
0+ -2j -1+ 1j -3+ -10j -1041+-1041j
0+ 1j 1+ 0j -3+ -10j -1041+-1041j
-1+ 0j 3+ 0j -3+ -10j -1041+-1041j
1+ 0j -2+ -1j -3+ -10j -1041+-1041j
analog@analog:~/workspace/fmcomms5_py $ python3 fmcomms5_py_source.py
-1+ 0j -1+ -2j 1+ 0j 0+ 1j
1+ 0j -1+ -2j 1+ 0j 1+ 2j
0+ 1j 0+ 1j -1+ 0j -1+ 1j
0+ 1j -1+ 0j 1+ -1j -2+ 0j
-1+ 1j 1+ 0j 0+ 1j 0+ 0j
0+ -1j 2+ -1j -1+ -1j -1+ 0j
0+ 0j 1+ 0j -1+ -1j 1+ 0j
1+ 0j 1+ 0j -1+ 0j 0+ 0j
-1+ -2j 1+ 1j 0+ 0j -3+ 1j
0+ -1j -2+ 0j -1+ 1j 0+ 1j
It is easy to see that ch0/1 are correct for two running. But ch2/3 are not correct for the first running. When ch2/3 are correct are totally randomly, sometimes it can repeat the error for tens time.
Parents Reply Children
  • This likely happens since FMComms5 relies upon MCS to do the alignment of the data frames from the transceivers. This only happens if you have libad9361-iio (and python bindings for it). You can see the MCS call here: https://github.com/analogdevicesinc/pyadi-iio/blob/master/adi/fmcomms5.py#L81

    Try installing the libad9361 bindings.

    -Travis

  • Thanks a lot, Travis. But I am still not know what to do. I am just freshman to use the board.

    I checked the package installed:

    analog@analog:~/workspace/fmcomms5_py $ sudo apt list *9361*
    Listing... Done
    libad9361-0/stable,now 0.2-1 armhf [installed,automatic]
    libad9361-dev/stable 0.2-1 armhf
    analog@analog:~/workspace/fmcomms5_py $ sudo apt list *iio*
    Listing... Done
    gr-iio/stable,now 0.3-9+b3 armhf [installed]
    iio-sensor-proxy/stable,now 3.0-2 armhf [installed]
    iiod-dbgsym/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    iiod/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libgiftiio-dev/stable,now 1.0.9-4 armhf [installed]
    libgiftiio0/stable,now 1.0.9-4 armhf [installed]
    libgnuradio-iio1/stable,now 0.3-9+b3 armhf [installed]
    libiio-dev/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libiio-utils-dbgsym/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libiio-utils/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libiio0-dbgsym/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libiio0-doc/stable,now 0.23-2~bpo11~rpt1 all [installed]
    libiio0/stable,now 0.23-2~bpo11~rpt1 armhf [installed]
    libniftiio-dev/stable,now 3.0.1-8 armhf [installed]
    libniftiio2/stable,now 3.0.1-8 armhf [installed]
    miio-tools/stable,now 0.5.0.1-1 all [installed]
    python3-libiio/stable,now 0.23-2~bpo11~rpt1 all [installed]
    python3-miio/stable,now 0.5.0.1-1 all [installed]
    analog@analog:~/workspace/fmcomms5_py $

    there is no  libad9361-iio.

    What is "the libad9361 bindings"?

  • Just now I tried to build libad9361-iio on ZC702 from https://github.com/analogdevicesinc/libad9361-iio master branch.

    After it is installed and reboot ZC702, I tried the same python code. It still gives the same results. Sometime correct, sometimes wrong.

    I also did another trial, starting ZC702 with command line instead of GUI. Same results still, just the chance of correct is higher, but still about half of running gives wrong results.

    I also run the code with sudo privilege, seems no much difference still.

  • When I ran iio oscilloscope on a remote Linux host. seems there is no this problem from observing ch4 waveform. But if running the same python code with sudo on that host, it still show the problem