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
$ echo 1 > /sys/bus/iio/devices/iio\:device0/buffer/enable-sh: echo: write error: Invalid argument
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.
Hi PAVLOSPANAGIOTIS
continuous conversion is enabled by bit ADCO register ADCx_GC,
described in sect.13.6.7 General control register (ADCx_GC) i.MX6UL Reference Manual
http://www.nxp.com/docs/en/reference-manual/IMX6ULRM.pdf
One can try to add this flag to driver sources in /linux/drivers/iio/adc/vf610_adc.c
linux-imx.git - i.MX Linux Kernel
using "of_property_read_u32", use as example "num-channels" dts property in:
linux/arch/arm/boot/dts/imx6ul.dtsi
linux-imx.git - i.MX Linux Kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor,
Thanks for the fast reply.
I took a deeper look into the vf610_adc driver and it looks like it has full implementation of the continues mode.
In detail there is control register field define VF610_ADC_ADCON that enables the continues mode in vf610_adc_buffer_postenable and disables the continues mode in vf610_adc_buffer_predisable. So in my understanding there shouldn't be any need to add any additional flag to the driver or create a dts property. From some debugging it looks like the following error
$ echo 1 > /sys/bus/iio/devices/iio\:device0/buffer/enable-sh: echo: write error: Invalid argument
Is not related to the vf610 driver but the iio buffer or trigger driver. Do you know if there is a special configuration needed for the buffer except from doing the initialisation as pointed in the original post?
Many Thanks and Kind Regards,
Pavlos