Jetson nano: PPS GPIO interrupt not getting registered

Hello,

We are using gpio(B,7) i.e. physical pin 18 in J41 as PPS input from ardusimple simpleRTK2B.

Below is our environment:

Board: Jetson Nano Developer kit B01
Model: P3450
L4T 32.6.1 
Kernel 4.9 (L4T Driver Package (BSP) Sources)

I have followed steps in Enabling PPS on Jetson Nano and configured the device tree & enabled PPS.

#
# PPS support
#
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y

I have added pps entry to tegra210-soc-base.dtsi (as separate node towards end of file)

pps {
    gpios = <&gpio TEGRA_GPIO(B, 7) 0>;
    compatible = "pps-gpio";
    status = "okay";
};

For flashing I have used jetson-disk-image-creator.sh file in environment provided by Jetson-210_Linux_R32.6.1_aarch64.tbz2
(rootfs from same release i.e. 32.6.1 was taken)

After copying kernel Image and dts files in above environment, I have run below commands o create the image file for flashing the sd card,

$ sudo ./apply_binaries.sh
$ cd tools
$ sudo ./jetson-disk-image-creator.sh -o sd-blob-img -b jetson-nano -r 300

I checked the dmesg after booting,

dmesg output: showed pps modules. however there is no IRQ registered msg

$ dmesg | grep -i pps
[    0.603840] pps_core: LinuxPPS API ver. 1 registered
[    0.603846] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    1.362662] pps pps0: new PPS source ktimer
[    1.362809] pps pps0: ktimer PPS source registered
[    1.362813] pps_ldisc: PPS line discipline registered

While executingsudo ppstest /dev/pps0, I get same output whether the gps pps pin is connected or not.

$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1588064315.861849703, sequence: 4355 - clear  0.000000000, sequence: 0
source 0 - assert 1588064316.885912540, sequence: 4356 - clear  0.000000000, sequence: 0
source 0 - assert 1588064317.909913941, sequence: 4357 - clear  0.000000000, sequence: 0
source 0 - assert 1588064318.933846094, sequence: 4358 - clear  0.000000000, sequence: 0
source 0 - assert 1588064319.957913486, sequence: 4359 - clear  0.000000000, sequence: 0

Below is some more additional info

$ vi  /lib/modules/4.9.253-tegra/modules.builtin
...
kernel/drivers/pps/pps_core.ko
kernel/drivers/pps/clients/pps-gpio.ko
...

$ ls /sys/module/pps_gpio/
uevent  version
$ cat /sys/module/pps_gpio/version 
1.0.0

//gpio pin is not configured for PPS
$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-255, parent: platform/6000d000.gpio, tegra-gpio:
...
 gpio-15  (SPI1_CS0            )
...

I have checked the dtb in /boot/dtb to confirm the dts changes are present - by using dtc to convert to dts format.
But it seems the dts changes do not have any effect.

Are there any additional setting to be done for configuring the GPIO pin as interrupt source?

I am very likely to be doing something wrong, since this appears to be a very straight forward procedure.

Any help will be appreciated.

Thanks,

hello gina_v,

please have a try to add assert-falling-edge; into device tree.
for example,

pps {
    gpios = <&gpio TEGRA_GPIO(B, 7) 0>;
    compatible = "pps-gpio";
+    assert-falling-edge;
    status = "okay";

after system boots, could you please also check sysfs node for PPS. i.e. $ ls /sys/class/pps/pps0/
whenever interrupt occurs on falling edge of signal of gpio pin, timestamp will be captured and seen using: $ cat /sys/class/pps/pps0/assert

Hello JerryChang,

Thank you for your reply.
I have made the changes as suggested.

Below is the status after rebooting.
dmesg after rebooting is still not showing ‘Registered IRQ’ message.

after system boots, could you please also check sysfs node for PPS. i.e. $ ls /sys/class/pps/pps0/

$ ls /sys/class/pps/pps0
assert  clear  dev  echo  mode  name  path  power  subsystem  uevent

whenever interrupt occurs on falling edge of signal of gpio pin, timestamp will be captured and seen using: $ cat /sys/class/pps/pps0/assert

$ cat /sys/class/pps/pps0/assert 
1639637001.838668084#104

// ------> pps source is ktimer, not the SimpleRTK2B provided signal <---------
$ cat /sys/class/pps/pps0/name 
ktimer

//gpio pin is not configured for PPS
$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-255, parent: platform/6000d000.gpio, tegra-gpio:
...
 gpio-11  (                    )
 gpio-12  (SPI1_MOSI           )
 gpio-13  (SPI1_MISO           )
 gpio-14  (SPI1_SCK            )
 gpio-15  (SPI1_CS0            )
 gpio-16  (SPI0_MOSI           )
 gpio-17  (SPI0_MISO           )
 gpio-18  (SPI0_SCK            )
...

Note: To confirm PPS working with signal from SimpleRTK2B, we checked on Raspberry Pi. We enabled PPS pin and gave SimpleRTK2B PPS signal input on PPS GPIO pin. The SimpleRTK2B PPS setting is configured as 5 seconds. We could observe the timestamp every 5 seconds.

dmesg snippet from Raspberry Pi (shows IRQ registered)
pi@raspberrypi:~ $ dmesg
...
[    7.066488] pps pps0: new PPS source pps@4.-1
[    7.066627] pps pps0: Registered IRQ 199 as PPS source
...

//shows PPS source name 
pi@raspberrypi:~ $ sudo cat /sys/class/pps/pps0/name
pps@4.-1

//shows data every 5 second
pi@raspberrypi:~ $ sudo ppstest /dev/pps0 
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1639638262.000993277, sequence: 843291 - clear  0.000000000, sequence: 0
time_pps_fetch() error -1 (Connection timed out)
source 0 - assert 1639638267.000996249, sequence: 843292 - clear  0.000000000, sequence: 0
time_pps_fetch() error -1 (Connection timed out)
source 0 - assert 1639638272.000997191, sequence: 843293 - clear  0.000000000, sequence: 0

//shows gpio pin configured for interrupt
pi@raspberrypi:~ $ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-53, parent: platform/3f200000.gpio, pinctrl-bcm2835:
...
 gpio-4   (                    |pps@4               ) in  lo IRQ 
... 

pi@raspberrypi:~ $ cat /sys/class/pps/pps0/assert
1639638402.000947733#843319

Are there any additional setting to be done for configuring the GPIO pin as interrupt source on Jetson Nano?

Thanks

hello gina_v,

there’s pps-gpio driver which uses GPIO pin as PPS source.
you’ll need NVPPS driver, which enables interrupt on GPIO pin provided in device tree node.
here’s pseudo code for your reference,

int main()
{
        struct nvpps_timeevent  time_event;

        fd = open("/dev/nvpps0", O_RDWR);
        ret = ioctl(fd, NVPPS_GETEVENT, &time_event);

please also check Topic 107409 for the steps.
thanks

Hello JerryChang,

Thank you for your reply.

Please correct me if I am wrong (I am new to this). I think NVPPS is PPS generator on GPIO pin i.e. it configures GPIO as GPS source.

Whereas we want to use GPS (SimpleRTK2B signal) as the external PPS source on GPIO-15, so I guess we need to use pps-gpio driver (kernel-source/drivers/pps/clients/pps-gpio.c).

Thanks

Hello JerryChang,

I have attached the dts file being used (tegra210-soc-base.dtsi). The pps changes are present in same.
I think the interrupt is not getting enabled for GPIO-15 (SPI_2_CS0 pin).

Are there any additional setting to be done for configuring the SPI_2_CS0 pin as a GPIO interrupt source in the DTS file?

Thanks
tegra210-soc-base.dtsi (73.4 KB)

hello gina_v,

here’s an example to configure the DT as GPIO interrupt,

                        ...
                        interrupt-parent = <&gpio>;
                        interrupts = <TEGRA_GPIO(B, 7) 0x01>;
                        status = "okay";

Hello JerryChang,

Thank you for your reply.

We found the issue at our end. Somehow, the dtb changes were not getting reflected in below 2 scenarios,

  1. Flash a fresh image on SD card (using jetson-disk-image-creator.sh) having PPS changes in DTB file
  2. Replace updated DTB file in /boot/dtb/ folder on target and reboot

So, we reflashed the dtb partition on SD card using below command (with board in recovery mode and SD card present in board),

sudo ./flash.sh -k DTB –-image  tegra210-p3448-0000-p3449-0000-b00.dtb jetson-nano-2gb-devkit  mmcblk0p1

After above, the PPS changes in DTS file worked without additional changes.

Below are the snippets of PPS working after board reboot.

//shows the new source
$ dmesg | grep -i pps
...
[    0.579195] pps_core: LinuxPPS API ver. 1 registered
[    0.579200] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
...
[    1.275812] pps_ldisc: PPS line discipline registered
[    1.276174] pps pps0: new PPS source pps.-1
...

//shows source name
$ cat /sys/class/pps/pps0/name
pps.-1

$ ls /sys/class/pps/pps0
assert  clear  dev  echo  mode  name  path  power  subsystem  uevent

$ cat /sys/class/pps/pps0/assert
1640008151.978396572#73

//shows the pin configured for PPS input
$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-255, parent: platform/6000d000.gpio, tegra-gpio:
...
 gpio-12  (SPI1_MOSI           )
 gpio-13  (SPI1_MISO           )
 gpio-14  (SPI1_SCK            )
 gpio-15  (SPI1_CS0            |pps-gpio            ) in  hi IRQ
 gpio-16  (SPI0_MOSI           )
 gpio-17  (SPI0_MISO           )
 gpio-18  (SPI0_SCK            )
 gpio-19  (SPI0_CS0            )
 gpio-20  (SPI0_CS1            )
...

Thank you for your support.

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