Pps-gpio overlay?

Has anyone created a pps-gpio overlay to allow the pps-gpio.ko kernel module to use a rock pi gpio pin?

Similar to https://github.com/raspberrypi/linux/blob/rpi-4.4.y/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts for RPI perhaps?

Hey Dave,

I just came across this and I was wondering if you ever found a solution? I’m looking to use PPS for accurate GPS time.

Best

Yes, something like this should work (for GPIO block 2 pin 14).

Or you can just get one of mine prebuilt at https://centerclick.com/ntp/

/dts-v1/;
/plugin/;

/ {
 compatible = "rockchip,rk3308";

 // Enable GPS PPS input pin
 fragment@0 {
  target-path = "/";
  __overlay__ {
   pps: pps {
    compatible = "pps-gpio";
    pinctrl-names = "default";
    pinctrl-0 = <&pps_pins>;
    gpios = <&gpio2 14 0>;
    status = "okay";
   };
  };
 };
 fragment@1 {
  target = <&gpio2>;
  __overlay__ {
   pps_pins: pps_pins {
    rockchip,pins =     <14>;
    rockchip,function = <0>;    // in
    rockchip,pull =     <0>;    // off
   };
  };
 };
};
2 Likes

Hi Dave,

thanks so much for the overlay! My hardware finally came in today, and I’m excited to get this working! I can read the NMEAs via UART, so I know the module itself works. I wasn’t sure chich pin GPIO block 2 pin 14 was, so I decided to try with GPIO0_C1 from here - I have hardware version 1.2. Accordingly, I modified the overlay to look like this:

/dts-v1/;
/plugin/;

/ {
 compatible = "rockchip,rk3308";

 // Enable GPS PPS input pin
 fragment@0 {
  target-path = "/";
  __overlay__ {
   pps: pps {
    compatible = "pps-gpio";
    pinctrl-names = "default";
    pinctrl-0 = <&pps_pins>;
    gpios = <&gpio0 17 0>;
    status = "okay";
   };
  };
 };
 fragment@1 {
  target = <&gpio0>;
  __overlay__ {
   pps_pins: pps_pins {
    rockchip,pins =     <17>;
    rockchip,function = <0>;    // in
    rockchip,pull =     <0>;    // off
   };
  };
 };

Unfortunately, all I’m seeing in dmesg is this:
[ 0.759143] pps_core: LinuxPPS API ver. 1 registered
[ 0.759156] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
[ 8.015014] rockchip-pinctrl pinctrl: unable to find group for node pps_pins

I’m on the latest Armbian.

Do you have a version of this overlay running on the devices you sell? How did you calculate the pin number? Am I right that GPIO 2 pin 14 would be GPIO2_B5? Thank you so much for your help!

I tried dave444 's device tree overlay, and it shows rockchip-pinctrl pinctrl: unable to find group for node pps_pins too.

But after that, I came accross mill1000’s post. He shows how to enable pps-gpio on rock64.
I noticed that his dtoverlay only contains the definition part of dave444’s dts, but it did work.

That’s how I add his overlay (btw I use armbian):

  1. Grab the dts and save it on to disk (in my case pps.dts):
/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3308";
	fragment@0 {
		target-path = "/";
		__overlay__ {
			pps: pps@0 {
				compatible = "pps-gpio";
				gpios = <&gpio0 16 0>; // gpio0 c0
			};
		};
	};
};
  1. Add it to your overlay.
  • i. by armbian-add-overlay:
    sudo armbian-add-overlay pps.dts
  • ii. by hand (haven’t tested it yet but should work):
    dtc -I dts -O dtb -o pps.dtbo pps.dts
    sudo cp pps.dtbo /boot/dtb/rockchip/overlay/
    and add bootenv to load dtoverlay: add overlays=pps line to /boot/armbianEnv.txt
  1. Reboot and it should work!

To check whether it works or not, run sudo dmesg | grep pps and it should print something like

[    0.759120] pps_core: LinuxPPS API ver. 1 registered
[    0.759131] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    9.235459] pps pps0: new PPS source pps@0.-1
[    9.235669] pps pps0: Registered IRQ 43 as PPS source

Cheers!
amenekowo

Hey there,

just wanted to let you know that this works perfectly for me! Thanks for looking it up and putting together the information like that!

I’ve had to revert to the official Radxa Debian Buster images, and the manual compilation and installing the device tree overlay works as described. I added a -@ to the command as per the manpage, but I can imagine that it would have worked regardless.

I’m currently seeing accuracy at the level of 3000 ns in chrony. Admittedly, my GPS signal isn’t that great, but I think it should be possible to reduce this by about an order of magnitude. What deviation are you seeing?

Cheers!

Sorry for late reply. I was busy preparing for exam in June.
“-@” seems to have something with symbols generation. In my thought, it feels like as a pointer in device tree, but don’t know whether it’s a right understanding :smile:
I used u-blox’s LEA-M8T module for GPS timing.
My accuracy is:
Residual freq : -0.001 ppm
Skew : 0.041 ppm
-1920ns[-2810ns] +/- 1100ns
My GPS signal is not that good because my receiver is at balcony, therefore it can’t see a full sky. But I’m satisfied with this.
Really don’t have a application scene, it’s just so much fun playing with high accuracy time base. :rofl: