Access Apalis T30 GPIO7 from C Code

I tryed to access GPIO1 to 8 from Apalis T30 (+ Ixora Carrier Board) with some C-Code. These GPIOs are available by Extension Header X27. Unfortunately GPIO7 cannot be set by the program.

I extended the gpio_output example .c and .h files. GPIO7 was defined this way:

#define GPIO_07_VALUE		"/sys/class/gpio/gpio151/value"			//S07 Tegra
#define GPIO_07_DIRECTION	"/sys/class/gpio/gpio151/direction"

If I try to access via terminal window I get “No such file or directory”. The export command also did not work.

echo 151 > /sys/class/gpio/export

I get “echo: write error: Device or resource busy”. Unexport says “echo: write error: Invalid argument.” When 189 is used like the GPIO (Linux) example it is possible to export/unexport.

What I’m doing wrong?

Another question is, how to read the GPIO value correctly if it’s an input?

This is due to this Apalis GPIO7 being used as PCIe switch reset by default working around an errate there. Our upcoming Q4 release contains a change already available in our -next branch which allows changing this behaviour via kernel command line argument without having to recompile the kernel.

Please find some more information concerning GPIO inputs here.

Maybe a stupid question, but how can I apply this patch to the board?

And what’s the way to include the correctly to use it for the apalis t30?

Why it isn’t shown on the scheme of the ixora board?

Because this PCIe switch is only available on the Apalis Evaluation board and not the Ixora but we are using one and the same Linux kernel for both. This is also why we made this configurable via kernel command line as previously mentioned.

So, I can use the pin GPIO 7 on the Ixora board as an input or output if I rebuild the kernel, is not it?

No need to rebuild the kernel really just pass pex_perst=0 via kernel command line.