1

How to achieve that ntpd synchronizes time from GPS? I have adafruit ultimate gps (without battery). It is connected to raspberry and i got fix. PPS pin not connected. I configured ntpd to use GPS http://www.catb.org/gpsd/gpsd-time-service-howto.html#_feeding_ntpd_from_gpsd

server 127.127.28.0  
fudge 127.127.28.0 time1 0.350 refid GPS

also changed ntp init script to run ntpd as root RUNASUSER=root. if i run ntpq -p, i got:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 SHM(0)          .SHM.            0 l    -    8    0    0.000    0.000   0.000

so, there is no update from GPS and reach is 0.

Here http://blog.petrilopia.net/linux/raspberry-pi-set-time-gps-dongle/ is how to do it without ntp. But then i first must know that gps has fix.

Also in some sites i seen, that some configurations is used address 127.127.20.0. But in official documentation is mentioned 127.127.28.0.

Is it possible to get it work without PPS pin?

ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x4e545030 0          root       600        80         2
0x4e545031 32769      root       600        80         1
0x4e545032 65538      root       666        80         1
0x4e545033 98307      root       666        80         1

ntp version = ntpd [email protected] Fri May 18 20:30:57 UTC 2012 (1)

1
  • Yes, you can get it without PPS - RPi needs some patch to use PPS. Did you check using the gpsd commands that GPS is indeed working? Also checkout satsignal.eu/ntp/Raspberry-Pi-NTP.html
    – d586
    Jan 21, 2015 at 8:50

1 Answer 1

2

I found solution (not clean but it works). I added battery to gps, so date and time is saved. In gps chip specification page 22 $GPRMC contains time and date $GPRMC,191822.247,A,2907.1856,N,19016.4938,E,0.03,165.48,031214,3.05,W,A*2C

And here is /etc/rc.local

#start GPSd
gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
# read date & time from GPS
/bin/bash /date_set_from_gps.sh

cat /date_set_from_gps.sh

#!/bin/bash

# $GPRMC,191749.247,V,,,,,0.17,0.00,031214,,,N*4C
r=`gpspipe -R | head -10 | grep GPRMC | head -1 | awk -F"," '{print $10" "$2}'`
# 031214 191822.247
D="20${r:4:2}-${r:2:2}-${r:0:2} ${r:7:2}:${r:9:2}:${r:11:2}"
# I added prefix 20 to year (to get year with 4 digits ex: 2014)

# set date in UTC format.... -u 
DD=`date -us "$D $T"`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.