AnsweredAssumed Answered

Imx6ul how to use ADC continues mode from the userspace with libiio

Question asked by PAVLOSPANAGIOTIS PAPAMICHALIS on Apr 16, 2018
Latest reply on Apr 18, 2018 by PAVLOSPANAGIOTIS PAPAMICHALIS

Hi All,

I try to make the continues mode work for the embedded adc of the imx6ul. Single mode works perfectly according to my device tree configuration. I compiled libiio and tried to use the buffer mode which returns with the following error:

$ ./iio_readdev 2198000.adc

Unable to allocate buffer: Invalid argument

Then I tried to configure the buffer from the file system with the following commands 

$ echo 1 > /sys/bus/iio/devices/iio\:device0/scan_elements/in_voltage0_en
$ echo 100 > /sys/bus/iio/devices/iio\:device0/buffer/length
But when I enable the buffer I get the following error:
$ echo 1 > /sys/bus/iio/devices/iio\:device0/buffer/enable
 -sh: echo: write error: Invalid argument
The version of my kernel is 
4.12.4-BSP-Yocto

What I do know is that the adc peripheral (adc@02198000) and the kernel driver vf610-adc have buffer support. Additionally there is this document called IMX6LXRM Rev. 0, 12/2015 i.MX Linux® Reference Manual which claims that continues mode is not supported but that document is already very outdated. 

Outcomes