GPIO interrupts using UIO [Jetson AGX Xavier]

Hi,

I have a GPS module that sends a PPS signal every second. I want to read that signal in my software application as an interrupt. I am trying to configure userspace UIO modules to achieve that.

I have successfully compiled the kernel with the drivers enabled and using modprobe I can see that they are loaded properly. The problem is that I cannot see a uio device in the path /sys/class/uio/. This directory is empty.

I added this device tree node

uio_gpio_interrupt {
compatible = "generic-uio";
reg; /* No memory range needed for a simple GPIO interrupt */
interrupt-parent = <&tegra_main_gpio>; /* The main GPIO controller node */
interrupts = <TEGRA194_MAIN_GPIO(Q, 1) IRQ_TYPE_EDGE_RISING>; /* Pin Q.1, Rising Edge */
status = "okay";
};

in this file: tegra194-p2888-0001-p2822-0000.dts

By my understanding, adding this device tree node should add a new device inside the /sys/class/uio directory which I can then “read“ to check if the interrupt was received.

My signal is attached to PIN22 of the 40 PIN expansion header. Here are its properties for the PINMUX file:

Signal name: GPIO17
MPIO: SOC_GPIO21
Pinmuxing GPIO: GPIO3_PQ.01

Please help me understand what I am missing here.

Thanks.

Hi @usufwasi Hope you’re doing well,
Could you check and share the dmesg for any UIO GPIO messages to verify the driver is loading on the board?
You can use: dmesg | grep uio
Please also share the device tree to confirm the node path and that it’s enabled.
Best Regards,

Carlos Quiros Gomez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi @carlos.quiros

Here is my output from dmesg | grep uio

[ 18.194891] uio_pdrv_genirq: module verification failed: signature and/or required key missing - tainting kernel

Running this command: lsmod | grep -E ‘uio|uio_pdrv’
gives this output:

uio_pdrv_genirq 16384 0
uio 24576 1 uio_pdrv_genirq

I am also attaching the .dts file I changed. I downloaded the official kernel source from nvidia. This file is present in /Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/galen/kernel-dts

tegra194-p2888-0001-p2822-0000.txt (1.8 KB)

I compiled the kernel image and the device tree files, replaced them in my current system and updated the extlinux.conf file as needed.

Thanks

Hi usufwasi,

Are you using the devkit or custom board for AGX Xavier?
What’s the Jetpack version in use?

Have you tried PPS GPIO driver instead?
You can refer to the following threads for the similar use case.
AGX Xavier PPS fetch timeout R35.2.1(R32.7.1 works fine) - Jetson & Embedded Systems / Jetson AGX Xavier - NVIDIA Developer Forums
Pps_gpio interrupt not asserted - #8 by KevinFFF
PPS input to GPIO on Jetpack 6.1 - #8 by erik93

Hi @KevinFFF

I am using a development kit.
My jetpack version is:
Model: Jetson-AGX - Jetpack 5.1 [L4T 35.2.1]

I have not tried PPS GPIO yet. I will look into it as well.

Thanks

Hi @usufwasi
After checking the DTS, everything seems to be correct, but I still have some doubts about the message that appears in the dmesg log:
uio_pdrv_genirq: module verification failed: signature and/or required key missing - tainting kernel
This makes me wonder whether the driver isn’t fully loading to register the subdevice. Could you check if there is anything in your kernel configuration that needs to be enabled to resolve this issue?

I found this post discussing the same error:

Best Regards,
Carlos Quiros Gomez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi,

I have been looking into the issue and have found something odd. I downloaded the kernel sources for the AGX xavier from the official website and flashed it. I think there is a mismatch of GPU mapping. For example:

I intend to use PIN 22 on the 40 pin header for my PPS input. According to the pinmux document that corresponds to:

image

GPIO PQ.01

and, according to this link: NVIDIA Jetson AGX Xavier GPIO Header Pinout - JetsonHacks

The sysfs name for that pin should be gpio417.

In my image that I flashed, gpio417 does not correspond to PQ.01, instead:

gpio-417 (PM.07 |bt_ext_wake ) out hi
gpio-436 (PQ.01 )

I got this output using this command:
sudo cat /sys/kernel/debug/gpio | sed -n ‘1,200p’

Should the gpio mapping not match in both the image and documentation? or am I missing something here?

Thanks.

I have an update. For whatever reason, the numerical value of gpios (e.g 417) does not match the pinmux file but the sysfs name PQ.01 works as expected. So essentially as per my system, I used gpio436 corresponding to my PQ.01 and it worked.

I am now receiving PPS interrupts.

PIN22 of 40pins expansion header(J30) is as following.
image
Please simply run the following command to check its gpio number.

$ sudo cat /sys/kernel/debug/gpio|grep PQ.01
 gpio-436 (PQ.01               )

And you can simple run the following command to export it.

$ sudo su
# echo 436 > /sys/class/gpio/export