How to make Jetson TK1.GPIO module

Hello all,

I am planning to connect multichannel gas sensor product of a Grove pie system to TK1 board.

I am using GPIO pins of TK1 using I2C to connect gas sensor pins [VCC, GND, SCL, SDA].

but when I run code from git hub it shows me following error:

“No module named RPI.GPIO” , anyone know Jetson tk1. GPIO python module which will works with TK1, not with a raspberry pi board.

Thanks in advance!!

I can’t help for the particular case, these are just hints or a place to start. You might want to know this information as a place to start:

FYI, the module might be a kernel module, not a python module. I don’t know (I’ve never worked on RPi and am a C/C++ guy with only a bit of Python use). If this is a Python module, then someone else will need to tell you how to work with it.

If a kernel module is required, then you probably have to build this yourself (part of building a kernel module).

GPIO, by its very name, means the pin can be assigned for different uses. This is custom to every SoC, so this is the same concept in an RPi, but entirely different in making it work. The two are not interchangeable so far as low level configuration. Even on a given SoC the device tree (which configures GPIO use) will differ based on the carrier board (device tree is for configuration of SoC to match the component layout surrounding it…different surrounding layout implies a new device tree).

You will have to learn a lot about device trees as a general concept and installation or editing (you won’t actually need to know much about details). You can start by reverse compiling the tree which your running Jetson is using. The “dtc” tool converts device tree formats (the “dtc” tool on your PC should work as well as the one on the Jetson…this is architecture independent and mostly version independent). To add this to a TK1 if you don’t already have it:

sudo apt-get install device-tree-compiler

To extract the device tree of a running Jetson (the dts file is human readable):

dtc -I fs -O dts -o extracted.dts /proc/device-tree

Always save a copy of this original device tree for permanent reference prior to any modifications!

To convert a dts file into binary dtb format (used for actual install):

dtc -I dts -O dtb -o extracted_converted_to_binary.dtb extracted.dts

You might see references to device tree files in the kernel. This is a case of the kernel doing the same thing more or less (the kernel has “dtc” in it as a script), but it can piece together subsets of trees to make a final tree with the “make dtbs” command (you’d need ot have the kernel configured first). Mostly I’d suggest not doing this until you are comfortable with configuring a kernel and building modules. It might be you never need to build a tree from kernel source.

Installing a device tree is possible using different methods. Consider that a separate topic until you believe you have a correct device tree for your Jetson’s custom GPIO use (and if you are lucky you might not need a new device tree…but you have to see the existing device tree before you will know this).

Note that a kernel module becomes part of kernel driver code. A device tree in combination with the right module makes the hardware you want to be available where you want it. Device trees set up the hardware during boot prior to the kernel taking over…the kernel modules and drivers will assume the tree is valid and will inherit a good or bad device tree without having any actual control of what happened prior to the kernel beginning its life.

You can find documentation under the R21.7 URL:

You can find extra documention under this URL: