596 | | One handy feature of an on-board GPS is that it can deliver Pulse-Per-Second (PPS) signal. This signal can be used to get a high-precision time reference that an application can use to adjust system clock time. Common use is to configure the Network Time Protocol Daemon (NTPD) with a PPS source to obtain a wallclock-time with sub-millisecond synchronization to UTC. |
597 | | |
598 | | Our 14.08 BSP for both Laguna and Ventana families includes PPS support already (if a GPS is present). However, in order to hook NTPD with a PPS source, you have to have the fully featured ntpd package (i.e. not busybox). Below is an example of how to configure ntpd to use GPS and use PPS to keep syncronization: |
| 596 | One handy feature of an on-board GPS is that it can deliver Pulse-Per-Second (PPS) signal. This signal can be used to get a high-precision time reference that an application can use to adjust system clock time. |
| 597 | |
| 598 | PPS is supported by the Linux kernel by the {{{pps-gpio}}} driver (CONFIG_PPS_CLIENT_GPIO). This adds a pps device to {{{/sys/class/pps}}} which you can interact with: |
| 599 | {{{#!bash |
| 600 | # cat /sys/class/pps/pps0/assert |
| 601 | 170026870.983207967#8 |
| 602 | }}} |
| 603 | * The above shows the most recent timestamp and sequence number that has been asserted via PPS |
| 604 | |
| 605 | Common use is to configure the Network Time Protocol Daemon (NTPD) with a PPS source to obtain a wallclock-time with sub-millisecond synchronization to UTC. |
| 606 | |
| 607 | The various Gateworks Board Support Packages includes PPS support (if a GPS is present). However, in order to hook NTPD with a PPS source, you have to have the fully featured ntpd package (i.e. not busybox). Below is an example of how to configure ntpd to use GPS and use PPS to keep syncronization: |
612 | | |
613 | | For BSP's that do not include PPS by default, refer to the following guide. |
614 | | |
615 | | Gateworks boards with on-board GPS use ARM Host GPIO lines for PPS sources. Therefore you would want to [wiki:OpenWrt/kernelconfig configure your kernel] with: |
616 | | * CONFIG_PPS - enable PPS support |
617 | | * CONFIG_NTP_PPS - enable PPS kernel consumer (direct in-kernel time synch using PPS source) |
618 | | * CONFIG_PPS_CLIENT_GPIO - add support for a PPS source using GPIO |
619 | | * Configure "pps-gpio" driver: |
620 | | * Device-Tree Boards (ie Ventana/Newport): |
621 | | * This is already done in the device tree for on-board GPS. |
622 | | {{{ |
623 | | pps { |
624 | | compatible = "pps-gpio"; |
625 | | pinctrl-names = "default"; |
626 | | pinctrl-0 = <&pinctrl_pps>; |
627 | | gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; |
628 | | status = "okay"; |
629 | | }; |
630 | | |
631 | | pinctrl_pps: ppsgrp { |
632 | | fsl,pins = < |
633 | | MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x1b0b1 |
634 | | >; |
635 | | }; |
636 | | |
637 | | }}} |
638 | | * Non Device-Tree Boards (ie Laguna): |
639 | | * Add a "pps-gpio" platform resource to the kernel board support file (ie arch/arm/mach-cns3xxx/laguna.c for Laguna) |
640 | | - see include/linux/pps-gpio.h for struct pps_gpio_platform_data |
641 | | - define gpio_pin (ie 0 for GW2388) |
642 | | - define gpio_label (ie "GPS_PPS") |
643 | | - define assert_falling_edge=0 (PPS is a rising edge) |
644 | | - define capture_clear=0 (capture PPS 'assertions') |
645 | | - make sure you comment out any other exporting of this GPIO (ie 'GPS_PPS' export from laguna_gpio_gw2388) |
646 | | - this will create an entry in /sys/class/pps/pps0 |