This document entails the use of the Connect Tech MPG20X GPS mPCIe or m.2 device as a time source for the system clock.
To communicate with your GPS device(s), you will require the use of the GPS daemon gpsd. This software allows Linux to interpret the native GPS signal over the connected serial interface on the MPG20X devices.
To provide the OS (Operating System) with time data from the MPG20X you will require NTP to be installed, a network time protocol that allows the system time to synchronise with a networked source. In this case the source will be the GPS module.
For additional accuracy and precision time you will require the use of the PPS pin located on the MPG20X device header PIN2. Further information can be found in the manual. To use the PPS you will need pps-tools installed.
Prior to setting up the hardware device you will need to ensure your kernel has pps enabled and that it is supported. Navigate to your boot config file and set your kernel PPS params to y from m. You may find these commands in /boot/config-XXX, they are as follows:
*Reboot, as we have edited the boot params.
This signal must be connected to a digital GPIO device (GPIO setup is device dependent and is not covered by the KDB), and can be set as a pps device using the ldattach command to the corresponding GPIO dev/ address such as:
ldattach 18 /dev/deviceNAME
There should now be a new device located at dev/pps0
Now add the following lines to /etc/ntp.conf:
# GPS PPS reference
Server 127.127.28.1 minpoll 4 maxpoll 4
Fudge 127.127.28.1 refid PPS
Proceed to the setup without pps in the next section
The GPS module MPG20X can be started using gpsd, you may also use it to test/debug your gps device. GPSD can be started using the following command:
gpsd –n /dev/ttyACM0
(Your device may be at a different address depending on how it was installed and which version of linux)
When the GPS has started you can check cgps to see if the device is receiving data/signal from satellites.
When the device is ready and receiving, it is now possible to proceed with NTP, which must be permitted by the firewall.
firewall-cmd --add-service=ntp --permanent
Add the following lines to ntp.conf
# GPS Serial Data reference
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.0 refid GPS
Now start NTP, using the following commands (This was done using Centos 7.1 and as such you may require a different system command):
systemctl start ntpd
systemctl enable ntpd
Check to see if NTP services is running
systemctl status ntpd
You should now have time synchronization using the GPS module. Please keep in mind that NTP does not instantly update the system time. The NTP will slowly synchronize with the connected source device as to not cause sporadic time skips when using a potentially unstable time source. As such, you will not witness the results of gps time sync until the system has stabilized.
The TIMEPULSE output is a buffered and ESD protected signal from the GPS receiver. This signal connects to pin 2 of the External I/O Connector. It also drives the TIMEPULSE LED. By default, when satellites are not fixed this signal is High (3.3V). When satellites are fixed, this signal pulses at 1 pulse-per-second (1Hz) with a 20% duty cycle (200ms High, 800ms Low). For more information see the Receiver Description Including Protocol Specification document for your GPS receiver found in the Software Support section of this document.