Gpio address of xavier nx

Hello, I’m configuring GPIO12(pin:218), and I have a problem:

  1. Get GPIO3_PCC.04 in the pinmux file;
  2. According to the file source-code/kernel/kernel-5.10/include/dt-bindings/gpio/tegra194-gpio.h, get: #define TEGRA194_AON_GPIO_PORT_CC 2
  3. Enter the following command in xavier nx:
  4. The GPIO number of GPIO12 is 305 + 8 * 2 + 4 = 325
  5. But when I check on xavier nx the result is
sudo cat /sys/kernel/debug/gpio | grep PCC.04
gpio-321(PCC.04        )
  1. So what is the base address of gpio.

hello Yolomei,

just for confirmation, may I know which JetPack release you’re working with.

Hello, I am using R35.1.

hello Yolomei,

GPIO calculation using below is not valid anymore for K5.10.
please refer to developer guide, [Identifying the GPIO Number] for the steps for looking up the port and offset.

Hello, I use the xavier nx development board, but this part is not described in the manual

hello Yolomei,

you may follow the same for checking /sys/kernel/debug/gpio

How to view the gpio base address of xavier nx

hello Yolomei,

may I know which pin you’re going to check?
you should look into pinmux configuration file, i.e. tegra19x-mb1-pinmux-p3668-a01.cfg
there’re address, values, and also the pin naming in the cfg file.

In “Jetson TX2 Platform Adaptation and Bring Up”, there are two base addresses of GPIO, 256 and 320 respectively, which can also be obtained by using the command shown in the following figure. How to obtain the base address of xavier nx in R35.1

hello Yolomei,

ohh… you’re asking for kernel allocation ranges instead of physical reg address.
had you check [Identifying the GPIO Number] for the steps for looking up the port and offset?

there’re some approaches…
for example,

  1. you may follow the same to check /sys/kernel/debug/gpio directly.

  2. these also reported during kernel init, you can check kernel logs.
    $ sudo dmesg | grep "registered GPIOs"
    [ 3.062843] gpiochip0: registered GPIOs 504 to 511 on max77620-gpio
    [ 5.954009] gpiochip1: registered GPIOs 335 to 503 on tegra194-gpio
    [ 5.956153] gpiochip2: registered GPIOs 305 to 334 on tegra194-gpio-aon

  3. please check via sysfs as below for confirmation.
    for example,
    # cat /sys/kernel/debug/pinctrl/2430000.pinmux/gpio-ranges
    GPIO ranges handled:
    0: tegra194-gpio GPIOS [335 - 499] PINS [0 - 164]
    165: tegra194-gpio GPIOS [500 - 503] PINS [195 - 198]
    0: tegra194-gpio-aon GPIOS [305 - 334] PINS [165 - 194]

So the GPIO number of GPIO12 is “305+8 * 2+4=325”. Why is GPIO number of GPIO12 found in the xavier nx development board is 321

hello Yolomei,

GPIO calculation for using this formula is not valid anymore for JetPack-5.0.2 release version.
you may consider this gpio-321 is correct GPIO number of PCC.04 for system.
$ sudo cat /sys/kernel/debug/gpio | grep PCC.04
gpio-321(PCC.04 )

Do you mean that for R35.1, the gpio calculation formula has been changed? What is the new formula?

hello Yolomei,

I meant there’s BUG for following that calculation formula to check GPIO numbers.
please read GPIO numbers through sysfs.

That is, the R35.1 version can only obtain the GPIO number in this way, and cannot obtain the GPIO number through the calculation formula in advance as R32.5.1 version does. That is, there is no GPIO calculation formula in R35.1

it is also mentioned in the developer guide, To check a GPIO number.

Yes, but after seeing the calculation formula in the R32.5.1 manual, I thought that this version could also use the calculation formula to get the GPIO number. Thank you for your help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.