IMX6UL ADC test from user space

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMX6UL ADC test from user space

3,417 次查看
anshulkhare
Contributor III

Hi All,

I want to do an adc test on imx6ul board. But, I am not able to see anything under /sys/bus/iio/devices/.

I have enabled the ADC support in kernel configurations.

My dtsi(imx6ul.dtsi) file contains :

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";
};

Is there anything more to be done to see the devices in /sys/bus/iio/devices/.

Could anyone kindly help me out on this ?

标签 (1)
标记 (3)
0 项奖励
回复
14 回复数

2,789 次查看
fabio_poiatti
Contributor III

Hi,

I tried the MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 as ADC_IN4 connecting the physical pin to 3.3V

or 0V but I read always a number near 4095 as I read a different gpio pin ...

Any suggestion?

Thanks

0 项奖励
回复

2,789 次查看
huf
Contributor II

num-channels = <5>;

and then try: cat  /sys/bus/iio/devices/iio\:device0/in_voltage4_raw

2,789 次查看
fabio_poiatti
Contributor III

It is working :-)

many thanks

0 项奖励
回复

2,789 次查看
huf
Contributor II

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 = <1>;
clock-names = "adc";
status = "disabled";
};

&adc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
vref-supply = <&reg_vref_3v3>;
status = "okay";
};

pinctrl_adc1 define the pins.

I think the key is: status = "okay";

you will see /sys/bus/iio/devices/iio:device0,document is wrong.

0 项奖励
回复

2,789 次查看
fabio_poiatti
Contributor III

I don't se anything ...

is it correct the pin definition

&iomuxc {
imx6ul-ccimx6ul {
/* Uncomment specific pins of the ADC channels enabled in 'adc-ch-list' */
pinctrl_adc1: adc1grp {
fsl,pins = <
/* GPIO1_4/ADC1_IN4 (pin 7 of the expansion header) */
MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0x80
>;
};
};

thanks

0 项奖励
回复

2,789 次查看
huf
Contributor II

my dts:

pinctrl_adc1: adc1grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 0x1b0b0
>;
};  

ADC_IN4, the i.MX Pins Tools recommed configuration is

MX6UL_PAD_GPIO1_IO04__GPIO1_IO04           0x000010B0

adn maybe your kernel configuration is not correct.

0 项奖励
回复

2,789 次查看
fabio_poiatti
Contributor III

now I see  something but I have some doubts regarding the meaning of pinctrl_adc1 ...

1) in your example you set pinctrl_adc1 as MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 with value 0x10B0

is it correct? is the initial value for IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03 register? The same for 

MX6UL_PAD_GPIO1_IO04__GPIO1_IO04

2) how is possible to set the adc input channel? Or in other words ... how is the relationship

beetwen the adc input channel, the bit0.4 of ADC1.HC0.ADCH register and the setting as

pinctrl_adc1 in the DTB file?

thanks

0 项奖励
回复

2,789 次查看
fabio_poiatti
Contributor III

any news?

always in the same condition .... and I also modified the DTS file to produce the adc1 anabled ..

but always I didn't see anything in the /sys directories

Thanks

0 项奖励
回复

2,789 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Anshul

please try procedures described in sect.53.3.3 Programming Interface

attached Linux Manual, use nxp bsps described on

https://www.nxp.com/support/developer-resources/run-time-software/i.mx-developer-resources/i.mx-6ser...

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

2,789 次查看
anshulkhare
Contributor III

Hello igor,

Thank you for the suggestion. But as per the document, we have enabled freescale vf610 ADC driver as well as ADC driver for imx6 (the board we are using). Still we are not able to see any devices under /sys/bus/iio/devices/. 

Is there anything else we are supposed to do?

0 项奖励
回复

2,789 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Anshul

 according to document interface is available at

/sys/devices/soc0/soc.1/2200000.aips-bus/

Best regards
igor

0 项奖励
回复

2,789 次查看
anshulkhare
Contributor III

Hi igor,

There is nothing as soc.1 under /sys/devices/soc0/.

I can see only family, machine, power(dir), revision, soc_id, subsystem(link), uevent under this directory.

0 项奖励
回复

2,789 次查看
igorpadykov
NXP Employee
NXP Employee
0 项奖励
回复

2,790 次查看
fabio_poiatti
Contributor III

I have the same problem ... and the demo image does not work signalling a 

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Any suggestion?

thanks

0 项奖励
回复