GPIO, SPI and PWM not working on Jetson Xavier NX

hello Out_of_the_BOTS,

the gpio allocation range has changed for JP-5.0, the GPIO number (soc_gpio42_pq6) isn’t 422 as shown in NVIDIA Jetson Xavier NX GPIO Header Pinout - JetsonHacks.
please refer to below for GPIO calculation formula,


#define TEGRA194_MAIN_GPIO_PORT_Q 16

#define TEGRA194_MAIN_GPIO(port, offset)
((TEGRA194_MAIN_GPIO_PORT_##port * 8) + offset)

so, the gpio number of GPIO3_PQ.06 = ((16 * 8) + 6) + 335 = 469
you should try export the pin again, please check you’re able to make GPIO output working.


$ sudo devmem2 0x02430030 w 0x0a
$ echo 469 > /sys/class/gpio/export
$ cd /sys/class/gpio/PQ.06
$ echo out > direction
$ cat value # change value and check.

[edit]

please refer to developer guide, To check a GPIO number,
please follow the GPIO debugfs for looking up the port and offset.
for example, 454 the GPIO number of PQ.06

$ sudo cat /sys/kernel/debug/gpio | grep PQ.06
 gpio-454 (PQ.06               )