"gpioset" command getting hang-up and not able to set the pin status high/low using it

Hi Team,

We have tried to set the default output gpio value as 1 or 0 using “gpioset” command but that command is getting hang-up we need to terminate that proess using “Ctrl + C”.

gpiodetect
gpiochip0 [tegra234-gpio] (164 lines)
gpiochip1 [tegra234-gpio-aon] (32 lines)
gpiochip2 [9-0020] (8 lines)
gpiochip3 [10-0020] (8 lines)

How do we set the GPIO direction as output and set the value 1 and 0 using command-line utility on NVIDIA Jetson Orin Nano EVK ?

We are using below kernel version as per Jetpack.

image

cat /etc/nv_tegra_release
# R36 (release), REVISION: 4.4, GCID: 41062509, BOARD: generic, EABI: aarch64, DATE: Mon Jun 16 16:07:13 UTC 2025

How do we set the GPIO direction as output with High/Low value on terminal using command or utility ???

In Additional Verification for testing:-

We have also enabled the “CONFIG_GPIO_SYSFS” in linux kernel and using that we have exported below GPIO from 40-Pin Header and try to check pin status using Digital Multimeter and in that case we are not able get PIN High even-though we have set value 1 using in “/sys/class/gpio/PQ.05/value”

GPIO01_LS (29) -->  118  (GPIO3_PQ.05)   -->  gpio-453 (PQ.05) 
 
 
echo 453 > /sys/class/gpio/export
ls -la /sys/class/gpio/PQ.05/
 
cat /sys/class/gpio/PQ.05/direction
cat /sys/class/gpio/PQ.05/value
 
Set-Direction O/P:- 
---------------------
echo out > /sys/class/gpio/PQ.05/direction
cat /sys/class/gpio/PQ.05/direction
cat /sys/class/gpio/PQ.05/value
 
 
Set-Pin High:- 
echo 1 > /sys/class/gpio/PQ.05/value
cat  /sys/class/gpio/PQ.05/value
cat /sys/kernel/debug/gpio | grep "PQ.05"

Command o/p on terminal but physically Pin Status not getting changed on 40pin HDR on Nvidia Jetson Orin Nano EVK. (On Pin we are getting evertime value 0 (low)). (Checked on Connector Pin-29)

— 🤖 This is an automated AI response. I’m here to help, but please verify important details! —

To set the GPIO direction as output and set the value 1 and 0 using a command-line utility on the NVIDIA Jetson Orin Nano EVK, you can use the gpioset command.

First, you need to find the GPIO chip and the specific GPIO line you want to control. You can use the gpiodetect command to list all available GPIO chips and lines:

gpiodetect

This will show you the available GPIO chips and lines, similar to what you’ve already done:

gpiochip0 [tegra234-gpio] (164 lines)
gpiochip1 [tegra234-gpio-aon] (32 lines)
gpiochip2 [9-0020] (8 lines)
gpiochip3 [10-0020] (8 lines)

Let’s say you want to control a GPIO line on gpiochip0. You can use the gpiofind command to find the line number for a specific GPIO, for example, PQ.05:

gpiofind "PQ.05"

This will give you the line number, let’s say 453.

To set the direction of the GPIO line as output, you can use the gpioset command with the --mode=wait option:

gpioset --mode=wait gpiochip0 453=1

This sets the GPIO line 453 on gpiochip0 to output and sets its value to 1 (high). If you want to set the value to 0 (low), you can use:

gpioset --mode=wait gpiochip0 453=0

Note that the --mode=wait option tells gpioset to wait until the operation is complete before returning. This can help prevent the command from hanging.

As for the issue with the gpioset command hanging, it’s possible that there’s an issue with the GPIO line or the chip itself. You may want to try resetting the GPIO chip or checking the kernel logs for any errors related to the GPIO subsystem.

Additionally, you’ve mentioned that you’ve enabled CONFIG_GPIO_SYSFS in the Linux kernel and are using the /sys/class/gpio interface to control the GPIOs. This is a different approach from using gpioset, and it’s possible that there’s an issue with the kernel configuration or the GPIO driver. You may want to try checking the kernel logs or the GPIO driver documentation for any clues about what might be going wrong.

— We support team will also look into your issue to have further suggestions soon. please stay tuned. —

Hi nisarg.prajapati,

Please apply the patch from the following thread for r36.4.4.
40hdr - SPI1 gpio padctl register bit[10] effect by gpiod tools in JP6 - #20 by KevinFFF

If you want to control PQ.05 with gpioset command, please simply run the following commands to verify.

# gpioset --mode=wait `gpiofind "PQ.05"`=1
# gpioset --mode=wait `gpiofind "PQ.05"`=0

Please also remember to configure the pinmux before use.

Hi Kevin,

We have checked by applying changes in driver by creating patch**(test.patch)** and integration into custom layer. Please check attached source-code and patch-file as per your suggestion.

pinctrl-tegra.zip (8.8 KB)

We applied the patch we can also see changes in the file that patch is successfully applied

tree: ./meta-i2c
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
├── recipes-example
│   └── example
│       └── example_0.1.bb
└── recipes-kernel
├── linux
│   ├── files
│   │   ├── gpio-sysfs.cfg
│   │   └── test.patch
│   └── linux-jammy-nvidia-tegra_%.bbappend
└── nvidia-kernel-oot
├── files
│   └── hardware
│       └── nvidia
│           └── t23x
│               └── nv-public
│                   └── overlay
│                       └── tegra234-i2c6-dpaux-overlay.dts
└── nvidia-kernel-oot_%.bbappend
13 directories, 9 files

But When we ran the command gpiofind "PQ.05" command was not found. Please check below test results; suggested command not supported.

Also checked below command but still command is getting hang with these changes also and capture “dmesg” log during that time.

gpioset -c gpiochip0 105=1

gpioset -c gpiochip0 PQ.05=1

Please check and provide solution on this asap. Thanks, Nisarg

Are you using Orin Nano with Yocto?

Have you installed the gpiod correctly?

If gpiofind is unavailable in your environment, you can alternatively specify the exact gpiochip controller and pin line for the gpioset command."

From the log you shared, it seems line 105 should be able to be controlled.

Have you configured the pinmux before use?

Hi Kevin,

We are using Orin Nano with Yocto.

We are using above version of “libgpiod” (gpioinfo (libgpiod) v2.1.3). Please let me know if any issue in it.

Could you try using libgpiod v1.6.3 instead?

nvidia@Jetson:~$ gpioinfo --v
gpioinfo (libgpiod) v1.6.3
Copyright (C) 2017-2018 Bartosz Golaszewski
License: LGPLv2.1
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law

nvidia@Jetson:~$ sudo gpiofind "PQ.05"
gpiochip0 105

gpiofind command is available on my devkit.