GPIOs returning stale value on Ixora

Hi all,

I created a circuit with button connected to GPIO.
I try to read from GPIOs on Ixora using sysfs (the pins on the X27):

Example for GPIO 1:

# echo 1 > /sys/class/gpio/export
# echo "in" > /sys/class/gpio/gpio1/direction
# cat /sys/class/gpio/gpio1/value     // always returns 1

The problem is it always returns 1 regardless the position of the button (if it is pressed or not).

I tried with another GPIO pins - some pins return permanently 0, some permanently 1.

Example for GPIO 2:

# echo 2 > /sys/class/gpio/export
# echo "in" > /sys/class/gpio/gpio2/direction
# cat /sys/class/gpio/gpio2/value     // always returns 0

The circuit and the button are ok - it works fine on another device (e.g. Raspberry).

I should mention I replaced the default preinstalled Linux with JetPack (Ubuntu) - (according to these instructions: Installing NVIDIA JetPack with L4T on Apalis TK1)

How to get the GPIOs work? Did I miss something?

Thanks, Petr

Yes, you missed that the GPIO numbering of the Linux kernel (which is what sysfs uses) is not the same as our Apalis GPIO numbering.

Please have a look at the following article on our developer website for an explanation.

You basically first need to get NVIDIA’s pin name for resp. Apalis GPIO which you find in our datasheet and then using the table as linked to in above referred to article to translate it to the number as used by the Linux kernel.

So what number would the GPIO1 on pin 13 have? (as written here: http://docs.toradex.com/101430-apalis-arm-ixora-datasheet.pdf - page 28, chapter 3.11.4 Extension Header (X27))

It is not clear to me from the article. (And as I installed the JetPack, I don’t have the GPIO tool anymore.)

No, sorry. I’m not talking about the Ixora but rather the Apalis TK1 datasheet (https://docs.toradex.com/103129-apalis-tk1-datasheet.pdf - page 33, chapter 6.2 GPIOs).

So basically Apalis GPIO1 is NVIDIA TK1 ball/port FF2. And now looking that one up here gives us number 250. And that’s what you should use on the kernel/sysfs level.