Trouble setting pinmux for GPIO in device-tree, need help with device tree config. Pin won't output in Linux. [Solved]

Hello,

I’m working on a bring up of a custom carrier board with the Colibri iMX6ULL module and I’m having trouble enabling the GPIO for specific pins. I managed to compile the device tree and load the board with my custom device tree. I suspect that I’m configuring the device tree wrong but I’m not sure what to do. There will be several pins that I need to change, but for now, I’m just trying to get GPIO3_IO03 and GPIO3_IO11 to work.

The following is my current device tree:

/dts-v1/;

#include "imx6ull-colibri-nonwifi.dtsi"
#include "imx6ull-colibri-eval-v3.dtsi"

/ {
	model = "Toradex Colibri iMX6ULL 256MB on Colibri Evaluation Board V3 - My Version";
	compatible = "toradex,colibri_imx6ull-eval", "fsl,imx6ull";

	gpio_additional {
		 pinctrl-name = "default";
		 pinctrl-0 = <&pinctrl_additionalgpio>;
		 status = "okay";
	};
};

&lcdif {
	status = "disabled";
};

&pinctrl_lcdif_ctrl {
	status = "disabled";
};




&iomuxc {
	pinctrl-names = "default";  
	
	imx6ull-eval-v3 {
		pinctrl_additionalgpio: additionalgpios {
			fsl,pins = <
				MX6UL_PAD_LCD_VSYNC__GPIO3_IO03    0x5
				MX6UL_PAD_LCD_DATA06__GPIO3_IO11  0x5
			>;
		};
	};

};

I test the pins with the following Linux commands (Only GPIO03_IO3 here):

echo 67 > /sys/class/gpio/export

echo "out" > /sys/class/gpio/gpio67/direction

echo 1 > /sys/class/gpio/gpio67/value

When I call:

cat /sys/kernel/debug/gpio

I can see pin 67 there configured as an output with a ‘high’ state, but when measuring the pin, there is no change.

I’ve verified the Linux commands work fine for pin 118 and 120 on the Iris board when following the ‘Getting started’ tutorial. It just doesn’t work with these particular pins on my custom carrier board. (The physical pin connection is fine, I’ve tested.)

I’ve read the ‘device-tree-customization’ web page several times but can’t manage to fully wrap my head around how to set up the device tree for setting those pins to Alt5 mode (GPIO).

I’m new to using device-trees; I’ve searched the forums for help, read the relevant reference manual sections and watched the tutorial videos but still can’t manage to figure out what to do. I’ve been stuck with this problem for a few days now.

Any help would be appreciated. Thanks.

HI @Brietoe

Welcome to the Toradex Community!!!

Could you provide the version of the hardware and software of your module?
Have you checked that these pins are not used by any other functionality?
Could you share the output of git diff in a file ? Thanks.

Hello @jaski.tx,

Thank you for the warm welcome, glad to be here.

Hardware:

• Colibri iMX6ULL 256MB V1.0 A

• Iris Rev 1.1

• Custom carrier board

Software:

• Colibri iMX6ULL - Linux Console Image (2.8b3 | 2018-06-26 | 42.74 MB)

• Colibri iMX6ULL - Toradex Easy Installer (1.7 | 2018-07-31 | 20.25 MB)

Both files above found here (Toradex Easy Installer Overview | Toradex Developer Center).

• Linux Kernel (To build device tree): linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

Have you checked that these pins are
not used by any other functionality?

So, let’s focus on the ‘GPIO3_IO03 / SODIMM82 / Linux# 67’ pin because I think if I can understand 1 pin, I could hopefully figure out the rest.

I believe the pin might be configured for ‘LCD_VSYNC’ by default which is what I think I need to change, however, I don’t know how to determine the pins functionality. Is there any way that I can verify what functionality is being used? That would be very helpful.

Could you share the output of git diff in a file ?

link text

I’ve attached the git diff generated by running ‘git diff’ from the main directory of the Linux kernel clone.

The code I provided in my original post was in this file: ‘imx6ull-colibri-eval-v3-myVersion.dts’ which I duplicated the original template from ‘imx6ull-colibri-eval-v3.dts’

After compiling the ‘dts’ file into a ‘dtb’ file, I copied the ‘imx6ull-colibri-eval-v3-myVersion.dtb’ file into the extracted ‘Linux Console Image’ root directory and used the Toradex easy installer to install the image via USB.

In addition, in the extracted image folder, I see ‘image.json’ with the following lines:

                {
                    "name": "dtb",
                    "content": {
                        "rawfiles": [
                            {
                                "filename": "imx6ull-colibri-eval-v3.dtb",
                                "product_ids": "0044"
                            },
                            {
                                "filename": "imx6ull-colibri-wifi-eval-v3.dtb",
                                "product_ids": "0040"
                            },
                            {
                                "filename": "imx6ull-colibri-eval-v3.dtb",
                                "product_ids": "0036"
                            }
                        ]
                    },

I modified those lines to this:

{
                    "name": "dtb",
                    "content": {
                        "rawfiles": [
                            {
                                "filename": "imx6ull-colibri-eval-v3-myVersion.dtb",
                                "product_ids": "0044"
                            },
                            {
                                "filename": "imx6ull-colibri-wifi-eval-v3.dtb",
                                "product_ids": "0040"
                            },
                            {
                                "filename": "imx6ull-colibri-eval-v3-myVersion.dtb",
                                "product_ids": "0036"
                            }
                        ]
                    },

But not quite sure if what I did was correct.

Sorry for being so lost. I do really appreciate the help.

Thanks for the Information.

So, let’s focus on the ‘GPIO3_IO03 / SODIMM82 / Linux# 67’ pin because I think if I can understand 1 pin, I could hopefully figure out the rest.
I believe the pin might be configured for ‘LCD_VSYNC’ by default which is what I think I need to change, however, I don’t know how to determine the pins functionality. Is there any way that I can verify what functionality is being used? That would be very helpful.

You are right, the pin is used for LCD_VSYNC, you could delete this from here or completely delete the node &lcdif. Then the lcd output is not working anymore.

pinctrl_lcdif_ctrl: lcdifctrlgrp {
			fsl,pins = <
				MX6UL_PAD_LCD_CLK__LCDIF_CLK	    0x00079
				MX6UL_PAD_LCD_ENABLE__LCDIF_ENABLE  0x00079
				MX6UL_PAD_LCD_HSYNC__LCDIF_HSYNC    0x00079
				MX6UL_PAD_LCD_VSYNC__LCDIF_VSYNC    0x00079
			>;
		};

In addition, in the extracted image folder, I see ‘image.json’ with the following lines

This is correct.

Best regards

Thank you @jaski.tx !

Worked like a charm!

Perfect, that it works. Thanks for your feedback.