I would like to use the ADC1 with in1, in2 and in4 channels.
On the DeviceTree source (.dts) I wrote:
&adc1 {
vref-supply = <&touch_3v3_regulator>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
clocks = <&clks IMX6UL_CLK_PWM8>,
<&clks IMX6UL_CLK_PWM8>;
num-channels = <3>;
status = "okay";
};
pinctrl_adc1: adc1grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO01__GPIO1_IO01 0x000b0 /* ADC1_IN1 */
MX6UL_PAD_GPIO1_IO02__GPIO1_IO02 0x000b0 /* ADC1_IN2 */
MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0x000b0 /* ADC1_IN4 */
>;
};
while in the included imx6ul.dtsi (not edited) I have:
adc1: adc@02198000 {
compatible = "fsl,imx6ul-adc", "fsl,vf610-adc";
reg = <0x02198000 0x4000>;
interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_ADC1>;
num-channels = <2>;
clock-names = "adc";
status = "disabled";
};
When I take a look to the sysfs of my linux distro, I can only see 2 adc channels (in_voltage0_raw and in_voltage1_raw) and if I try to read their values i get the "Connection Timed Out" error.
How could I fix it ?
Regards.
UPDATE: Setting num-channels = <3> in the imx6ul.dtsi file allows to see 3 in_voltageX_raw items in my sysfs.
I supposed the dts file overlayered the included file, so I can't figure it out.
The problem of Connection Timed Our persists.
Hi Daniele
seems record num-channels should not be duplicated in dts and dtsi, as example one can look at :
imx6ull-14x14-ddr3-arm2-adc.dts
http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/tree/arch/arm/boot/dts/imx6ull-14x14-ddr3-ar...
&adc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
vref-supply = <®_vref_3v3>;
status = "okay";
};
imx6ull.dtsi
http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/tree/arch/arm/boot/dts/imx6ull.dtsi?h=imx_4....
adc1: adc@02198000 {
compatible = "fsl,imx6ul-adc", "fsl,vf610-adc";
reg = <0x02198000 0x4000>;
interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_ADC1>;
num-channels = <2>;
clock-names = "adc";
status = "disabled";
};
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi, I am having a similar problem, on an IMX6ULL EVK board. I am using GPIO pins 0 - 3 for digital I/O, and I want to use GPIO1_IO04 as an analog input (ADC1_IN4). I added this to my board DTS file:
&adc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
num-channels = <5>;
status = "ok";
};
And:
pinctrl_adc1: adc1grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0x00080 /* ADC1_IN4 */
>;
};
This works and I see 5 input channels under "/sys/bus/iio/devices/iio\:device0/", in_voltage0_raw to in_voltage4_raw.
By setting analog voltages on various pins and reading the values, I have confirmed that at least GPIO_1 and GPIO_4 are working as analog channels (other pins are used for other things so just read high or low).
However, this seems incorrect if I ONLY want one analog input channel. What should I use in the DTS file if I want only one ADC input channel in iio:device0, connected to the ADC1_IN4 pin?
Nb: If I remove "num-channels = <5>" from my DTS, I get the (default) 2 channels and they are connected to GPIO pins 0 and 1.