Jetson-GPIO Library Update for DSBOX-N2 and DSBOX-NX2 - Forecr.io

Jetson-GPIO Library Update for DSBOX-N2 and DSBOX-NX2

Jetson Nano | Jetson Xavier NX

18 May 2021
WHAT YOU WILL LEARN?

1- How to use Jetson GPIO Library

2- How to set Industrial Output Pins

3- How to use Industrial Input Pins

ENVIRONMENT

Hardware: DSBOX-N2

OS: Jetpack 4.5.0

Language: Python


Lately, NVIDIA has published a GPIO library based on Raspberry Pi GPIO library. This library comes pre-installed on the module. On this blog post, we will patch that library to activate DSBoard industrial input/output pins. This blog post applicable for DSBOX-NX2 (v1.1) and DSBOX-N2 (v1.1).

First, download the updated version of this library from our GitHub repository.


cd
git clone -b v2.0.21 https://github.com/mistelektronik/jetson-gpio


You can use this library directly but there could be a conflict between pre-installed library.

To solve this, copy "jetson-gpio/lib/python/Jetson/GPIO/gpio_pin_data.py" file over the pre-installed library.


cd jetson-gpio
sudo mv /usr/lib/python2.7/dist-packages/Jetson/GPIO/gpio_pin_data.py /usr/lib/python2.7/dist-packages/Jetson/GPIO/gpio_pin_data_backup.py
sudo mv /usr/lib/python3/dist-packages/Jetson/GPIO/gpio_pin_data.py /usr/lib/python3/dist-packages/Jetson/GPIO/gpio_pin_data_backup.py
sudo cp lib/python/Jetson/GPIO/gpio_pin_data.py /usr/lib/python2.7/dist-packages/Jetson/GPIO/gpio_pin_data.py
sudo cp lib/python/Jetson/GPIO/gpio_pin_data.py /usr/lib/python3/dist-packages/Jetson/GPIO/gpio_pin_data.py


After these commands, you can use IIO pins using the library. First two commands added for backup reason; so, anything goes wrong you can find original files.


On the table below you can find IIO GPIO numbers and names to use inside the library.



In order to test General Purpose Input Output pins, we can use "simple_out.py". We should only change the output pin number with our digital pin numbers. You can check the example below.



We need to run simple_out.py on the below.


python3 simple_out.py

Thank you for reading our blog post.