# How to configure the GPIO Pins in the DeviceTree File

**URL:** <https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546>\
**Category:** Linux\
**Tags:** linux, gpio, yocto, ccimx6ul, dts\
**Created:** [May 24, 2018, 9:30am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546 "2018-05-24T09:30:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbau](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@dbau](https://forums.digi.com/u/dbau)\
**Post date:** [May 24, 2018, 9:30am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/1 "2018-05-24T09:30:26Z")

</div>

Hello,  
I’m pretty new to linux/yocto and I hope somebody can help me.

I have a custom board with the ccimx6ul SoC mounted. There are 3 Pins which I use as GPIO’s:

MX6UL\_PAD\_LCD\_DATA09 -\> red LED  
MX6UL\_PAD\_CSI\_MCLK -\> green LED  
MX6UL\_PAD\_LCD\_DATA08 -\> Button

I have added them to the imx6ul-ccimx6ulstarter-id129.dts file like this:

/\* Pin mux configuration _/  
&iomuxc {  
imx6ul-ccimx6ul {  
pinctrl\_adc1: adc1grp {  
fsl,pins = \<  
/_ GPIO1\_4/ADC1\_IN4 (pin 7 of the expansion header) \*/  
MX6UL\_PAD\_GPIO1\_IO00\_\_GPIO1\_IO00 0xb0  
MX6UL\_PAD\_GPIO1\_IO01\_\_GPIO1\_IO01 0xb0  
MX6UL\_PAD\_GPIO1\_IO04\_\_GPIO1\_IO04 0xb0  
MX6UL\_PAD\_GPIO1\_IO05\_\_GPIO1\_IO05 0xb0  
\>;  
};  
pinctrl\_io1{  
fsl,pins = \<  
MX6UL\_PAD\_LCD\_DATA08\_\_GPIO3\_IO13 0x10b0  
MX6UL\_PAD\_LCD\_DATA09\_\_GPIO3\_IO14 0x10b0  
MX6UL\_PAD\_CSI\_MCLK\_\_GPIO4\_IO17 0x10b0  
\>;  
};  
};  
};

The green LED works fine, the red one and the button are not.  
Did I something wrong? I can change the value of the red LED and read it, but there is still a voltage of 1,6V - 1,8V at about 40kHz

Thanks

---

<div class="post-metadata">

**Author:** ![LeonidM](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@LeonidM](https://forums.digi.com/u/LeonidM)\
**Post date:** [May 24, 2018, 10:30pm UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/2 "2018-05-24T22:30:28Z")

</div>

Look at other possible functions of those pins in the HRM. I suspect they are used by some other enabled peripheral.

---

<div class="post-metadata">

**Author:** ![dbau](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@dbau](https://forums.digi.com/u/dbau)\
**Post date:** [May 29, 2018, 7:22am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/3 "2018-05-29T07:22:56Z")

</div>

Thanks for your advice, but I can’t find any other peripherial wich uses these pins. Is there any way to change or see the devicetree File on the device?

---

<div class="post-metadata">

**Author:** ![hpalacios](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/hpalacios/32/10637_2.png) [@hpalacios](https://forums.digi.com/u/hpalacios)\
**Post date:** [May 29, 2018, 6:37am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/4 "2018-05-29T06:37:39Z")

</div>

Hello,

Two things:

- First, as Leonid said, check that those pads are not being configured by another device for a different functionality.
- Second, adding a pinctrl node to the device tree does not automatically make Linux configure the IOMUX in it. Pinctrl nodes are linked to other nodes in the device tree (for example the UART), and those to the Linux device drivers. It is the loading of a driver by the kernel, that configures the pinctrl sets linked to such node in the DT.  
For groups of pads that you need to configure but are not linked to _any_ driver, you must add them to a special node that’s called ‘pinctrl\_hog’, which is linked to the IOMUX driver itself.  
You will find it in the DTSI files. Add your pads there.

## Regards,

Héctor Palacios

---

<div class="post-metadata">

**Author:** ![LeonidM](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@LeonidM](https://forums.digi.com/u/LeonidM)\
**Post date:** [May 29, 2018, 7:23am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/5 "2018-05-29T07:23:51Z")

</div>

device tree on the target is compiled binary. You have to modify it on host and re-compile, then deploy on target again.

---

<div class="post-metadata">

**Author:** ![dbau](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@dbau](https://forums.digi.com/u/dbau)\
**Post date:** [May 30, 2018, 11:16am UTC](https://forums.digi.com/t/how-to-configure-the-gpio-pins-in-the-devicetree-file/19546/6 "2018-05-30T11:16:11Z")

</div>

**edit**
