Post Go back to editing

USRP E312 (AD9361) - IIO Oscilloscope doesn't work

Category: Software
Product Number: USRP E312 (AD9361) from Ettus
Software Version: WSL 2: Ubuntu-20.04, Kernel 5.10.102.1, hdl: master, no-OS master

I tried using IIO oscilloscope with the SDR E312 from Ettus, I use the code from my previous thread USRP E312 (AD9361) - ad9361_dig_tune_delay: Tuning RX FAILED!  thanks to   with this commit.

Then I enable IIO_SUPPORT, it works with the following result: 

cf-ad9361-lpc: Successfully initialized (61439514 Hz)
ad9361_init : AD936x Rev 2 successfully initialized
Sampling frequency is: 30720000
New sampling frequency is: 15360000
LO frequency of TX is: 1000000000
Output port TX: 0
Power state of Tx: 1
cf-ad9361-dds-core-lpc: Successfully initialized (30718994 Hz)
�Running TinyIIOD server...
If successful, you may connect an IIO client application by:
1. Disconnecting the serial terminal you use to view this message.
2. Connecting the IIO client application using the serial backend configured as shown:
Baudrate: 921600
Data size: 8 bits
Parity: none
Stop bits: 1
Flow control: none

However, on my computer IIO Oscilloscope doesn't work. I have the same problems than   in this thread  serial connection with iio oscilloscope .

For example when installing IIO oscilloscope with this link IIO Oscilloscope , i can't choose Serial Content.

According to  ,  I reinstalled libiio with the command:

analog@precision:~/libiio$ mkdir build
analog@precision:~/libiio/build$ cd build
analog@precision:~/libiio/build$ cmake ../ -DWITH_SERIAL_BACKEND=ON
analog@precision:~/libiio/build$ make -j
analog@precision:~/libiio/build$ sudo make instal

Thus, i have the error Could not get IIO Context: inappropriate ioctl for device ...

So I tried to build libserialport with the link https://sigrok.org/wiki/Libserialport and the post of   with the command:

$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ sudo make instal

but I'm stuck at ./autogen.sh, I get the following error:

/path/to/libserialport$ ./autogen.sh
/bin/sh: 0: Illegal option -

How can we solve this problem?
Thank you very much for your time,

Regards,

Rémi



Modification
[edited by: RemiL at 12:58 PM (GMT -4) on 13 Jul 2023]
  • Hi Rémi,

    Could you try to install libserialport via the package manager rather than building it  from source ? 

    Try :  apt-get install libserialport-dev

    After you have installed this package, you will need to rebuild libiio with the serial backend enabled. Then, you will also have to rebuild iio-oscilloscope.

    Let us know if this works for you.

    -Cristina

  • HI  ,

    Thank you for your reply.

    I installed as you said libserialport-dev. But I get exactly the same error.

    Here are the results of some commands if you need them:

    path/to/libiio/build$ cmake ../ -DWITH_SERIAL_BACKEND=ON

    -- cmake version: 3.16.3
    -- The C compiler identification is GNU 9.4.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Performing Test HAS_WPEDANTIC
    -- Performing Test HAS_WPEDANTIC - Success
    -- Performing Test HAS_WSHADOW
    -- Performing Test HAS_WSHADOW - Success
    -- Looking for strdup
    -- Looking for strdup - found
    -- Looking for strndup
    -- Looking for strndup - found
    -- Looking for strerror_r
    -- Looking for strerror_r - found
    -- Looking for strtok_r
    -- Looking for strtok_r - found
    -- Looking for newlocale
    -- Looking for newlocale - found
    -- Looking for in6addr_any
    -- Looking for in6addr_any - found
    -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
    -- Checking for module 'libusb-1.0'
    --   Found libusb-1.0, version 1.0.23
    -- Looking for libusb_get_version
    -- Looking for libusb_get_version - found
    -- Found Git: /usr/bin/git (found version "2.25.1")
    -- Looking for libserialport : Found
    -- Performing Test WITH_NETWORK_EVENTFD
    -- Performing Test WITH_NETWORK_EVENTFD - Success
    -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.10")
    -- Found BISON: /usr/bin/bison (found version "3.5.1")
    -- Found FLEX: /usr/bin/flex (found version "2.6.4")
    -- Looking for pthread_setname_np
    -- Looking for pthread_setname_np - found
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of struct usb_functionfs_descs_head_v2
    -- Check size of struct usb_functionfs_descs_head_v2 - done
    -- Features enabled : xml network dns-sd avahi ipv6 serial local local-mmap hwmon usb utils iiod udev-rule iiod-serial iiod-aio iiod-usb man-utils
    -- Features disabled: zstd bonjour examples c++-bindings iiod-systemd iiod-sysvinit iiod-upstart doc man python-bindings c#-bindings
    -- Configuring done
    -- Generating done
    -- Build files have been written to :path/to/liibio/build
    

    path/to/libiio/build$ sudo make install

    path/to/libiio/build$ sudo make install
    [ 41%] Built target iio
    [ 47%] Built target iio_tests_helper
    [ 52%] Built target iio_genxml
    [ 56%] Built target iio_writedev
    [ 60%] Built target iio_stresstest
    [ 64%] Built target iio_info
    [ 68%] Built target iio_attr
    [ 72%] Built target iio_readdev
    [ 77%] Built target iio_reg
    [100%] Built target iiod
    Install the project...
    -- Install configuration: "RelWithDebInfo"
    -- Installing: /usr/lib/x86_64-linux-gnu/pkgconfig/libiio.pc
    -- Installing: /usr/lib/x86_64-linux-gnu/libiio.so.0.25
    -- Up-to-date: /usr/lib/x86_64-linux-gnu/libiio.so.0
    -- Up-to-date: /usr/lib/x86_64-linux-gnu/libiio.so
    -- Installing: /usr/include/iio.h
    -- Installing: /lib/udev/rules.d/90-libiio.rules
    -- Installing: /usr/bin/iio_genxml
    -- Set runtime path of "/usr/bin/iio_genxml" to ""
    -- Installing: /usr/bin/iio_info
    -- Set runtime path of "/usr/bin/iio_info" to ""
    -- Installing: /usr/bin/iio_attr
    -- Set runtime path of "/usr/bin/iio_attr" to ""
    -- Installing: /usr/bin/iio_readdev
    -- Set runtime path of "/usr/bin/iio_readdev" to ""
    -- Installing: /usr/bin/iio_reg
    -- Set runtime path of "/usr/bin/iio_reg" to ""
    -- Installing: /usr/bin/iio_writedev
    -- Set runtime path of "/usr/bin/iio_writedev" to ""
    -- Installing: /usr/bin/iio_stresstest
    -- Set runtime path of "/usr/bin/iio_stresstest" to ""
    -- Installing: /usr/sbin/iiod
    -- Set runtime path of "/usr/sbin/iiod" to ""

    path/to/iio-oscilloscope/build$ cmake ../ && make -j $(nproc)

    path/to/iio-oscilloscope/build$ cmake ../ && make -j $(nproc)
    -- The C compiler identification is GNU 9.4.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Found Git: /usr/bin/git (found version "2.25.1")
    -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
    -- Checking for module 'glib-2.0'
    --   Found glib-2.0, version 2.64.6
    -- Checking for module 'gtk+-3.0'
    --   Found gtk+-3.0, version 3.24.20
    -- Checking for module 'gthread-2.0'
    --   Found gthread-2.0, version 2.64.6
    -- Checking for module 'gtkdatabox'
    --   Found gtkdatabox, version 1.0.0
    -- Checking for module 'fftw3'
    --   Found fftw3, version 3.3.8
    -- Checking for module 'libxml-2.0'
    --   Found libxml-2.0, version 2.9.10
    -- Checking for module 'libcurl'
    --   Found libcurl, version 7.68.0
    -- Checking for module 'jansson'
    --   Found jansson, version 2.12
    -- Checking for module 'matio'
    --   Found matio, version 1.5.17
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /path/to/iio-oscilloscope/build
    Scanning dependencies of target osc
    [  1%] Building C object CMakeFiles/osc.dir/osc.c.o
    [  8%] Building C object CMakeFiles/osc.dir/datatypes.c.o
    [  8%] Building C object CMakeFiles/osc.dir/oscplot.c.o
    [  8%] Building C object CMakeFiles/osc.dir/iio_utils.c.o
    [  8%] Building C object CMakeFiles/osc.dir/fru.c.o
    [  8%] Building C object CMakeFiles/osc.dir/iio_widget.c.o
    [  9%] Building C object CMakeFiles/osc.dir/dialogs.c.o
    [  9%] Building C object CMakeFiles/osc.dir/trigger_dialog.c.o
    [ 10%] Building C object CMakeFiles/osc.dir/xml_utils.c.o
    [ 12%] Building C object CMakeFiles/osc.dir/libini/libini.c.o
    [ 13%] Building C object CMakeFiles/osc.dir/libini2.c.o
    [ 14%] Building C object CMakeFiles/osc.dir/phone_home.c.o
    [ 15%] Building C object CMakeFiles/osc.dir/plugins/dac_data_manager.c.o
    [ 16%] Building C object CMakeFiles/osc.dir/plugins/fir_filter.c.o
    [ 18%] Building C object CMakeFiles/osc.dir/eeprom.c.o
    [ 19%] Building C object CMakeFiles/osc.dir/osc_preferences.c.o
    [ 20%] Linking C shared library libosc.so
    [ 20%] Built target osc
    Scanning dependencies of target adrv9002
    Scanning dependencies of target ad6676
    Scanning dependencies of target fmcadc3
    Scanning dependencies of target cf_axi_tdd
    Scanning dependencies of target ad9371_adv
    Scanning dependencies of target xmw
    Scanning dependencies of target fmcomms6
    Scanning dependencies of target oscmain
    [ 21%] Building C object plugins/CMakeFiles/xmw.dir/xmw.c.o
    [ 22%] Building C object plugins/CMakeFiles/cf_axi_tdd.dir/cf_axi_tdd.c.o
    [ 28%] Building C object plugins/CMakeFiles/fmcadc3.dir/fmcadc3.c.o
    [ 28%] Building C object plugins/CMakeFiles/adrv9002.dir/adrv9002.c.o
    [ 28%] Building C object plugins/CMakeFiles/fmcomms6.dir/fmcomms6.c.o
    [ 28%] Building C object CMakeFiles/oscmain.dir/oscmain.c.o
    [ 28%] Building C object plugins/CMakeFiles/ad6676.dir/ad6676.c.o
    [ 30%] Building C object plugins/CMakeFiles/ad9371_adv.dir/ad9371_adv.c.o
    [ 31%] Linking C shared library cf_axi_tdd.so
    [ 32%] Linking C shared library xmw.so
    [ 33%] Linking C shared library fmcadc3.so
    [ 34%] Linking C shared library fmcomms6.so
    [ 36%] Linking C shared library ad6676.so
    [ 37%] Linking C executable osc
    [ 38%] Linking C shared library ad9371_adv.so
    [ 38%] Built target cf_axi_tdd
    [ 38%] Built target fmcadc3
    [ 38%] Built target xmw
    [ 38%] Built target fmcomms6
    Scanning dependencies of target adrv9009_adv
    Scanning dependencies of target lidar
    Scanning dependencies of target fmcomms2_adv
    Scanning dependencies of target fmcomms11
    [ 38%] Built target ad6676
    Scanning dependencies of target pr_config
    [ 39%] Linking C shared library adrv9002.so
    [ 39%] Built target ad9371_adv
    Scanning dependencies of target fmcomms1
    [ 39%] Built target adrv9002
    Scanning dependencies of target adrv9009
    [ 39%] Built target oscmain
    Scanning dependencies of target fmcomms5
    [ 40%] Building C object plugins/CMakeFiles/lidar.dir/lidar.c.o
    [ 42%] Building C object plugins/CMakeFiles/adrv9009_adv.dir/adrv9009_adv.c.o
    [ 44%] Building C object plugins/CMakeFiles/fmcomms11.dir/fmcomms11.c.o
    [ 44%] Building C object plugins/CMakeFiles/fmcomms2_adv.dir/fmcomms2_adv.c.o
    [ 45%] Building C object plugins/CMakeFiles/pr_config.dir/pr_config.c.o
    [ 46%] Building C object plugins/CMakeFiles/fmcomms1.dir/fmcomms1.c.o
    [ 48%] Building C object plugins/CMakeFiles/adrv9009.dir/adrv9009.c.o
    [ 49%] Building C object plugins/CMakeFiles/fmcomms5.dir/fmcomms5.c.o
    [ 50%] Linking C shared library lidar.so
    [ 51%] Linking C shared library fmcomms11.so
    [ 53%] Linking C shared library pr_config.so
    [ 54%] Linking C shared library adrv9009_adv.so
    [ 55%] Linking C shared library fmcomms2_adv.so
    [ 55%] Built target lidar
    [ 55%] Built target fmcomms11
    Scanning dependencies of target cn0540
    [ 55%] Built target pr_config
    Scanning dependencies of target generic_dac
    [ 55%] Built target adrv9009_adv
    Scanning dependencies of target ad9371
    Scanning dependencies of target scpi
    [ 55%] Built target fmcomms2_adv
    Scanning dependencies of target ad9739a
    [ 56%] Linking C shared library fmcomms1.so
    [ 57%] Linking C shared library adrv9009.so
    [ 59%] Linking C shared library fmcomms5.so
    [ 59%] Built target fmcomms1
    [ 59%] Built target adrv9009
    Scanning dependencies of target daq2
    Scanning dependencies of target dmm
    [ 59%] Built target fmcomms5
    Scanning dependencies of target AD5628_1
    [ 60%] Building C object plugins/CMakeFiles/cn0540.dir/cn0540.c.o
    [ 61%] Building C object plugins/CMakeFiles/generic_dac.dir/generic_dac.c.o
    [ 62%] Building C object plugins/CMakeFiles/scpi.dir/scpi.c.o
    [ 63%] Building C object plugins/CMakeFiles/ad9371.dir/ad9371.c.o
    [ 65%] Building C object plugins/CMakeFiles/ad9739a.dir/ad9739a.c.o
    [ 66%] Linking C shared library generic_dac.so
    [ 67%] Linking C shared library cn0540.so
    [ 67%] Built target generic_dac
    Scanning dependencies of target fmcomms2
    [ 68%] Linking C shared library scpi.so
    [ 69%] Linking C shared library ad9739a.so
    [ 69%] Built target cn0540
    [ 71%] Building C object plugins/CMakeFiles/dmm.dir/dmm.c.o
    [ 72%] Building C object plugins/CMakeFiles/daq2.dir/daq2.c.o
    Scanning dependencies of target spectrum_analyzer
    [ 73%] Building C object plugins/CMakeFiles/AD5628_1.dir/AD5628_1.c.o
    [ 74%] Linking C shared library ad9371.so
    [ 74%] Built target scpi
    Scanning dependencies of target cn0357
    [ 74%] Built target ad9739a
    Scanning dependencies of target cn0508
    [ 75%] Linking C shared library AD5628_1.so
    [ 75%] Built target ad9371
    [ 77%] Linking C shared library dmm.so
    Scanning dependencies of target ad9084
    [ 78%] Linking C shared library daq2.so
    [ 78%] Built target AD5628_1
    [ 78%] Built target dmm
    Scanning dependencies of target ad9081
    Scanning dependencies of target cn0511
    [ 78%] Built target daq2
    Scanning dependencies of target motor_control
    [ 79%] Building C object plugins/CMakeFiles/fmcomms2.dir/fmcomms2.c.o
    [ 80%] Building C object plugins/CMakeFiles/spectrum_analyzer.dir/spectrum_analyzer.c.o
    [ 81%] Building C object plugins/CMakeFiles/cn0357.dir/cn0357.c.o
    [ 83%] Building C object plugins/CMakeFiles/cn0508.dir/cn0508.c.o
    [ 84%] Linking C shared library spectrum_analyzer.so
    [ 85%] Building C object plugins/CMakeFiles/ad9084.dir/ad9084.c.o
    [ 86%] Linking C shared library cn0357.so
    [ 89%] Building C object plugins/CMakeFiles/ad9081.dir/ad9081.c.o
    [ 89%] Building C object plugins/CMakeFiles/cn0511.dir/cn0511.c.o
    [ 90%] Linking C shared library cn0508.so
    [ 90%] Built target spectrum_analyzer
    Scanning dependencies of target debug
    [ 91%] Building C object plugins/CMakeFiles/motor_control.dir/motor_control.c.o
    [ 92%] Linking C shared library fmcomms2.so
    [ 92%] Built target cn0357
    [ 92%] Built target cn0508
    [ 93%] Linking C shared library ad9084.so
    [ 95%] Linking C shared library cn0511.so
    [ 95%] Built target fmcomms2
    [ 96%] Linking C shared library ad9081.so
    [ 96%] Built target ad9084
    [ 96%] Built target cn0511
    [ 96%] Built target ad9081
    [ 97%] Linking C shared library motor_control.so
    [ 97%] Built target motor_control
    [ 98%] Building C object plugins/CMakeFiles/debug.dir/debug.c.o
    [100%] Linking C shared library debug.so
    [100%] Built target debug

    Do you have any other possible solutions to this problem?

    I also tried to install IIO oscilloscope with this link on a windows laptop but I get the following error:

    Is there any other software to install or is the problem with the USRP E312?


    Thank you very much,

    Regards,

    Rémi

  • Hi ,

    You will have to set XPAR_XUARTPS_0_INTR in the following define:

    https://github.com/analogdevicesinc/no-OS/blob/d4a97230dc27d5a3c6d243d18e424fef6da73c93/projects/ad9361/src/parameters.h#L107

    then, you should be able to connect with osc to the system.

    Regards,

    George

  • Hi ,

    Thank you for your reply.

    I tried to replace XPAR_XUARTPS_1_INTR by XPAR_XUARTPS_0_INTR in the define L107

    of the file parameters.h but i get exactly the same errors as before on WSL and Windows.

    Have I forgotten something? How can I solve this?

    Thank you,

    Regards,

    Rémi

  • Hi, Rémi.

    If you'd like to retry building libserialport from source on your Ubuntu 20.04 machine , these are the steps that you need to follow:

    1. Install the packages required by autotools:

    sudo apt-get install autotools-dev autoconf libtool

    2. Clone the libserial port repo and build the library:

    git clone https://github.com/sigrokproject/libserialport.git

    cd libserialport

    ./autogen.sh

    ./configure --prefix=/usr

    make

    sudo make install

    This should get rid of the initial "inappropriate ioctl for device" error that you have reported.

    After you have built it, you can proceed to rebuilding libiio with the serial backend enabled and finally, rebuilding iio-oscilloscope.

    We hope this fixes your issue and you'll be able to connect to your device.

    -Cristina

  • Hi ,

    Sure, I can do that.

    However, I get stuck when I try to execute the command ./autogen.sh

    I have the following error:

    /path/to/libserialport$ ./autogen.sh
    /bin/sh: 0: Illegal option -
    

    Do you know how I can avoid this mistake?

    Thank you,

    Regards,

    Rémi

  • Is this the entire error message ? If not, could you include the complete error ?

    Are you running Ubuntu natively or through Windows WSL? 

    What shell are you using ? What is printed when you type echo $SHELL ?

  • Yes, this is the complete error.

    I'm on Windows WSL (Ubuntu 20.04, Kernel 5.10.102.1, Windows 10)

    The result of echo $SHELL is /bin/bash.

    Regards,

    Rémi

  • Hi   ,

    I've managed to solve the SHELL problem.

    The problem of ./autogen.sh comes from the fact that I was on the m aste r branch of libserialport.

    When I used the latest libserialport-0.1.1 tag, it worked perfectly.

    As well as for libiio with the tag v0.24 and libad9361-iio with the tag v0.3

    So I rebuilt liibio and iio-oscilloscope.

    However, I get exactly the same errors.

    Do you have any other options for solving this problem? Thank you for the time you took to solve my problem.

    Regards,

    Rémi

  • Hi, Rémi.

    When you say you get the exact same error, do you mean "the inappropriate ioctl for the device" or the ""Could not get iio context: Unknown error"?