How to map physical GPIO pin to logical GPIO pin or vice versa on Tegra Jetson TK1

Hello All,
I want to use GPIOs in my application. We have only 8 GPIOs directly as listed in “” but we can also use Camera pins as GPIO. So i export “CAM_I2C_SCL PBB1” logical pin_217 and “CAM_I2C_SDA PBB2” logical pin_218. It is also showing entry of this pins in “cat /sys/kernel/debug/gpio” as “sysfs”.

I don’t know the physical pin number of this two pins. So how to map those logical pins to physical pins to access those GPIOs.

I am new to this board on Hardware side so not be able to figure it out. Your help much appreciated…
Thanks in advance…

GPIO naming is defined in kernel source arch/arm/mach-tegra/gpio-names.h.

Pins are shown in the schematic to connector J3A2 or J3A1. Schematic is dowloadable either from R19.x or R21.x pages. Link to links:

The sysfs files are the only “easy” way to access those pins. Without that you need to understand mapping of physical memory to virtual memory and figure out GPIO controller physical address in terms of virtual…as well as pinmux.

Thanks linuxdev, the link is useful. I have another query is that i am able to export gpio217 which is “TEGRA_GPIO_PBB1” in “gpio-names.h” and gpio218 so i thought all pins other than this two pins which are,


can also be exported and it did.
So i checked up “cat /sys/kernel/debug/gpio” and it gives me following results,

gpio-57 (sysfs ) in hi
gpio-160 (sysfs ) in lo
gpio-161 (sysfs ) in lo
gpio-162 (sysfs ) in hi
gpio-163 (sysfs ) in lo
gpio-164 (sysfs ) in lo
gpio-165 (sysfs ) in lo
gpio-166 (sysfs ) in lo

gpio-216 (sysfs ) in lo
gpio-217 (sysfs ) in lo
gpio-218 (sysfs ) in lo
gpio-219 (sysfs ) in lo
gpio-220 (sysfs ) in lo
gpio-221 (sysfs ) in lo
gpio-222 (sysfs ) in lo
gpio-223 (sysfs ) in lo

So i am not be able to map these logical pins to physical pins on “J3A1” or “J3A2” expansion header.
Thanks in advance.

I’m not sure what the question is…but if you want access to all GPIO it simply is not all routed to external pins. Of those GPIO which are physically available, some may have multiple uses and pinmux may prevent “simple” use of those pins; some pinmux changes may cause unexpected failure of something depending on existing pinmux.

Hi, how do you realize that TEGRA_GPIO_PBB0 was 216, I can’t find it in any doc. Can you help me please?

$ grep 216 kernel/arch/arm/mach-tegra/gpio-names.h
#define TEGRA_GPIO_PBB0         216

Kulve, can you be more specific in your path? Where is kernel/arch/arm/mach-tegra/gpio-names.h?

You have to download the kernel sources for the TK1 and expand them. The kernel sources should be expanded in /usr/src.
After that, the full path is:
Typically you’ll see this abbreviated as kernel/arch/arm… or arm/arch… as the /usr/src and sometimes kernel path are implied by the writer.

A slight explanation in this thread: