Read ADC on mx28evk

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

Read ADC on mx28evk

跳至解决方案
1,438 次查看
JeromeBaron
Contributor II

Hi everyone,

I want to do a simple read on the lradc pins on the mx28evk. I have read a lot of threads but I could not find the answer to my question or could wrap my head around what I'm missing there.

- In the kernel menuconfig, I have "Low Resolution ADC support" checked, which set CONFIG_MXS_LRADC=y.

- In the target filesystem, I have some files related to lradc:

/sys/devices/platform/mxs-lradc.0

/sys/devices/system/mxs-lradc

/sys/devices/system/mxs-lradc/mxs-lradc-1

/sys/bus/platform/devices/mxs-lradc.0

/sys/bus/platform/drivers/mxs-lradc

/sys/bus/platform/drivers/mxs-lradc/mxs-lradc.0

- I have one dev related to that: /dev/input/ts0

Now, can I, in the filesystem, read the ADCs?

If not, should I do a simple program that use ioctl of a driver? Which driver file?

Regards,

Jerome

标签 (1)
0 项奖励
1 解答
810 次查看
pt
Senior Contributor I

Hi

I have found adc test code on the following thread.

https://community.freescale.com/message/313683#313683

Regards

Pt

在原帖中查看解决方案

0 项奖励
4 回复数
811 次查看
pt
Senior Contributor I

Hi

I have found adc test code on the following thread.

https://community.freescale.com/message/313683#313683

Regards

Pt

0 项奖励
810 次查看
JeromeBaron
Contributor II

Thanks everyone for your answers. I think I'll go with the register access way like suggested by Pt. I already have a section in my code where I rewrite the PINMUX registers so I'll just do the same for the ADC.

0 项奖励
810 次查看
fabio_estevam
NXP Employee
NXP Employee

On a 3.17 kernel you can read the ADC by doing:

root@freescale /$ cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw    

4095 

0 项奖励
810 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi,

There is no driver of ADC in user space. But you can use as reference the touchscreen driver  source code to develop your own ADC driver in user space.

If you want to check the touchscreen funcionality in user space you can type:

cat /dev/input/touchscreen0

It seems that there is  customer's example at

LRADC with IMX28

Best Regards,

Alejandro