Jetson 模组
[*] Jetson AGX Orin
Jetson 软件
[*] JetPack 6.2.1
问题描述
我使用Jetson.GPIO这个python库,按照例程GPIO.output输出高低电平后,40-pin的扩展引脚并没有实现高低电平的转换;按照例程使用GPIO.add_event_detect也无法检测40-pin的扩展引脚的中断信号。
请问下是缺少了什么步骤吗?
另外请问是否有C语言的例程可以参考
Jetson 模组
[*] Jetson AGX Orin
Jetson 软件
[*] JetPack 6.2.1
问题描述
我使用Jetson.GPIO这个python库,按照例程GPIO.output输出高低电平后,40-pin的扩展引脚并没有实现高低电平的转换;按照例程使用GPIO.add_event_detect也无法检测40-pin的扩展引脚的中断信号。
请问下是缺少了什么步骤吗?
另外请问是否有C语言的例程可以参考
*** Please note that this reply is generated by LLM automatically ***
To address the question regarding Jetson AGX Orin, JetPack 6.2.1, and the use of Jetson GPIO with Python for output and event detection on the 40-pin GPIO, we need to break down the components and understand how they interact.
Jetson AGX Orin: This is a high-performance module designed for edge AI applications. It’s part of the NVIDIA Jetson platform, which is known for its ability to handle complex AI workloads. The Jetson AGX Orin module is particularly powerful, making it suitable for applications that require significant processing power, such as robotics, autonomous vehicles, and advanced computer vision tasks.
JetPack 6.2.1: JetPack is a software development kit (SDK) provided by NVIDIA for its Jetson modules, including the Jetson AGX Orin. JetPack includes a variety of tools and libraries that make it easier to develop applications for Jetson devices, including support for AI, computer vision, and robotics. JetPack 6.2.1 is a specific version of this SDK, which would include support for the latest features and improvements for the Jetson platform.
Jetson GPIO with Python: The General Purpose Input/Output (GPIO) pins on the Jetson AGX Orin module can be used for a variety of tasks, such as controlling external devices, reading sensor data, or communicating with other microcontrollers. Python is a popular programming language that can be used on the Jetson platform for developing applications. The Jetson GPIO library for Python allows developers to easily access and control the GPIO pins from their Python scripts.
40-pin GPIO and Event Detection: The 40-pin GPIO header on the Jetson AGX Orin provides a convenient way to connect external devices to the module. For event detection, developers can use the GPIO pins to monitor for specific conditions (like button presses, sensor readings, etc.) and trigger actions within their application. This can be particularly useful for applications that require real-time interaction with the physical world.
To use the Jetson GPIO with Python for output and event detection on the 40-pin GPIO header, developers would typically follow these steps:
Here’s a simple example of how to use the Jetson GPIO library in Python to blink an LED connected to a GPIO pin:
import jetson.gpio as gpio
import time
# Pin definitions
LED_PIN = 12 # Replace with the actual GPIO pin number you're using
# Setup GPIO pin as output
gpio.setmode(gpio.BOARD)
gpio.setup(LED_PIN, gpio.OUT)
try:
while True:
# Turn the LED on
gpio.output(LED_PIN, gpio.HIGH)
time.sleep(1)
# Turn the LED off
gpio.output(LED_PIN, gpio.LOW)
time.sleep(1)
except KeyboardInterrupt:
# Clean up GPIO settings before exiting
gpio.cleanup()
For event detection, you would use a similar approach but focus on reading the state of the GPIO pins and reacting to changes. For example:
import jetson.gpio as gpio
import time
# Pin definitions
BUTTON_PIN = 16 # Replace with the actual GPIO pin number you're using
# Setup GPIO pin as input
gpio.setmode(gpio.BOARD)
gpio.setup(BUTTON_PIN, gpio.IN)
try:
while True:
# Read the state of the button
button_state = gpio.input(BUTTON_PIN)
if button_state == gpio.HIGH:
print("Button is pressed")
else:
print("Button is not pressed")
time.sleep(0.1)
except KeyboardInterrupt:
# Clean up GPIO settings before exiting
gpio.cleanup()
Remember, the actual implementation details may vary depending on the specific requirements of your project and the version of the Jetson GPIO library you’re using. Always refer to the official NVIDIA documentation and the library’s documentation for the most accurate and up-to-date information.
*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***
Hi xllin,
Have you configured the pinmux before use?
The GPIO should be configured as Output or Bi-directional in pinmux spreadsheet.
Have you applied the patch from 40hdr - SPI1 gpio padctl register bit[10] effect by gpiod tools in JP6 - #20 by KevinFFF?
Please also share the detailed steps how did you verify with Jetson.GPIO.
busybox devmem 0x02434090 w 0x004
import jetson.GPIO as gpio
import time
LED_PIN = 40
gpio.setmode(gpio.BOARD)
gpio.setup(LED_PIN, gpio.OUT)
while True:
gpio.output(LED_PIN, gpio.HIGH)
time.sleep(1)
gpio.output(LED_PIN, gpio.LOW)
time.sleep(1)
Please configure it in pinmux spreadsheet instead of writing its register directly.
Are you connecting the following PIN40 of 40-pins header with your LED?
![]()
You may also try running the following commands to control it.
# gpioset --mode=wait `gpiofind "PI.00"`=1
# gpioset --mode=wait `gpiofind "PI.00"`=0
我生成了 pinmux.dtsi和 gpio.dtsi,但是后面的步骤不太理解。
我是用SDK Manager烧录的,没有用过flash.sh。
请问是否有更加详细的教程?
This doc page shows an option from /opt/nvidia/jetson-io/jetson-io.py to:
" Save and reboot to reconfigure pins: Creates a new DTB by applying device tree overlays for the header configurations, updates the configuration file for booting Linux (/boot/extlinux/extlinux.conf), and reboots the developer kit. "
You could check extlinux.conf to see if your *.dtbo was added.
Here’s some source files that may be helpful.
Linux_for_Tegra/
source/kernel/kernel-jammy-src/drivers/pinctrl/tegra/*.c
source/hardware/nvidia/t23x/nv-public/include/platforms/dt-bindings/
source/hardware/nvidia/t23x/nv-public/include/kernel/dt-bindings/gpio
source/kernel/kernel-jammy-src/Documentation/driver-api/gpio
source/kernel/kernel-jammy-src/Documentation/devicetree/
这个链接有问题
很抱歉。
" The main screen allows you to configure or reconfigure another header, and also displays some additional options:
/boot/extlinux/extlinux.conf), and reboots the developer kit"You could check extlinux.conf to make sure the lines were added to it.
Then if nedded, rerun
/opt/nvidia/jetson-io/jetson-io.py
Please refer to Pinmux Changes to apply the change for pinmux.
You have to confirm your pinmux.dtsi has included gpio.dtsi.
You can simply run the following command to flash the AGX Orin devkit.
$ sudo ./flash.sh jetson-agx-orin-devkit internal
board.conf file that you created for your board..conf文件修改完之后就可以执行"sudo ./flash.sh jetson-agx-orin-devkit internal"了吗?
Please check PINMUX_CONFIG= and PMC_CONFIG= configuration in p3701.conf.common for your case.
Correct, you can run this command to perform flash to apply the change.
按照你之前的操作,我们已经完成了引脚的配置。
我们在40pin的扩展引脚上接了一根来自FPGA 的1ms中断信号线,它会1ms产生一个上升沿信号。
在linux中,我们通过gpiod_line_event_read(line, &event)获取到这个信号,然后打印当前的时间戳,并与上一次信号的时间戳比较。我们发现,差值并不是准确的1ms,会有0.5ms的偏差。
请问下,如何可以更准确的获取这个1ms的信号,我们已经试过调整进程优先级,但是效果并不是很好。
I would suggest using pps-gpio driver for this use case.
Please refer to PPS input to GPIO on Jetpack 6.1 - #8 by erik93 for details or you can create another topic to discuss in details.
我按照链接里最后的解决方法配置,但是
/boot/extlinux/extlinux.conf
+OVERLAYS /boot/pps-overlay.dtbo
添加这个配置之后,没有生效;
已经检查过了,内核中CONFIG_PPS_CLIENT_GPIO=y,CONFIG_OF_OVERLAY=y
我按这个文档中的操作添加了pps1,https://forums.developer.nvidia.com/t/device-tree-overlay-for-pps-support-on-jp4-6-4/279790/9,但是用ppstest测试的时候,显示为time out。我用的是40pin扩展口的pin10,PR.03,gpioinfo里也显示了PR.03是pps-gpio,但是我却获取不到中断信号。
另:请问C语言怎么获取pps信号
Could you run the following command on your board and check if your configuration is included in extracted_proc.dts?
$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree
I would suggest creating another topic to discuss about pps-gpio related issue.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.