Part Number: ADS8688
Tool/software: Linux
i got a the ads8688 connected via SPI protocol.
It shows up in /sys/buses/iio/devices/iio:device0
I can run iio_info and it shows the device entries
prompt$>iio_info
Library version: 0.7 (git tag: v0.7)
IIO context created with local backend.
Backend version: 0.7 (git tag: v0.7)
Backend description string: Linux arm 4.9.10-bone4 #1 Thu Feb 16 19:35:11 UTC 2017 armv7l
IIO context has 1 devices:
iio:device0: ads8688
8 channels found:
voltage6: (input)
5 channel-specific attributes found:
attr 0: raw value: 39887
attr 1: scale value: 0.312504320
attr 2: offset value: -32768
attr 3: offset_available value: -32768 0
attr 4: scale_available value: 0.312504320 0.156254208 0.078127104
voltage4: (input)
5 channel-specific attributes found:
attr 0: offset value: -32768
attr 1: raw value: 39887
attr 2: scale value: 0.312504320
attr 3: offset_available value: -32768 0
attr 4: scale_available value: 0.312504320 0.156254208 0.078127104
voltage0: (input)
5 channel-specific attributes found:
attr 0: scale value: 0.312504320
attr 1: raw value: 48303
attr 2: offset value: -32768
attr 3: offset_available value: -32768 0
attr 4: scale_available value: 0.312504320 0.156254208 0.078127104
voltage3: (input)
5 channel-specific attributes found:
attr 0: scale value: 0.312504320
attr 1: raw value: 32726
attr 2: offset value: -32768
attr 3: offset_available value: -32768 0
attr 4: scale_available value: 0.312504320 0.156254208 0.078127104
voltage7: (input)
[...]
This is fine, and i can read the voltage from channel 0, as you might see above.
However I can not find some folders i was expecting to find, those used to enable/disable channels, the buffer, etc.
Anyhow, i tried to read from the device using the iio tools, but i got...
bs@arm:~$ iio_readdev iio:device0
Unable to allocate buffer: Invalid argument
I get the same result with my own code when calling iio_device_create_buffer: it fails with --EINVAL ( Invalid argument ).
Under further inspection of the libiio code i think the iio_device_get_sample_size result is to blame for the failure, so i did some more testing...
Calling iio_device_get_sample_size ( dev ) returns 0, and sets errno to: 13 ( permission denied ) if you are not root or 2 ( No such file or directory ) if you are running it as root.
In order to create the buffer iio_device_get_sample_size must be bigger than zero.
I think this is a flaw or an issue at the ti_ads8688.c driver. Is there an updated ti_ads8688.c driver i could try r any plans to update it?