NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 3

Pulse Per Second (at RS232 Level)

DCD

Attached the scope to verify the PPS signal.  This is a slightly confusing waveform as the signal is inverted on the wire (it is inverted back to the original when is passes through the MAX3232). Essentially the PPS signal is a the rising edge (falling edge here) and is a pulse of approx 200ms duration.  (This 200ms ON, 800ms OFF makes the LED on the receiver box flash in a friendly way).

Once inverted and converted to 3.3V the PPS signal presents itself at GPIO 18 as a rising edge.

A Raspberry PI Kernel with PPS Support

For precision timing you want the latency from the rising edge on the PPS signal to its processing to be as small as possible.  There are inevitably some delays (in the wires and gates) but ideally you would like a hardware level interrupt and then a kernel mode event rather than polling or a switch into user space.  Fortunately the hard work has already been done and kernels are available with PPS support built-in.  A kernel with PPS bound to GPIO 18 is available here  http://ntpi.openchaos.org/downloads/. (Detailed instructions on how to recompile with PPS support are given but the kernel can be used as-is to get going).

Download the Kernel, Format an SD card, copy kernel onto card, Plug in serial card, attach to GPS receiver via a Serial Modem Cable (Straight through cable) and power on the GPS and Pi.

Powering On and Testing PPS

The kernel provided by openchaos.org is almost perfect for my needs but needs a couple of tweaks, specifically on start-up it runs gpsd which connects to the serial device (/dev/ttyAMA0).  To disable gpsd remove the links in /etc/rc[0-9].d and reboot

Once restarted ensure that the Pi is attached to a network and then configure the ethernet interface.  The eth0 interface defaults to DHCP but I prefer static for my LAN so changed the entries in /etc/interfaces to be…

iface eth0 inet static
address 192.168.1.7
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

(and then restarted).

Once restarted, download ppstest tool…

apt-get install pps-tools

And then look for a PPS signal on the /dev/pps0 device using ppstest.  (It should be noted that for the PPS signal to be present the VP Oncore must have locked and be solving for time; the LED on the receiver should be flashing contentedly).

(Incidentally the default login for the kernel is pi/raspberry; then sudo su – to become root)

root@ntpi:/etc/network# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1388358515.999999495, sequence: 14437 - clear  0.000000000, sequence: 0
source 0 - assert 1388358516.999999285, sequence: 14438 - clear  0.000000000, sequence: 0
source 0 - assert 1388358517.999999074, sequence: 14439 - clear  0.000000000, sequence: 0
source 0 - assert 1388358518.999999866, sequence: 14440 - clear  0.000000000, sequence: 0
^C

As can be seen we are receiving data at regular 1 second intervals. All looking good!

Part 4

Advertisements

About nivagswerdna

Professional Geek
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 3

  1. Pingback: NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 2 | aardvarklabs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s