Usb C ( FLashing usb ) connection detection using V_BUS interruption

Hello everyone. I’m currenly using a Jetson Orin NX and i would like to know when a usb c cable is plugged in through the USBx_VBUS_DET state. I wrote a little python script to try to read the state of the said pin but i couldn’t read it.

import Jetson.GPIO as GPIO
GPIO.setmode(GPIO.TEGRA_SOC)
GPIO.setup("USB0_VBUS_DET",GPIO.IN)

Result :

...  ValueError: Channel USB0_VBUS_DET is invalid

So i have a few questions :

  • Do i have to modify the device tree to be able to read the state of the V_BUS pin on the usb ?
  • If not , How should i read the state of that pin

Thank you.

Hi,
For information, please share which Jetpack release you are using. 5.1.3 or 6.0GA?

Hello @DaneLLL . I’m using Jetpack 5.1.3 . Here are some additionnal infos about the software setup :

Hi,
Please try gpiod tool:

$ sudo apt install gpiod
$ sudo gpiofind "PZ.01"
gpiochip0 131
$ sudo gpioget 0 131
1

Hi @DaneLLL ,
I installed gpiod and executed the commands. I got the exact same outputs as you. But i’m not sure how this helps me.

Hi,
You can use libgpiod tool to read status of the pin.