AGX Xavier PPS fetch timeout R35.2.1(R32.7.1 works fine)

Hi NV_Team,

AGX Xavier using L4T-R32.7.1 works fine with pps, but L4T-R35.2.1 can’t get pps (timeout), please help to check R35.2.1need patch ?

dtsi

	pps {
		// here use gpio for the pin in which you want pps signal. SYNC_IN
		gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(A, 0) GPIO_ACTIVE_LOW>; 
		compatible = "pps-gpio";
		assert-falling-edge;
		status = "okay";
	};

pps-gpio.c

diff --git a/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/clients/pps-gpio.c b/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/clients/pps-gpio.c
old mode 100644
new mode 100755
index e0de1df2e..21c64669e
--- a/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/clients/pps-gpio.c
+++ b/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/clients/pps-gpio.c
@@ -110,12 +110,12 @@ static int pps_gpio_setup(struct platform_device *pdev)
        data->gpio_pin = devm_gpiod_get(&pdev->dev,
                NULL,   /* request "gpios" */
                GPIOD_IN);

        if (IS_ERR(data->gpio_pin)) {
                dev_err(&pdev->dev,
                        "failed to request PPS GPIO\n");
                return PTR_ERR(data->gpio_pin);
        }

        data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
                        "echo",
                        GPIOD_OUT_LOW);
@@ -186,9 +186,10 @@ static int pps_gpio_probe(struct platform_device *pdev)
        } else {
                ret = pps_gpio_setup(pdev);
                if (ret)
-                       return -EINVAL;
+                       return ret; //  return -EINVAL;
        }
-
+       pr_err("%s: add some debug prints...Line(%d)\n", __func__, __LINE__);
+       
        /* IRQ setup */

diff --git a/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/pps.c b/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/pps.c
index 22a65ad4e..7aa30d719 100644
--- a/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/pps.c
+++ b/l4t-r35.2.1-jp5.1ga/kernel/kernel-5.10/drivers/pps/pps.c
@@ -179,12 +179,16 @@ static long pps_cdev_ioctl(struct file *file,
                dev_dbg(pps->dev, "PPS_FETCH\n");
 
                err = copy_from_user(&fdata, uarg, sizeof(struct pps_fdata));
-               if (err)
+               if (err) {
+                       pr_err("%s: add some debug prints...copy Line(%d)\n", __func__, __LINE__);
                        return -EFAULT;
+               }
 
                err = pps_cdev_pps_fetch(pps, &fdata);
-               if (err)
+               if (err) {
+                       pr_err("%s: add some debug prints...fetch Line(%d)\n", __func__, __LINE__);
                        return err;
+               }
 
                /* Return the fetched timestamp */
                spin_lock_irq(&pps->lock);

dmesg log

root@nvidia-desktop:/sys/kernel/debug/dynamic_debug# sudo ppswatch -a /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)

.....
[ 2641.072167] pps pps0: PPS_FETCH
[ 2641.072177] pps pps0: timeout 3.000000000
[ 2644.143637] pps_core: pps_cdev_ioctl: add some debug prints...fetch Line(189)
[ 2644.143896] pps pps0: PPS_FETCH
[ 2644.143907] pps pps0: timeout 3.000000000
[ 2646.547452] pps pps0: pending signal caught
[ 2646.547464] pps_core: pps_cdev_ioctl: add some debug prints...fetch Line(189)
1 Like

Hi Luna2020,

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

Have you refer to the following topic to configure for pps on R35.2.1?
Can’t enable PPS on Jetson AGX Xavier - Jetson & Embedded Systems / Jetson AGX Xavier - NVIDIA Developer Forums

Can’t enable PPS on AGX Xavier - Jetson & Embedded Systems / Jetson AGX Xavier - NVIDIA Developer Forums

Hi KevinFFF,

we have fix this bug and setting pps gpio high. Thanks.

		gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(A, 0) GPIO_ACTIVE_HIGH>; //not  GPIO_ACTIVE_LOW

1 Like

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