Home/Support/Support Forum/Add ADC to Device Tree
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Add ADC to Device Tree

0 votes
Hi,
thanks to both of you, my GPIO's work now. I added them to the dtsi file like hpalacios said. :)

But now I have an other Problem. I tried the same with the ADC Pins, but everytime I add a second Pin, the device (iio\:device1) in the sysfs disappeared.

I tried to add the Pins to the dts file and also I tried to add them to the dtsi file, like the GPIOs, but everytime the same Problem.

If i change the "num-channels" in "imx6ul.dtsi", should then several be displayed in the sysfs? (I read this in a nxp forum)

That's what I changed:

- in my dts file and/or in the imx6ul-ccimx6ulstarter.dtsi file

&adc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
adc-ch-list = <0 1 4 5>;
status = "okay";
};

&iomuxc {
imx6ul-ccimx6ul {
pinctrl_adc1: adc1grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO00__GPIO1_IO00 0xb0
MX6UL_PAD_GPIO1_IO01__GPIO1_IO01 0xb0
MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0xb0
MX6UL_PAD_GPIO1_IO05__GPIO1_IO05 0xb0
>;
};
};
};



- in the imx6ul.dtsi

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 = <5>;
clock-names = "adc";
fsl,adck-max-frequency = <30000000>, <40000000>,
<20000000>;
status = "disabled";
};
asked Jun 5, 2018 in Linux by dbau New to the Community (10 points)

Please log in or register to answer this question.

1 Answer

0 votes
 
Best answer
There is an example here:
https://www.digi.com/resources/documentation/digidocs/90002285/#reference/bsp/v4-9_6ul/r_adc_6ul.htm

Are you able to follow it? does it work?
answered Jun 8, 2018 by LeonidM Veteran of the Digi Community (3,556 points)
selected Jun 29, 2018 by dbau
yes, I tried it this way, I added the channel to the adc-ch-list and configured the pins in iomux, but everytime I add a second Channel, the device (~# cat /sys/bus/iio/devices/iio\:device1) in the sysfs is gone.

Do I have to do anything else?
there could be a gpio conflict, please check that the pins you are trying to use are not used by anything else
check your dmesg for stuff like this:
imx6ul-pinctrl 20e0000.iomuxc: pin MX6UL_PAD_GPIO1_IO02 already requested by 20e0000.iomuxc; cannot claim for 2198000.adc
imx6ul-pinctrl 20e0000.iomuxc: pin-25 (2198000.adc) status -22
imx6ul-pinctrl 20e0000.iomuxc: could not request pin 25 (MX6UL_PAD_GPIO1_IO02) from group adc1grp on device 20e0000.iomuxc
...