This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

基于AM3354 , ADC问题



内核版本linux 3.2

在板级信息内添加:

static struct adc_data am335x_adc_data = {
        .adc_channels = 8,
};

static struct mfd_tscadc_board tscadc = {
        /*.tsc_init = &am335x_touchscreen_data,*/
        .adc_init = &am335x_adc_data,
};

初始化:

#ifdef CONFIG_MFD_TI_TSCADC
static void mfd_tscadc_init(int evm_id, int profile)
{
        int err;

        err = am33xx_register_mfd_tscadc(&tscadc);
        if (err)
                pr_err("failed to register touchscreen device\n");
}
#endif /* CONFIG_MFD_TI_TSCADC */

配置单选中

Device Drivers  --->

                    [*] Staging drivers  --->

                                    <*>   Industrial I/O support  --->

                                               [*]   Enable buffer support within IIO

                                                        <*>     Industrial I/O lock free software ring                                                                   

                                                        <  >     Industrial I/O buffering based on kfifo                                                                 

                                                       - *-   Enable triggered sampling support                                                                         

                                             Analog to digital converters  --->

                                                       <*>     TI's ADC driver

            

编译后烧写进去,成功生成8个ADC设备:

[root@EmbedSky /]# ls /sys/bus/iio/devices/iio\:device0/
buffer           in_voltage2_raw  in_voltage6_raw  power
dev              in_voltage3_raw  in_voltage7_raw  scan_elements
in_voltage0_raw  in_voltage4_raw  mode             subsystem
in_voltage1_raw  in_voltage5_raw  name             uevent

[root@EmbedSky /]# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
3901

默认为12bit采样,理论上ADC满值4095对应电压为1.8V。
可是ADC0设备,输入为无论输入0.5V还1.4V读到的adc都为3900左右, 将该管脚接地可以读到AD值为0。除了这个脚另外7个AD管脚却能正常采集, 有没大神知道原因呢?

小弟拜谢。。