10.10 GPIO Function Test
Note Under Amov NVIDIA Jetson Linux 35.2.1 (JetPack 5.1), IO9 (PAC.06 492) is used for another function. Use a different GPIO.
3 min read · English documentationGPIO Function Test
Test Equipment
Power adapter, Allspark-Orin NX main unit, and a GPIO test cable. You must make the GPIO test cable yourself. The GPIO pin definition is shown below.

| Pin Parameter | PIN 1 | PIN 2 | PIN 3 | PIN4 | PIN 5 | PIN6 |
|---|---|---|---|---|---|---|
| I/O Name | 3.3V | IO9 | IO11 | IO1 | IO13 | GND |
| Internal Software Name | / | PAC.06 | PQ.06 | PQ.05 | PH.00 | / |
| Internal Software Number | / | 492 | 454 | 453 | 391 | / |
Note
Under Amov NVIDIA Jetson Linux 35.2.1 (JetPack 5.1), IO9 (PAC.06 492) is used for another function. Use a different GPIO.
Test Objective
Test the functionality of the GPIO-related circuitry
Ubuntu 20.04 Test Procedure
- Enter the following command to become the superuser.
sudo su
- Enter the following command to set all outputs high. Use a multimeter to check whether the port voltages change to a high level.
gpioh_test
- Unexport the high-level port numbers.
gpio_unexport
- Enter the following command to set all outputs low. Use a multimeter to check whether the port voltages change to a low level.
gpiol_test
- Test an individual GPIO. For example, set PIN 2 (492/PAC.06) high.
echo 492 > /sys/class/gpio/export
echo out > /sys/class/gpio/PAC.06/direction
echo 1 > /sys/class/gpio/PAC.06/value
- Test an individual GPIO. For example, set PIN 2 (492) low.
echo 0 > /sys/class/gpio/PAC.06/value
Note
The GPIO control method changed in NVIDIA Jetson Linux 36.4 (JetPack 6.1). Because of the NVIDIA kernel upgrade, the previous `/sys/class/gpio` control method is deprecated. A new method is now used to enable GPIO.
Ubuntu 22.04 Test Procedure
1. Prerequisite:
a. Install busybox.
sudo apt-get install busybox
2. Install libgpiod
a. Remove libgpiod from the local system:
sudo apt remove libgpiod2
b. Copy libgpiod to the Allspark2 Orin NX. (Alternatively, download libgpiod directly from GitHub.)
c. Install the automake build tools:sudo apt-get install automake autoconf libtool autoconf-archive
d. Install libgpiod:
(1) Extract libgpiod.
unzip libgpiod-master.zip
(2) Enter the directory.
cd libgpiod-master
(3) Run the installation commands.
sudo ./autogen.sh --enable-tools=yes
sudo make
sudo make install
e. Set the environment variable:
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
Verify the installation:
gpioinfo --version

Note
You can also use another version of libgpiod; configure it as needed.
Using GPIO:
- Set a GPIO to output mode.
busybox devmem <32-bit address>Here,<32-bit address>is the GPIO register address. For the Allspark2 Orin NX, the GPIO register addresses are shown below.

| Pin Parameter | PIN 1 | PIN 2 | PIN 3 | PIN4 | PIN 5 | PIN6 |
|---|---|---|---|---|---|---|
| I/O Name | 3.3V | IO9 | IO11 | IO1 | IO13 | GND |
| Internal Software Name | / | PAC.06 | PQ.06 | PQ.05 | PH.00 | / |
| Internal Software Number | / | 492 | 454 | 453 | 391 | / |
Register addresses:
| Pin Number | Register Address |
|---|---|
| PAC.06 | 0x02448030 |
| PQ.06 | 0x02430070 |
| PQ.05 | 0x02430068 |
| PH.00 | 0x02434040 |
For example, to set PIN2 to output mode:
- View the current value.
sudo busybox devmem 0x02448030
For details on configuring GPIO registers, refer to Orin-TRM.
- Set the GPIO to out mode.
sudo busybox devmem 0x02448030 w 0x004

Changing GPIO State: GPIO9 (PAC.06) Example
- Set the direction of GPIO9 (PAC.06) to OUT.
sudo busybox devmem 0x02448030 w 0x004
Verify that the value was written successfully.
sudo busybox devmem 0x02448030
Note
IO9 (PAC.06) is high by default. All other GPIOs are low by default.
- Set GPIO9 (PAC.06) to a high level.
sudo gpioset PAC.06=1

- Set GPIO9 (PAC.06) to a low level.
sudo gpioset PAC.06=0

Commands for Controlling All GPIOs
(1) IO9 (PAC.06)
sudo busybox devmem 0x02448030
sudo busybox devmem 0x02448030 w 0x004
sudo gpioset PAC.06=1
(2) IO11 (PQ.06)
sudo busybox devmem 0x02430070
sudo busybox devmem 0x02430070 w 0x004
sudo gpioset PQ.06=1
(3) IO1 (PQ.05)
sudo busybox devmem 0x02430068 w 0x004
sudo busybox devmem 0x02430068
sudo gpioset PQ.05=1
(4) IO13 (PH.00)
sudo busybox devmem 0x02434040 w 0x004
sudo busybox devmem 0x02434040
sudo gpioset PH.00=1
