Enable Pull-up/Pull-down on GPIO


if I understood the reference manual (chapter 8.12.38) correctly, the K1 has the ability to enable a pull-up or pull-down resistor on the gpio pins.
Unfortunately, it seems that this cannot be done via the sysfs interface. Is there another way?


The Jetson tk1 schematic shows that some of the GPIO have pull up resistors on the circuit board itself (leading to the 1.8V rails). These are not programmable without a soldering iron.

If you are looking for the control of tri-state logic, each GPIO has a register associated with this. GPIO/SFIO controllers have a register associated with it to control this functionality at a base physical controller address plus offset from that base (offset depending on which GPIO within the controller you are looking at). You can go into the kernel and locate which virtual address corresponds to the necessary physical address and simply write to the proper location to toggle tri-state.

If you simply want something other than 1.8V you might just pick up level converters, e.g., to 3.3V. It might be better to mention what it is you want to accomplish.

Maybe you can look at the driver sources for the device, and build a new driver that exports the capability to sysfs? It looks like the functionality is there… I’ve had to rebuild drivers myself…

Do you know what the name of the gpio device is?

Some Raspberry Pi GPIO libs just mmap /dev/mem into their local address space to access the memory-mapped registers directly (needs root of course). Maybe this can be done on the Jetson as well?

This way you wouldn’t have to recompile the kernel or write a kernel module.

Thanks. So I think there are 3 possible ways:

I had a look at wiringPi ( https://git.drogon.net/?p=wiringPi;a=blob;f=wiringPi/wiringPi.c - see line 1777)
I think the easiest way would be to do it like they do (mmaping the registers directly as anlumo said). Unfortunately this is a bit hacky, as you should not run such an executable on another SoC.

The proper way would be to extend the gpio subsystem and the driver to support this.

And the third way would be to use an external resistor.

I haven’t decided yet, what I’ll do.

Maybe you can read / write the GPIO devices through /dev/mem? Chapter 2.1 in the Tegra K1 reference manual shows the location of the devices in memory.