Post Go back to editing

How can iio_info find "context" of two chained boards each with their own libiio/iiod?

Category: Software

https://wiki.analog.com/resources/tools-software/linux-software/libiio_internals says that "in theory, it would be completely possible to make IIOD use the network backend, and chain two IIO servers"

The network backend

iio_info finds network context for:

A -> B    where A=PC and B=ADALM-PLUTO
A -> C    where A=PC and C=DART-6UL dev board
C -> B    i.e. iio_info running on DART-6UL reporting context of ADLAM-PLUTO

However, I want the following configuration

A -> C -> B  where A -> C is ethernet and C -> B is usb

How can I get iio_info on A (PC) reporting stuff from B (PLUTO) connected via C (DART-6UL)?

Kind regards
DrFlute

 

 

  • Thank you Travis,

    It's the "run iiod and allow the USB context to be "bridged" to Ethernet to other remote hosts" that I'm not quite getting right.

    With A->C->B chained devices, the following shows iio_info running on A and getting a response from iiod running on C ... but not from B:

    dev@dev-VirtualBox:~/SVNviews_local/libiio/build/tests$ iio_info --uri ip:192.168.10.100
    Library version: 0.24 (git tag: a08ad5f)
    Compiled with backends: local xml ip usb
    IIO context created with network backend.
    Backend version: 0.24 (git tag: a08ad5f)
    Backend description string: 192.168.10.100 Linux imx6ul-var-dart 4.14.78-mx6ul+ge692c30 #1 SMP PREEMPT Fri Aug 21 09:21:40 UTC 2020 armv7l
    IIO context has 3 attributes:
           local,kernel: 4.14.78-mx6ul+ge692c30
           uri: ip:192.168.10.100
           ip,ip-addr: 192.168.10.100

    Also the following shows iio_info running on C and getting a response from its own local context and from iiod running on B:

    root@imx6ul-var-dart:~/libiio-tests# ./iio_info --scan
    Library version: 0.24 (git tag: a08ad5f)
    Compiled with backends: local xml ip usb
    Available contexts:
    	0: 192.168.1.2 ) [ip:imx6ul-var-dart.local]
    	1: 192.168.10.100 ) [ip:imx6ul-var-dart.local]
    	2: 192.168.2.10 ) [ip:imx6ul-var-dart.local]
    	3: 192.168.2.1 (Analog Devices PlutoSDR Rev.B (Z7010-AD9363A)), serial=104473ae7393000101003600085f2dbec1 [ip:pluto.local]
    	4: (2198000.adc on Variscite DART-6UL with i.MX6ULL, eMMC & WiFi support on VAR-6ULCustomBoard) [local:]
    	5: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=104473ae7393000101003600085f2dbec1 [usb:2.2.5]
    

    So I've noticed that B (Pluto) is on a different subnet from A (PC) ... so perhaps my problem is that I need to learn how to bridge two subnets. Doh!

    Kind regards

    DrFlute

  • What arguments are you using to run iiod?

    -Travis

  • I'm starting iiod on C manually but without any arguments. The iiod on B (Pluto) is run automatically ... and it would probably be a good idea if I looked at the startup script that runs it ... and report back soon.

  • As you can see from that commit I linked you need to tell the bridging iiod which context it needs to relay with the uri flag.

    -Travis

  • Well the Pluto says:

    # grep -rnw /etc -e iiod
    grep: /etc/resolv.conf: No such file or directory
    /etc/init.d/S23udc:114: start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x  /usr/sbin/iiod  -- $IIOD_OPTS
    

    ...and

     

    # grep -rnw /etc -e IIOD_OPTS
    grep: /etc/resolv.conf: No such file or directory
    /etc/init.d/S23udc:7:IIOD_OPTS="-D -n $ENDPOINTS -F /dev/iio_ffs"
    

    ... and 

    # grep -rnw /etc -e ENDPOINTS
    grep: /etc/resolv.conf: No such file or directory
    /etc/init.d/S23udc:7:IIOD_OPTS="-D -n $ENDPOINTS -F /dev/iio_ffs"
    /etc/device_config:4:ENDPOINTS=3
    

    So I think this all amounts to:
    /usr/sbin/iiod -- -D -n 3 -F /dev/iio_ffs

    ... and you've just replied ahead of m e...

  • OK ... so I need to start iiod on C with an argument that says it should relay the context of B (Pluto) by using the uri flag. I'll try that right away.

  • OK ... so I'm getting further ... but it's not great.

    This is starting iiod on C using the ip address of B (Pluto) ... and the "ERROR: READ LINE: -32" start when I run iio_info on A

    root@imx6ul-var-dart:~/libiio-tests# ./iiod --uri ip:192.168.2.1
    Starting IIO Daemon version 0.24.a08ad5f
    IPv6 support enabled
    Attempting to start Avahi
    ERROR: host imx6ul-var-dart
    Avahi: Registered 'iiod on imx6ul-var-dart:30431' to ZeroConf server avahi 0.7
    Avahi: Started.
    Avahi: Service 'iiod on imx6ul-var-dart:30431' successfully established.
    New client connected from 0.0.0.0
    ERROR: READ LINE: -32
    ERROR: READ LINE: -32
    ERROR: READ LINE: -32
    ERROR: READ LINE: -32
    ERROR: READ LINE: -32

    ... and this is the response from A, at least trying to report attributes of Pluto

    dev@dev-VirtualBox:~/SVNviews_local/libiio/build/tests$ iio_info --uri ip:192.168.10.100
    Library version: 0.24 (git tag: a08ad5f)
    Compiled with backends: local xml ip usb
    IIO context created with network backend.
    Backend version: 0.23 (git tag: v0.23)
    Backend description string: 192.168.10.100 Linux (none) 5.4.0-00535-g9c04de11ae53 #1 SMP PREEMPT Fri Aug 20 13:01:03 CEST 2021 armv7l
    IIO context has 9 attributes:
    	hw_model: Analog Devices PlutoSDR Rev.B (Z7010-AD9363A)
    	hw_model_variant: 1
    	hw_serial: 104473ae7393000101003600085f2dbec1
    	fw_version: v0.34
    	ad9361-phy,xo_correction: 39999923
    	ad9361-phy,model: ad9363a
    	local,kernel: 5.4.0-00535-g9c04de11ae53
    	uri: ip:192.168.10.100
    	ip,ip-addr: 192.168.10.100
    IIO context has 5 devices:
    ...
    				attr  4: hardwaregain ERROR: Broken pipe (32)
    ...

    That's enough for today.

    Thank you very much for your help Travis

    Kind regards
    DrFlute

  • So ... the solution to my problem of chaining boards A -> C -> B where  

    A=PC
    C=DART-6UL
    B=ADALM-PLUTO

    and 

    A -> C is ethernet
    C -> B is usb

    is ...

    1) run iiod on C with the ip address of B and with the same command line arguments as the iiod run on B: ./iiod  -D -n 3 --uri ip:192.168.2.1  

    2) run iio_info on A with the ip address of C: iio_info --uri ip:192.168.10.100

    Now I can run IIO Oscilloscope on A and have it present a spectrum of samples from B relayed via C.

    I hope this helps someone with the same problem ... and thanks to Travis for pointing me in the right direction.

    Kind  regards
    DrFlute