Issues with GPIO output on Colibri iMX7D

Hello,

we have used Colibri i.MX7D 1GB (eMMC) in a custom-designed product many times.

Since I tried BSP 5.6.0 I experience a strange behaviour of GPIO15 (pin 178 of SODIMM):

  • pin is fully controllable as output via u-boot from serial console
  • pin goes high when kernel boots, then goes low a few seconds after “root login” appears on serial console
  • if I try to control pin from my application or by using “old sysfs method”, I see it assigned to the correct driver, set as output and being “hi”/“lo” in /sys/kernel/debug/gpio, but no change in hardware status. If set it as an input and apply a voltage, I see the value changing in /sys/kernel/debug/gpio.
  • doing the same with GPIO14 (pin 188) works without issues from user space/application
  • older BSP (with 5.4.91 kernel, I think it was BSP 5.4.x) works perfectly
  • I tried with both custom device tree and Toradex eval-v3 device tree, same issue
  • I tried with both custom kernel and Toradex Minimal Image 5.6.0 from Tezi, same issue

Any suggestions?

HW: Colibri iMX7D 1GB V1.1A on custom carrier board or Viola Carrier Board
SW: BSP 5.6.0

Thanks in advance.

BR,
Diego

Could you provide output for
# gpioinfo
command?

Have you tried to control that pin using

#gpioset 0 14=1 
#gpioset 0 14=0

Sure, here it is:

Just after boot:
root@colibri-imx7-emmc-06949105:~# gpioinfo
gpiochip0 - 32 lines:
        line   0:  "SODIMM_43"         "cd"   input   active-low [used]
        line   1:  "SODIMM_45"    "Wake-Up"   input  active-high [used]
        line   2: "SODIMM_135"       unused   input  active-high
        line   3:  "SODIMM_22"       unused   input  active-high
        line   4:      unnamed        "scl"  output  active-high [used open-drain]
        line   5:      unnamed        "sda"  output  active-high [used open-drain]
        line   6:  "SODIMM_37"       unused   input  active-high
        line   7:  "SODIMM_29"       unused   input  active-high
        line   8:  "SODIMM_59"       unused   input  active-high
        line   9:  "SODIMM_28"       unused   input  active-high
        line  10:  "SODIMM_30"       unused   input  active-high
        line  11:  "SODIMM_67"       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed  "interrupt"   input  active-high [used]
        line  14: "SODIMM_188"       unused   input  active-high
        line  15: "SODIMM_178"       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high

With application running:
root@colibri-imx7-emmc-06949105:~# gpioinfo | head -n 40
gpiochip0 - 32 lines:
        line   0:  "SODIMM_43"         "cd"   input   active-low [used]
        line   1:  "SODIMM_45"    "Wake-Up"   input  active-high [used]
        line   2: "SODIMM_135"       unused   input  active-high
        line   3:  "SODIMM_22"       unused   input  active-high
        line   4:      unnamed        "scl"  output  active-high [used open-drain]
        line   5:      unnamed        "sda"  output  active-high [used open-drain]
        line   6:  "SODIMM_37"       unused   input  active-high
        line   7:  "SODIMM_29"       unused   input  active-high
        line   8:  "SODIMM_59"       unused   input  active-high
        line   9:  "SODIMM_28"       unused   input  active-high
        line  10:  "SODIMM_30"       unused   input  active-high
        line  11:  "SODIMM_67"       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed  "interrupt"   input  active-high [used]
        line  14: "SODIMM_188"  "periphery"  output  active-high [used]
        line  15: "SODIMM_178"  "periphery"  output  active-high [used]
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high

gpioset command works with ch14 (gpio set 0 14=1) but not with ch15 (gpio set 0 15=1): no voltage change on output
gpio set 15 still works on u-boot

Diego

Are you using Toradex pre-built version? If so, could you pleas share its full name (ie

Linux Reference Minimal
Downstream SoC vendor based kernel
Wayland/XWayland graphics back-end supported but not included
[5.6.0+build.18]

If you building your own image - could you check if it’s reproduceable on Toradex prebuilt image?

Dear Alex,

issue is found with both custom and prebuilt images.

The prebuilt image installed with Easy Installer is the one you mentioned (5.6.0 build 18, minimal).

BR,
Diego

I tried this:

  1. install a custom-built image based on BSP 5.6.0 build 18 minimal
  2. put an old precompiled Kernel form BSP 5.4 ( Linux colibri-imx7-emmc-06949105 5.4.129-5.4.0-devel+git.cb88cc157bfb ) with its modules into bootfs/rootfs of the module (zImage in /boot and modules in /lib/modules)
    and it works.

Dear @d.moimas,

Thanks for letting us know. We’ll try to reproduce it on our side and then we’ll come back to you.

Best regards
Guilherme

Dear @gclaudino.tx ,

thanks. Let us know if you need more details.

We managed to resume production by manual modification of our carrier board PCB to use another GPIO but we’d like to fix this issue for next production batch.

BR,
Diego

Dear @d.moimas, how are you?

I’ve tested our downstream minimal image on the BSP 5.6.0 and I was indeed able to check the behavior you presented here. However, I think the problem is more linked to which kernel version you’re using. I’ve been able to control the GPIO 15 normally using the BSP 5.6.0 Upstream Kernel.

The version I used was:

TDX Wayland with XWayland Upstream 5.6.0+build.18 (dunfell)
Colibri-iMX7-eMMC_Reference-Minimal-Image-upstream

Can you please test with this version? Would this be a plausible solution for you at the moment? I forwarded this point to our team to see how we could deal with this so that customers willing to use Downstream Kernel are able to use this GPIO pin if needed.

Best regards,
Guilherme

Dear @gclaudino.tx,

thanks for testing with other kernel versions. I think we’ll try the upstream/mainline kernel and if everything works fine, we’ll stuck with that for the moment.

BTW, let us know how it goes with downstream kernel issue.

Best regards,
Diego

Hi @gclaudino.tx,

just finished adjusting my Yocto build to work with upstream kernel.
Without running repo sync, it compiled upstream kernel 5.4.161+gitAUTOINC+ed9c66090d-r0 (downstream was also 5.4.161) and GPIO works fine.

We’ll test other peripherals and performance and hope to find them OK.

Regards,
Diego

EDIT: gpio-poweroff is not working anymore

Dear @d.moimas, thanks for the feedback.

I’ll keep you updated on the status of the Downstream Kernel.

How are you trying to use gpio-poweroff so that I can try to reproduce it on my side? By the way, did you check our article post about it? GPIO (Linux) | Toradex Developer Center. There is a mention to enabling CONFIG_POWER_RESET_GPIO. Did you check if the upstream kernel has this enabled?

Best regards,
Guilherme

Thanks for suggesting about Kconfig value, it was the right direction. I’ll resume validation of oure application tomorrow.

BR,
Diego

1 Like

Dear @d.moimas,

I got feedback from our team that the fix for this GPIO issue will be available on the nextDownstream Kernel nightly release. If you want, you could give it a try.

Otherwise, is there anything else that we could help you with? Or could we mark this issue as solved?

Best regards,

Dear @gclaudino.tx ,

sorry for not providing any other feedback. With mainline kernel everything works fine but I had to modify our application software as root device will change name (eMMC is no more /dev/mmcblk0) and other minor changes. I’ll give a try to new downstream kernel and if it works fine, I’ll go back to downstream kernel as we have other devices around.

We’ll decide if we’ll have an application software with different settings based on which kernel is installed (mainline/downstream) or if we’ll stick with downstream.

If the fix on downstream kernel works, I’ll consider everything fixed.

Thanks,
Diego

Dear @d.moimas,

Thanks for the update. Please keep me updated about your current status. Also, remember that the fix will still be on the nightly release only. Later it will migrate to other future releases.

Best regards,

Dear @gclaudino.tx,

I assume the fix is the one related to commit 49e38908678f863728eda82ca64fd4acaaed9685 ( linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules ) . I just applied this patch to my Yocto build environment

BR,
Diego

Confirmed working

1 Like