[LinuxPPS] Fwd: Attaching PPS to kernel
Igor Plyatov
plyatov at gmail.com
Fri Apr 1 10:27:12 CEST 2011
Hello!
For the NMEA reference clock driver with PPS support, you need:
0) Linux kernel with PPS support enabled. I use Linux-2.6.36.
1) timepps.h file from pps-tools installed into /usr/include/
2) right NTP version compiled AFTER timepps.h installation. I use
ntp-4.2.6p3, because ntp-4.2.4p7 does not work correctly with PPS.
3) symbolic links which will link real devices with devices for
refclock.nmea driver from ntpd. Just invoke "ln -s /dev/ttyS0 /dev/gps0"
and "ln -s /dev/pps0 /dev/gpspps0", where /dev/ttyS0 is a UART for GPS
receiver with NMEA sentences and /dev/pps0 is a PPS device.
4) ntpd.conf configuration file:
#------------------------/etc/ntp.conf start-----------------
# GPS with PPS as the Reference Clock.
server 127.127.20.1 mode 1 prefer minpoll 4
fudge 127.127.20.1 flag1 1 flag2 0 flag3 1
# Allow connection for NTP clients
# This must be adjusted to real IP and mask of used network.
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Allow connection from localhost
restrict 127.0.0.1
#------------------------/etc/ntp.conf end-------------------------
5) read documentation from NTP package, about suitable reference clocks
and their fudge flags.
6) start NTP software as "ntpd -gdn" to look at debugging output.
7) some patience, because ntpd synchronise with GPS only after 15
minutes and PPS source will be used only after this.
8) look at "ntpq -p" command output. Read docs if you don't understand
what its data mean.
9) Good luck!
Best regards!
--
Igor Plyatov
> Please help out with this problem:
>
> -------- Original Message --------
> Subject: Attaching PPS to kernel
> Date: Wed, 30 Mar 2011 19:07:49 +0000
> From: Alvarez, Ralph <ralph.alvarez at windriver.com>
> To: udovdh at xs4all.nl <udovdh at xs4all.nl>
>
>
>
>
>
> Hi,
>
>
>
> Your email was referenced in the
> http://wiki.enneenne.com/index.php/LinuxPPS_NTPD_support article on
> setting up PPS support with NTPD. I’m hoping you’ll be able to help me
> with getting my NTPD to sync on the kernel’s PPS signal/event.
>
>
>
> I was able to verify that my kernel is getting PPS events by:
>
> 1. Checking dmesg log to ensure that “PPS event on source 0 at
> 1291626009.999782403” messages were being logged.
>
> 2. Using PPS-TOOLS “pps-test /dev/pps0” to verify that I’m getting
> “source 0 - assert 1291623265.999472205, sequence: 894 - clear
> 0.000000000, sequence: 0” messages.
>
> 3. Using NMEAD simulator to send “GPRMC” sentences at 1PPS
> intervals (synced to PPS interrupts).
>
>
>
> From what I can tell, the kernel PPS framework is in place and
> functioning as expected. The problem that I’m having is that I’m not
> sure how to “hook” up the PPS signal to the NTPD daemon. From all the
> NTPD configuration documentation I’ve read, I believe that I’m properly
> referencing the correct NMEAD/PPS device “127.127.20.0“ in the ntd.conf
> file. I’ve list the following details below:
>
>
>
> 1. NTPD command used to build NTPD
>
> 2. The output from NTPQ
>
> 3. The output from NTPTIME (note that there’s no PPSIGNAL bit set)
>
> 4. NTP configuration file
>
> 5. NTPD log output.
>
>
>
> Any idea what I’m missing here?
>
>
>
> Any help you can provide would be greatly appreciated !!
>
>
>
> -Ralph
>
>
>
>
>
> NTPD Build options:
>
> -----------------------------
>
> ./configure --without-ntpsnmpd --disable-all-clocks
> --disable-parse-clocks --enable-NMEA --enable-LOCAL-CLOCK
>
>
>
> NTPQ output:
>
> ----------------------
>
> remote refid st t when poll reach delay offset
> jitter
>
> ==============================================================================
>
> *GPS_NMEA(0) .GPS. 1 l 9 16 377 0.000 0.224
> 0.164
>
> Mon Dec 6 08:10:02 GMT 2010
>
>
>
>
>
> NTPTIME output:
>
> ----------------------
>
> ntp_gettime() returns code 0 (OK)
>
> time d0a718da.ecc4b000 Mon, Dec 6 2010 8:10:02.924, (.924876),
>
> maximum error 5185 us, estimated error 226 us
>
> ntp_adjtime() returns code 0 (OK)
>
> modes 0x0 (),
>
> offset 216.000 us, frequency 7.567 ppm, interval 1 s,
>
> maximum error 5185 us, estimated error 226 us,
>
> status 0x1 (PLL),
>
> time constant 4, precision 1.000 us, tolerance 500 ppm,
>
>
>
>
>
> NTP CONF output:
>
> ----------------------
>
> #
>
> # NTP configuration file (ntp.conf)
>
> #
>
> server 127.127.20.0 mode 1 minpoll 4 # PPS from GPS2
>
> fudge 127.127.20.0 time1 0.126 flag1 1 flag2 0 flag3 1 stratum 1 refid GPS
>
>
>
> #
>
> # Access control stuff
>
> #
>
> restrict default noserve # default deny
>
> restrict 127.0.0.1 # allow local host
>
> restrict 128.4.0.0 mask 255.255.0.0 # allow DCnet clients
>
> restrict 128.175.0.0 mask 255.255.0.0 # allow UDel clients
>
> restrict 140.173.0.0 mask 255.255.0.0 # allow DARTnet/CAIRN clients
>
>
>
> broadcastclient # broadcast client
>
>
>
>
>
> #
>
> # Miscellaneous stuff
>
> #
>
> statsdir /var/log/ntp/server
>
> filegen loopstats file loopstats type day enable
>
> driftfile /var/log/ntp/server/drift
>
> logfile /var/log/ntp/server/messages
>
>
>
>
>
> Output from NTPD:
>
> root at EDU1-A19:/root> /usr/bin/ntpd -Adng -c /etc/server.ntp.conf
>
> ntpd 4.2.6p3 at 1.2290 Tue Mar 29 22:46:51 UTC 2011 (1)
>
> 6 Dec 08:33:09 ntpd[7309]: proto: precision = 1.000 usec
>
> event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
>
> Finished Parsing!!
>
> 6 Dec 08:33:09 ntpd[7309]: ntp_io: estimated max descriptors: 1024,
> initial socket boundary: 16
>
> 6 Dec 08:33:09 ntpd[7309]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
>
> 6 Dec 08:33:09 ntpd[7309]: Listen and drop on 1 v6wildcard :: UDP 123
>
> 6 Dec 08:33:09 ntpd[7309]: Listen normally on 2 lo 127.0.0.1 UDP 123
>
> restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00003000 flags
> 00000001
>
> 6 Dec 08:33:09 ntpd[7309]: Listen normally on 3 eth0 10.10.11.189 UDP 123
>
> restrict: op 1 addr 10.10.11.189 mask 255.255.255.255 mflags 00003000
> flags 00000001
>
> 6 Dec 08:33:09 ntpd[7309]: Listen normally on 4 lo ::1 UDP 123
>
> restrict: op 1 addr ::1 mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
> mflags 00003000 flags 00000001
>
> 6 Dec 08:33:09 ntpd[7309]: Listen normally on 5 eth0
> fe80::827f:2cff:fe31:d600 UDP 123
>
> restrict: op 1 addr fe80::827f:2cff:fe31:d600 mask
> ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff mflags 00003000 flags 00000001
>
> 6 Dec 08:33:09 ntpd[7309]: peers refreshed
>
> 6 Dec 08:33:09 ntpd[7309]: Listening on routing socket on fd #22 for
> interface updates
>
> restrict: op 1 addr 0.0.0.0 mask 0.0.0.0 mflags 00000000 flags 00000002
>
> restrict: op 1 addr :: mask 0.0.0.0 mflags 00000000 flags 00000002
>
> restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00000000 flags
> 00000000
>
> restrict: op 1 addr 128.4.0.0 mask 255.255.0.0 mflags 00000000 flags
> 00000000
>
> restrict: op 1 addr 128.175.0.0 mask 255.255.0.0 mflags 00000000 flags
> 00000000
>
> restrict: op 1 addr 140.173.0.0 mask 255.255.0.0 mflags 00000000 flags
> 00000000
>
> 6 Dec 08:33:09 ntpd[7309]: io_setbclient: Opened broadcast client on
> interface #3 eth0
>
> io_setbclient: Opened broadcast clients
>
> peer_clear: at 0 next 1 associd 25578 refid INIT
>
> 6 Dec 08:33:09 ntpd[7309]: refclock_open /dev/gps0: No such file or
> directory
>
> Connection from 127.0.0.1 at Mon Dec 6 08:33:09 2010
>
> 6 Dec 08:33:09 ntpd[7309]: GPS_NMEA(0) serial /dev/gps0 open at 4800 bps
>
> event at 0 GPS_NMEA(0) 8011 81 mobilize assoc 25578
>
> newpeer: 127.0.0.1->127.127.20.0 mode 3 vers 4 poll 4 4 flags 0x9 0x1
> ttl 1 key 00000000
>
> event at 0 0.0.0.0 c016 06 restart
>
> event at 0 0.0.0.0 c012 02 freq_set kernel 7.554 PPM
>
> refclock_transmit: at 1 127.127.20.0
>
> event at 1 GPS_NMEA(0) 802b 8b clock_event clk_no_reply
>
> nmea: gpsread 70
> $GPRMC,083311,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6A
>
> nmea: timecode 70
> $GPRMC,083311,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6A
>
> nmea: gpsread 70
> $GPRMC,083312,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*69
>
> nmea: timecode 70
> $GPRMC,083312,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*69
>
> nmea: gpsread 70
> $GPRMC,083313,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*68
>
> nmea: timecode 70
> $GPRMC,083313,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*68
>
> nmea: gpsread 70
> $GPRMC,083314,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6F
>
> nmea: timecode 70
> $GPRMC,083314,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6F
>
> nmea: gpsread 70
> $GPRMC,083315,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6E
>
> nmea: timecode 70
> $GPRMC,083315,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6E
>
> nmea: gpsread 70
> $GPRMC,083316,A,3426.7827,N,11838.4318,W,000.0,218.8,061210,013.7,E*6D
>
>
>
>
>
> Ralph Alvarez
>
> Member of Technical Staff
>
> Wind River Systems
>
> 895 Dove Street #315
>
> Newport Beach, CA 92660
>
> Phone: 949-851-4689 Fax: 949-851-4677
>
> Email: ralvarez at windriver.com <mailto:ralvarez at windriver.com>
>
>
> _______________________________________________
> LinuxPPS mailing list
> LinuxPPS at ml.enneenne.com
> http://ml.enneenne.com/cgi-bin/mailman/listinfo/linuxpps
> Wiki: http://wiki.enneenne.com/index.php/LinuxPPS_support
More information about the LinuxPPS
mailing list