GPIO_4 not working on Verdin iMX8Mplus with Dahlia

Hello,

I am using the VerdiniMX8Mplus with Dahlia. Trying to use pin 30 on X20 connector as GP input.

As per the table 5-4 dedicated GPIO signals in datasheet for Verdin, I have the following information.
212 GPIO_4 GPIO1_IO06 GPIO1_IO6
So this GPI appears to line up with “gpiochip1” and pin 6.

I am using the code as per this link to read the GP input.

However, I am getting a -1 i.e. I am not getting any value received.
I have also used the input to this pin as 1.8SW output from X20 pin 26 on the same connector, to see if the GP input reads a 1 , however I am not getting the right output.

Software that I am using on the board is as follows:
Linux verdin-imx8mp-07331171 5.15.77-6.1.0-devel+git.a8d2c55c6ae7 #1-TorizonCore SMP PREEMPT Wed Nov 30 08:37:42 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Any ideas what could be going wrong?

Greetings @SJ_BHD,

I think I know what’s going on.

So this GPI appears to line up with “gpiochip1” and pin 6.

You would be correct when thinking about how the datasheet and device tree lists this pin. However, in Linux the numbering for gpiochip* starts at 0 not 1. This means in software the gpiochip you want is 1 less than what you think. You can see this via the output from gpioinfo:

gpiochip0 - 32 lines:
        line   0: "SODIMM_206"       unused   input  active-high
        line   1: "SODIMM_208"       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed  "interrupt"   input  active-high [used]
        line   4:      unnamed       unused   input  active-high
        line   5: "SODIMM_210"       unused   input  active-high
        line   6: "SODIMM_212"       unused   input  active-high
        line   7: "SODIMM_216"       unused   input  active-high
        line   8: "SODIMM_218"       unused   input  active-high
        line   9:      unnamed       unused  output  active-high
        line  10:      unnamed  "interrupt"   input  active-high [used]
        line  11:  "SODIMM_16"       unused   input  active-high
        line  12: "SODIMM_155"       unused   input  active-high
        line  13: "SODIMM_157"       unused   input  active-high
        line  14: "SODIMM_185"       unused   input  active-high
        line  15:  "SODIMM_91"       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

As seen above even though in the datasheet this pin is listed under gpiochip/bank 1 in software it’s actually under gpiochip0.

Best Regards,
Jeremias

Hello @jeremias.tx ,

Tried changing to “gpiochip0” but still pin reads -1. Got the same issue with the remaining gpios noted ie. gpiochip2, gpiochip3, gpiochip4 and gpiochip5.

I am wondering if this pin has been defined as an alternate function.

I also tried the other pin 5 apart from pin 6 on X20 connector, but get the same output.

I have also tried using gpioinfo on SSH terminal for the Verdin Dahlia, but get a command not found error. Tried with both the software versions 5.7.0 and 6.1.0 supported currently on Verdin iMX8Mplus.

Hey @SJ_BHD,

@jeremias.tx and I did some testing. Would you mind trying to rebuild the docker image with some additional build arguments. We found the README guides need updating as well.

Docker build command w/ additional build arguments:

docker build --build-arg IMAGE_ARCH=linux/arm64 --build-arg CROSS_TC_IMAGE_ARCH=arm64 --build-arg GCC_PREFIX=aarch64-linux-gnu -t youruser/arm64v8-gpio-test .

This should replace the old build command:

docker build --build-arg IMAGE_ARCH=linux/arm64 -t youruser/arm64v8-gpio-test .

-Eric

I am wondering if this pin has been defined as an alternate function.

As far as I can tell SODIMM pin 212 is defined with the GPIO function by default.

I have also tried using gpioinfo on SSH terminal for the Verdin Dahlia, but get a command not found error

The gpioinfo tool and other libgpiod related tools are only available in a container where these tools are installed. These tools are not available on TorizonCore itself.

Best Regards,
Jeremias