i.MX6UL ADC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6UL ADC

Jump to solution
5,371 Views
宗標廖
Contributor V

Hello Community

I want to use ADC1 input 3,4, 6 and 7 of i.MX6UL, so I configed device tree as bellow:

in dts file:

reg_vref_3v3: regulator-vref {

  compatible = "regulator-fixed";

  regulator-name = "vref-3v3";

  regulator-min-microvolt = <3300000>;

  regulator-max-microvolt = <3300000>;

};

&adc1 {

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_adc1>;

  vref-supply = <&reg_vref_3v3>;

  status = "okay";

};

pinctrl_adc1: adc1grp {

  fsl,pins = <

  MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 0xb0    

 MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0xb0

MX6UL_PAD_GPIO1_IO06__GPIO1_IO06 0xb0

MX6UL_PAD_GPIO1_IO07__GPIO1_IO07 0xb0

  >;

};

in imx6ul.dtsi:

adc1: adc@02198000 {

  ...

  num-channels = <8>;

  ...

};

And I want to use GPIO1_IO00 ~ GPIO1_IO02 and GPIO1_IO05 for some other functions.

But under /sys/bus/iio/devices/iio:device0, I can see in_voltage0_raw ~ in_voltage7_raw.

Does it mean I cannot use GPIO1_IO00 GPIO1_IO02 and GPIO1_IO05 for other functions?

Thank you!

ZongbiaoLiao.

Labels (3)
1 Solution
2,202 Views
igorpadykov
NXP Employee
NXP Employee

Hi ZongbiaoLiao

>Does it mean I cannot use GPIO1_IO00 ~ GPIO1_IO02 and GPIO1_IO05 for other functions?

Seems it can be used as described in attached Linux Manual sect.53.2 ADC External Signals

"The ADC pin settings should be done in the ADCx_PCTL register. No other extra
IOMUX settings are required."
Also even these pads are used by ADC, it can not influence on GPIO operation as
ADC are just high impedance analog inputs.

For usage only  ADC1 input 3,4, 6 and 7 one can try next changes:

change num-channels=4 in imx6ul.dtsi:

adc1: adc@02198000 {
  ...
  num-channels = <4>;

change order channels iio_chan_spec vf610_adc_iio_channels[]  in linux/drivers/iio/adc/vf610_adc.c
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/iio/adc/vf610_adc.c?id=rel_...


static const struct iio_chan_spec vf610_adc_iio_channels[] = {
    VF610_ADC_CHAN(3, IIO_VOLTAGE),
    VF610_ADC_CHAN(4, IIO_VOLTAGE),
    VF610_ADC_CHAN(6, IIO_VOLTAGE),
    VF610_ADC_CHAN(7, IIO_VOLTAGE),
          remaining channels

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

View solution in original post

1 Reply
2,203 Views
igorpadykov
NXP Employee
NXP Employee

Hi ZongbiaoLiao

>Does it mean I cannot use GPIO1_IO00 ~ GPIO1_IO02 and GPIO1_IO05 for other functions?

Seems it can be used as described in attached Linux Manual sect.53.2 ADC External Signals

"The ADC pin settings should be done in the ADCx_PCTL register. No other extra
IOMUX settings are required."
Also even these pads are used by ADC, it can not influence on GPIO operation as
ADC are just high impedance analog inputs.

For usage only  ADC1 input 3,4, 6 and 7 one can try next changes:

change num-channels=4 in imx6ul.dtsi:

adc1: adc@02198000 {
  ...
  num-channels = <4>;

change order channels iio_chan_spec vf610_adc_iio_channels[]  in linux/drivers/iio/adc/vf610_adc.c
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/iio/adc/vf610_adc.c?id=rel_...


static const struct iio_chan_spec vf610_adc_iio_channels[] = {
    VF610_ADC_CHAN(3, IIO_VOLTAGE),
    VF610_ADC_CHAN(4, IIO_VOLTAGE),
    VF610_ADC_CHAN(6, IIO_VOLTAGE),
    VF610_ADC_CHAN(7, IIO_VOLTAGE),
          remaining channels

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