GPIO07, PG.06 not working in Jetpack 6

We are working on porting our device tree changes for the ARK Jetson PAB Carrier to Jetpack 6. We are stuck on controlling GPIO07, PG.06. This was all working in Jetpack 5 with the pinmux file set to output. Now with it set to output, it isn’t controllable.

I tried setting it to Bidirectional in the pinmux, but it doesn’t look like the excel is generating the correct config for the pin.

  	soc_gpio19_pg6 {
  		nvidia,pins = "soc_gpio19_pg6";
  		nvidia,function = "rsvd1";
  		nvidia,pull = <TEGRA_PIN_PULL_NONE>;
  		nvidia,tristate = <TEGRA_PIN_DISABLE>;
  		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
  		nvidia,lpdr = <TEGRA_PIN_DISABLE>;
  	};

jetson@jetson:~/ark_companion_scripts/jetson/scripts$ sudo gpioset --mode=exit --drive=push-pull gpiochip0 41=1
jetson@jetson:~/ark_companion_scripts/jetson/scripts$ gpioinfo | grep PG.06
line 41: “PG.06” unused output active-high

Update: it looks like it is working with gpioset but not with jetson-gpio in python. GPIO13, PH0 is working fine in jetson-gpio.

Hi,

How did you control it with gpioset and jetson-gpio, respectively?
Any command or code to provide?

If you don’t do anything after booting, is the pin shown as output by gpioinfo?

gpioinfo after booting just shows both pins as inactive outputs, active high.

With gpioset this works.

sudo gpioset --mode=exit --drive=push-pull gpiochip0 41=1

With jetson-gpio this works in Jetpack 5 but not 6.

import RPi.GPIO as GPIO
import time

Pin Definitions

vbus_det_pin = 32

def main():
# Pin Setup:
GPIO.setmode(GPIO.BOARD) # BCM pin-numbering scheme from Raspberry Pi
# set pin as an output pin with optional initial state of HIGH
GPIO.setup(vbus_det_pin, GPIO.OUT, initial=GPIO.HIGH)

value = GPIO.HIGH
print("Outputting {} to pin {}".format(value, vbus_det_pin))
GPIO.output(vbus_det_pin, value)

if name == ‘main’:
main()

Then in this script, pin 33 works but not 32.

Have you tried with our official repo?

Your sample looks like a third-party fork.

I am just installing Jetson.GPIO via pip. Isn’t that from your official repo?

It looks like Jetson.GPIO is already built into Jetpack 5 and 6. In Jetapck 5 it shows the version is 2.1.6 but in Jetapck 6 it shows 2.1.7. But 2.1.7 is not shown in the github repo.

Oh, sorry.
I just noticed that you are making your own carrier board.
Then do you have a DevKit for validation?

Yes its my own carrier board. Everything with this GPIO works in Jetpack 5. Flashed back to 35.5.0 on the same board with the same pinmux and it works.

I am asking whether you have a DevKit and the same pinmux setting works on a DevKit.

I would need to check that. But its just a gpio wired straight through.

Why would gpioset work but not jetson-gpio? Especially when gpio13 works in jetson-gpio.

This is my pinmux file. Both pins are set to output.

I just verified locally on my Orin Nano DevKit, and I can make sure both PG.06 and PH.00 work with either gpiod or jetson-gpio.
Does setting it as bidirectional makes any difference?
Or maybe your multimeter is somehow problematic.

Okay I think I have it figured out but not ultimately solved. In Jetpack 5, the jetson-gpio python script would leave the pins configured and driven after exiting. But in Jetpack 6, when the python script exits, the pins revert to the default state.

How can we use the python script to leave a pin in a certain state after exiting?

This is what I found for gpioset.

https://manpages.debian.org/testing/gpiod/gpioset.1.en.html

Modes:
exit:
set values and exit immediately
wait:
set values and wait for user to press ENTER
time:
set values and sleep for a specified amount of time
signal:
set values and wait for SIGINT or SIGTERM
Note: the state of a GPIO line controlled over the character device reverts to default when the last process referencing the file descriptor representing the device file exits. This means that it’s wrong to run gpioset, have it exit and expect the line to continue being driven high or low. It may happen if given pin is floating but it must be interpreted as undefined behavior.

we clean up the pin state when python code exit. We dont support different mode like this for the JetsonGPIO library. I dont think we have the functionality to set the drive mode like gpioset also.

I’m not concerned with gpioset necessarily. Just the jetson-gpio python library. Historically on the Pi and Jetson if you didn’t call cleanup, it would leave the pin in the state you set it to. This is going to break a lot of people’s setups when they move from Jetpack 5 to 6.

Okay so this comes back to the fundamental change over to libgpiod.

I changed my pinmux on this pin to output drive high by default. But even in the python script that only ever drives the pin high, when the script exits, it goes back to low.

Any interaction with the pin will cause it to reset to low.