AnsweredAssumed Answered

Reading AD5592R using python bindings results in segfault

Question asked by Jonathan_Eidsness on Jan 25, 2016
Latest reply on Feb 8, 2016 by larsc

I'm trying to get an AD5592R running and have encountered some difficulty reading from the device. I believe I've got the device tree and kernel modules configured properly.

$ iio_info
Library version: 0.6 (git tag: db00cf9)
IIO context created with local backend.
Backend version: 0.6 (git tag: db00cf9)
Backend description string: Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l
IIO context has 1 devices:
    iio:device0: ad5592r
        1 channels found:
            voltage0:  (input)
            1 channel-specific attributes found:
                attr 0: raw value: 3076

I've written the following python script to set up a context the device:

import iio


ctx = iio.Context()
ad5592r = ctx.find_device(b'ad5592r')
buffer = iio.Buffer(ad5592r, 2000)
channel = ad5592r.channels[0]

From here attempting either buffer.refill() or result in the same segmentation fault:

Program received signal SIGSEGV, Segmentation fault.
iio_buffer_refill (buffer=0x0) at /home/pi/libiio/buffer.c:134
134        if (buffer->dev_is_high_speed) {

I'm not sure how relevant it is, but I've also noticed that the values of channel.enabled and channel.scan_element are both False. I've not been able to figure out a way to flip them to True.