How to configure the GPIO Pins in the DeviceTree File

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

1 Like

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

1 Like

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?

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

2 Likes

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

edit