Post Go back to editing

TimeoutError: [Errno 110] connecting to Pluto SDR on Phaser from remote host

Category: Software
Product Number: CN0566
Software Version: pyadi-iio v0.0.16, pylibiio v0.25

Running pyadi-iio/examples/phaser/phaser_minimal_example.py (and all others) from a remote host configured with Ubuntu 22.04 connected a Phaser I get the following TimeoutError:

(venv_phaser) rbolling@Antenna:~/Phaser/pyadi-iio/examples/phaser$ python3 phaser_minimal_example.py
Attempting to connect to CN0566 via ip:localhost...
CN0566 on ip.localhost not found, connecting via ip:phaser.local...
Found CN0566. Connecting to PlutoSDR via shared context...
Found SDR on shared phaser.local.
file not found, loading default 10.5GHz
No signal freq file found, setting to 10.525 GHz
Traceback (most recent call last):
  File "/home/rbolling/Phaser/pyadi-iio/examples/phaser/phaser_minimal_example.py", line 108, in <module>
    my_sdr._ctrl.debug_attrs["adi,frequency-division-duplex-mode-enable"].value = "1"
  File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 704, in <lambda>
    lambda self, x: self._write(x),
  File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 789, in _write
    _d_write_debug_attr(self._device, self._name_ascii, value.encode("ascii"))
  File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 62, in _check_negative
    raise OSError(-result, _strerror(-result))
TimeoutError: [Errno 110] Connection timed out

This happens with all scripts attempting to control the Pluto SDR on the Phaser board. It is repeatable even within the Python command lind interpreter:

(venv_phaser) rbolling@Antenna:~$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as n
>>> from adi import ad9361
>>> sdr = ad9361(uri="ip:phaser.local:50901")
>>> sdr._ctrl.debug_attrs["adi,frequency-division-duplex-mode-enable"].value = "1"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 704, in <lambda>
lambda self, x: self._write(x),
File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 789, in _write
_d_write_debug_attr(self._device, self._name_ascii, value.encode("ascii"))
File "/home/rbolling/venv_phaser/lib/python3.10/site-packages/iio.py", line 62, in _check_negative
raise OSError(-result, _strerror(-result))
TimeoutError: [Errno 110] Connection timed out
>>>

What can be causing this? The only possible issue I can see is that the host machine is running PyAdi 0.0.16 which is the latest available on git while the Phaser R-Pi is running a different PyAdi that displays as pip show pyadi-iio Version:0.0.17.

Host computer: HP Elite Book laptop running Ubuntu Jammy Jellyfish. Installed libiio with python bindings and pyadi-iio per ADI "PyADI-IIO" wiki. Here's its configuration:

(venv_phaser) rbolling@Antenna:~$ cat /etc/os-release
VERSION="22.04.4 LTS (Jammy Jellyfish)"

(venv_phaser) rbolling@Antenna:~$ pip freeze
contourpy==1.2.1
cycler==0.12.1
fonttools==4.53.0
kiwisolver==1.4.5
matplotlib==3.3.4
numpy==1.26.4
packaging==24.1
pillow==10.3.0
pyadi-iio==0.0.16
pylibiio==0.25
pyparsing==3.1.2
python-dateutil==2.9.0.post0
scipy==1.13.1
six==1.16.0

(venv_phaser) rbolling@Antenna:~$ iio_info -V
iio_info version: 0.25 (git tag:4aa46db3)
Libiio version: 0.25 (git tag: 4aa46db) backends: local xml ip usb

rbolling@Antenna:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 Antenna
192.168.1.117 phaser

Remote is a Stock Phaser CN0566 Raspberry Pi 4B with fresh ADI Kuiper image configured per ADI wiki "EVAL-CN0566-RPIZ Hardware User Guide". Here's its configuration:

analog@phaser:~ $ cat /etc/os-release
PRETTY_NAME="Kuiper GNU/Linux 11.2 (bullseye)"
NAME="Kuiper GNU/Linux"sdr.sample_rate = int(30e6)
VERSION_ID="11.2"
VERSION="11.2 (bullseye)"

Partial list of pip packages edited to remove from this printout what I believe were unrelated packages:

analog@phaser:~ $ pip freeze
adi-colorimeter==1.0
adidt @ git+github.com/.../pyadi-dt.git@2f53fda5f49f1c2eb251f051aaca855001bba031
attrs==20.3.0
cycler==0.10.0
dbus-python==1.2.16
kiwisolver==1.3.1
matplotlib==3.3.4
numpy==1.26.4
packaging==20.9
Pillow==8.1.2
pyadi-iio @ file:///home/analog/pyadi-iio
pylibiio==0.25
pyparsing==2.4.7
python-dateutil==2.8.1
scipy==1.6.0
si==1.16.0

I'm at a bit of a standstill as the Raspberry Pi doesn't have nearly the processing power to everything locally.

  • Two questions here

    1. When this happens does Pluto restart? This can point to power issues

    2. Can you describe what your remote setup is like? Are you using a VM, directly connected with Ethernet or going through a switch/router?

    -Travis

  • To add to travisfcollins comment:

    Indeed, we have seen occasional issues with the USB cable that ships with the phaser kit. If you have a short, high-quality USB-micro cable, you could try replacing the 90-degree cable. (We are working on a solution for future builds.)

    Re: Raspberry Pi doesn't have nearly the processing power to everything locally - all of the scripts in the examples/phaser directory, including the main GUI, can run on the Raspberry Pi directly - not as fast as on a remote machine, but fast enough for lots of use cases. Can you try running the phaser_minimal_example.py example locally, either connecting to the phaser over VNC (which should be enabled), or with a locally attached monitor and keyboard? If it is a power issue, the same problem should occur.

    Note that there should be a clone of pyadi-iio already in /home/analog if you used the setup scripts.

    -Mark

  • Travis, Mark - First thank you very much for the rapid reply. I believe I have (mostly) resolved this issue in a surprising (to me anyway) way. First, though, to answer Travis' questions:

    1. I've verified that the Pluto does *not* restart. That was a relief. It seems pretty solid I believe. Further evidence is that I have not had an issue when running all the example scripts located in the pyadi-iio/examples/phaser folder without a hiccup as well as Jon Kraft's excellent video series. Albeit a bit slow.

    2. The remote machine is an HP Elite notebook running Ubuntu 22.04 natively. It has a wired Ethernet port I am using connected to a Netgear GS105 switch that also connects to the Phaser R-Pi4 wired Ethernet port. This is part of my home network with an Asus router providing DHCP. I initially though maybe there was a port filtering or firewall issue but not so.

    Early on, when I first received the phaser I noticed unreliable Pluto operation like Mark suggests. I connected a higher quality short USB cable and that indeed solved that issue. I also attempted to use VNC directly into the R-Pi. Although this worked, it was too painfully slow to be useful.

    Strangely, the fix (at least so far) was to take a closer look at Mark's phaser_sdcard_setup.sh script and noting the direct pip building of pyadi-iio from the main branch checkout. That gave the version 0.0.17 that was the key! TimeoutError disappeared. I am not sure of the connection, but it worked. After that I had to stamp out an exception in phaser_functions.py caused by my host machine running a later version of scipy, v 1.13.1. Changing window = signal.kaiser(N, beta=38) to window = signal.windows.kaiser(N, beta=38) on line 550 seems to have fixed that.

    Thanks again! The phaser is great dev board that will help our investigation a lot.

    ~Roberrt

  • Thanks for posting the resolution!

    Noted on the pyadi-iio version. This issue will disappear with the next release.

    I'll take a closer look at https://github.com/analogdevicesinc/pyadi-iio/blob/main/examples/phaser/requirements_phaser.txt and add version ranges at some point.

    -Mark