Jetson Orin NX Hardware Library Configuration

Jetson.GPIO - Linux for Tegra

1.introduce

The Jetson TX1, TX2, AGX Xavier, Nano, and Orin series development boards include a 40 pin GPIO connector, similar to the 40 pin connector in Raspberry Pi. You can use the Python library provided in the Jetson GPIO Library package to control the digital inputs and outputs of these GPIOs. This library shares the same API as Raspberry Pi's RPi. GPIO library to provide a convenient way to move applications running on Raspberry Pi to the Jetson board.

In addition to this document, the Jetson GPIO library package also includes the following content:

  1. This lib/Python/subdirectory contains Python modules that implement all library functions. The gpio.py module is the main component of gpio that imports applications and provides the required APIs_ Event.py and gpio_ pin_ The data.py module is used for importing directly into applications through the gpio.py module.
  2. This samples/subdirectory contains sample applications to help you familiarize yourself with the library API and start using the application. These simple_ Input.py and simple_ The output.py application shows how to perform read and write operations on GPIO pins using buttons_ led.py, button_ Event.py and button_ Interrupt. py shows how to use buttons to use busy waiting, blocking waiting, and interrupt callback to make the LED blink.

This document will introduce the content contained in the Jetson GPIO library package, how to configure the system, and run the provided sample applications and library APIs. Here we briefly introduce how to use this library for Jetson.GPIO, with detailed instructions: https://pypi.org/project/Jetson.GPIO/ 或者 https://github.com/NVIDIA/jetson-gpio

2.Pin diagram

GPIO and BCM Comparison Table image-2023040400001.png

3.Environmental configuration

Environmental configuration 1、DownLoad jetson-gpio: git clone https://github.com/NVIDIA/jetson-gpio image-2023040400002.png

2、Move downloaded files to directory: /opt/nvidia 中 If your directory exists in this library, we need to backup the original directory as follows: image-2023040400003.png

Then place the downloaded folder in the opt/nvidia directory. Since I am placing the folder in the path~/and currently in opt/nvidia, I can execute the following command to move the folder.

image-2023040400004.png

3、Install pip3 tool: sudo apt-get install python3-pip

4、Enter the Jetson gpio library folder and install the library。 cd /opt/nvidia/jetson-gpio sudo python3 setup.py install image-2023040400005.png

5、Before using, you also need to create a GPIO group, add your current account to this group, and grant usage permissions sudo groupadd -f -r gpio sudo usermod -a -G gpio user_name image-2023040400006.png

sudo cp /opt/nvidia/jetson-gpio/lib/python/Jetson/GPIO/99-gpio.rules /etc/udev/rules.d/ In order for the new rule to take effect, you need to reboot or reload the udev rule by running the following command

Attention: user_ Name is the username you use, such as Jetson