I'm using Kuiper Linux running on a Raspberry Pi 3B. 'uname -a' says:
Linux analog 5.10.63-v7+ #1 SMP Wed Aug 3 14:47:24 UTC 2022 armv7l GNU/Linux
I have attached the EVAL-AD7124-8-PMDZ board to the Pi GPIO as described in https://wiki.analog.com/university/labs/software/precision_adc_toolbox
I know the board is connected properly and it works, because the ADI IIO Oscilloscope program works as expected, and shows reasonable values. Apparently it uses a sampling rate of about 10 samples per second. Also I can use iio_reddev for example
sudo iio_readdev -u local: -b 256 -s 10 -T 0 ad7124-8 voltage0-voltage1 > readings.dat
and get reasonable binary data written to the "readings.dat" file. For reference, here is what iio_attr says:
analog@analog:~/ad7124 $ iio_attr -c -u local:
IIO context has 5 devices:
hwmon0, cpu_thermal: found 1 channels
hwmon1, rpi_volt: found 1 channels
iio:device0, ad7124-8: found 8 channels
iio_sysfs_trigger: found 0 channels
trigger0, ad7124-8-dev0: found 0 channels
However when I try to run a python program like ad7124_simple_capture.py from https://github.com/mthoren-adi/precision_adc_toolbox/blob/master/ad7124_simple_capture.py I have a problem as shown below:
analog@analog:~/ad7124 $ python ad7124_simple_capture.py ip:localhost
Traceback (most recent call last):
File "/home/analog/ad7124/ad7124_simple_capture.py", line 51, in <module>
my_ad7124 = adi.ad7124(uri=my_ip)
File "/usr/local/lib/python3.9/dist-packages/adi/ad7124.py", line 74, in __init__
for ch in self._ctrl._channels:
AttributeError: 'Device' object has no attribute '_channels'
I get the same result with no argument, instead of "ip:localhost". It looks like the Pyadi-iio cannot find the locally attached AD7124 chip, even though iio_readdev has no problem working. I also tried the loopback IP address, and got a different error:
analog@analog:~/ad7124 $ python ad7124_simple_capture.py 127.0.0.1
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/adi/context_manager.py", line 65, in __init__
self._ctx = iio.Context(self.uri)
File "/usr/local/lib/python3.9/dist-packages/iio.py", line 1358, in __init__
self._context = _new_uri(_context.encode("ascii"))
File "/usr/local/lib/python3.9/dist-packages/iio.py", line 56, in _check_null
raise OSError(err, _strerror(err))
OSError: [Errno 38] Function not implemented
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/analog/ad7124/ad7124_simple_capture.py", line 51, in <module>
my_ad7124 = adi.ad7124(uri=my_ip)
File "/usr/local/lib/python3.9/dist-packages/adi/ad7124.py", line 54, in __init__
context_manager.__init__(self, uri, self._device_name)
File "/usr/local/lib/python3.9/dist-packages/adi/context_manager.py", line 67, in __init__
raise Exception("No device found")
Exception: No device found
I see that the iiod daemon is running. What am I doing wrong?
analog@analog:~/ad7124 $ ps aux | grep iiod
root 670 0.0 0.2 66608 2684 ? Ssl 22:26 0:00 /usr/sbin/iiod