[LinuxPPS] Tentative Success using git:linuxpps and ntp-4.2.4 ; and a question

Scott Doty scott-lpps at ponzo.net
Thu Jan 25 17:20:34 CET 2007


Hi,

After having our Linux 2.4 PPSKit box die in the Summer heat, I started back
up with this project, using the linuxpps git repository, (including the NMEA driver
patch to ntp), using ntp-4.2.4.  I can report some measure of success...

Hardware verification:  To ensure a PPS signal is making it to CD on the
serial port, one can run the following:

   # while : ; do cat /proc/tty/driver/serial ; done

...which should show CD pulsing once every second (as it does on my system).

Kernel:  I retrieved the latest linuxpps repo from enneenne.com...

   git clone git://git.enneenne.com/linuxpps

Alas, the system I was building this on was our old RH73+fedoralegacy
distribution that we used before moving to CentOS.  I used our RH73 distro,
as I thought I'd be using Linux 2.4 + PPSKit -- but for that to work, I
would have needed ntp 4.0 + patches, which starts to get messy.  (Not to
mention having to find ntp 4.0, with 4.2.4 the latest stable release...)

Anyway, the default RH7.3+fedoralegacy compiler is the RH bastardized
version of gcc that gnu said they wouldn't maintain... and it is too old to
build a recent 2.6 kernel.  It also has trouble detecting the PPS API when
running ./configure on ntp-4.2.4.  In a nutshell:  Better success can be
found using a newer compiler -- I finally broke down and grabbed gcc-4.1.1
from ftp.gnu.org and did a "make bootstrap" to get a modern compiler on the
system:

      _[/usr/src/sbin/git.enneenne.com]_(root at time2.sr)_
      # /opt/gcc/bin/gcc -v
      Using built-in specs.
      Target: i686-pc-linux-gnu
      Configured with: ../gcc-4.1.1/configure --prefix=/opt/gcc-4.1.1
      Thread model: posix
      gcc version 4.1.1

I'd built the linuxpps kernel on another system...

   # cat /etc/redhat-release 
   CentOS release 4.4 (Final)

...but I decided I wanted to try to get this self-hosted, hence, the new compiler.

Anyway:  I also made some decisions about kernel clocking and pre-emption,
settling with the 1000hz clock + maximum pre-emptibility (i.e., "low-latency
desktop"), which seemed more suited to realtime applications.  (Please let
me know if this sounds correct or not...)

_[/usr/src/sbin/ntp-4.2.4]_(root at time2.sr)_
# head Do_Config
#!/bin/sh

export CC=/opt/gcc/bin/gcc

./configure --enable-ipv6=no --enable-fast-install=no \
        --disable-all-clocks --disable-parse-clocks \
        --enable-NMEA --enable-LOCAL-CLOCK

Following configuration, I verified that PPS was enabled for ntp, as
recommended in the wiki:

   _[/usr/src/sbin/ntp-4.2.4]_(root at time2.sr)_
   # fgrep HAVE_PPSAPI config.h
   #define HAVE_PPSAPI 1

So after a "make install" for ntp-4.2.4, plus running the linuxpps kernel:

   # which ntpd
   /usr/local/bin/ntpd

 ... I ran ntpd -d for testing.

Here's the thing, though -- when I run ntptime, I get:

      _[/root]_(root at time2.sr)_
      # ntptime
      ntp_gettime() returns code 0 (OK)
        time c963511c.98a60000  Thu, Jan 25 2007  7:54:04.596, (.596283),
        maximum error 8817 us, estimated error 18 us
      ntp_adjtime() returns code 0 (OK)
        modes 0x0 (),
        offset 2486.000 us, frequency 40.875 ppm, interval 1 s,
        maximum error 8817 us, estimated error 18 us,
        status 0x1 (PLL),
        time constant 4, precision 1.000 us, tolerance 512 ppm,

With PPSKit, this would mention "PPS" in the status -- does this look like
the PPS signal is working?  Comment would be very much appreciated.

More bits from the system appended...thanks!

 -Scott
p.s.

One problem that came up was this error:

   refclock_nmea: cannot find PPS path "ttyS0" in the system

The solution:  I had a symlink /dev/gps0 -> ttyS0 -- to fix, the full path must be in the
symlink target,e.g.:  # cd /dev ; ln -sf /dev/ttyS0 gps0

Also, I was showing double-digit estimated errors until I
did a "setserial /dev/gps0 low_latency" -- not sure if that
helped or not, but ntptime now reads:

ntp_gettime() returns code 0 (OK)
  time c9635675.12f45000  Thu, Jan 25 2007  8:16:53.074, (.074040),
  maximum error 4324 us, estimated error 7 us
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 1711.000 us, frequency 43.621 ppm, interval 1 s,
  maximum error 4324 us, estimated error 7 us,
  status 0x1 (PLL),
  time constant 4, precision 1.000 us, tolerance 512 ppm,

Here are some more tidbits:

# uname -a
Linux time2.sr.sonic.net 2.6.19 #1 SMP PREEMPT Wed Jan 24 15:23:46 PST 2007 i686 unknown

# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 8
model name      : Pentium III (Coppermine)
stepping        : 3
cpu MHz         : 751.762
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse up
bogomips        : 1504.19

# free # note: noticed I didn't have swap configured, I've just added it to fstab below...
             total       used       free     shared    buffers     cached
Mem:        253288     235180      18108          0      73104      75268
-/+ buffers/cache:      86808     166480
Swap:      1052248          0    1052248

# cat /proc/pps/sources 
id      mode    echo    name                    path
----    ------  ----    ----------------        ----------------
00      1133    no      serial0         /dev/ttyS0
01      1133    no      serial1         /dev/ttyS1

# lspci
00:00.0 Host bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)
00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 02)
00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB (rev 01)
00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 02)
00:0c.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 08)
00:0d.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 08)
00:0e.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200 (rev 01)
00:0f.0 SCSI storage controller: Adaptec AIC-7892A U160/m (rev 02)

My kernel config can be found here:
   http://sonic.net/scott/time2/sd.scoured.linuxpps.config

/sd



More information about the LinuxPPS mailing list