Changes between Version 3 and Version 4 of gps


Ignore:
Timestamp:
03/02/2018 10:28:48 PM (5 years ago)
Author:
Tim Harvey
Comment:

update PPS linux details

Legend:

Unmodified
Added
Removed
Modified
  • gps

    v3 v4  
    594594[=#pps]
    595595= Time synchronization via PPS (Pulse-Per-Second) =
    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:
     596One 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
     598PPS 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
     601170026870.983207967#8
     602}}}
     603 * The above shows the most recent timestamp and sequence number that has been asserted via PPS
     604
     605Common 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
     607The 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:
    599608* Make sure you have the fully featured ntpd package via selecting ntpd in [wiki:OpenWrt/kernelconfig].
    600609* Run the following steps (This is on GW5400, please see proper /dev/ttyX for your device) [http://www.catb.org/gpsd/gpsd-time-service-howto.html GPSD Time Service]
     
    610619* That's it! With gpsd and ntpd running, you have successfully configured your system time to come from GPS data.
    611620
    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
    647621
    648622The PPS signal is also routed to a spare pin on the miniPCIe slots of many models:
     
    655629
    656630Reference:
     631 - [https://www.kernel.org/doc/Documentation/pps/pps.txt Linux PPS Documentation]
    657632 - [http://linuxpps.org/wiki/index.php/Main_Page LinuxPPS]
    658   - The Kernel side of PPS support was added in 2.6.31 - see [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=eae9d2ba0cfc27a2ad9765f23efb98fb80d80234 here]
    659633 - [http://www.catb.org/gpsd/gpsd-time-service-howto.html GPSD Time Service] - Lots of examples relating to gpsd
    660634 - [http://tools.ietf.org/html/rfc2783 RFC 2783] - Pulse-Per-Second API for UNIX-like Operating Systems.  This describes the Linux OS API for userland applications to access a PPS source.
    661635 - http://gpsd.berlios.de/gpsd.html - there is some info in the gpsd manpage about PPS, time accuracy and ntp synchronization
    662  - [http://lxr.linux.no/linux+v2.6.38.8/Documentation/pps/pps.txt Documentation/pps/pps.txt] - Linux kernel API/support for synchronizing system time from a PPS source directly (Note this is the API that drivers/pps/clients/pps-gpio.c conforms to)
    663636 - [http://lxr.linux.no/linux+v2.6.38.8/Documentation/ABI/testing/sysfs-pps Documentation/ABI/testing/sysfs-pps] - Linux sysfs pps class documentation (sysfs API for Userland apps to interface with PPS from LinuxPPS kernel support above)
    664637 - [http://lxr.linux.no/linux+v2.6.38.8/include/linux/pps.h include/linux/pps.h] - Linux ioctl pps documentation/support (ioctl API for Userland apps to interface with PPS from LinuxPPS kernel support above)