uboot patch fails to set GPIO low at startup

I have a critical safety function that I require my device to follow at startup. Three of my GPIOs are connected to a heater that I cannot have turned on at boot. I have followed the instructions from the GPIO page on Toradex’s website. I created a patch file and applied it to my Uboot config. Here’s that patch file, 0001-Updated-Colibri-Startup.patch:

From 940d41fc2cef8b26a546afb449a0ed00c8b1d4a3 Mon Sep 17 00:00:00 2001
From: ccastillo <ccastillo@sherpa-design.com>
Date: Thu, 13 Nov 2025 14:36:22 -0800
Subject: [PATCH] Updated Colibri Startup

---
 board/toradex/colibri_vf/colibri_vf.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index 35920008805..bd204d3fdef 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -327,6 +327,24 @@ int board_early_init_f(void)
 
 #ifdef CONFIG_VYBRID_GPIO
 	setup_iomux_gpio();
++	//See XP1-FW Pin_config.json for pinouts
++	//GPIO -> 32*chip + line
++	gpio_request(117, "SODIMM_PIN_98");
++	gpio_direction_output(117, 0)
++	gpio_request(168, "SODIMM_PIN_135");
++	gpio_direction_output(168, 0)
++	gpio_request(132, "SODIMM_PIN_133");
++	gpio_direction_output(132, 0)
++	gpio_request(33, "SODIMM_PIN_92");
++	gpio_direction_output(33, 0)
++	gpio_request(25, "SODIMM_PIN_103");
++	gpio_direction_output(25, 0)
++	gpio_request(50, "SODIMM_PIN_55");
++	gpio_direction_output(50, 0)
++	gpio_request(49, "SODIMM_PIN_63");
++	gpio_direction_output(49, 0)
++	gpio_request(22, "SODIMM_PIN_28");
++	gpio_direction_output(22, 0)
 #endif
 
 	return 0;
-- 
2.34.1

I integrated it into my yocto build with the following recipe, u-boot-toradex_%.bbappend:

# Apply patch to uboot source
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += "file://0001-Updated-Colibri-Startup.patch"

That gives no errors, although I’m not sure how to determine if it actually built and was integrated into my Uboot. Regardless, I tested this by starting up the board and checking the levels on the pins that I am setting low there. It seems to have no effect, as there is no change in the gpio state.

I also went through manually whilst in uboot to see if I could change the GPIO state. That also didn’t work even though I got no errors:

Colibri iMX8X # gpio status GPIO0_25
Bank GPIO0_:
GPIO0_25: input: 1 [ ]
Colibri iMX8X # gpio clear 25   
gpio: pin 25 (gpio 25) value is 0
Colibri iMX8X # gpio status GPIO0_25
Bank GPIO0_:
GPIO0_25: input: 1 [ ]

This appears to show that the gpio is still configured as an input even though I should be setting it to be output with the patch file. I don’t know where that CONFIG_VYBRID_GPIO is defined, but I didn’t see it in the colibri_vf.c file anywhere. That being said, the GPIO setup is there anyways (gpio_setup_iomux()) so it must be running that if it configures the GPIO at all.

Any thoughts?

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


I can see you’re working on GPIO control in U-Boot for safety-critical applications. Before I provide specific guidance, I need to clarify your setup to ensure I give you the most accurate instructions.

Could you please run the tdx-info command on your device and share the output? This will help me understand exactly which hardware and OS version you’re using. You can find more information about this command at tdx-info documentation.

Additionally, could you specify:

  • Which OS and version are you running on the device?
  • Are you using Torizon OS, Yocto BSP, or another system?

The reason I’m asking is that GPIO configuration approaches vary significantly between different Toradex platforms and OS versions. For example, the code structure and GPIO handling differs between Colibri VF (Vybrid-based) and Colibri iMX8X modules, and your patch appears to target Colibri VF while your U-Boot prompt shows “Colibri iMX8X”.

Once I have this information, I can provide you with the correct GPIO configuration approach for your specific hardware and ensure your safety-critical heater control works properly at startup.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

If you are using a Colibri iMX8X, why are you applying patches to the board initialization files intended for the Colibri VFxx?

Yes, I see that now that you pointed it out. I probably just copied the GPIO without paying attention to it. I have rebuilt my patch file to work off of “colibri-imx8x.c” in the board_init function:

From cd1efa6b7d6b2214f927589485e2c0fa8af1ff5f Mon Sep 17 00:00:00 2001
From: ccastillo <ccastillo@sherpa-design.com>
Date: Thu, 4 Dec 2025 08:18:16 -0800
Subject: [PATCH] Updated colibri IMX8X board_init

---
 board/toradex/colibri-imx8x/colibri-imx8x.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index 2a71e7b92de..dd9cf8a1458 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -125,6 +125,24 @@ int board_init(void)
 			return ret;
 	}
 
+	//See XP1-FW Pin_config.json for pinouts
+	//GPIO -> 32*chip + line
+	gpio_request(117, "SODIMM_PIN_98");
+	gpio_direction_output(117, 0);
+	gpio_request(168, "SODIMM_PIN_135");
+	gpio_direction_output(168, 0);
+	gpio_request(132, "SODIMM_PIN_133");
+	gpio_direction_output(132, 0);
+	gpio_request(33, "SODIMM_PIN_92");
+	gpio_direction_output(33, 0);
+	gpio_request(25, "SODIMM_PIN_103");
+	gpio_direction_output(25, 0);
+	gpio_request(50, "SODIMM_PIN_55");
+	gpio_direction_output(50, 0);
+	gpio_request(49, "SODIMM_PIN_63");
+	gpio_direction_output(49, 0);
+	gpio_request(22, "SODIMM_PIN_28");
+
 	return 0;
 }
 
-- 
2.34.1

I just rebuilt with Yocto and pushed to my machine, but the same issue is still occurring. All the GPIOs I set low there are high and set as inputs. I get the same output as in my original post Any other thoughts?

Also, to answer the Toradex AI:

My Hardware:

  • Toradex Colibri iMX8QXP

  • Yocto Version: Scarthgap

  • uname -r: 6.6.101-7.4.0-devel

Thank you

Have you checked the pin level physically (with a multimeter or oscilloscope)?

To confirm that your changes were applied and the new U-Boot was properly deployed, add a line like puts("\nMy custom code here\n"); to your patch. This will print a message to the serial console during boot.

Yes, I have checked the levels with a multimeter. I stop the autoboot process and look in the uboot menu.

I added the string output to the code and rebuilt the patch. The new patchfile is as follows:

From 00373295196ce416278ae6ab2f45f068bdb4da50 Mon Sep 17 00:00:00 2001
From: ccastillo <ccastillo@sherpa-design.com>
Date: Thu, 4 Dec 2025 11:46:19 -0800
Subject: [PATCH] Updated colibri IMX8X board_init

---
 board/toradex/colibri-imx8x/colibri-imx8x.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index 36bc85fdf0b..ae88b21c96b 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -169,6 +169,26 @@ int board_init(void)
 {
 	board_gpio_init();
 
+	//See XP1-FW Pin_config.json for pinouts
+	//GPIO -> 32*chip + line
+       	puts("\nCustom Patch Running!\n");
+	gpio_request(117, "SODIMM_PIN_98");
+	gpio_direction_output(117, 1);
+	gpio_request(168, "SODIMM_PIN_135");
+	gpio_direction_output(168, 1);
+	gpio_request(132, "SODIMM_PIN_133");
+	gpio_direction_output(132, 1);
+	gpio_request(33, "SODIMM_PIN_92");
+	gpio_direction_output(33, 1);
+	gpio_request(25, "SODIMM_PIN_103");
+	gpio_direction_output(25, 1);
+	gpio_request(50, "SODIMM_PIN_55");
+	gpio_direction_output(50, 1);
+	gpio_request(49, "SODIMM_PIN_63");
+	gpio_direction_output(49, 1);
+	gpio_request(22, "SODIMM_PIN_28");
+
+
 	if (IS_ENABLED(CONFIG_IMX_SNVS_SEC_SC_AUTO)) {
 		int ret = snvs_security_sc_init();
 
-- 
2.34.1

Then I looked at the U-boot logs:

 U-Boot 2024.04-7.4.0+git.cf50ed467107 (Aug 05 2025 - 15:22:26 +0000)                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                      
CPU:   NXP i.MX8QXP RevC A35 at 1200 MHz at 46C                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                      
DRAM:  2 GiB                                                                                                                                                                                                                                                          
Core:  249 devices, 24 uclasses, devicetree: separate                                                                                                                                                                                                                 
MMC:   FSL_SDHC: 0, FSL_SDHC: 1                                                                                                                                                                                                                                       
Loading Environment from MMC... OK                                                                                                                                                                                                                                    
In:    serial                                                                                                                                                                                                                                                         
Out:   serial                                                                                                                                                                                                                                                         
Err:   serial                                                                                                                                                                                                                                                         
Model: Toradex 0038 Colibri iMX8QXP 2GB WB IT V1.0E                                                                                                                                                                                                                   
Serial#: 08642230                                                                                                                                                                                                                                                     
Boot:  MMC0                                                                                                                                                                                                                                                           
Reset cause: Software reset                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                      
 BuildInfo:                                                                                                                                                                                                                                                           
  - SCFW 83624b99, SECO-FW c9de51c0, IMX-MKIMAGE 81fca643, ATF lf-6.6.                                                                                                                                                                                                
  - U-Boot 2024.04-7.4.0+git.cf50ed467107                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                      
flash target is MMC:0                                                                                                                                                                                                                                                 
Net:   eth0: ethernet@5b040000 [PRIME]                                                                                                                                                                                                                                
Fastboot: Normal                                                                                                                                                                                                                                                      
Normal Boot                                                                                                                                                                                                                                                           
Hit any key to stop autoboot:  0                                                                                                                                                                                                                                      
switch to partitions #0, OK                                                                                                                                                                                                                                           
mmc1 is current device                                                                                                                                                                                                                                                
Scanning mmc 1:1...                                                                                                                                                                                                                                                   
Found U-Boot script /boot.scr                                                                                                                                                                                                                                         
5389 bytes read in 3 ms (1.7 MiB/s)                                                                                                                                                                                                                                   
## Executing script at 9d480000                                                                                                                                                                                                                                       
Loading DeviceTree: imx8qxp-colibri-eval-v3.dtb                                                                                                                                                                                                                       
121871 bytes read in 8 ms (14.5 MiB/s)                                                                                                                                                                                                                                
52 bytes read in 2 ms (25.4 KiB/s)                                                                                                                                                                                                                                    
Working FDT set to 9d400000                                                                                                                                                                                                                                           
Applying Overlay: colibri-imx8x_vga-640x480_overlay.dtbo                                                                                                                                                                                                              
2222 bytes read in 3 ms (722.7 KiB/s)                                                                                                                                                                                                                                 
8309519 bytes read in 351 ms (22.6 MiB/s)                                                                                                                                                                                                                             
Bootargs: root=PARTUUID=076c4a2a-02 ro rootwait console=tty1 console=ttyLP3,115200                                                                                                                                                                                    
   Uncompressing Kernel Image to 0                                                                                                                                                                                                                                    
## Flattened Device Tree blob at 9d400000                                                                                                                                                                                                                             
   Booting using the fdt blob at 0x9d400000                                                                                                                                                                                                                           
Working FDT set to 9d400000                                                                                                                                                                                                                                           
   Loading Device Tree to 00000000fd630000, end 00000000fd670fff ... OK                                                                                                                                                                                               
Working FDT set to fd630000                                                                                                                                                                                                                                           
/bus@59000000/dma-controller@591f0000, 43308                                                                                                                                                                                                                          
/bus@59000000/dma-controller@599f0000, 44544                                                                                                                                                                                                                          
/bus@5a000000/dma-controller@5a1f0000, 60352                                                                                                                                                                                                                          
/bus@5a000000/dma-controller@5a1f0000, 60352                                                                                                                                                                                                                          
/bus@5a000000/dma-controller@5a9f0000, 61464                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                      
Starting kernel ...

I did not see that string output there or anywhere else in the kernel messages. I am betting its a Yocto build issue or something if it’s not getting applied to the boot. Here are the GPIO startup messages as well:

[    1.743700] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.754897] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.766539] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.780310] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.794135] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.809447] gpio gpiochip5: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.820607] gpio gpiochip6: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.831789] gpio gpiochip7: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    8.691716] input: gpio-keys as /devices/platform/gpio-keys/input/input0

I’ll look at what could be causing this in Yocto. I don’t know if that static allocation warning is an issue, but let me do some more research

Thanks

And what were the levels?

So, you need to fix your build.

The gpios were still high when I want them to startup low.

I went to using devtool to create the patch. I’m not sure what devtool did any differently than me, but I can at least change the GPIOs that I set in the patch to 0 in U-boot. Before, even doing “gpio clear GPIOX_XX” was not setting the pins low. Now, it is. I also tried values of both 0 and 1 to check if they’re inverted in some way. Clearing them sets them low (as expected, verified with board measurements – i.e. multimeter)

Note that I’m on scarthgap, and I see that there’s a patch that was added earlier this year to fix a bug in u-boot from openembedded. I wasn’t getting any errors using my custom bbappend, but the error popped up when I used devtool. It doesn’t seem to be actually related to devtool as far as I can tell. For anyone else appending u-boot, consider applying that patch.

I also was curious as to where puts would print to the console, as I wasn’t seeing anything on the output still even though something clearly changed. I also threw a log_debug() message in and #defined the LOG_DEBUG variable as described here. I still see nothing on the output.

Any clues as to what might be going wrong with the build? So far, I have no output even thought I can see that bitbake is applying the patches:

$ bitbake-layers show-appends | grep u-boot-toradex
u-boot-toradex_2024.04.bb:
  /home/USER/yocto/dev/layers/meta-custom/recipes-bsp/u-boot/u-boot-toradex_2024.04.bbappend
  /home/USER/yocto/dev/build/workspace/appends/u-boot-toradex_2024.04.bbappend
$ bitbake -e u-boot-toradex | grep SRC_URI     
...                                                                                                                                                                                                                                                           
SRC_URI="file://0001-Updated-colibri-board_init.patch file://0002-Updated-colibri-pins-to-1.patch file://0003-Added-new-log-message.patch file://0004-fixed-semicolon-issue.patch"   

Thanks!

Please note that immediately after startup the System Controller (SCU) takes control and manages pin muxing and other low-level configuration. You can try to modify the SCU firmware to change pin states.

On the other hand, all unused GPIOs should be configured as inputs, and internal pull-up resistors may be enabled to reduce power consumption. I tested pulling some lines you are concerned about down using a 4.7 kΩ external resistor, and this approach worked as expected.

Therefore, instead of modifying the SCU code, you can simply add pull-down resistors on your carrier board.

Hi @camstillo ,

All set here? Should we close this?

Best regards,