From cce07300aa7b2e90cecaf5000529c7468420eac3 Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Wed, 6 May 2026 10:10:24 -0600 Subject: [PATCH] docs(gpio): pin Jetson.GPIO >=2.1.12 and add loopback example The apt-shipped python3-jetson-gpio doesn't recognize the Orin Nano Super compatible string (nvidia,p3768-0000+p3767-0005-super) and fails with "Could not determine Jetson model". Jetson.GPIO 2.1.12 on PyPI contains the fix; pin a >= constraint in both gpio-control.md pages (JAJ + PAB) so customers don't trip over this on a fresh device. Also replace the single-write Python example with a HIGH/LOW/HIGH/LOW toggle that reads each transition back, mirroring the loopback test in scripts/test_i2s_gpio_loopback.sh in ark_jetson_kernel. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../ark-just-a-jetson/gpio-control.md | 29 +++++++++++----- .../gpio-control.md | 33 ++++++++++++------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/embedded-computers/ark-just-a-jetson/gpio-control.md b/embedded-computers/ark-just-a-jetson/gpio-control.md index 1ceba55..fce7f77 100644 --- a/embedded-computers/ark-just-a-jetson/gpio-control.md +++ b/embedded-computers/ark-just-a-jetson/gpio-control.md @@ -25,19 +25,32 @@ sudo reboot ## Using the GPIOs -After applying the overlay and rebooting, you can control the pins using the Jetson.GPIO Python library. The pins are addressed by their 40-pin header number. +First, install `Jetson.GPIO` 2.1.12 or newer — the apt-shipped version doesn't recognize the Orin Nano Super and will fail with `Could not determine Jetson model`: +```bash +sudo pip3 install 'Jetson.GPIO>=2.1.12' ``` -import Jetson.GPIO as GPIO -GPIO.setmode(GPIO.BOARD) -GPIO.setup(40, GPIO.OUT) # I2S0_DOUT as output -GPIO.setup(38, GPIO.IN) # I2S0_DIN as input +After applying the overlay and rebooting, you can control the pins using the Jetson.GPIO Python library. The pins are addressed by their 40-pin header number. The example below jumpers HDR40 pin 40 (DOUT) to pin 38 (DIN) and toggles HIGH/LOW/HIGH/LOW, reading each transition back as a loopback test. -GPIO.output(40, GPIO.HIGH) -value = GPIO.input(38) +```python +import time +import Jetson.GPIO as GPIO -GPIO.cleanup() +GPIO.setmode(GPIO.BOARD) +GPIO.setup(40, GPIO.OUT, initial=GPIO.LOW) # I2S0_DOUT +GPIO.setup(38, GPIO.IN) # I2S0_DIN + +try: + for level in (GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.LOW): + GPIO.output(40, level) + time.sleep(0.2) + got = GPIO.input(38) + label = "HIGH" if level else "LOW" + result = "PASS" if got == level else f"FAIL (read {got})" + print(f"DOUT=40 {label} DIN=38 {got} {result}") +finally: + GPIO.cleanup() ``` For a complete working example, see the [i2s_gpio_example.py](https://github.com/ARK-Electronics/ARK-OS/blob/main/platform/jetson/scripts/i2s_gpio_example.py) script in ARK-OS. diff --git a/knowledge-base/knowledge-base/common-jetson-pab-knowledge-base/gpio-control.md b/knowledge-base/knowledge-base/common-jetson-pab-knowledge-base/gpio-control.md index 5dcea63..2da0a00 100644 --- a/knowledge-base/knowledge-base/common-jetson-pab-knowledge-base/gpio-control.md +++ b/knowledge-base/knowledge-base/common-jetson-pab-knowledge-base/gpio-control.md @@ -25,23 +25,32 @@ sudo reboot ## Using the GPIOs -After applying the overlay and rebooting, you can control the pins using the Jetson.GPIO Python library. The pins are addressed by their 40-pin header number. +First, install `Jetson.GPIO` 2.1.12 or newer — the apt-shipped version doesn't recognize the Orin Nano Super and will fail with `Could not determine Jetson model`: +```bash +sudo pip3 install 'Jetson.GPIO>=2.1.12' ``` -import Jetson.GPIO as GPIO - -GPIO.setmode(GPIO.BOARD) -GPIO.setup(40, GPIO.OUT) # I2S0_DOUT as output -GPIO.setup(38, GPIO.IN) # I2S0_DIN as input -state = GPIO.HIGH -GPIO.output(40, state) -print(f"Wrote pin 40: {'HIGH' if state else 'LOW'}") +After applying the overlay and rebooting, you can control the pins using the Jetson.GPIO Python library. The pins are addressed by their 40-pin header number. The example below jumpers HDR40 pin 40 (DOUT) to pin 38 (DIN) and toggles HIGH/LOW/HIGH/LOW, reading each transition back as a loopback test. -value = GPIO.input(38) -print(f"Read pin 38: {'HIGH' if value else 'LOW'}") +```python +import time +import Jetson.GPIO as GPIO -GPIO.cleanup() +GPIO.setmode(GPIO.BOARD) +GPIO.setup(40, GPIO.OUT, initial=GPIO.LOW) # I2S0_DOUT +GPIO.setup(38, GPIO.IN) # I2S0_DIN + +try: + for level in (GPIO.HIGH, GPIO.LOW, GPIO.HIGH, GPIO.LOW): + GPIO.output(40, level) + time.sleep(0.2) + got = GPIO.input(38) + label = "HIGH" if level else "LOW" + result = "PASS" if got == level else f"FAIL (read {got})" + print(f"DOUT=40 {label} DIN=38 {got} {result}") +finally: + GPIO.cleanup() ``` For a complete working example, see the [i2s_gpio_example.py](https://github.com/ARK-Electronics/ARK-OS/blob/main/platform/jetson/scripts/i2s_gpio_example.py) script in ARK-OS.