We are testing simple GPIO Functionality (digital input/output) of the Jetson Orin Nano Developer Kit (Super) by interfacing LED and Pushbutton.
In first step, we interfaced, and LED at GPIO Pin 7 (Board Pin) and program it to flash at 1 Hz frequency. Which is perfectly working fine.
In the second step, we also interface a pushbutton (external pull-up) at GPIO Pin 15 (Board Pin) and program it to turn ON the LED only when the pushbutton is pressed. This time, LED turn ON when we first time press the pushbutton and it never turned OFF even when the button is released. We have verified the LED and pushbutton connections multiple times and found no issue.
Here is the code of the second program:
# Example_3.3.5b_Button_LED.py -- a pushbutton lights the LED for 1 second per press
import Jetson.GPIO as GPIO
import time
LED, BTN = 7, 15 # BOARD pins: LED out, button in
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(BTN, GPIO.IN) # external 10k pull-up holds it HIGH
print('Press the button (Ctrl+C to quit)')
try:
while True:
if GPIO.input(BTN) == GPIO.LOW: # LOW = pressed
GPIO.output(LED, GPIO.HIGH)
time.sleep(1.0) # keep the LED on 1 s
GPIO.output(LED, GPIO.LOW)
time.sleep(0.02) # small debounce delay
except KeyboardInterrupt:
pass
finally:
GPIO.cleanup()
We have also attached the 40 pin headers configuration done through the Expansion Header Tool (Jeston-IO). Please guide me on this issue and do let me know if i need to share more information.
sudo apt install gpiod busybox
apt show gpiod
Package: gpiod
Version: 1.6.3-1.1build1
Priority: optional
Section: universe/misc
Source: libgpiod
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: SZ Lin (林上智) <szlin@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 437 kB
Depends: libc6 (>= 2.38), libgpiod2t64 (>= 1.5.1)
Homepage: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
Download-Size: 24.0 kB
APT-Sources: http://ports.ubuntu.com/ubuntu-ports noble/universe arm64 Packages
Description: Tools for interacting with Linux GPIO character device - binary
libgpiod encapsulates the ioctl calls and data structures
behind a straightforward API. This new character device
interface guarantees all allocated resources are freed after
closing the device file descriptor and adds several new
features that are not present in the obsolete sysfs interface
(like event polling, setting/reading multiple values at once or
open-source and open-drain GPIOs).
.
This package contains the gpiod binary tools.
$ ls /usr/local/bin/gpio*
/usr/local/bin/gpiodetect /usr/local/bin/gpioget /usr/local/bin/gpioinfo /usr/local/bin/gpiomon /usr/local/bin/gpionotify /usr/local/bin/gpioset
Here is the output I got for these two Ubuntu Commands:
$ apt show gpiod
Package: gpiod
Version: 1.6.3-1build1
Priority: optional
Section: universe/misc
Source: libgpiod
Origin: Ubuntu
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: SZ Lin (林上智) szlin@debian.org
Bugs: OpenID transaction in progress
Installed-Size: 115 kB
Depends: libc6 (>= 2.34), libgpiod2 (>= 1.5.1)
Homepage: Making sure you're not a bot!
Download-Size: 23.6 kB
APT-Manual-Installed: yes
APT-Sources: Index of /ubuntu-ports jammy/universe arm64 Packages
Description: Tools for interacting with Linux GPIO character device - binary
libgpiod encapsulates the ioctl calls and data structures
behind a straightforward API. This new character device
interface guarantees all allocated resources are freed after
closing the device file descriptor and adds several new
features that are not present in the obsolete sysfs interface
(like event polling, setting/reading multiple values at once or
open-source and open-drain GPIOs).
.
This package contains the gpiod binary tools.
$ ls /usr/local/bin/gpio*
ls: cannot access ‘/usr/local/bin/gpio*’: No such file or directory
Thank you @KevinFFF for moving the topic to correct category. Much appreciated.
I am using Jetpack Version 6.2.2 and Jetson GPIO Version 2.1.9.
My LED is working fine on PIN7. The only issue is with pushbutton. Initial I get HIGH, as pull-up is used, and when I press the button, I get LOW. But on releasing the button after first press, it always stays the LOW.
I have also measured the voltage levels with DMM. It shows 0 V on button press and approx. 1.5 V on button release, after 1st press.
I hope this will be helpful to identify the issue.
Yes. Irrespective of the value of pullup resistor, we are not getting a signal HIGH once we press (and release) the pushbutton.
Additionally, I have tried almost all the available GPIO pins on the 40 Pin header. Output functionality works seamless as verified by an external LED. But the behavior of the input couldn’t be observed correctly.
We are using Jetson Expansion Header Tool to configure the GPIO pins. We configure manually the pin 7 and 15 as a GPIO pin, Save the changes and restart the system. Pin 7 and 15 is set as GPIO may be verified by the image shared with the post. Interestingly, pin 7 (output) is working fine, the only issue is with pin 15 that is used as an input pin.
We never touched the pinmux etc while configuring pins.
Could you try configuring them through pinmux spreadsheet to verify?
The Jetson-IO tool would only configure the pin function but not for the GPIO direction(Input/Output).