Re: [chrony-users] Setting up Chrony with PPS

[ Thread Index | Date Index | More Archives ]

Hi Deven,

Before configuring chrony or gpsd you will want to verify that kpps is working.

There are two kernel modules that provide kpps clients, pps-gpio (gpio) and pps-ldisc (serial control line). If you are bringing the timepulse signal in gpio, you will be using the pps-gpio kernel module. You may need to configure which gpio is to used. This is probably done with the device tree.

If either module is being loaded, you should see a device (e.g. pps0) in /sys/class/pps. If your GPS has a lock and the pps kernel module is configured properly, you should see timestamps updating every second, e.g.

$cat /sys/class/pps/pps0/assert 

Are you seeing those?

Rob Calhoun

On Thu, Feb 18, 2016 at 10:25 AM, Deven Hickingbotham <devenh@xxxxxxxxxxx> wrote:
I'm developing a Python 3 app on a Raspberry Pi running Wheezy (Debian 7.8).  I need help selecting the right version of Chrony to use and configuring PPS.  My GPS is an Adafruit Ultimate GPS Hat using ttyAMA0 with PPS on GPIO pin 4.  My app is a mobile one.  It may have internet access via cell phone, but should primarily use PPS.  Time accuracy requirement is only +/- 5ms.

I installed Chrony.  It is v1.24.  I added the changes suggested here to chrony.conf:

The full chrony.conf appears at the end of this post, but these two lines I believe are the important ones:

refclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2
refclock SOCK /var/run/chrony.ttyAMA0.sock refid PPS

I suspect the reference to /var/run/chrony.ttyAMA0.sock may not be correct.

Here is the output of chronyc sources:

pi@gps ~/SystemFiles $ chronyc sources
210 Number of sources = 6
MS Name/IP address           Stratum Poll LastRx Last sample
^*              3    6      4   +682us[+6549us] +/-   80ms
^?               0    6    10y     +0ns[   +0ns] +/-    0ns
^?                0    6    10y     +0ns[   +0ns] +/-    0ns
^+          3    6      1   -357us[ -357us] +/-  107ms
#x GPS                           0    4     14   +346ms[ +347ms] +/- 2838us
#? PP                            0    4    10y     +0ns[   +0ns] +/-    0ns

Note the last line shows PP, not PPS.

So I'd like help getting Chrony 1.24 working with PPS and also some advice as to whether I should upgrade to 2.3.



# This the default chrony.conf file for the Debian chrony package.  After
# editing this file use the command 'invoke-rc.d chrony restart' to make
# your changes take effect.  John Hasler <jhasler@xxxxxxxxxx> 1998-2008

# See for an explanation of these servers.  Please
# consider joining the project if possible.  If you can't or don't want to
# use these servers I suggest that you try your ISP's nameservers.  We mark
# the servers 'offline' so that chronyd won't try to connect when the link
# is down.  Scripts in /etc/ppp/ip-up.d and /etc/ppp/ip-down.d use chronyc
# commands to switch it on when a dialup link comes up and off when it goes
# down.  Code in /etc/init.d/chrony attempts to determine whether or not
# the link is up at boot time and set the online status accordingly.  If
# you have an always-on connection such as cable omit the 'offline'
# directive and chronyd will default to online.
# Note that if Chrony tries to go "online" and dns lookup of the servers
# fails they will be discarded.  Thus under some circumstances it is
# better to use IP numbers than host names.

##server offline minpoll 8
##server offline minpoll 8
##server offline minpoll 8
##server offline minpoll 8

# Look here for the admin password needed for chronyc.  The initial
# password is generated by a random process at install time.  You may
# change it if you wish.

keyfile /etc/chrony/chrony.keys

# Set runtime command key.  Note that if you change the key (not the
# password) to anything other than 1 you will need to edit
# /etc/ppp/ip-up.d/chrony, /etc/ppp/ip-down.d/chrony, /etc/init.d/chrony
# and /etc/cron.weekly/chrony as these scripts use it to get the password.

commandkey 1

# I moved the driftfile to /var/lib/chrony to comply with the Debian
# filesystem standard.

driftfile /var/lib/chrony/chrony.drift

# Comment this line out to turn off logging.

log tracking measurements statistics
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.

maxupdateskew 100.0

# Dump measurements when daemon exits.


# Specify directory for dumping measurements.

dumpdir /var/lib/chrony

# Let computer be a server when it is unsynchronised.

local stratum 10

# Allow computers on the unrouted nets to use the server.

allow 10/8
allow 192.168/16
allow 172.16/12

# This directive forces `chronyd' to send a message to syslog if it
# makes a system clock adjustment larger than a threshold value in seconds.

logchange 0.5

# This directive defines an email address to which mail should be sent
# if chronyd applies a correction exceeding a particular threshold to the
# system clock.

# mailonchange root@localhost 0.5

# This directive tells chrony to regulate the real-time clock and tells it
# Where to store related data.  It may not work on some newer motherboards
# that use the HPET real-time clock.  It requires enhanced real-time
# support in the kernel.  I've commented it out because with certain
# combinations of motherboard and kernel it is reported to cause lockups.

# rtcfile /var/lib/chrony/chrony.rtc

# If the last line of this file reads 'rtconutc' chrony will assume that
# the CMOS clock is on UTC (GMT).  If it reads '# rtconutc' or is absent
# chrony will assume local time.  The line (if any) was written by the
# chrony postinst based on what it found in /etc/default/rcS.  You may
# change it if necessary.
# rtconutc

# set larger delay to allow the NMEA source to overlap with
# the other sources and avoid the falseticker status
refclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2
refclock SOCK /var/run/chrony.ttyAMA0.sock refid PPS

To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.

Mail converted by MHonArc 2.6.19+