Skip to content

BeagleBone Black as a NTP server using GPS time source

Notifications You must be signed in to change notification settings

guycole/perky-janus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perky-janus

BeagleBone Black as a NTP server using GPS as a time source.

Introduction

This project is to share my experience using a BeagleBone Black to obtain time from a GPS and then sharing time with other computers on a local network. There are many stale posts about this topic, so here is a fresh take to throw on the pile. I am writing this during May, 2022 for the BeagleBone Black (Revision C) using AM3358 Debian 10.3 2020-04-06 4GB SD IoT

The deployment domain is a network of single board computers in a mobile application. Little computers have terrible clock drift, so an external source was a priority. I also needed location (because, mobile) so a GPS was mandatory.

The Plan

  1. Purchase a GPS receiver w/PPS output (probably not a USB device)
  2. Flash a BeagleBone Black w/a fresh image
  3. Install software packages
  4. Configure GPS and PPS
  5. Configure time server

Implementation follows, there is certainly room for substitution.

GPS Receivers

I purchased several inexpensive USB GPS receivers via Amazon, which all delivered location data but would not drive ntpd(8), because they lacked a PPS output.

This GPS Receiver was my solution (w/a powered antenna).

I used a Digilent Digital Discovery to verify the GPS receiver was healthy.

  1. GPS UART output GPS output
  2. GPS PPS output PPS output

Install packages

  1. apt-get install gps
  2. apt-get install gpsd-clients
  3. apt-get install pps-tools
  4. apt-get install ntp

Configure GPS and PPS

The GPS receiver will write ASCII messages to BeagleBone UART1, and send a sync pulse to GPIO_60. gpsd(8) will readily accept the UART messages, but the pps driver will require some extra work.

Pins

Header Pin Name Description
P9 1 DGND Ground
P9 7 SYS_5V GPS VIN
P9 12 GPIO_60 GPS PPP
P9 24 UART1_TXD GPS RX
P9 26 UART1_RXD GPS TX

gpsd(8)

  1. Copy gpsd.default to /etc/default/gpsd

  2. Start gpsd(8) by invoking systemctl restart gpsd.service

  3. Verify gpsd(8) by invoking systemctl status gpsd.service resultsl

  4. Assuming gpsd(8) started, try your luck with cgps(1). resultsl

pps

  1. For reasons, pps will require you to install a device overlay.
  2. git clone https://github.com/RobertCNelson/bb.org-overlays.git
  3. Copy BB-UART1-GPS-00A0.dts to bb.org-overlays/src/arm
  4. Install the overlays by invoking bb.org-overlays/install.sh
  5. Update /boot/uEnv.txt to reference the new overlay uEnv.txtl
  6. Reboot
  7. Test for PPS success ppstestl
  8. gpsmon(1) will demonstrate you have pps working resultsl
  9. ntpshmmon(1) will also verify gpsd using PPS resultsl

Configure Time Server

For my application, there are not internet connected time servers to consult. I want time exclusively from the GPS receiver.

  1. Copy ntpd.conf to /etc/default/ntpd.conf
  2. Restart ntpd(8) by invoking systemctl restart ntpd.service
  3. Verify ntpd(8) by invoking systemctl status ntpd.service
  4. Verify ntpd(8) is reading via shared memory/PPS ntpq

Verify Results

  1. Remove external network connectivity
  2. Disable gpsd via systemctl systemctl stop gpsd.service
  3. Set a bogus date date 042708002020
  4. Restart gpsd systemctl restart gpsd.service
  5. Observe the time eventually become current

Relevant Links

  1. thread w/RCN
  2. overlays on elinux.org
  3. pps on kernel.org
  4. gpsd time service howto
  5. beaglebone-gps-clock
  6. Dan Drown BBB as NTP/GPS
  7. toptechboy python
  8. small golden sceptre
  9. LinuxPPS Wiki

About

BeagleBone Black as a NTP server using GPS time source

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published