Verdin iMX8M - Device Tree Overlay, GPIO Output, Default State

Hello!

I’m running into a bit of an issue setting the power-on state of a GPIO pin.

To begin, we are using a Verdin SOM (iMX8M Plus) on a custom carrier board, which is based upon the Dahlia board. We are also running a b2qt image at the moment, but will be moving to a custom Yocto image.

From a hardware perspective, on the carrier board, we are running the GPIO pin (SODIMM 143 - GPIO2-IO6) to a 1.8V to 5V level shifter. There is a 1K pullup on the 5V side, as required by the level shifter.

During boot up, the desired behavior is to have the line at 0V.

I have a device tree overlay that contains the below:

&iomuxc {

	pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>,
		    <&pinctrl_gpio3>, <&pinctrl_gpio4>,
		    <&pinctrl_gpio7>, <&pinctrl_gpio8>,
		    <&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>,
		    <&pinctrl_hdmi_hog>, <&pinctrl_add_gpio>;
	
    pinctrl_add_gpio: add_gpio_grp {
		fsl,pins = <
			MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06		0x104	/* SODIMM 143*/
		>;
	};
};

I can confirm that the overlay is functioning properly. If I disconnect the GPIO pin from the level shifter, I see 0V at the pin during boot up when the Pad Control Register is set to 0x104. If I change the Pad Control Register to a pull up instead of a pull down (0x144), I see 1.8V at the GPIO pin during boot up.

When the Pad Control Register is set to pull down (0x104) and the pin is connected to the level shifter, I see 1.8V at the pin during boot up. If I let the OS (Yocto Linux) boot and use sysfs to set the pin as an output with a value of 0, the GPIO pin successfully goes to 0V.

I’m suspecting that the pin is configured as an input during boot up and that is why I’m not able to drive the pin low with the level shifter attached. Do you think this might be the case? If so, is there a way to configure the pin as an output during boot up?

Thanks for your help!

Hey @Kyle.W ,

Would you mind sharing what the type of level shifter you are using?

And if I’m correct, you are saying it’s functioning as expected, but when the GPIO pin is connected the to the level shifter you see this undesirable behavior on boot of 1.8v when it’s configured to pull-down?

Also, in-case it’s important can you share your OS version and are you building with yocto or TorizonCore Builder?

Thanks

-Eric

Hi Eric,

That is correct.

The device tree overlay functions as expected. When I isolate the GPIO pin from the level shifter, I see 0V when I configure the pin to pulldown and 1.8V when I configure the pin to pullup.

The level shifter also operates as expected. With the level shifter connected, within Linux (Yocto), I’m able to configure the GPIO as an output and set the value as 0 and 1. In Linux, when setting a value of 0 to the pin, I see 0V on the GPIO side of the level shifter and 0V on the 5V side of the level shifter. When setting a value of 1 to the pin, I see 1.8V on the GPIO side of the level shifter and 5V on the 5V side of the level shifter.

It is only during boot up that I’m running into issues. I suspect that the device tree pulldown is not strong enough to overpower the pullup on the level shifter. It seems Linux is allowing me to switch the pin from an input to an output and use push-pull, but I’m not sure if it is possible to set this same configuration in the device tree so that the pin is configured this way during boot up.

To answer your questions, the level shifter that we are using is a TI LSF0204PWR. The OS is a Yocto build (Dunfell).

Thanks for your help!

Are you guys using the stock uboot for the module? There are ways to add gpio config/operation during the boot process. If you search around this forum, you’ll find a bunch:

Not sure if the stock uboot has the gpio command enabled, but you could use that also to get things set at least before the kernel boots. But, that’s probably not fast enough for you anyway…

Hi Dave,

This fit our needs perfectly. Per your link, I was able to modify the stock uboot source to configure the necessary pins.

Thanks so much!

1 Like