Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


PC Engines APU / u-blox 6 Timing receiver / NTP


  • PC Engines APU
  • Additional serial port(s)
  • u-blox 6 timing receiver (evaluation kit)


Install and configure OS

  • Install Voyage linux using PXE (network) or USB.
  • After installation, log in as root (password voyage) and remount read/write.
    # remountrw
  • Create non root user.
    useradd username
    passwd username
  • Change hostname /etc/hosts /etc/hostname, configure network.
  • Change apt mirrors in /etc/apt/…
  • Install prerquisites.
    apt-get install dialog setserial
  • Update.
    apt-get update
    apt-get upgrade
  • Configure time zone.
    dpkg-reconfigure tzdata
  • Configure locale.
    apt-get install locales
    dpkg-reconfigure locales
  • Edit Voyage Linux config to enable writing to ntp drift file. Edit /etc/default/voyage-util

Install and configure gpsd

  • Install gpsd.
    apt-get install gpsd gpsd-clients
  • Reconfigure gpsd, add the -n option:
    dpkg-reconfigure gpsd
    # GPS device /dev/gps0
    # Add -n option

Install and configure NTPd

  • We need to compile NTP to enable ATOM PPS support.
    (apt-get remove ntp ntp-doc)
    cd /root
    apt-get install dpkg-dev dialog devscripts fakeroot pps-tools
    apt-get source ntp && apt-get build-dep ntp
    cd ntp-4.2.6.p5+dfsg
    debuild -us -uc
    cd ..  
    dpkg --install ntp_4.2.6.p5+dfsg-2+deb7u1_amd64.deb
    dpkg --install ntp-doc_4.2.6.p5+dfsg-2+deb7u1_all.deb  
  • Configure NTPd to run at the highest priority. Edit /etc/default/ntp
    NTPD_OPTS='-g -N'
  • Create PPS device and set low_latency. Add udev rules. Create /etc/udev/rules.d/gps.rules.
    KERNEL=="ttyS2", SYMLINK+="gps0"
    KERNEL=="ttyS2", RUN+="/bin/setserial -v /dev/%k low_latency"
    KERNEL=="ttyS2", RUN+="/usr/sbin/ldattach pps /dev/%k"
  • Configure /etc/ntp/conf.
    # Allow more distance between GPS (USB) and Serial PPS.
    # Stratum level 12 when no ref source available
    tos mindist 0.100 orphan 12
    driftfile /var/lib/ntp/ntp.drift
    leapfile  /var/lib/ntp/leap-seconds
    statsdir  /var/log/ntpstats/
    statistics loopstats peerstats clockstats
    filegen loopstats file loopstats type day enable
    filegen peerstats file peerstats type day enable
    filegen clockstats file clockstats type day enable
    # Local servers
    # ATOM PPS (/dev/pps0)
    server minpoll 4 maxpoll 4
    fudge refid PPS
    # GPS (USB /dev/ttyACM0)
    server minpoll 4 maxpoll 4 prefer
    fudge refid GPSd
    fudge time1 0.063
    # By default, exchange time with everybody, but don't allow configuration.
    restrict -4 default limited kod notrap nomodify nopeer noquery
    restrict -6 default limited kod notrap nomodify nopeer noquery
    # Local users may interrogate the ntp server more closely.
    restrict ::1
  • Remove /var/lib/ntp/ntp.conf.dhcp
  • Disable automatic update of ntp package. Remember to update it yourself in case of security updates!
    sudo apt-mark hold ntp ntp-doc
  • Reboot and check results.

Leap second file

Automatic download of new leap second file.

  • Install lftp.
    apt-get install lftp
  • Create leap second download script: /usr/local/bin/
  • Change executable mode
    chmod +x /usr/local/bin/
  • Download new file weekly. Create /etc/cron.weekly/leapsecond
  • Change executable mode
    chmod +x /etc/cron.weekly/leapsecond


  • Make sure gpsd and ntpd start at boot. If not, enable it.
    update-rc.d ntp enable
    update-rc.d gpsd enable
  • Test PPS reception.
    # ppswatch /dev/pps0
    trying PPS source "/dev/pps0"
    found PPS source "/dev/pps0"
    timestamp: 1403289214, sequence: 11, offset:  81613988
    timestamp: 1403289214, sequence: 11, offset:  81613988
    timestamp: 1403289215, sequence: 12, offset:  81607583
    timestamp: 1403289215, sequence: 12, offset:  81607583
    timestamp: 1403289216, sequence: 13, offset:  81609303
    timestamp: 1403289216, sequence: 13, offset:  81609303
    timestamp: 1403289217, sequence: 14, offset:  81601958
  • Check ntpq status. The 'o' means, PPS is working.
    $ ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ============================================================================== .PZF.            1 u   47   64    1    0.270   12.367   0.001     2 u   48   64    1    0.293   12.720   0.001
     ntp3.home.polai .DCF.            1 u   47   64    1    0.300   13.941   0.001
    oPPS(0)          .PPS.            0 l    -   16    7    0.000   12.355   0.102
    *SHM(0)          .GPSd.           0 l    2   16    7    0.000    1.188   1.431
    # After a while...
         remote           refid      st t when poll reach   delay   offset  jitter
    ============================================================================== .PZF.            1 u   56   64  377    0.292   -0.099   0.075     2 u   50   64  377    0.289    0.638   0.086
    +ntp3.home.polai .DCF.            1 u   41   64  377    0.237    1.656   0.048
    oPPS(0)          .PPS.            0 l   15   16  377    0.000    0.027   0.003
    *SHM(0)          .GPSd.           0 l   16   16  377    0.000   -8.657   2.708
  • Show connected clients:
    ntpdc -c monlist
  • Verify leap variables:
    ntpq -c "rv 0"
    associd=0 status=0118 leap_none, sync_pps, 1 event, no_sys_peer,
    version="ntpd 4.2.6p5@1.2349-o Tue Jan  6 09:09:39 UTC 2015 (1)",
    processor="x86_64", system="Linux/3.10.11-voyage", leap=00, stratum=1,
    precision=-22, rootdelay=0.000, rootdisp=85.497, refid=PPS,
    reftime=d8562b21.98df89e1  Tue, Jan  6 2015 10:36:33.597,
    clock=d8562b2d.36477b48  Tue, Jan  6 2015 10:36:45.212, peer=27238, tc=4,
    mintc=3, offset=0.000, frequency=0.000, sys_jitter=8.116,
    clk_jitter=65.587, clk_wander=0.000, leapsec=201207010000,

Configure, firmware update ublox 6 module

The module is attached to an embedded device and you cannot run Windows on the APU system board. The following directions will let you pass through the serial device to a Windows computer over the network. Then you will be able to run the u-center GNSS evaluation software for Windows.

APU config

  • Install socat.
    apt-get install socat
  • Connect serial to TCP port.
    socat file:/dev/ttyACM0,raw,echo=0 tcp-l:3006,fork&

Windows config

I'm using Windows 7 in this example.

  • The com0com.sys is a test-signed kernel-mode driver that will not load by default. NOTE: Enabling test signing will impair computer security. To enable test signing, enter command:
    bcdedit.exe -set TESTSIGNING ON
  • Reboot
  • Download and install com0com and com2tcp
  • Launch setup to determine virtual com port pair. In my case it's COM5 ⇔ COM6
  • Start cmd.exe, run:
    com2tcp.exe --ignore-dsr \\.\COM6 3006
  • Run u-center, go to Receiver → Port → COM5
  • Receiver → Generation → u-blox 6


  • SBAS → Subsystem: Disabled.
  • TMODE2 → Fixed location. As a rule of thumb the position should be known with an accuracy of better than 1 m for a timing accuracy in the order of nanoseconds. If an accuracy is required only in the order of microseconds, a position accuracy of roughly 300 m is sufficient. If the position is known, the receiver can provide an accurate time solution by tracking only one satellite. For an unknown position, the receiver needs a minimum of four satellites to calculate a position fix and to solve for a timing solution. This is known as survey-in and can be chosen using the UBX-CFG-TMODE2 message. It is recommended to use survey-in only for non-moving platform applications. For optimal performance a known fixed position of the antenna should be used.
  • NAV5 → Dynamic Model: Stationary
  • TP5 → Active, 1Hz, 0, Lock to GNSS, Other setting, 1Hz, 100000us, Align Pulse to TOW, 0-UTC time, clear invert pulse.
pc_engines_apu_ublox_6_timing_gps_ntp.txt · Last modified: 2021/10/09 15:14 by