GithubHelp home page GithubHelp logo

jetson-gpio's People

Contributors

aeronotix avatar anhmiuhv avatar atan1021 avatar gautham103 avatar ivyaccount avatar kitazaki avatar knro avatar nvswarren avatar pjueon avatar sagar73594 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jetson-gpio's Issues

in python2 its showing the RPIO can only work in

Installed with source and pip both i tried ,but for python2 it is showing the following error...

RuntimeError: This module can only be run on a Raspberry Pi!

nvidia@tegra-ubuntu:~/jetson_gpio/jetson-gpio-master$ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing lib/python/Jetson.GPIO.egg-info/PKG-INFO
writing top-level names to lib/python/Jetson.GPIO.egg-info/top_level.txt
writing dependency_links to lib/python/Jetson.GPIO.egg-info/dependency_links.txt
reading manifest file 'lib/python/Jetson.GPIO.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'LICENCE.txt'
writing manifest file 'lib/python/Jetson.GPIO.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/Jetson
copying build/lib.linux-aarch64-2.7/Jetson/init.py -> build/bdist.linux-aarch64/egg/Jetson
creating build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib.linux-aarch64-2.7/Jetson/GPIO/init.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib.linux-aarch64-2.7/Jetson/GPIO/gpio_pin_data.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib.linux-aarch64-2.7/Jetson/GPIO/99-gpio.rules -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib.linux-aarch64-2.7/Jetson/GPIO/gpio.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib.linux-aarch64-2.7/Jetson/GPIO/gpio_event.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
creating build/bdist.linux-aarch64/egg/RPi
copying build/lib.linux-aarch64-2.7/RPi/init.py -> build/bdist.linux-aarch64/egg/RPi
creating build/bdist.linux-aarch64/egg/RPi/GPIO
copying build/lib.linux-aarch64-2.7/RPi/GPIO/init.py -> build/bdist.linux-aarch64/egg/RPi/GPIO
byte-compiling build/bdist.linux-aarch64/egg/Jetson/init.py to init.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/init.py to init.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_pin_data.py to gpio_pin_data.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio.py to gpio.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_event.py to gpio_event.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/init.py to init.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/GPIO/init.py to init.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Jetson.GPIO-2.0.1-py2.7.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing Jetson.GPIO-2.0.1-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/Jetson.GPIO-2.0.1-py2.7.egg
Copying Jetson.GPIO-2.0.1-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Jetson.GPIO 2.0.1 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/Jetson.GPIO-2.0.1-py2.7.egg
Processing dependencies for Jetson.GPIO==2.0.1
Finished processing dependencies for Jetson.GPIO==2.0.1
nvidia@tegra-ubuntu:/jetson_gpio/jetson-gpio-master$ cd samples/
nvidia@tegra-ubuntu:
/jetson_gpio/jetson-gpio-master/samples$ python simple_input.py

Traceback (most recent call last):
File "simple_input.py", line 22, in
import RPi.GPIO as GPIO
File "/home/nvidia/.local/lib/python2.7/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

nvidia@tegra-ubuntu:~/jetson_gpio/jetson-gpio-master/samples$ python3 simple_input.py
Starting demo now! Press CTRL+C to exit
Value read from pin 18 : LOW

Jetson Nano developer kit (4GB) not detected correctly

$ ls -l /proc/device-tree/chosen/plugin-manager/ids
total 0
-r--r--r-- 1 root root 26 Jan 29 10:21 3448-0000-400
drwxr-xr-x 3 root root  0 Jan 29 10:21 connection
-r--r--r-- 1 root root  4 Jan 29 10:21 name

Library reports:

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.

test_all_apis.py fails for test_out_in_init_high

Describe the bug
A clear and concise description of what the bug is, including

  • Which version of Jetson.GPIO you are using.
    1.0.0
  • Which version of L4T (not JetPack) you are using.
    32
  • Which Jetson board you are using.
    Nano
Traceback (most recent call last):
  File "./test_all_apis.py", line 622, in <module>
    test()
  File "./test_all_apis.py", line 289, in test_out_in_init_high
    assert(val == GPIO.LOW)
AssertionError

To Reproduce
Steps to reproduce the behavior:

  1. No pins wired to the board
  2. Run sudo ./run_sample.sh test_all_apis.py

Expected behavior
For all tests to run successfully.

Additional context
Add any other context about the problem here.

Edge detection: how to know which edge triggered

Hello, I'm trying to measure the input pwm duty cycle (see #7).

import RPi.GPIO as GPIO
import time

but_pin = 23  # Board pin 18

t = time.time()
def callback_one(channel):
    global t

    print(GPIO.input(channel), (time.time() - t) * 100000)
    t = time.time()

def main():
    GPIO.setmode(GPIO.BOARD)  # BOARD pin-numbering scheme
    GPIO.setup(but_pin, GPIO.IN)  # button pin set as input

    GPIO.add_event_detect(but_pin, GPIO.BOTH)
    GPIO.add_event_callback(but_pin, callback_one)

    try:
        while True:
            pass

Example output looks like:

1 2555.6087493896484
0 2555.561065673828
0 2562.1652603149414
0 2051.234245300293
0 2558.2313537597656
0 2553.6537170410156
0 547.2898483276367
0 1540.8754348754883
0 2555.537223815918
1 1574.6116638183594
0 558.7100982666016
0 13.73291015625
1 1337.4090194702148
0 1032.3286056518555
0 523.2572555541992
0 1030.6119918823242
1 519.4664001464844

Since because API doesn't allow to handle each type of edge FALLING, RISING separately, the only method to know what level was switched is using GPIO.input(channel), but as you can notice it doesn't work well (first column of the output). Possibly because level is not yet switched at the moment when edge is triggered. I'm 100% sure that's the PWM in the input, I checked it using signal analyzer so that output must be 0, 1, 0, 1, 0... etc. Can you please update the API and provide an optional argument to callback function specifying what type of edge has triggered the event?

button_event.py does not always work

Hi!

I'm testing the GPIO with button_event.py example. Sometimes when I press the button the event "button pressed" is activated. Sometimes that does not happen (I need to wait and try again). I'm using a 4.7k resistor as pull-up.

Board: Jetson TX2.

Thanks!
Mauricio

Insufficient permissions for upstart

Hello, I am trying to run ROS automatically when booting up my Xavier NX using the robot_upstart package. The ROS core and most of the nodes get up and running successfully however when trying to load the Jetson-GPIO library I get the following error:

File "/../../../button_input.py", line 6 import Jetson.GPIO as GPIO File "/usr/lib/python2.7/dist-packages/Jetson/GPIO/__init__.py", line 1, in <module> from .gpio import * File "/usr/lib/python2.7/dist-packages/Jetson/GPIO/gpio.py", line 33, in <module> raise RuntimeError("The current user does not have permissions set to " RuntimeError: The current user does not have permissions set to access the library function

It looks like 99-gpio.rules isn't granting gpio permission to the daemon process started by robot_upstart. I've tried adding the following line to the bottom of 99-gpio.rules:

ACTION=="add", KERNEL=="gpio", MODE="0666"

but this hasn't made a difference. Do you know how I can make the gpio/pwm interfaces accessible to the daemon?

Thanks

pwm not working

I'm trying to run simple_pwm.py code but .pwm is not working, do we have to change the pinmux configuration to make it work. i'm unable to find any documentation on pinmux configuration.

Exception: Could not determine Jetson model

Updated to include uname -a && pip3 --version && python3 --version && python3 -m pip install --user adafruit-blinka && error traceback
Jetson.GPIO 2.0.0
Running on Raspberry Pi 3B+

$ uname -a
Linux ubiquityrobot 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l armv7l arm7l GNU/Linux
$ pip3 --version
pip 19.2.2. from /home/ubuntu/.local/lib/python3.5/site-packages/pip (python 3.5)
$ python3 --version
Python 3.5.2
$ python3 -m pip install --user adafruit-blinka
Requirement already satisfied: adafruit-blinka in ./.local/lib/python3.5/site-packages (2.3.2)
Requirement already satisfied: Jetson.GPIO in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (2.0.0)
Requirement already satisfied: sysv-ipc in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (1.0.0)
Requirement already satisfied: Adafruit-PlatformDetect in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (1.3.2)
Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from adafruit-blinka) (3.0)
Requirement already satisfied: RPi.GPIO in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (0.7.0)
Requirement already satisfied: rpi-ws281x>=4.0.0 in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (4.2.2)
Requirement already satisfied: Adafruit-PureIO in ./.local/lib/python3.5/site-packages (from adafruit-blinka) (0.2.3)
$ python3 blinkatest.py 
Traceback (most recent call last):
  File "blinkatest.py", line 1, in <module>
    import board
  File "/home/ubuntu/.local/lib/python3.5/site-packages/board.py", line 47, in <module>
    from adafruit_blinka.board.raspi_40pin import *
  File "/home/ubuntu/.local/lib/python3.5/site-packages/adafruit_blinka/board/raspi_40pin.py", line 3, in <module>
    from adafruit_blinka.microcontroller.bcm283x import pin
  File "/home/ubuntu/.local/lib/python3.5/site-packages/adafruit_blinka/microcontroller/bcm283x/pin.py", line 1, in <module>
    import RPi.GPIO as GPIO
  File "/home/ubuntu/.local/lib/python3.5/site-packages/RPi/GPIO/__init__.py", line 1, in <module>
    from Jetson.GPIO import *
  File "/home/ubuntu/.local/lib/python3.5/site-packages/Jetson/GPIO/__init__.py", line 1, in <module>
    from .gpio import *
  File "/home/ubuntu/.local/lib/python3.5/site-packages/Jetson/GPIO/gpio.py", line 70, in <module>
    model, JETSON_INFO, _channel_data_by_mode = gpio_pin_data.get_data()
  File "/home/ubuntu/.local/lib/python3.5/site-packages/Jetson/GPIO/gpio_pin_data.py", line 260, in get_data
    raise Exception('Could not determine Jetson model')
Exception: Could not determine Jetson model

Installation of adafruit's adafruit-blinka has a Jetson.GPIO dependency which was downloaded and installed using pip3.

Error returns 'Could not determine Jetson model' from gpio_pin_data.py.

My /proc/device-tree/compatible looks like:
raspberrypi,3-model-b-plus^@brcm,bcm2837^@

Question: Does jetson-gpio not support raspberry pi hardware? Can I manually modify my compatible file to include a compatible board, and if so which one? Thanks

PWM pulses not reaching Jetson Nano GPIO pin

import RPi.GPIO as GPIO
import time

output_pins = {
    'JETSON_XAVIER': 18,
    'JETSON_NANO': 33,
}
out_pin = output_pins.get(GPIO.model, None)

def main():

    GPIO.setmode(GPIO.BOARD)
    print('board is set')
    GPIO.setup(out_pin, GPIO.OUT, initial=GPIO.HIGH)
    print('pin out set to high')
    p = GPIO.PWM(out_pin, 50)
    print('pwm pin set')
    p.start(0)
    print('pwm is started')
    
    try:
        while 1:
            for dc in range(0, 101, 5):
                print('+ve Duty cycle')
                p.ChangeDutyCycle(dc)
                time.sleep(0.1)
            for dc in range(100, -1, -5):
                print('-ve duty cycle')
                p.ChangeDutyCycle(dc)
                time.sleep(0.1)
    except KeyboardInterrupt:
        pass
    p.stop()
    GPIO.cleanup()
    print('pwm cycle completed')

if __name__ == '__main__':
    main()

Once while loop start executing motors stops running. It seems pwm signal is not reaching pin 33. using L298N pwm motor controller.

what are PWM software limitations?

Hello, I'm trying to use a servo SG90 with a Jetson nano, but without successes.

This servo go to 90 degrees with 10% of DC and -90 with 5%, but it always rotate to a maximum of one side, not the other. And after rotate it do not have any resistance to be move back to any position.

I'm using a simple copy of simple_pwm.py just changing the p.start()

My question are: can pwm using python be accurate enough to do this task and I have other problem than the python script? Is pwm sending continuous?

PWM not working on Jetson Xavier NX

I am trying to use pwm on the GPIO 33 of the Xavier NX board but the sample script is not working. I have seen that I might have to configure the pinmux. However, there is a document called "Jetson Nano Developer Kit 40-Pin Expansion Header Configuration" for the Nano but there is nothing for the Xavier NX.

What should I do ? How can I configure the board properly ?

Xavier NX, some pins do not work well

Hey guys, i test the Jetson.GPIO in python3, my code is realy very simple.

device XavierNX
Jetpack : 4.4

import Jetson.GPIO as GPIO 
import time
GPIO.setmode(GPIO.BOARD)
print(GPIO.getmode())
channel = 13 
GPIO.setup(channel, GPIO.OUT)
while True:
    print('setting pin 13 high')
    GPIO.output(channel, GPIO.HIGH)
   time.sleep(2)

    print('setting pin 13 low')
    GPIO.output(channel, GPIO.LOW)
    time.sleep(2)

print()

but some pins not working, you can see that my code is just set a pin up and down,
the pin12 35 38 40 works fine, but the others maintain 1.6V.

why is that??

the pin configuration is shown below
Screenshot from 2020-09-21 20-17-30

Confusing test code

Hi,

I reviewed the code of test_all_apis.py script, and I belive in test_setup_one_out_no_init function it should be GPIO.OUT (rather then GPIO.IN)

GPIO.setup(pin_data['out_a'], GPIO.IN)

The tests probably passed anyway due to the fact that and digital output pin is also input pin.

simple pwm example script not working

Add any other context about the problem here.
/jetson-gpio/samples$ python3 simple_pwm.py
/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py:352: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings
RuntimeWarning)
/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py:593: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings
RuntimeWarning)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "simple_pwm.py", line 61, in
main()
File "simple_pwm.py", line 41, in main
p = GPIO.PWM(output_pin, 13)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 597, in init
self._reconfigure(frequency_hz, 50.0)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 635, in _reconfigure
_set_pwm_period(self._ch_info, self._period_ns)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 245, in _set_pwm_period
f.write(str(period_ns))
OSError: [Errno 22] Invalid argument

problem with GPIO.remove_event_detect()

  • Jetson.GPIO version: '2.0.1', '2.0.3'
  • L4T version: nvidia-l4t-core 32.2.1-20190812212815
  • Jetson board: Nano

To Reproduce
Steps to reproduce the behavior:

  1. run these code in jupyter lab
import Jetson.GPIO as GPIO
GPIO.setmode(GPIO.TEGRA_SOC)

in_pin = 'SPI2_MISO'
GPIO.setup(in_pin, GPIO.IN)

def cb_fn(channel):
    pass

GPIO.add_event_detect(in_pin, GPIO.RISING, callback=cb_fn, bouncetime=200)
  1. make a FALLING Edge on in_pin
  2. run the code below in jupyter lab, and the kernel will keep busy
GPIO.remove_event_detect(in_pin)
  1. if interrupt the kernel, it will show:
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-6-6287b623d9e5> in <module>
----> 1 GPIO.remove_event_detect(in_pin)

/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio.py in remove_event_detect(channel)
    501 def remove_event_detect(channel):
    502     ch_info = _channel_to_info(channel, need_gpio=True)
--> 503     event.remove_edge_detect(ch_info.gpio)
    504 
    505 

/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio_event.py in remove_edge_detect(gpio)
    134     _set_edge(gpio, NO_EDGE)
    135 
--> 136     _mutex.acquire()
    137     del _gpio_event_list[gpio]
    138     _mutex.release()

KeyboardInterrupt: 

Expected behavior
GPIO.remove_event_detect(in_pin) should run successfully.

Install nvidia jetson-gpio on docker container

Is there a dockerfile for installing nvidia jetson-gpio on docker
I tried to write the Dockerfile myself but when I import the library in my python file I get this error:
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this

Now working with systemd service at boot

Describe the bug
Not working with systemd

A clear and concise description of what the bug is, including

  • Which version of Jetson.GPIO you are using.
    {'P1_REVISION': 1, 'RAM': '8192M', 'REVISION': 'Unknown', 'TYPE': 'Jetson TX2', 'MANUFACTURER': 'NVIDIA', 'PROCESSOR': 'ARM A57 + Denver'}
  • Which version of L4T (not JetPack) you are using.
    NVIDIA Jetson TX2
    L4T 32.2.1 [ JetPack UNKNOWN ]
    Board: t186ref
    Ubuntu 18.04.3 LTS
    Kernel Version: 4.9.140-tegra
    CUDA 10.0.326
  • Which Jetson board you are using.
    Jetson TX2

To Reproduce
Steps to reproduce the behavior:
a. Creat a python script

  1. Read the P12
  2. if is is low, sleep, otherwise shutdown the system
    b. add the script as a systemd service
    [Unit]
    Description = This is a Service that shutdown the system when the P is loaded high.
    After=graphical.target

[Service]
#ExecStart=/home/nvidia/shutdown.sh
WorkingDirectory=/home/nvidia/
ExecStart=/usr/bin/python3 /home/nvidia/yolov3/shutdown_jutson.py
Restart=always
StandardOutput=inherit
StandardError=inherit
User=root
#Group=nvidia
#RestartSec=10s
Type=simple
[Install]
WantedBy=graphical.target
#WantedBy=multi-user.target

Expected behavior
It is expected to work on boot up.
However, it seems the GPIO is not working at the begging.
If I reset the P12 such as GPIO.setup(12, GPIO.IN) or reboot the python script.
it works normally as expected.

Here is my script

import Jetson.GPIO as GPIO
import time
import os
input_pin = 18 # BCM pin 18, BOARD pin 12

def main():
TimeToDown = 6
mytimer = 0
value = GPIO.LOW

GPIO.setmode(GPIO.BCM)  # BCM pin-numbering scheme from Raspberry Pi
GPIO.setup(input_pin, GPIO.IN)  # set pin as an input pin
print("Starting demo now! Press CTRL+C to exit")
try:
    while True:

        value = GPIO.input(input_pin)
        if mytimer != TimeToDown:
            if value != GPIO.HIGH:
                if mytimer != 0:
                    print("Power supply recovered!")
                mytimer = 0
            else:
                print("{} seconds left to down".format(TimeToDown - mytimer))
                mytimer = mytimer + 1
                time.sleep(1)
        else:
            print("Shut OS down...")
            time.sleep(2)
            os.system('shutdown now')
finally:
    GPIO.cleanup()

if name == 'main':
main()

Jetson.GPIO on Connect Tech astro carrier

Hello,

I am currently using this library. I am using the Astro carrier board from connect Tech. Is there a way to run this library on the Astro?

I get the following message:
Screenshot from 2020-10-01 20-19-12

Thank you

simple_pwm not working

Add any other context about the problem here.
/jetson-gpio/samples$ python3 simple_pwm.py
/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py:352: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings
RuntimeWarning)
/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py:593: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings
RuntimeWarning)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "simple_pwm.py", line 61, in
main()
File "simple_pwm.py", line 41, in main
p = GPIO.PWM(output_pin, 13)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 597, in init
self._reconfigure(frequency_hz, 50.0)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 635, in _reconfigure
_set_pwm_period(self._ch_info, self._period_ns)
File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 245, in _set_pwm_period
f.write(str(period_ns))
OSError: [Errno 22] Invalid argument

Permission error after update 2.0.6

After the last update I get permission errors in my dockerized builds:

Traceback (most recent call last):
File "./listen_input.py", line 2, in
import RPi.GPIO as GPIO
File "/usr/local/lib/python2.7/site-packages/RPi/GPIO/init.py", line 1, in
from Jetson.GPIO import *
File "/usr/local/lib/python2.7/site-packages/Jetson/GPIO/init.py", line 1, in
from .gpio import *
File "/usr/local/lib/python2.7/site-packages/Jetson/GPIO/gpio.py", line 33, in
raise RuntimeError("The current user does not have permissions set to "
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this

I also tried this with python3, but also the same error there:
Traceback (most recent call last):
File "./listen_input.py", line 2, in
import RPi.GPIO as GPIO
File "/usr/local/lib/python3.8/site-packages/RPi/GPIO/init.py", line 1, in
from Jetson.GPIO import *
File "/usr/local/lib/python3.8/site-packages/Jetson/GPIO/init.py", line 1, in
from .gpio import *
File "/usr/local/lib/python3.8/site-packages/Jetson/GPIO/gpio.py", line 33, in
raise RuntimeError("The current user does not have permissions set to "
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this

This used to work ~2 weeks ago without issue.

I ran the
sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name
and copied the 99-gpio.rules and rebooted several times and rebuilt the image several times.

id -a
uid=1000(edgeai) gid=1000(edgeai) groups=1000(edgeai),4(adm),24(cdrom),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(i2c),118(lpadmin),124(gdm),127(docker),130(sambashare),131(iotedge),998(weston-launch),999(gpio)

ls -l /sys/class/gpio/export
--w--w---- 1 root gpio 4096 feb 28 10:00 /sys/class/gpio/export

ls -l /sys/class/gpio/unexport
--w--w---- 1 root gpio 4096 feb 28 10:00 /sys/class/gpio/unexport

Any ideas?

Containerized gpio access

Hello, I have a question. I'm interested in operating GPIO on Jetson NANO from within container and then from K3s.
I encountered errors when tried to activate simple_out.py example from docker container.

My dockerfile is:

#FROM ubuntu:20.04
#FROM python:2
FROM nvcr.io/nvidia/l4t-base:r32.4.3

ARG uid
ARG gid
ARG gid_gpio
RUN groupadd -f -r -g $gid_gpio gpio
RUN groupadd -f -r -g 1000 user


RUN apt-get update && \
    apt-get install -y python-pip && \
    pip install Jetson.GPIO

# gpio needs to be main group, otherwise we get permission problems
RUN useradd -M --uid $uid -g $gid_gpio user --groups uucp,$gid,user 
RUN mkdir -p /etc/sudoers.d \ 
   && echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/user \
   && echo 'Defaults exempt_group+=user' >> /etc/sudoers.d/user \
   && chmod a=r,o= /etc/sudoers.d/user

WORKDIR /app
COPY simple_out.py /app

CMD ["/bin/sh", "-c", "python /app/simple_out.py"]

I am running the container with following script:

#!/bin/bash

source ../configure.sh
 
docker run --rm  -it \
   --runtime=nvidia --gpus all\
  -v /sys:/sys \
  --device /dev/spidev0.0:/dev/spidev0.0:rw \
  --group-add $(cut -d: -f3 < <(getent group gpio)) "poc/gpio:${POC_VER}_${MY_KUBECTL_VERSION}_${MY_TARGETPLATFORM}" /bin/bash

and the errors are printed:

root@46ede1d99ba7:/app# python simple_out.py 
Traceback (most recent call last):
  File "simple_out.py", line 22, in <module>
    import RPi.GPIO as GPIO
  File "/usr/local/lib/python2.7/dist-packages/RPi/GPIO/__init__.py", line 1, in <module>
    from Jetson.GPIO import *
  File "/usr/local/lib/python2.7/dist-packages/Jetson/GPIO/__init__.py", line 1, in <module>
    from .gpio import *
  File "/usr/local/lib/python2.7/dist-packages/Jetson/GPIO/gpio.py", line 70, in <module>
    model, JETSON_INFO, _channel_data_by_mode = gpio_pin_data.get_data()
  File "/usr/local/lib/python2.7/dist-packages/Jetson/GPIO/gpio_pin_data.py", line 373, in get_data
    with open(compatible_path, 'r') as f:
IOError: [Errno 2] No such file or directory: '/proc/device-tree/compatible'

I have tried with the NVIDIA base container (nvcr.io/nvidia/l4t-base:r32.4.3) but it didn't help. I understand that the /sys contains files that should be mapped into container, (/proc/device-tree/compatible is a symlink to one of the files in that directory)

Any ideas ?

Not able to read pwm

Thanks for jetson.gpio.

Currently I'm not able to read PWM signal by Jetson nano (Jetson.GPIO) from RC receiver. PWM signal can be red by RPi but not by Jetson Nano, please find link to the code below for read_pwm on RPi:
http://abyz.me.uk/rpi/pigpio/code/read_PWM_py.zip

Is there any way Jetson.GPIO can read PWM signal as on RPi pigpio?

Please find below the scheme for more information:
image

No "99-gpio. rules file in the GPIO directory

Please don't submit questions
Please use this form to report specific bugs in Jetson.GPIO. All general questions or support requests should be directed at NVIDIA's forums; see:
https://developer.nvidia.com/embedded/community/support-resources

Please delete this section from your bug report.

Describe the bug
A clear and concise description of what the bug is, including

  • Which version of Jetson.GPIO you are using.
  • Which version of L4T (not JetPack) you are using.
  • Which Jetson board you are using.

To Reproduce
Steps to reproduce the behavior:

  1. Connect button/wire/LED/... XXX to the board
  2. Configure pin ... to input/output/...
  3. Execute API ...

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

GPIO setup with initial state dips voltage down for ~300us

Describe the bug

There is a short voltage drop to 0V when a Pin is setup via the GPIO.setup function. This drop is around 300μs long and occures if you use the initial optional flag or if you put the pin HIGH afterwards. If you setup the pin multiple times in one script, preferably with a delay in between, you can also observe the behavior.

  • Jetson.GPIO.VERSION: '2.0.16'
  • L4T Version 32.5.1
  • We are using a Jetson Xavier NX with our own carrier board.

To Reproduce
Steps to reproduce the behaviour:

  1. Connect an oscilloscope to a GPIO pin of the Jetson
  2. Setup the pin via this function: GPIO.setup(22, GPIO.OUT, initial=GPIO.HIGH)
  3. Notice the behavior

Expected behavior
Because of the internal pull-up I think, the Jetson GPIO pin is at a steady 1.8V level. If you setup the pin as an output while setting initial to HIGH, then you should not see any difference in the pin level. But in reality, the level drops down to 0V which is not acceptable in our use case.

Additional context
Please look at the provided picture of the oscilloscope, you also need to know, that the output is level shifted to 5V.

OscilloscopeCapture

Troubles with HC-SR04 control

Hello,

I want to contorl the HC-SR04 ultrasonic sensor with the Jetson Nano's GPIO pins. It needs a 0.01ms Trigger signal and sends an Echo signal as soon as the sonic wave arrives. Here is my simple code to do that:

# Import libraries
import RPi.GPIO as GPIO`
import time`

# GPIO Mode (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
print("Distance measurement in process")

# Assign GPIO Pins
GPIO_TRIGGER = 19
GPIO_ECHO = 21

# Set direction of GPIO Pins (IN / OUT)
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)

# Start the sensor
GPIO.output(GPIO_TRIGGER, GPIO.LOW)
print("Sensor is starting!")
time.sleep(2)

# Set Trigger to HIGH
GPIO.output(GPIO_TRIGGER, GPIO.HIGH)

# Set Trigger after 0.01ms to LOW
time.sleep(0.00001)
GPIO.output(GPIO_TRIGGER, GPIO.LOW)


#Save start time
while GPIO.input(GPIO_ECHO) == GPIO.LOW:
    StartTime = time.time()

# Save arrival time
while GPIO.input(GPIO_ECHO) == GPIO.HIGH:
    StopTime = time.time()

# Difference between start and arrival
TimeElapsed = StopTime - StartTime
distance = (TimeElapsed * 34300) / 2
print("Distance: ", distance)

GPIO.cleanup()

Here is my problem: It gets stuck in the first 'while'-loop, which means that the Echo signal never comes. I use a voltage translator to connect the sensor to the Jetson. I remember that I connected the 5V power supply pin first and then connected the Ground-pin, could that be the problem? Or my other assumption is related to the pin numbering definition. The numbers I entered in the definition are the ones that I can read from my Jetson Nano board. Are they right with the BCM-Mode? I also tested the state of the pins in a seperate program and I have different results when I type import Jetson.GPIO as GPIO and import RPi.GPIO as GPIO.
Can someone tell me where the problem could be originated?

Thanks for the help in advance!

Invalid Channels

Hi, sorry for if i miss something.
This is my code for taking input from GPIO 10.

import Jetson.GPIO as GPIO 

class CheckGPIO():

    def __init__(self): 
        GPIO.setmode(GPIO.BOARD) 
        GPIO.setwarnings(False) 
        self.CONVEYOR_BACKWARD_PIN = 10 
        GPIO.setup(self.CONVEYOR_BACKWARD_PIN, GPIO.IN) 

    def _check_conveyor(self): 
        if GPIO.input(self.CONVEYOR_BACKWARD_PIN): 
            print("LOW") 
        else: 
            print("HIGH") 

checkclass = CheckGPIO() 
checkclass._check_conveyor()

But i got an error. Here is error log;

Traceback (most recent call last):
  File "karalama.py", line 55, in <module>
    check = CheckGPIO()
  File "karalama.py", line 22, in __init__
    GPIO.setup(self.CONVEYOR_BACKWARD_PIN, GPIO.IN)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 358, in setup
    ch_infos = _channels_to_infos(channels, need_gpio=True)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 121, in _channels_to_infos
    for c in _make_iterable(channels)]
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 121, in <listcomp>
    for c in _make_iterable(channels)]
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 104, in _channel_to_info_lookup
    raise ValueError("Channel %s is invalid" % str(channel))
ValueError: Channel 10 is invalid

Jetson AGX Xavier GPIO PWM & I2C not working anymore

This seems to be similar to #32, but only happening on Jetson AGX Xavier with 32 GB eMMC and symptom is that I2C and PWM do not work anymore on the pins. GPIO pins 3.3V & 5V still work as expected.

jetson@agx:~$ sudo python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Jetson.GPIO as GPIO
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.
>>> GPIO.JETSON_INFO
{'P1_REVISION': 1, 'RAM': '16384M', 'REVISION': 'Unknown', 'TYPE': 'Jetson Xavier', 'MANUFACTURER': 'NVIDIA', 'PROCESSOR': 'ARM Carmel'}
>>> GPIO.VERSION
'2.0.16'
>>>
jetson@agx:~$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 5.0, GCID: 25531747, BOARD: t186ref, EABI: aarch64, DATE: Fri Jan 15 23:21:05 UTC 2021
jetson@agx:~$
jetson@agx:~$ cat /proc/device-tree/compatible
nvidia,galennvidia,jetson-xaviernvidia,p2822-0000+p2888-0001nvidia,tegra194
jetson@agx:~$ ls -l /proc/device-tree/chosen/plugin-manager/ids
total 0
-r--r--r-- 1 root root 25 Feb 25 21:40 2888-0004-400
-r--r--r-- 1 root root 25 Feb 25 21:40 framos-imx464-0
-r--r--r-- 1 root root  4 Feb 25 21:40 name
jetson@agx:~$

The strange thing, this particular board worked before, so we don't really understand what happened and what can be the problem/debug actions. HDMI for example is working, so the board is clearly connected.

Thank you in advance!
R

GPIO warning not carrier board

Describe the bug

  • Which version of Jetson.GPIO you are using.
    Jetson.GPIO (2.0.6)

  • Which version of L4T (not JetPack) you are using.

R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t210ref, EABI: aarch64, DATE: Tue Dec 10 06:58:34 UTC 2019

To Reproduce

  1. Install OS using jetpack (target device jetson nano developer kit)
  2. sudo pip3 install jetson.GPIO
  3. import jetson.GPIO

Expected behavior
I expect GPIO pins to function, but they are not functioning

Additional context
$ ls -l /proc/device-tree/chosen/plugin-manager/ids
total 0
-r--r--r-- 1 root root 26 Feb 25 10:38 3448-0000-200
drwxr-xr-x 3 root root 0 Feb 25 10:38 connection
-r--r--r-- 1 root root 4 Feb 25 10:38 name

$ cat /etc/nv_tegra_release
R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t210ref, EABI: aarch64, DATE: Tue Dec 10 06:58:34 UTC 2019

--not sure if relevant-- install cuda, deepstream, various libs required for jetson-inference using apt.
https://github.com/dusty-nv/jetson-inference

For jetson-inference I followed instructions to build from source.
https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md

PWM Permission issue

Hi, I'm using Jetson Nano(I installed jebot image version 0p3p2)

I've just downloaded the pakage using pip.
And I set up the user permissions following Readme.md and it works fine.
( I downloaded 99-gpio.rules from the repository.)

I can run almost every samples on the repository without using sudo,
but I can't run simple_pwm.py without using sudo. With sudo, it works fine.

I chcecked the source, and I found out that when I run it without using sudo, it stucks in the loop in _export_pwm function.

I checked the permission in /sys/devices/7000a000.pwm/pwm/pwmchip0/pwm2
duty_cycle, enable and period files' permissions are -rw-r--r--
Because I don't have permission to write enable, the program stucks in loop
(while not os.access(enable_path, os.R_OK | os.W_OK))

I also checked the permission in /sys/devices/7000a000.pwm/pwmchip0 ,
export and unexport files' permissions are --w--w--- , which are set correctly.

Can you give some advice?

Please don't submit questions
Please use this form to report specific bugs in Jetson.GPIO. All general questions or support requests should be directed at NVIDIA's forums; see:
https://developer.nvidia.com/embedded/community/support-resources

Please delete this section from your bug report.

Describe the bug
A clear and concise description of what the bug is, including

  • Which version of Jetson.GPIO you are using.
  • Which version of L4T (not JetPack) you are using.
  • Which Jetson board you are using.

To Reproduce
Steps to reproduce the behavior:

  1. Connect button/wire/LED/... XXX to the board
  2. Configure pin ... to input/output/...
  3. Execute API ...

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

getmode? what mode needs to be set to read from pin13 of Xavier GPIO [PWM01]/GPIO424

`python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

import Jetson.GPIO as GPIO
mode = GPIO.getmode()
GPIO.JETSON_INFO
{'P1_REVISION': 1, 'RAM': '16384M', 'REVISION': 'Unknown', 'TYPE': 'Jetson Xavier', 'MANUFACTURER': 'NVIDIA', 'PROCESSOR': 'ARM Carmel'}
`

>>> import Jetson.GPIO as GPIO
>>> GPIO.setmode(GPIO.TEGRA_SOC)
>>> mode = GPIO.getmode()
>>> GPIO.getmode()
1000

Is there any knowledge about sensors that worked with the Jetson.GPIO approach?
Any insights on how to read from dht11 that driver is integrated into tegra kernel?

support for orbitty board

I am trying to use this library with orbitty board on jetson tx2 , getting below error , any recommendations on how to get it working ?

image

Jetson.GPIO, RPi.GPIO and python-spidev

Hi,

I am trying to control a device (Unicorn HAT HD) using Jetson Nano through SPI. Unicorn HAT HD has been commonly used with Raspberry Pi. In this case, the required python package python-spidev is somehow interfaced with RPi.GPIO. I wonder if I use Jetson.GPIO, what should I do to replace RPi.GPIO to avoid conflict? Do I need to do that?

And where should I call GPIO.setmode()?

Hope my questions make sense.

Tom

AttributeError from Jetson Nano GPIO in python.

Jetson Nano GPIO in python.

This is error code:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import Jetson.GPIO as GPIO
  File "/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/__init__.py", line 1, in <module>
    from .gpio import *
  File "/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio.py", line 70, in <module>
    model, JETSON_INFO, _channel_data_by_mode = gpio_pin_data.get_data()
  File "/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio_pin_data.py", line 286, in get_data
    revision = f.split('-')[-1]
AttributeError: '_io.TextIOWrapper' object has no attribute 'split'

I found this error "split" from .egg packages.

Permission issue

Hi,
I just followed the installation instruction to install Jetson.GPIO and after executing the Permission setup step, I have this error:

raise RuntimeError("The current user does not have permissions set to "
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this

I'm using virtualenv and I installed it using pip inside the virtualenv, is that an issue ?
I'm on Jetson TX2 by the way.
Thanks

Event triggered twice despite high debounce time

I'm playing with the button_interrupt.py sample and I'm getting some strange behavior.

I'm running Jetson.GPIO 2.0.8 on L4T # R32 (release), REVISION: 4.2, GCID: 20074772, BOARD: t210ref. Jetson Nano Development Kit B01.

I have connected a button to the J41 pin 31 (which is supposed to be by default configured as pull up, correct me if I'm wrong here). The pin is configured as input as per the sample.

With the original sample, I get the event triggered twice. When I use a not-so-low debounce time (even up to a second), I get an event triggered twice. If I raise the debounce time up to a point where I don't get the event repeated (e.g.: two seconds), I get the event triggered once, but the button stops responding and the python program will need two Ctrl+C until it gets the keyboard interrupt. I guess this indicates the thread gets stuck somewhere, looks like waiting for some mutex unlock.

Here's the traceback after the double Ctrl+C:

Starting demo now! Press CTRL+C to exit
Blink LED 2
^C^CTraceback (most recent call last):
  File "./test_button.py", line 57, in main
    time.sleep(2)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test_button.py", line 62, in <module>
    main()
  File "./test_button.py", line 59, in main
    GPIO.cleanup()  # cleanup all GPIOs
  File "/usr/local/lib/python3.7/dist-packages/Jetson/GPIO/gpio.py", line 396, in cleanup
    _cleanup_all()
  File "/usr/local/lib/python3.7/dist-packages/Jetson/GPIO/gpio.py", line 293, in _cleanup_all
    _cleanup_one(ch_info)
  File "/usr/local/lib/python3.7/dist-packages/Jetson/GPIO/gpio.py", line 283, in _cleanup_one
    event.event_cleanup(ch_info.gpio)
  File "/usr/local/lib/python3.7/dist-packages/Jetson/GPIO/gpio_event.py", line 369, in event_cleanup
    remove_edge_detect(gpio)
  File "/usr/local/lib/python3.7/dist-packages/Jetson/GPIO/gpio_event.py", line 136, in remove_edge_detect
    _mutex.acquire()
KeyboardInterrupt

Unstable performance of GPIO port + motion sensor

I use the same motion sensor. When plug in GPIO port of Raspberry Pi 3 B+, it works fine. When I use Jetson Nano and jetson-gpio library, it performs differently, it seems to be very unstable and produces high and low very frequently.

What could be problem between the jetson-gpio and the one used in Raspberry pi given that I use the (almost) same code and same sensor. Is there any bug that would affect this in the jetson-gpio?

Unhandled exception in thread started by <function _poll_thread at 0x...>

I am trying to run the following code:

import Jetson.GPIO as GPIO

BUTTON_GPIO = 'AUD_MCLK' # / pin number 7 (connected to 3.3v)
BUTTON_LED = 'LCD_TE' # / pin number 15

def button(argument):
    print(f"{type(argument)}: {argument}")
    print("Button")

def main():

    GPIO.setmode(GPIO.TEGRA_SOC)

    GPIO.setup(BUTTON_GPIO, GPIO.IN)
    GPIO.setup(BUTTON_LED, GPIO.OUT)

    GPIO.add_event_detect(BUTTON_GPIO, GPIO.RISING, callback=button)

if __name__ == "__main__":
    main()

Jetson.GPIO Version:

grass@grass-desktop:~/grass_hopper$ pip3 show Jetson.GPIO
Name: Jetson.GPIO
Version: 2.0.17
Summary: A module to control Jetson GPIO channels
Home-page: https://github.com/NVIDIA/jetson-gpio
Author: NVIDIA
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
Requires: 

L4T Version:

grass@grass-desktop:~/grass_hopper$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t210ref, EABI: aarch64, DATE: Fri Feb 19 16:45:52 UTC 2021

Jetson board:
Nvidia Jetson Nano Developer Kit

To Reproduce
Steps to reproduce the behavior:

  1. Connect button from 3v3 to pin 7
  2. Connect LED from 5V via 460ohm resistor to pin 15
  3. Run python3 button.py (with code above)

Expected behavior
"Button" should be printed when pressing button

Additional context
This issue does not happen when running python3, then entering the code in file.

cannot find devices

I do everything as the readme file say, but the terminal returns the following err
No such file or directory: '/sys/devices/3160000.i2c/i2c-0/0-0074/gpio

I reboot jetson but it seems that doesn't work, btw, I have run the sample successfully on the same jetson just yesterday.

How to use this for servos / sensors?

Hi! Thanks for this library. I'm just getting started with Jetson Nano and was wondering how I can use this (or another) library to interface with servos and I2C sensors.

Any pointers would be appreciated. Thanks!

error in GPIO.py using Jetson Nano with Jetpack 4.2.1

Please don't submit questions
Please use this form to report specific bugs in Jetson.GPIO. All general questions or support requests should be directed at NVIDIA's forums; see:
https://developer.nvidia.com/embedded/community/support-resources

Please delete this section from your bug report.

Describe the bug
A clear and concise description of what the bug is, including

  • Which version of Jetson.GPIO you are using.
    0.1.3
  • Which version of L4T (not JetPack) you are using.
    4.2.1
  • Which Jetson board you are using.
    Jetson Nano

To Reproduce
Steps to reproduce the behavior:

  1. Connect RPi Motion sensor to the board
  2. Configure pin 12 to output and etc.
  3. Execute simple_input.py
    bash run_sample.sh simple_input.py

Expected behavior
Traceback (most recent call last):
File "./simple_input.py", line 22, in
import RPi.GPIO as GPIO
File "/opt/nvidia/jetson-gpio/lib/python/RPi/GPIO/init.py", line 1, in
from Jetson.GPIO import *
File "/opt/nvidia/jetson-gpio/lib/python/Jetson/GPIO/init.py", line 1, in
from .gpio import *
File "/opt/nvidia/jetson-gpio/lib/python/Jetson/GPIO/gpio.py", line 96, in
_board_info, _gpio_chip_base = gpio_pin_data.get_gpio_data(get_model())
File "/opt/nvidia/jetson-gpio/lib/python/Jetson/GPIO/gpio.py", line 94, in get_model
% model_str)
Exception: Could not guess Jetson model from the model string (NVIDIA Jetson Nano Developer Kit).
Additional context
I find this bug when using the 4.2.1 new release, the previous version OS works fine.

Wrong Linux GPIO numbering

Hi!
I consulted your GPIO pin data for the NX to find out the linux pin number for board pin 31 after moving from a nano to an NX, and found that it might be wrong?
in the line:
(134, "/sys/devices/2200000.gpio", 31, 6, 'GPIO11', 'SOC_GPIO42', None, None),
134 should be the linux GPIO pin number according to the file, but actually for GPIO11 the pin number is 388 (which I tested and is indeed correct) am I looking at it wrong?

for the nano the line is correct, as 200 is indeed the correct pin for GPIO11

Issue with virtualenv

Hi,
I followed the process to install the library but I'm also using virtualenv to separate my workspaces.
So I did pip install in my virtualenv and when I want to import Jetson.GPIO it tells me I don't have the permissions:

import Jetson.GPIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nvidia/.virtualenvs/cv/lib/python3.5/site-packages/Jetson/GPIO/__init__.py", line 1, in <module>
    from .gpio import *
  File "/home/nvidia/.virtualenvs/cv/lib/python3.5/site-packages/Jetson/GPIO/gpio.py", line 33, in <module>
    raise RuntimeError("The current user does not have permissions set to "
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this

Even after I added gpio as a group and included nvidia as a new member and copy and reload the rules..

The problem then is if I want to use python as root , I then have the old environment for python where Jetson.GPIO is not installed of course...

Is there a way to solve this ?

I suppose I have to clone the repository elsewhere than /opt/nvidia but I don't understand where ? Or is there a file in which I should change a python path to point to my virtual environment ?

Thank in advance

Nano: No .input, no .PWM

Neither .input nor .PWM work on the Jetson Nano with GPIO.BOARD configuration. Identical code & connected circuitry works as expected on the rasberry pi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.