imx6ul adc driver

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

imx6ul adc driver

Jump to solution
8,136 Views
小辉哥
Contributor III

Dear all,

I want to put the GPIO1_IO09 pin configured to adc functionI have modified the imx6ul-14x14-evk.dts and imx6ul.dtsi .

The following: (Red font is I modified in the imx6ul-14x14-evk.dts)

reg_sd1_vmmc: regulator@1 {

  compatible = "regulator-fixed";

  regulator-name = "VSD_3V3";

  regulator-min-microvolt = <3300000>;

  regulator-max-microvolt = <3300000>;

//gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;

  //enable-active-high;

  };

  reg_vref_3v3: regulator@2 {

  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_hog_1: hoggrp-1 {

  fsl,pins = <

  MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY    0x30b0

  MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059 /* SD1 CD */

  MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT 0x17059 /* SD1 VSELECT */

  //MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */

  >;

  };

pinctrl_adc1: adc1grp {

  fsl,pins = <

  MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0xb0

  >;

  };

imx6ul.dtsi file i modified :

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 = <10>;

  clock-names = "adc";

  status = "disabled";

When I send this pin is connected to the different voltage(3.3V or 2.5V), found the adc values will not change,

root@imx_mfgtools_nogpu:/sys/bus/iio/devices/iio:device0# cat in_voltage9_raw

4080

root@imx_mfgtools_nogpu:/sys/bus/iio/devices/iio:device0# cat in_voltage9_raw

4077

root@imx_mfgtools_nogpu:/sys/bus/iio/devices/iio:device0# cat in_voltage9_raw

Can you tell me how to modify to get the right result?

Best Regards,

xiaohuige

Labels (3)
Tags (1)
0 Kudos
Reply
1 Solution
3,542 Views
igorpadykov
NXP Employee
NXP Employee

Hi 小辉哥

this signal is used in uboot also, please try to set it as input with pull disabled,

iomux_v3_cfg_t const usdhc1_pads[]

uboot-imx.git - Freescale i.MX u-boot Tree

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
9 Replies
3,542 Views
krzysztoflukasz
Contributor I

Good morning,

I am trying as well to set up the ADC on iMX6UL on my custom board.

I would like to run ADC on the following pins:

GPIO1_IO02 to GPIO1_IO07.

GPIO1_IO00 to GPIO1_IO01 I want to use as I2C pins.

GPIO1_IO08 to GPIO1_IO09 I want to use as output pins.

I understand that I need to modify in imx6ul.dtsi as follow:

num-channels = <6>;

But how to apply the offset to not start from channel 0 but 2?

Best Regards,

Krzysztof

0 Kudos
Reply
3,542 Views
宗標廖
Contributor V
0 Kudos
Reply
3,542 Views
krzysztoflukasz
Contributor I

Thanks! :smileyhappy:

So I will need as well to change something in the driver code.

BR

Krzysztof

0 Kudos
Reply
3,542 Views
goiatzmaser
Contributor II

Good morning,

I am trying to do the same with my custom board, only with the diference that I will use 10 gpios.

Using your example, i configure GPIO6 not GPIO9 like this example and I am reading ok a temperature sensor.

pinctrl_adc1: adc1grp {

  fsl,pins = <

  MX6UL_PAD_GPIO1_IO06__GPIO1_IO06 0xb0

  >;

  };

But, i need to configure other 9gpios, started form GPIO1_IO1 to GPIO1_IO9 all ADC. What I don´t know is how I must configure on the device tree, all this gpios. Maybe:

pinctrl_adc1: adc1grp {

  fsl,pins = <

      MX6UL_PAD_GPIO1_IO00__GPIO1_IO00 0xb0

     MX6UL_PAD_GPIO1_IO01__GPIO1_IO01 0xb0

     MX6UL_PAD_GPIO1_IO02__GPIO1_IO02 0xb0

     MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 0xb0

     MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0xb0

     MX6UL_PAD_GPIO1_IO05__GPIO1_IO05 0xb0

     MX6UL_PAD_GPIO1_IO06__GPIO1_IO06 0xb0

     MX6UL_PAD_GPIO1_IO07__GPIO1_IO07 0xb0

       MX6UL_PAD_GPIO1_IO08__GPIO1_IO08 0xb0

       MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0xb0

  >;

  };

I can´t find any information on internet. Can you help me please?

Thanks for all, best regards,

Goiatz

0 Kudos
Reply
3,542 Views
小辉哥
Contributor III

Hi,Goiatz

yes,You this set is right,Note that other drivers didn't use these pins both uboot and linux。

0 Kudos
Reply
3,543 Views
igorpadykov
NXP Employee
NXP Employee

Hi 小辉哥

this signal is used in uboot also, please try to set it as input with pull disabled,

iomux_v3_cfg_t const usdhc1_pads[]

uboot-imx.git - Freescale i.MX u-boot Tree

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
3,542 Views
小辉哥
Contributor III

sorry, I missed one place, don't set it to input ,now it is ok。

0 Kudos
Reply
3,542 Views
玉栋郭
Contributor III

hi 小辉哥,

    我也遇到这个问题,但是我修改完之后,cat in_voltage9_raw 一直是4095,我要怎样从uboot中禁用 pull?

0 Kudos
Reply
3,542 Views
小辉哥
Contributor III

hi igor

Thanks for your answers ,I modified the code as you suggest,but Is still the same result,I find it is only 3.3 V, and 0 V will change ,other voltage is about 4056.

0 Kudos
Reply