Im using jetson orin nano Jetpack 6 i want to dynamically change the gpio pin (29 pin and 31 pin ) How is setup
*** Please note that this reply is generated by LLM automatically ***
To dynamically change the GPIO pin settings on your Jetson Orin Nano with Jetpack 6, you can follow these steps:
Step 1: Check if the pins meet the conditions
- Verify that the pins (29 and 31) are part of the 40-pin header. You can check the Jetson AGX Orin pinmux spreadsheet to confirm.
- Ensure that the pins are not configured as SFIO pins by the MB1 BCT.
- Confirm that the pins are configured to be bidirectional by the MB1 BCT.
Step 2: Identify the pin details
- Search for the pin details from the Jetson Orin NX Series and Jetson Orin Nano Series Pinmux table (refer to Generating the Pinmux dtsi Files).
- For example, let’s assume the pin details are:
- Pin 29: SOC_GPIO29 is GPIO3_PB.05
- Pin 31: SOC_GPIO31 is GPIO3_PB.07
- Identify the port as B and the Pin_offset as 5 and 7, respectively.
Step 3: Calculate the pin number
- Use the formula:
base + port_offset + pin_offset - Verify the following values:
- The base is 348 (from the kernel boot log,
tegra234-gpioat base index 348) port_offsetof port B = 8 (from the tegra234 GPIO port and offset mapping)pin_offset= 5 and 7, respectively- Pin number = 348 + 8 + 5 = 361 (for Pin 29)
- Pin number = 348 + 8 + 7 = 363 (for Pin 31)
- The base is 348 (from the kernel boot log,
Step 4: Use Kernel debugfs to dynamically change the pin settings
- Search for the gpio pin in the Jetson AGX Orin pinmux table (see Pinmux Changes).
- Follow the gpio debugfs lookup that uses the port and offset.
- For example:
cat /sys/kernel/debug/gpio | grep PB.05(for Pin 29)cat /sys/kernel/debug/gpio | grep PB.07(for Pin 31)
- The gpio number is mentioned in the first column as gpio-361 and gpio-363, respectively.
Additional Notes
- To use a pin as GPIO, ensure that the E_IO_HV field is disabled in the corresponding pinmux register of the GPIO pin. You can disable the 3.3V Tolerance Enable field in the pinmux spreadsheet.
- Make sure the Pin Direction is set to Bidirectional so that the userspace framework can operate GPIO in both input and output directions.
- After these configurations, reflash the board with the updated pinmux file.
By following these steps, you should be able to dynamically change the GPIO pin settings for pins 29 and 31 on your Jetson Orin Nano with Jetpack 6.
*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***
Hi niyas2,
Are you using the devkit or custom board for Orin Nano?
What’s the exact Jetpack version in use?
What do you mean about “dynamically change the gpio pin”?
Do you want to use the GPIO either as Input or Output?
If so, please configure the Bidirectional in pinmux spreadsheet first.
Hi KevinFFF,
Im using devkit,jetpack 6.0 is the version ,
nvidia@ubuntu:~$ head -n 1 /etc/nv_tegra_release
R36 (release), REVISION: 3.0, GCID: 36923193, BOARD: generic, EABI: aarch64, DATE: Fri Jul 19 23:24:25 UTC 2024
nvidia@ubuntu:~$ dpkg-query --show nvidia-l4t-core
nvidia-l4t-core 36.3.0-20240719161631
nvidia@ubuntu:~
I connected an LDR module to the Jetson Orin Nano. The D0 pin is connected to pin 29, and I want to change the pin’s state to high or low depending on whether light is detected or not
If you mean to control the power level of GPIO pin, I think you can just use some library like NVIDIA/jetson-gpio: A Python library that enables the use of Jetson’s GPIOs with a bit Python code. There are also C++ libraries scattered on GitHub.
On the other hand, if you plan to provide input to Jetson by changing the GPIO level, I just found a demo on https://youtu.be/nloZS1wWpR4 looked very cool. Although it was for Rpi, I assume the GPIO behavior will be the same. Can’t wait to try it out!
The light should be detected by your LDR so that D0 is an output pin for your module and PIN29 is an Input pin for Orin Nano.
As a result, you would configure the PIN29 as Input and monitor its state to check if the light is detected.
Is my understanding correct?
If so, please configure this pin as Input and just use gpioget to check its state.
Hi KevinFFF,
root@ubuntu:/home/nvidia# sudo gpioget gpiochip0 361
gpioget: error reading GPIO values: Invalid argument
root@ubuntu:/home/nvidia# sudo gpioinfo gpiochip0 | grep -A 5 “gpio-361”
root@ubuntu:/home/nvidia#
nvidia@ubuntu:~$ sudo cat /sys/kernel/debug/gpio | grep -i “PC.” # or PB. depending on your table
gpio-321 (PAA.05 |regulator-vdd-3v3-pc) out hi
gpio-328 (PCC.00 )
gpio-329 (PCC.01 )
gpio-330 (PCC.02 )
gpio-331 (PCC.03 |mux ) out lo
gpio-332 (PCC.04 )
gpio-333 (PCC.05 )
gpio-334 (PCC.06 )
gpio-335 (PCC.07 )
gpio-357 (PC.00 )
gpio-358 (PC.01 )
gpio-359 (PC.02 )
gpio-360 (PC.03 )
gpio-361 (PC.04 )
gpio-362 (PC.05 )
gpio-363 (PC.06 )
gpio-364 (PC.07 )
So, I think it is not set as a GPIO pin. Am I correct? If yes, how can I set it as a GPIO pin?
All GPIO pins show as unused .
Please run the following command to check the state of PIN29(of 40pins-header) instead.
# gpioget `gpiofind "PQ.05"`
Jetson-IO can only be used when you want to enable SFIO function like SPI, I2C, UART..etc.
Most of the PINs are configured as GPIO input by default.
If you want to use them as Output pin and control them, please use pinmux spreadsheet to configure them as Output Drive0 or Drive1.
So can you give the command to change the pin state ?
can you share the link or the step how to do the steps
# gpioset --mode=wait `gpiofind "PQ.05"`=1
# gpioset --mode=wait `gpiofind "PQ.05"`=0
Please remember to configure the pinmux for PQ.05 as Output or Bi-directional before use.
Please refer to the following guide for details.
Jetson Orin NX and Nano Series — NVIDIA Jetson Linux Developer Guide
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
