Need the sysfs numbers for gpio in the jetson Nano reference design

I am using the Jetson Nano reference design. I need to know the sysfs name for GPIOS to be able to access them using GPIO Sysfs Interface for Userspace.
I looked into the Jetson_Nano_Module_Pinmux_Config_templates.xlsm but could not figure out the GPIO names to use in sysfs.
GPIO02 is 124 in SODIMM .
GPIO05 is 128
GPIO06 is 130
GPIO04 is 127
GPIO03 is 126

are these the value I need to use the access these gpio using gpio# for sysfs? like for GPIO02 I would use gpio124.

hello samir.alami,

you may disassembler the device tree (*.dtb) file into text file for quick checking of the signal name.
for example,
$ dtc -I dtb -O dts -o output.txt tegra210.dtb

please also check documentation, Accessing GPIOs via “gpio” Device Labels, for reference,

Hi Samir.alami,

This post may help you map between the various GPIO names and the Linux sysfs GPIO numbers.


hi Greg,
I followed the instruction on the post but cannot figure out the BASE value they are referring to

  1. The last step is to examine /sys/kernel/debuig/gpio to find the BASE pin id value from the kernels point of view.
    the pinmux sheet has the following info about the gpios I am interested in:
    |GPIO06|130|NFC_EN| GPIO3_PI.00|vddio_spi|pd|GPIO3_PI.00
    |GPIO04|127|NFC_INT| GPIO3_PI.01|vddio_spi|wake11||pd|GPIO3_PI.01
    |GPIO03|126|GPS_EN| GPIO3_PI.02|vddio_spi|pd|GPIO3_PI.02|

I got the offset for each gpio after I get the value value of the P (pat) number for each GPIO.
here are the offsets:
GPIO02 = 62
GPIO05 = 63
GPIO06 = 64
GPIO04 = 65
GPIO03 = 66

how to I get the base value?

hello samir.alami,

you may refer to kernel initial messages for the GPIO base.
for example,

$ dmesg | grep GPIOs
[    0.562454] gpiochip_setup_dev: registered GPIOs 0 to 255 on device: gpiochip0 (tegra-gpio)
[    0.615033] gpiochip_setup_dev: registered GPIOs 504 to 511 on device: gpiochip1 (max77620-gpio)

are you indicating that the base value that I am asking for is 0 for gpiochip0? which means the sysfs values for the GPIOs requested is
GPIO02 = 62
GPIO05 = 63
GPIO06 = 64
GPIO04 = 65
GPIO03 = 66.

hello samir.alami,

you may also check the header file for the calculation formulas,

#define TEGRA_GPIO(port, offset) \
        ((TEGRA_GPIO_PORT_##port * 8) + offset)

let’s taking GPIO02 and GPIO06 for an example,
GPIO02 = GPIO3_PH.06 = ( 7 * 8 ) + 6 = 62
GPIO06 = GPIO3_PI.00 = ( 8 * 8 ) + 0 = 64

thanks. that worked.