Orin NX GPIO12 gpioset not working

Hello, Nvidia.

We use L4T36.4.4 with original carrierboard and SUPER config.

Need to use GPIO12 (module pin 218, HAT40 pin 15) as output with active low level.

But we cant control pin (SET pin to 1 or 0).

We connected voltmetr to check phisical level at pin without any other components.

gpioinfo | grep PN.01
        line  85:      "PN.01"       unused   input  active-high

gpioget gpiochip0 85
0
# at voltmetr 0V
gpioset --mode=wait gpiochip0 85=1
# at voltmetr 0V, level dont changed

gpioinfo | grep PN.01
        line  85:      "PN.01"       unused  output  active-high 
# input changed to output with active-high
# at voltmetr 0V, really level dont changed!

cat /sys/kernel/debug/pinctrl/2430000.pinmux/pinconf-groups | grep pn1 -A 14
5 (soc_gpio39_pn1):
        pull=1
        tristate=1
        enable-input=1
        open-drain=1
        io-reset=1
        rcv-sel=1
        io-hv=1
        schmitt=0
        pull-down-strength=0
        pull-up-strength=0
        drive-type=0
        gpio-mode=1
        function=rsvd1

How can we can control GPIO as output without reflashing?

*** Please note that this reply is generated by LLM automatically ***

To control GPIO12 (module pin 218, HAT40 pin 15) as an output with an active low level on Jetson Orin NX, you can use the Jetson-IO tool to configure the pinmux settings. However, since the Jetson-IO tool currently supports pinmux setting for groups of pins related to a function, but not for individual pins, you will need to configure the pinmux for the entire GPIO group.

Here are the steps to follow:

  1. Launch Jetson-IO by running the command sudo /opt/nvidia/jetson-io/jetson-io.py.
  2. Select the 40-pin expansion header from the main screen.
  3. In the header screen, select the GPIO group that includes GPIO12 (module pin 218, HAT40 pin 15).
  4. Configure the pinmux settings for the GPIO group to use GPIO mode.
  5. Save the configuration and reboot the system.

Alternatively, you can use the config-by-pin command line tool to configure the pinmux settings for the GPIO group. For example:

sudo /opt/nvidia/jetson-io/config-by-pin.py -o dtbo gpio12

This will configure the pinmux settings for GPIO12 and save the configuration to a device tree overlay file.

To control the GPIO as an output with an active low level, you will need to use the gpiod command line tool. First, install gpiod by running the command sudo apt-get install gpiod.

Then, you can use the following commands to set the GPIO as an output and set its level to 0 (active low):

sudo gpiod gpiochip0 12 output 0

This will set GPIO12 as an output and set its level to 0.

Note that you may need to adjust the GPIO number and the pinmux settings depending on your specific use case.

In comparison to reflashing the device, using the Jetson-IO tool and gpiod command line tool is a more convenient and non-invasive way to configure the GPIO settings. Reflashing the device would require updating the pinmux spreadsheet and flashing the new configuration to the Jetson device, which can be a more complex and time-consuming process.

In terms of the voltage level at the pin, the Jetson Orin NX module supports a voltage range of 5V to 20V on VDD_IN, depending on the module configuration. However, the voltage level at the GPIO pin will depend on the specific configuration and the voltage level of the GPIO output. In general, the GPIO output voltage level will be around 3.3V or 1.8V, depending on the GPIO configuration.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

Thank for responce, but it is unusefull.

root@orin-nx-16-6:~# gpiod gpiochip0 12 output 0
-bash: gpiod: command not found

root@orin-nx-16-6:~# /opt/nvidia/jetson-io/config-by-pin.py -o dtbo gpio12
usage: Display configuration for Jetson expansion headers [-h] [-l | -p PIN] [-n HEADER]
Display configuration for Jetson expansion headers: error: unrecognized arguments: -o dtbo gpio12

Hi aanistratenko,

You should configure the pinmux for this pin as GPIO Output, Drive 0 or 1 before use.

You can simply try running the following command to control this GPIO.

# gpioset --mode=wait `gpiofind "PN.01"`=1
# gpioset --mode=wait `gpiofind "PN.01"`=0

Ok, how can we configure pinmux without reflashing ?
Excel spreadsheet generate overlay *.dtbo but it content labels for change device tree before flashing.
Python io tool for HAT ports can only change its to alternative functions without GPIO direction.

Please note that pinmux/gpio dtsi are loaded in early boot stage(i.e. MB1) rather than kernel so the reflashing is required.
You can add --qspi-only in the initrd flash command if you want to keep the rootfs unchanged.

Ok, but if the Jetson is remote, we cant reflash it in FRM.

If we will use custom overlay for pinmux, loaded with extlinux.conf, will it overrite the MB1 pinmux configuration?
PS: We tried custom overlay for pinmux with extlinux.conf - it dont change real GPIO mode.

/dts-v1/;
/plugin/;

/ {
  overlay-name = "For Uvionix WD JMB v0.1 - combined UARTB + PWM7 + SPI + USB3-SS2";
  compatible = "nvidia,p3768-0000+p3767-0000\0nvidia,p3768-0000+p3767-0001\0nvidia,p3768-0000+p3767-0003\0nvidia,p3768-0000+p3767-0004\0nvidia,p3768-0000+p3767-0005\0nvidia,p3768-0000+p3767-0000-super\0nvidia,p3768-0000+p3767-0001-super\0nvidia,p3768-0000+p3767-0003-super\0nvidia,p3768-0000+p3767-0004-super\0nvidia,p3768-0000+p3767-0005-super";

  /* Create pinmux groupes with labels */
  fragment@0 {
    target-path = "/bus@0/pinmux@2430000";
    __overlay__ {
   
      /* ADD: PN.01 (SOC_GPIO39_PN1) as GPIO output*/
        gpio_pn01: gpio-pn01 {
            nvidia,pins = "soc_gpio39_pn1";
            nvidia,function = "rsvd1";
            nvidia,gpio-mode = <0x01>;
            nvidia,pull = <0x00>;
            nvidia,tristate = <0x00>;
            nvidia,open-drain = <0x0>;
            nvidia,enable-input = <0x00>;
            nvidia,io-high-voltage = <0x00>;
            nvidia,lpdr = <0x00>;
        };
      };
    };
  };

For the remote device, please perform capsule update to update bootloader which includes the MB1-BCT.

MB1 pinmux configuration will be loaded first. The pinmux configuration from overlay is handled by pinctrl driver in kernel. Pinmux configuration will be updated during boot, but the pin direction and the default state is still derived from MB1-BCT. (because it is configured by gpio.dtsi)