Closed ilario closed 1 week ago
Can you provide details on the commits/versions of the python bindings and c library you are using?
Can you provide details on the commits/versions of the python bindings and c library you are using?
I am not sure I got the versions right... Here you are:
$ apt show libpython3.9-stdlib
Package: libpython3.9-stdlib
Version: 3.9.2-1
Could you tell me the name of the relevant packages? Thanks!
I need to know the libiio version/commit including its python bindings. If you don't know, how did you install both?
Ok, thanks for the patience. Here it is, I hope:
$ apt show libiio0
Package: libiio0
Version: 0.21-2+b1
$ apt show python3-libiio
Package: python3-libiio
Version: 0.21-2
My guess is you are running into some weak ref issues we had in python years back. For channel attributes it was related to this fix https://github.com/analogdevicesinc/libiio/commit/f2ebf4b3fe9c96dbc3721552765b319dac53ba99
I would upgrade to v0.25 for both the library and bindings
@ilario are you still having this issue?
Sorry for the silence. It is quite complicated for me to test the v0.25 as the provider (Olimex) of the single board computer I am using (A64-OLinuXino) is providing only Debian oldstable Bullseye (which includes only v0.21), until now. I am going to close the issue, and will report back when I will be able to test.
I am controlling an AD5370 evaluation board from Python 3.9.2 using IIO from an Olimex A64-OLinuXino-2Ge8G-IND single board computer running Debian Bullseye 11 (oldstable, aarch64) using its SPI port (exposed in its UEXT connector). I compiled the kernel (Olimex ships Debian with kernel 5.10.180, so I compiled that one with their patches) to include the ad5360 module.
The board works perfectly when I write to the file interface (writing to the files in
/sys/bus/iio/devices
) or when I control it from Python.The problem arises when I pass the channel object from a function to another, or I create it in the init of a class and I try to access it from one of its methods.
Here you are a minimal non-working example:
And here you have its output, with the content of the coredump:
Testing different environments I also observed bus_error instead of segfault.
The work around I found is to pass from function to function only the context manager, then find the device and find the channel and set the calibration values every time I want to operate the DAC.
This is the example with the ugly fix and its output: