Configure GPIO in iMX6UL-EVK

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

Configure GPIO in iMX6UL-EVK

Jump to solution
3,214 Views
toanjunifer
Senior Contributor I

Hi NXP,

My name is Toan. And I'm using iMX6UL-EVK. Currently, I'm trying to configure GPIO and get a trouble. In schematic, I see that pin D2 is usable as GPIO and find out number of pin. And I found that pin is gpio1.IO[25]. Because It's belong to GPIO1 so I don't need to plus with any value. Then I executed: 

$ echo 25 > /sys/class/gpio/export

$ echo "out" > /sys/class/gpio/gpio25/direction

$ echo 1 > /sys/class/gpio/gpio25/value

Then I test with a LED  but the light is quite weak. Then I try to set: 

echo 0 > /sys/class/gpio/gpio25/value

But the LED is still lighting. 

I tried to test with 3.3V power in this board, LED is light very strong. 

 

What should I do now ? Do I do wrong somewhere ?

Thank you so much,

      Toan

pastedImage_1.png

                                                                    Image 1

pastedImage_2.png

                                                                      Image 2

pastedImage_3.png

                                                                      Image 3

Labels (1)
1 Solution
2,713 Views
radhikasomaiya
Senior Contributor II

Hi Dao Van Toan,

To use GPIO1.IO[25] as a gpio one can change the status as "disabled" of UART2 node in device tree (imx6ul-14x14-evk.dts). In default configuration this pin is used as a UART2.

  &uart2 {
          pinctrl-names = "default";
          pinctrl-0 = <&pinctrl_uart2>;
          uart-has-rtscts;
          /* for DTE mode, add below change */
          /* fsl,dte-mode; */
          /* pinctrl-0 = <&pinctrl_uart2dte>; */
          status = "disabled";   

  };

Regards,

Radhika Somaiya.

View solution in original post

5 Replies
2,713 Views
toanjunifer
Senior Contributor I

Hi radhika.somaiya@volansystech.com‌ and YuriMuhin_ng‌,

Thank you so much for your reply. It's help me so much.

Best regards,

      Toan

0 Kudos
Reply
2,714 Views
radhikasomaiya
Senior Contributor II

Hi Dao Van Toan,

To use GPIO1.IO[25] as a gpio one can change the status as "disabled" of UART2 node in device tree (imx6ul-14x14-evk.dts). In default configuration this pin is used as a UART2.

  &uart2 {
          pinctrl-names = "default";
          pinctrl-0 = <&pinctrl_uart2>;
          uart-has-rtscts;
          /* for DTE mode, add below change */
          /* fsl,dte-mode; */
          /* pinctrl-0 = <&pinctrl_uart2dte>; */
          status = "disabled";   

  };

Regards,

Radhika Somaiya.

2,713 Views
Yuri
NXP Employee
NXP Employee

Hello,

  Please check if GPIO is declared in Your devicetree.


Have a great day,
Yuri

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

2,713 Views
toanjunifer
Senior Contributor I

Hi YuriMuhin_ng‌,

Thank you for quick reply. After read imx6ul-14x14-evk.dts file, I found this:

regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

reg_sd1_vmmc: sd1_regulator {
compatible = "regulator-fixed";
regulator-name = "VSD_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
off-on-delay = <20000>;
enable-active-high;
};

reg_can_3v3: regulator@0 {
compatible = "regulator-fixed";
reg = <0>;
regulator-name = "can-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpios = <&gpio_spi 3 GPIO_ACTIVE_LOW>;
};

reg_gpio_dvfs: regulator-gpio {
compatible = "regulator-gpio";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_dvfs>;
regulator-min-microvolt = <1300000>;
regulator-max-microvolt = <1400000>;
regulator-name = "gpio_dvfs";
regulator-type = "voltage";
gpios = <&gpio5 3 GPIO_ACTIVE_HIGH>;
states = <1300000 0x1 1400000 0x0>;
};
};

I actually don't understand clearly. May you explain more details ?

- Is this dts file needed to customize ?

- How to delare GPIO pin ? May you give me some example ?

Thank you so much !

      Toan

0 Kudos
Reply
2,713 Views
Yuri
NXP Employee
NXP Employee

Hello,

  use imx6ul.dtsi : gpio1 should be included; uart2 disabled. 

imx6ul.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Regards,

Yuri.