All right, these are the steps to reproduce:
Device setup
Download Jetson Linux R35.3.1 and the sample root filesystem from the download page.
Extract with:
sudo tar xpf ./Jetson_Linux_R35.3.1_aarch64.tbz2
sudo tar xpf ./Tegra_Linux_Sample-Root-Filesystem_R35.3.1_aarch64.tbz2 -C Linux_for_Tegra/rootfs
Take gpiotest.dtbo into use
cp gpiotest.dtbo Linux_for_Tegra/kernel/dtb/gpiotest.dtbo
sed -ie 's/OVERLAY.*/OVERLAY_DTB_FILE=gpiotest.dtbo/' Linux_for_Tegra/jetson-agx-xavier-devkit.conf
Set Port Z Pin 4 to INT1
sed -ie 's/Z.pin.4 = 0/Z.pin.4 = 1/' Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg
Flash
cd Linux_for_Tegra
sudo ./apply_binaries.sh
sudo ./flash.sh jetson-agx-xavier-devkit mmcblk0p1
Do the following connections on the pin header:
- Pin
PZ.03
↔ PZ.04
- Pin
PZ.06
↔ PZ.05
Software setup
Boot and do the system set-up. Copy gpio-test.ko to the device. Change to root user with sudo -i
. The following commands should be run as root. Insert the module with:
insmod gpio-test.ko
Export GPIO pins 495 (Port Z Pin 3) and 498 (Port Z Pin 6) to user space and set them to output low:
echo 495 > /sys/class/gpio/export
echo 498 > /sys/class/gpio/export
echo out > /sys/class/gpio/PZ.03/direction
echo out > /sys/class/gpio/PZ.06/direction
echo 0 > /sys/class/gpio/PZ.03/value
echo 0 > /sys/class/gpio/PZ.06/value
Setup overview
The current setup is now following:
-
PZ.06
is connected to PZ.05
. PZ.05
is set to INT0
in tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg
-
PZ.03
is connected to PZ.04
. PZ.04
is set to INT1
in tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg
- There is a driver that listens to rising edge interrupts on
PZ.04
and PZ.05
.
The test
The assumption is following: if we set PZ.06
high, we get an interrupt on PZ.05
. If we set PZ.03
high, we get an interrupt on PZ.04
. These interrupts should not have anything in common, other than being in the same interrupt controller port Z.
We can check the interrupts seen by the gpio-test
driver with:
cat /proc/interrupts | grep gpio-test
287: 0 0 0 0 gpio 161 Edge gpio-test-isr1
288: 0 0 0 0 gpio 162 Edge gpio-test-isr2
So far there are no interrupts. Now, let’s set PZ.06
high and check again:
echo 1 > /sys/class/gpio/PZ.06/value
cat /proc/interrupts | grep gpio-test
287: 0 0 0 0 gpio 161 Edge gpio-test-isr1
288: 1 0 0 0 gpio 162 Edge gpio-test-isr2
So far so good, now let’s try PZ.03
:
echo 1 > /sys/class/gpio/PZ.03/value
cat /proc/interrupts | grep gpio-test
287: 0 0 0 0 gpio 161 Edge gpio-test-isr1
288: 1 0 0 0 gpio 162 Edge gpio-test-isr2
We get no interrupt. However, if we now cause an interrupt on PZ.05
by toggling PZ.06
, we get both interrupts at the same time:
echo 0 > /sys/class/gpio/PZ.06/value
echo 1 > /sys/class/gpio/PZ.06/value
cat /proc/interrupts | grep gpio-test
287: 1 0 0 0 gpio 161 Edge gpio-test-isr1
288: 2 0 0 0 gpio 162 Edge gpio-test-isr2
So the interrupts are now linked in a way that triggering the INT0
interrupt triggers the interrupt in INT1
too, if INT1
was triggered in the meantime. INT1
intterrupt does not trigger without INT0
triggering.
Attachments
Device tree overlay: gpiotest.dtbo (511 Bytes)
GPIO test driver: gpio-test.ko (342.3 KB)
Device tree overlay source: gpiotest.dts (624 Bytes)
GPIO test driver source: gpio-test.c (1.5 KB)