Closed karu2003 closed 7 months ago
need to install
sudo apt install libiio-utils
sudo apt install libiio0
sudo apt install iiod
sudo apt install python3-libiio
Please post your question here: https://ez.analog.com/linux-software-drivers/ You need to verify you can communicate with the device with the driver before implementing the pyadi-iio interface
I've already checked. voltage is read. lib needed to be added to system. :)
Can you provide the output of iio_info from the system?
analog@analog:~/rpi_ad7476 $ iio_info -s Library version: 0.23 (git tag: v0.23) Compiled with backends: local xml ip usb Available contexts: 0: (ad7476a on Raspberry Pi 3 Model B Plus Rev 1.3) [local:] 1: 2a02:8109:9da3:f100::c2e ) [ip:analog.local] 2: 192.168.0.232 ) [ip:analog.local] 3: 127.0.0.1 ) [ip:analog.local]
I don't have ad7476a_example.py what needs to be added there?????? analog@analog:~/rpi_ad7476 $ iio_attr -u ip:analog.local -s -c ad iio_attr: Error : could not find device (ad7476a_example.py)
I need the context output so I can see the devices. Remove the -s flag or point it to the local context
Library version: 0.23 (git tag: v0.23)
Compiled with backends: local xml ip usb
IIO context created with local backend.
Backend version: 0.23 (git tag: v0.23)
Backend description string: Linux analog 6.1.65-v8+ #10 SMP PREEMPT Thu Dec 7 08:56:02 UTC 2023 aarch64
IIO context has 2 attributes:
local,kernel: 6.1.65-v8+
uri: local:
IIO context has 1 devices:
iio:device0: ad7476a (buffer capable)
2 channels found:
voltage0: (input, index: 0, format: be:u12/16>>1)
2 channel-specific attributes found:
attr 0: raw value: 0
attr 1: scale value: 0.805664062
timestamp: (input, index: 1, format: le:S64/64>>0)
2 device-specific attributes found:
attr 0: current_timestamp_clock value: realtime
attr 1: waiting_for_supplier value: 0
3 buffer-specific attributes found:
attr 0: data_available value: 0
attr 1: direction value: in
attr 2: watermark value: 1
ERROR: checking for trigger : Input/output error (5)
That looks fine. What error do you observe?
what needs to be added there ad7476a_example.py?????? how to add sample rate for iio?
In your first post you said you had an error. What is the exact error?
what needs to be added there ad7476a_example.py??????
There is no such file in your repo.
how to add sample rate for iio?
Based on the datasheet the sample rate is not configurable.
if i add my file to pyadi-iio/adi? and change everything to
import adi
rate = 1000000
samples = 5000
ADC = adi.ad7476a("ip:analog.local")
ADC.sample_rate = rate
ADC.rx_buffer_size = samples
I thought that sampling could be controlled via iio. I need to do it self. :(
If you want to create an example that will eventually be merged into pyadi-iio checkout the examples folder of the repo for examples.
If you need more information on the AD7476 please open a thread on ez.analog.com
I added rx_tx and received
File "/usr/local/lib/python3.9/dist-packages/iio.py", line 56, in _check_null raise OSError(err, _strerror(err)) OSError: [Errno 22] Invalid argument
Please paste the entire stack trace
analog@analog:~/rpi_ad7476 $ /usr/bin/python3 /home/analog/rpi_ad7476/ad7476.py
ERROR: Open unlocked: -22
Traceback (most recent call last):
File "/home/analog/rpi_ad7476/ad7476.py", line 63, in
When I try to create a buffer for the device, I get the same error.
dev = ctx.find_device(target_device)
buf = iio.Buffer(dev, samples)
Traceback (most recent call last):
File "/home/analog/rpi_ad7476/ad7476.py", line 65, in
I build the driver and the Devicetree. Full instructions are here
in the ADC system it is read. \cat /sys/bus/iio/devices/iio\:device0/name\ The test ad7476.py does not find the device.
Help me understand where the error is. Maybe the Devicetree has an error?![PXL_20231208_090727102.jpg](https://github.com/analogdevicesinc/pyadi-iio/assets/4937137/a9809131-dc2e-4039-bc88-ab537ea8d1c2)