How to Control GPIO on JetPack 5.1.2

Hello, I am trying to control GPIO on JetPack 5.1.2 to make an LED blink, but I can’t find how to enable the GPIO pins. I used opt/nvidia/jetson-io/jetson-io.py to enable PWM pins, and I was able to control a servo motor with those pins. However, I am unable to use GPIO pins. I would appreciate any help.

Hi,
You can use libgpiod commands to control GPIO pins. If you use custom board, you would need to configure the pins to GPIO in pinmux spreadsheet to generate the device tree and flash the dtb to the custom board. So that you can control it in userspace.

I managed to create the .dtsi file using a spreadsheet, but I’m not sure how to flash this .dtsi file.

Hi @jangjy0105

You can follow these instructions: Jetson Module Adaptation and Bring-Up: Jetson AGX Xavier Series — NVIDIA Jetson Linux Developer Guide 1 documentation.

Basically, after creating the .dtsi files using the pinmux spreadsheet, you have to do something similar to the following:

# pinmux-dts2cfg.py script usage
cd JetPack_5.1.4_Linux_JETSON_AGX_XAVIER_TARGETS/Linux_for_Tegra/kernel/pinmux/t19x/
python pinmux-dts2cfg.py --pinmux addr_info.txt gpio_addr_info.txt por_val.txt --mandatory_pinmux_file mandatory_pinmux.txt $PINMUX_DTSIFILE $GPIO_DTSIFILE 1.0 > $PINMUX_CFGFILE

python pinmux-dts2cfg.py --pad pad_info.txt $PADVOLTAGE_DTSIFILE 1.0 > $PADVOLTAGE_CFGFILE

The parameters in capital letters are how your .dtsi files are called.

Once the files are created, move them to the JetPack_5.1.4_Linux_JETSON_AGX_XAVIER_TARGETS/Linux_for_Tegra/bootloader/t186ref/BCT directory, where the .conf file will search them.

Your .config file should be jetson-agx-xavier-devkit.con that is in the Linux_for_tegra directory and it is pointing to the tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg file as you can check:

PINMUX_CONFIG="tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg";

You can edit the above .cfg contents (please make a backup before doing so) or edit the file where PINMUX_CONFIG points to with your custom .cfg file.

Hope this helps!

Regards!
Eduardo Salazar
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

1 Like

Hello, thank you for your help.

However, I can’t find the pinmux/t19x directory.

root@ubuntu:/# find / -name pinmux -type d
/usr/src/linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/kernel-5.10/include/config/generic/pinmux

I found pinmux at this path, but only the functions.h file is present in that location.

root@ubuntu:/# find / -name t19x -type d
/usr/src/linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/nvlink/include/nvlink/hw/t19x
/usr/src/linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/kernel-5.10/include/config/tegra/t19x

I also searched for t19x, but I couldn’t find any Python files related to pinmux in the directories I located.

Hi,

I have a couple of questions here:

  1. Where did you execute that command?
  2. How did you flash the board? By using SDKmanager?

Normally, when you flash the board, it is better to use the SDKmanager the first time. It will download the flash sources and they will be located, for example, in:

~/nvidia/nvidia_sdk/JetPack_5.1.2_Linux_JETSON_AGX_XAVIER_TARGETS

on your host Linux PC.

Regards!

Hello.

  1. I ran this command in the root directory that contains the boot, bin, etc, and opt directories.
  2. Yes, I used SDK Manager when flashing this board.

thank you.

Hi,
It looks like you don’t have the system files. If you flash the system through SDKManager, you should have Linux_for_Tegra folder. Maybe you can manually download it from the webpage:

Jetson Linux 35.4.1 | NVIDIA Developer
Driver Package (BSP)
Sample Root Filesystem

Please follow the steps to extract the system files:

Quick Start — Jetson Linux Developer Guide documentation

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.