GPIO changes in L4T r35.4.1 using Jetson.GPIO

Looks like there are some GPIO-related changes in L4T r35.4.1 and I’m curious what the recommended way to deal with them is.

Under r32.7.3, we can use Jetson.GPIO to read the same GPIO pin from multiple processes, while in r35.4.1, once our main process (running under docker) opens a GPIO, I can never read from it elsewhere (even after exiting Docker)

Suggestions for how to get this functionality back? Or do I need to write a kernel driver :(

Here’s an example script:

import Jetson.GPIO as gp
gp.setmode(gp.TEGRA_SOC)
XIN1='SPI3_CS1_N'
# set pin as input
gp.setup(XIN1, gp.IN)
print(gp.input(XIN1))

…under L4T r32.7.3, I get a warning, but it reads:

/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py:386: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings
  RuntimeWarning)
0

…while under L4T r35.4.1, I get an error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio_cdev.py", line 167, in open_line
    fcntl.ioctl(ch_info.chip_fd, GPIO_GET_LINEHANDLE_IOCTL, request)
OSError: [Errno 16] Device or resource busy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test2.py", line 6, in <module>
    gp.setup(XIN1, gp.IN)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 344, in setup
    _do_one_channel(ch_info, direction, initial, consumer)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio.py", line 155, in _do_one_channel
    gpio_cdev.open_line(ch_info, request)
  File "/usr/lib/python3/dist-packages/Jetson/GPIO/gpio_cdev.py", line 169, in open_line
    raise GPIOError(e.errno, "Opening output line handle: " + e.strerror)
Jetson.GPIO.gpio_cdev.GPIOError: [Errno 16] Opening output line handle: Device or resource busy

Hi riz94107,

Are you using the devkit or custom board for Xavier NX?

Are you trying to control the following pin?


jetson-gpio/lib/python/Jetson/GPIO/gpio_pin_data.py at e9f417a40fd2347182ed82af6a3a7b837db9df64 · NVIDIA/jetson-gpio (github.com)

If so, could you share the result of the following command on your board?

$ sudo cat /sys/kernel/debug/gpio|grep PY.04

It’s a custom board with the same pinout as the devkit (Seeed A203.v2).

Yes, that’s the pin from this example. Here’s the output:

olyns@linux:~$ sudo cat /sys/kernel/debug/gpio|grep PY.04
 gpio-488 (PY.04               |(null)              ) in  lo IRQ

… the output of /sys/kernel/debug/gpio is different under L4T r32.7.3, so I can’t directly compare it.

It seems someone in device tree is using this pin.
Could you help to check if any device node is using this pin (PY.04)?

You could also share the /boot/dtb/kernel_XXX.dtb as file here for further check.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.