GPIO, SPI and PWM not working on Jetson Xavier NX

hello Out_of_the_BOTS,

sorry, I’ve given incorrect sample. (will also revise my previous comments)
please assign this to generate gpio422 name from sysfs, i.e. # echo 422 > /sys/class/gpio/export

That didn’t generate the gpio422

if I ls the directory this is what I get

hello Out_of_the_BOTS,

may I know which JetPack release version you’re using, is this native JetPack release image?
could you please share below information for reference, thanks
i.e. # cat /etc/nv_tegra_release, and $ dmesg | grep DTS

I used SDKmanger to flash Jetpack5.01 to the SSD

hello Out_of_the_BOTS,

there’s /sys/class/gpio/PO.01 created, please enter the node and try toggle the pin for confirmation.

I still didn’t get a change on the pin see following terminal output

I am testing GPIO422 aka GPIO11 aka header pin 31 in below picture

Screenshot from 2022-07-12 14-40-45

hello Out_of_the_BOTS,

there’s an issue to configure GPIO directly,
currently, if you would like to make changes dynamically, you may use devmem/reg_dump to update pinmux register , or update MB1 pinmux bct file.
for example,
pinmux.0x02430030 = 0x0000005a; # soc_gpio42_pq6: rsvd2, pull-up, tristate-enable, input-enable, io_high_voltage-disable, lpdr-disable

please set both bit-4 and bit-6 as 0 to configure this pin as output mode. after that, you should be able to control the pin through sysfs.
for example,
pinmux register: 0x02430030 / Default boot value: 0x5a
please update bit-4 and bit-6 to set required direction. whereas, Output: Bit 4 = 0 Bit 6=0, Input: Bit 4=1 Bit 6=1
please try below steps to make GPIO output working.

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

BTW,
you’ll need to double check the gpio numbers. please see-also To check the GPIO number.
since I don’t have Xavier NX for double check, please examine the GPIO allocation range, you should check kernel init messages.
for example, this is the results by Orin AGX.

[    6.007898] gpiochip0: registered GPIOs 348 to 511 on tegra234-gpio
[    6.013957] gpiochip1: registered GPIOs 316 to 347 on tegra234-gpio-aon

furthermore,
this issue is fixed, you may expect next JetPack public release (l4t-r35.1) to include the fixes.

There doesn’t seem to be a GPIO allocation

because it’s naming is using tegra194-gpio and tegra194-gpio-aon.

GPIO 422 is within the GPIO list

I still haven’t been able to toggle a GPIO pin.

When will the update r35.1 be released?

I have also contacted Seed Studios about the issues incase it is a problem with the carrier board

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               )

I need to know which pin to check on the header. Which header pin responds to 469

the same pin you’re tested, pin-31 / GPIO11.

No change on the pin.

hello Out_of_the_BOTS,

it looks like a bug, we’ve follow the gpio calculation of PQ.06, but the sysnode report PV.03 here.
we need to obtain correct gpio number, is the GPIO allocation range change for every reboot cycle?

it’ll be public release around Q3/2022.

The GPIO allocation stays the same after each reboot.

gpiochip2: GPIOs 305-334, parent: platform/c2f0000.gpio, tegra194-gpio-aon:
gpiochip1: GPIOs 335-503, parent: platform/2200000.gpio, tegra194-gpio:

hello Out_of_the_BOTS,

it turns out GPIO calculation as shown in comment #18 is not valid anymore for K5.10.
please refer to developer guide, To check a GPIO number, please follow the GPIO debugfs for looking up the port and offset. i.e. # cat /sys/kernel/debug/gpio | grep PQ.06

Seed studios has requested that I send them back the unit as it could be a hardware problem as Jetpack 4.6 had the same problem.

Once I get the unit back again we will see if we can the GPIO working.

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