Jetson/AGX Xavier Check Pin Setting
This page talks about how to check pin setting (such as 1. pinmux - used as GPIO or other function, 2. input or output, 3. pull up or pull down) on Jetson platform.
Get all pin setting
Below command can get pinmux setting:
sudo cat /sys/kernel/debug/tegra_pinctrl_reg
The output is like below on Jetson AGX Xavier:
Bank: 1 Reg: 0x0c302000 Val: 0x00000400 -> touch_clk_pcc4 Bank: 1 Reg: 0x0c302008 Val: 0x00000458 -> uart3_rx_pcc6 Bank: 1 Reg: 0x0c302010 Val: 0x00000400 -> uart3_tx_pcc5 Bank: 1 Reg: 0x0c302018 Val: 0x00000540 -> gen8_i2c_sda_pdd2 Bank: 1 Reg: 0x0c302020 Val: 0x00000540 -> gen8_i2c_scl_pdd1 Bank: 1 Reg: 0x0c302028 Val: 0x00000400 -> spi2_mosi_pcc2 Bank: 1 Reg: 0x0c302030 Val: 0x00000440 -> gen2_i2c_scl_pcc7 Bank: 1 Reg: 0x0c302038 Val: 0x00000400 -> spi2_cs0_pcc3 Bank: 1 Reg: 0x0c302040 Val: 0x00000440 -> gen2_i2c_sda_pdd0 Bank: 1 Reg: 0x0c302048 Val: 0x00000400 -> spi2_sck_pcc0 Bank: 1 Reg: 0x0c302050 Val: 0x00000450 -> spi2_miso_pcc1 Bank: 1 Reg: 0x0c303000 Val: 0x0000c055 -> can1_dout_paa0 Bank: 1 Reg: 0x0c303008 Val: 0x0000c055 -> can1_din_paa1
Above output is a long list of all pinmux settings. To figure out the pinmux for certain pin, we need get the pin name.
Get pin name
The pin name used in above output is "ballname_gpio" format. For Jetson AGX Xavier, Ball Name and GPIO info is in Jetson AGX Xavier Pinmux. For example, if we want to get pinmux setting of pin which "Signal Name" is "GPIO22" and "Pin#" is "F54". We can get its "Ball Name" is "USB_VBUS_EN0" and "GPIO" is "GPIO3_PZ.01". So the pin name for searching is "usb_vbus_en0_pz1".
Note: For pin which "GPIO" field is empty, pin name for searching is "ballname". For example, pin which "Signal Name" is "STANDBY_ACK_N" and "Pin#" is "J60", we can get its "Ball Name" is "SOC_PWR_REQ" and "GPIO" is empty, so the pin name for searching is "soc_pwr_req".
Get pin setting
Below command get certain pin's pinmux register address and value.
sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep "pin name"
For our example, we can get pinmux register address(0x0243d0b0) and value(0x00000009) by command
sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep "usb_vbus_en0_pz1"
And the output is
Bank: 0 Reg: 0x0243d0b0 Val: 0x00000009 -> usb_vbus_en0_pz1
Decode pin setting
After we get pinmux register value, we can decode it by checking Technical Reference Manual. For Jetson AGX Xavier, we should refer section 8.4.4 in Jetson AGX Xavier Technical Reference Manual.
For our example, the register address is 0x0243d0b0 and value is 0x00000009.
Searching for "USB_VBUS_EN0" (the "Ball Name") in section 8.4.4, and we can find register "PADCTL_UART_USB_VBUS_EN0_0". Its offset is 0xb0 which matches the register address. By decoding register description, we know 0x00000009 means the pin is used as GPIO (bit 10 is 0) and it's pull up (bit 3:2 is 2).