Use gpio from l4t-ml container

First, on the TX2 body

sudo apt install python3-dev python3-pip

cd /opt/nvidia/
sudo git clone

cd jetson-gpio
sudo python3 install

cd /opt/nvidia/jetson-gpio/samples


is working

After executing -v /sys:/sys -v /usr:/usr -v /proc:/proc -v /opt:/opt when executing the l4t-ml container

cd /opt/nvidia/jetson-gpio/samples


not working

The error is

No such file or directory: ‘/proc/device-tree/compatible’

In TX2 itself, you can see that /proc/device-tree is linked to /sys/firmware/devicetree/base, but /sys/firmware/devicetree/base does not exist in the l4t-ml container
-v /sys:/sys I wonder if everything is mounted, but it doesn’t seem to be.

How can I mount all of/sys?

hello yoshifumi_watanabe_aa,

Jetson GPIO is a python library that enables the use of Jetson’s GPIOs, it may not supports while you’re using a container.
could you please access those GPIOs through system nodes, please refer to TX2 J21 Header Pinout for GPIO numbers.
you may enable GPIOs manually for usage.
for example,

$ echo 220 > /sys/class/gpio/export 
$ echo out > /sys/class/gpio/gpio220/direction
$ echo 1 > /sys/class/gpio/gpio220/value

When 220 was changed to 255, 3V output could be confirmed. However, I want to be able to execute it on a python program like Is it possible to mount all / sys somehow?


using GPIO from within a docker container

sudo pip3 install git + https: //

cd /usr/local/lib/python3.6/dist-packages/jetson/GPIO
sudo chmod 777

In def get_data(): change the model to JETSON_TX2

cd /opt/nvidia/jetson-gpio/samples
sudo chmod 777

Change 1 second to 5 seconds (because I want to see it on the tester)

sudo docker run ・・・-v /etc/udev/rules.d:/etc/udev/rules.d -v /sys/class/gpio:/sys/class/gpio -v /sys/devices:/sys/devices -v /dev/gpiochip0:/dev/gpiochip0 -v /dev/gpiochip1:/dev/gpiochip1 -v /opt:/opt ・・・Container name

cd /opt/nvidia/jetson-gpio/samples


Voltage between 12 and 14 ON/OFF 3.3V was confirmed