Use 40 pin header in python

I am running Jetpack5.1 on a NVMe SSD with all SDKs installed using SDKmanger.

I wanted to buy the official Jeston Xavier Developer kit but it has not been available so I had to pay the extra money to buy the recomputer from SeedStudios as an official partner of Nvidia. The recompute comes with the A206 carrier board but it is advertised as same as the Nvidia development board so the pin mapping should be identical.

I have tried to use " import Jetson.GPIO as GPIO" but it gives me the following error and when the python code changes the output state of the pin my scope doesn’t detect it has changed

WARNING: Carrier board is not from a Jetson Developer Kit.
WARNNIG: Jetson.GPIO library has not been verified with this carrier board,
WARNING: and in fact is unlikely to work correctly.

hello shane24,

Jetson.GPIO it only works with default carrier board, could you please try contact with the vendor for supports.
thanks

It is not possible to buy a Nvidia carrier board as Nvidia is not making them

I only wanted the offical Nvidia development kit but was forced to pay more money to buy the Seedstuios recomputer as Nvidia is only supplying Jetson products to seedstudios in a monopoly as their official partner.

Surely Nvidia is going to support their product that has been brought from their exclusive official partner?? Steedstudios is a retailer and is unlikely to have any idea on how to modify the Jetpack to solve the bug.

hello shane24,

ohh, it turns out there’s an issue with GPIO controls, it cannot control the GPIO behavior. the temporary workaround is writing the pinmux register directly.

may I know what’s the pin configuration you’re going to achieve?
thanks

I am creating a demo robot for display during a robot competition. It is the upper body of a humanoid robot with animatronic eyes built with hobby servos and dynamixel to operate the 2DOF neck joint (eventually arms too). It hopefully will be an sort of interavtice chat bot. I am using pose estimation (trt_pose) for the robot to be able to know what humans are around it and what they are doing. I would like to also add a ASR to NLP to TTS to make it Q and A interactive hopefully casn get this up and running GitHub - dusty-nv/jetson-voice: ASR/NLP/TTS deep learning inference library for NVIDIA Jetson using PyTorch and TensorRT

What I want to do is create the signals to control the servos from the timers on the Jetson, I have currently found a work around by using a PCA9685 external driver that can create 16 channel fo PWM and controlled by I2C. I have installed the Adafruit busio library and it successfully operates the I2C bus to control the servo driver board although it gives the same error message about it not being the official carrier board. It would be nice to be able to remove this extra bit of hardware and use use the timer on the Jetson.

I also want to be able to use some programmable RGB LEDs aka NeoPixels. They use the SPI to create the serial signal train but atm I can’t get SPI to work either. Although I used Jetsion-io to set the SPI pins then saved then rebooted when I try ls /dev/spi* it says"No such file or directory"

Can we get the SPI working and 2 timers for the 2 servos working too all programmable from python??

hello shane24,

there’s an issue to control the pin via sysfs neither python. you should use the pinmux configuration file to modify the settings. i.e. tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg

please see-also Enable SPI0 - #5 by ShaneCCC for NX SPI pin configure.
PIN-33, it’s pinmux.0x02440020 = 0x00000054; # soc_gpio54_pn1, you may update the cfg file to configure the pin.

My experience is mainly from robotics using micocontrollers. I am expanding into including AI on the edge, thus my learning Jetson.

Can you please tell where to find (directry) tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg file??

hello shane24,

you should already download the JetPack release to your host machine, and the files were located below the installation path.
for example, ~/nvidia/nvidia_sdk/JetPack_<version>_Linux_<platform>/Linux_for_Tegra/
the pinmux configuration file is under the bootloader/ folder, you may open it by text editor to change the pin settings.
since the temporary workaround is writing the pinmux register directly, you should perform the full flash by $ sudo ./flash.sh -r jetson-xavier-nx-devkit mmcblk0p1 to update the cfg settings.

after altering the cfg file then reflashing I still can’t use the GPIO pins.

If I attach my scope to the pin it show low until I run the python script then I get a 50Hz sine wave between 1.2v and 2v. This seems to happen with all the pins. See my attached screen shot from the scope.

hello shane24,

FYI
Upstream GPIO driver does not support calling pinctrl APIs to make changes in pinmux register.
Currently, to make changes dynamically, we can use devmem/reg_dump to update pinmux register or update in MB1 pinmux bct.
for example, for pin 7, PQ6:
Pinmux register: 0x02430030
Default boot value: 0x5a
Update Bit 4 and Bit 6 to set required direction.
For Output: Bit 4 = 0 Bit 6=0
For input: Bit 4=1 Bit 6=1

Try below steps to make GPIO output working:
/home/ubuntu/reg_dump -a 0x02430030 -w 0x0a
echo 441 > /sys/class/gpio/export
cd /sys/class/gpio/PQ.06
echo out > direction
cat value # change value and check.

first line return No such file or directory.

Also there seems to be a number of ways of naming the pins. When you say pin 7 which naming are you using. I have been referring to NVIDIA Jetson Xavier NX GPIO Header Pinout - JetsonHacks

hello shane24,

it’s utility for register read/write, you may try get the devmem2 for doing so.
for example, $ sudo devmem2 <physical address> <size (b/h/w)> [value] for reading the register value, by adding w [value] behind the command to write the register.

Is this the correct usage to send pin 7 high as I still can’t dectect a change on the pin?

shane@robot:~$ sudo devmem2 0x02430030 w 0x0a
/dev/mem opened.
Memory mapped at address 0xffffba6d5000.
Value at address 0x2430030 (0xffffba6d5030): 0x5A
Written 0xA; readback 0xA
shane@robot:~$ echo 441 > /sys/class/gpio/export
shane@robot:~$ cd /sys/class/gpio/PQ.06
shane@robot:/sys/class/gpio/PQ.06$ echo out > direction
shane@robot:/sys/class/gpio/PQ.06$ cat value
0
shane@robot:/sys/class/gpio/PQ.06$ echo 1 > value
shane@robot:/sys/class/gpio/PQ.06$ cat value
1
shane@robot:/sys/class/gpio/PQ.06$ echo 0 > value

hello shane24,

sorry, I am not given correct example, could you please try again with following.
for Xavier NX’s pin-7, it’s GPIO9 / GPIO3_PS.04, whereas gpio number is 436.
the register address is… tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg:pinmux.0x02431020 = 0x00000400; # aud_mclk_ps4

when I try

sudo /opt/nvidia/jetson-io/config-by-pin.py

The out puit for the 40 pin header is

Header 1 [default]: Jetson 40pin Header
1: 3.3V
2: 5V
3: i2c9
4: 5V
5: i2c9
6: GND
7: unused
8: uarta
9: GND
10: uarta
11: unused
12: unused
13: unused
14: GND
15: unused
16: unused
17: 3.3V
18: unused
19: unused
20: GND
21: unused
22: unused
23: unused
24: unused
25: GND
26: unused
27: i2c2
28: i2c2
29: unused
30: GND
31: unused
32: unused
33: unused
34: GND
35: unused
36: unused
37: unused
38: unused
39: GND
40: unused
Header 2: Jetson Nano CSI Connector
1: GND
7: GND
13: GND
19: GND
29: 3.3V

Should all the GPIO pins be listed as unsed or as GPIO pins??

Also

sudo ls /etc/udev/rules.d/

produces

90-alsa-asound-tegra.rules 99-nv-ufs-mount.rules
91-xorg-conf-tegra.rules 99-nv-wifibt.rules
99-nv-l4t-usb-device-mode.rules 99-tegra-devices.rules
99-nv-l4t-usb-host-config.rules 99-tegra-mmc-ra.rules

Shane there be a “99-gpio.rules” file there?

hello Out_of_the_BOTS,

when you execute Jetson-IO, the header screen shows the current configuration of the selected header; you may select from a list of configurations for hardware modules that can be attached to the header; or, you could specify which functions to enable on the header.
besides, please download pinmux spreadsheets for the default pin configurations.

I have used Jetson-io to setup other functions but they still don’t work please see this detailed video header problem - YouTube

it looks you’ve already file a new topic, let’s moving to Topic 220249 for tracking.

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