Orbitty Carrier and Jetson TX2: GPIO pins

The documentation at: https://www.balena.io/docs/learn/develop/hardware/gpio/

only discusses the Raspberry Pi, Beaglebone and Intel Edison. Each appear to use a different interface between user space and GPIO pins.

Is there any support for the Orbitty Carrier and Jetson TX2?

Test device at: https://dashboard.balena-cloud.com/devices/c7bd659a97a097938bb5ad359cd4d0cb/summary

Actually my colleague figured it out:

The Orbitty carrier board we are using with the Jetson TX2 has an expansion port with an I2C bus and four GPIO pins. Further reading here:

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

https://elinux.org/Jetson/Tutorials/GPIO

http://www.connecttech.com/pdf/CTIM-ASG003_Manual.pdf

We are going to use a GPIO pin to control a LED. The GPIO pin connects to the gate on the BS170 MOSFET which drives our LED.

First we enable the four pins… You only need to do this once.

echo 388 > /sys/class/gpio/export
echo 298 > /sys/class/gpio/export
echo 480 > /sys/class/gpio/export
echo 486 > /sys/class/gpio/export

This will create four directories

/sys/class/gpio/gpio388
/sys/class/gpio/gpio298
/sys/class/gpio/gpio480
/sys/class/gpio/gpio486

In the above order those directories correspond to GPIO pins 0-3, which are pins 7-10 on the Orbitty expansion connector. We are using pin #8 on the connector to control the LED, so we’re interested in gpio298.

Once you have enabled the pins, you can set pin a pin’s direction like this

echo out > /sys/class/gpio/gpio298/direction

Or

echo in > /sys/class/gpio/gpio298/direction

The first command will have the effect of turning the LED off by switching to output mode which defaults to low. You can turn the LED back on with the second command.

You can also turn the LED back on with this command

echo 1 > /sys/class/gpio/gpio298/value

And back off again with this one:

echo 0 > /sys/class/gpio/gpio298/value

Finally, you can read the state of the GPIO pin with the command:

cat /sys/class/gpio/gpio298

Thank you @jason10 for answering your question and sharing the information on the forum.

Cheers :tada: :confetti_ball:

have you guys tried this with GPIO jetson python libarary ?

jetson-gpio

@jason10

@yyogeshwar I hadn’t seen that lib, but looking at it I think it should work great if you run the container privileged :slight_smile:

@yyogeshwar Nope.

We ran the container privileged and used C++ to write code that used:

#include <linux/i2c-dev.h> // I2C bus definitions

if possible can you please share sample snippet of c++ code ?

below does not works out with orbitty carrier board

jetson-gpio

@jason10

Oh, you can control the pins through the command line:

thanks for the help , it will do the job @jason10

Hello dear @jason10
Thank you for posting this solution to work with the GPIO of the orbitty carrier board.

In my case, I am using python. The problem is that every time I have to run “echo 388 > /sys/…” to be able to run my python script to control the LEDs.
Do you know how ubuntu can run automatically the “echo 388 > /sys/…” command?

Thank you in advance.

Sorry, it’s been a few years since I last had to do this.

What I would do is write a short bash script that will become your DOCKERFILE CMD

#!/bin/bash
…do the echo
…run the Python program

Then save this as runCommand.bash, make sure it has the execute bits set, modify the DOCKERFILE to run the script as the CMD, git add, got commit, git push…

1 Like

dear @jason10 thanks a lot for your answer.
I understood.
Since I am trying to control an RGB LED common anode with python, I need to use PWM to control the RGB LED but it seems that I am only able to set output or input to the GPIO but I cannot set it as PWM output.
I’ll appreciate any advice.
Thank you.

Often the nvidia developer forums have advice on how to work with the connect tech boards. Jetson TX2 PWM - Jetson TX2 - NVIDIA Developer Forums