Bootloader pulling GPIO pins high

Good day,

We are using the Colibri iMX8X SoM and I am running into an issue with the GPIO behaviour on start-up.
I have configured it so that three pins are set to their GPIO function.

  • Pin 98 configured to GPIO0-25 is used as an input, I have not observed trouble with that.

  • Pin 133 configured to GPIO3-21 is used as an output and configured in the device tree as pull-down. There is also an external pull-down on the circuit it connects to.

  • Pin 103 configured to GPIO4-04 is configured and used the same way as 3-21.

I have observed the output pins which are configured to pull-down and have external pull-downs, are pulled high for about 3 seconds after boot. It seems that the bootloader is pulling both pins high, I measured it on a scope to see that if I interrupt the boot process the pins stay high until I proceed to boot.

I tested this also with the external circuit disconnected so it was only the toradex on a viola carried board, and also verified the same behaviour on the larger colibri evaluation board.

In the picture below we can see both pin states. The horizontal div is 5s. A reboot is triggered, the pins are pulled low, then back high for 3.2 seconds, then back to low. After ~30s the controlling software has started and pulls one of the lines high.

After the bootloader is finished the pins return to low state and respond to control by the software when it is up and running, so I believe that the device tree configuration is good, I include it below:

&iomuxc {
    pinctrl-0 = <&pinctrl_functions>;

    pinctrl_functions: functiongrp {
        fsl,pins =
            <IMX8QXP_QSPI0B_DATA3_LSIO_GPIO3_IO21   0x40>,  /* SODIMM  98   - PULL DOWN */
            <IMX8QXP_USB_SS3_TC1_LSIO_GPIO4_IO04    0x40>,  /* SODIMM  133 - PULL DOWN */
            <IMX8QXP_SAI0_TXD_LSIO_GPIO0_IO25       0x60>;  /* SODIMM  103 -  PULL DISABLED */
    };

};

Is there any way to stop this from happening?

Output of tdx-info:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.148-6.6.1+git.23a8e831749d #1-TorizonCore SMP PREEMPT Thu Feb 29 20:25:21 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.0/torizon/5cf4f112b51d928d617d43224b06a2c39f825920c3ce3d3621fb369cd97b437c/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.6.1-build.14
Distro variant:           VARIANT="Docker"
Hostname:                 vcd
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Colibri iMX8QXP on Colibri Evaluation Board V3
Toradex version:          0050 V1.0D
Serial number:            14764115
Processor arch:           aarch64
------------------------------------------------------------

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

Thank you for reaching out with your question. The behavior you’re observing, where GPIO pins are pulled high during the bootloader phase, is likely due to the default configuration of the bootloader, which can set GPIO states before the Linux kernel takes over. This is a common issue when the bootloader initializes hardware differently than the final operating system configuration.

To address this, you can modify the U-Boot bootloader configuration to ensure that the GPIO pins are set to the desired state during the boot process. Here are some steps you can take:

  1. Check U-Boot Configuration:

    • Access the U-Boot source code for your Colibri iMX8X module, typically available in the Toradex BSP (Board Support Package).
    • Locate the board-specific configuration files, which might be under a directory like board/toradex/colibri_imx8x/.
  2. Modify GPIO Initialization:

    • In the U-Boot source, look for the GPIO initialization code, often found in board-specific files or common initialization routines.
    • Ensure that the GPIO pins in question are configured as pull-downs during the bootloader phase. You may need to add or modify code to explicitly set these pins to the desired state.
  3. Rebuild U-Boot:

    • After making the necessary changes, rebuild the U-Boot bootloader. Follow the Toradex documentation for building and deploying U-Boot to your module.
  4. Test the Changes:

    • Flash the modified U-Boot to your module and observe the GPIO behavior during boot. Verify that the pins remain in the pull-down state as expected.

By ensuring that the bootloader configures the GPIO pins correctly, you can prevent them from being pulled high during the boot process. If you continue to experience issues, double-check the device tree and U-Boot configurations to ensure consistency across all stages of the boot process.

I hope this helps resolve your issue. If you have any further questions, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

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

Hi @colibri, good day.

@ToradexAI bot is correct. This is the expected behavior.

The device tree overlays are stacked when the kernel is launched, so in the first few seconds before, the pins are going to be configured by the U-boot device tree before the Linux kernel takes over.

Do you need further assistance on this?

Thanks for the answer, I see now that the automatic reply provided the information I need.