NavSpark GPS+GLONASS Stratum-1 NTP Time Source with a Raspberry Pi

Random Notes (The building blocks)
http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html

Update Pi

apt-get update apt-get distupgrade rpi-update

apt-get install pps-tools snmp libcap-dev i2c-tools

edit /boot/cmdline.txt, remove serial references (AMA0) edit /etc/inittab, remove serial console

crossdev -S -v -t arm-unknown-linux-gnueabi

Recommend to compile kernel on another system --http://elinux.org/Raspberry_Pi_Kernel_Compilation export CCPREFIX=arm-unknown-linux-gnueabi-

get kernel source: git clone --depth 1 git://github.com/raspberrypi/linux.git

Patch Kernel: http://ntpi.openchaos.org/pps_pi/

Custom PCB uses GPIO23

Boot Options -> Default Kernel Command String: Remove console=ttyAMA0,115200, unless you want for troubleshooting, recommend to leave debugger?

Grab latest NTP from: http://www.ntp.org/downloads.html, for compile computer extract ./configure --prefix=/usr --enable-ATOM --enable-NMEA --enable-GPSD --enable-SHM --enable-WWV --with-ntpsnmpd --enable-ipv6 --enable-linuxcaps --enable-clockctl make now wait ~20minutes rm /var/lib/ntp/ntp.conf.dhcp if DHCP, static recommended


 * 1) Cross-compile NTP:
 * 2) mkdir tmpinstall##make -j2##make install
 * 3) tar -cjf ntp.tar.bz2 tmpinstall
 * 4) copy files out cp bin/ntpd bin/ntp-wait bin/ntptime /usr/sbin
 * 5) https://support.ntp.org/bin/view/Dev/Cross-compilingNTP

create /etc/udev/rules/09-gps.rules file contents: KERNEL=="ttyAMA0", SYMLINK+="gps0"
 * 1) Adds symlink from serial interface to /dev/gps0 for ntpd

Edit /etc/ntp.conf enable calibrate enable kernel server 127.127.20.0 mode 82 minpoll 4 maxpoll 6 fudge 127.127.20.0 time2 +0.1939
 * 1) GPS Module

server 127.127.22.0 minpoll 4 fudge 127.127.22.0 flag3 1
 * 1) PPS of GPS Module

Add other servers/peers

Tune the offset http://www.catb.org/gpsd/gpsd-time-service-howto.html


 * 1) RTC

modules/i2c already enabled in kernel from above i2cdetect -y 1 - verify on 68 echo "ds3231 0x68" > /sys/class/i2c-adapter/i2c-1/new_device set timezone - ln -s /usr/share/zoneinfo/America/New_York /etc/localtime edit /etc/default/hwclock HWCLOCKACCESS=YES HCTOSYS_DEVICE=rtc0

edit /etc/init.d/hwclock.sh, line 67, comment out if statement for udev The RTC isn't handled by udev, so this check needs to be removed.

Edit /etc/networking/interfaces iface eth0 inet static address netmask gateway
 * 1) Static IP

dpkg --purge fake-hwclock cd /etc/rcS.d ln -s ../init.d/hwclock.sh S10hwclock.sh update-rc.d hwclock.sh enable
 * 1) http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=16218
 * 1) rm K05hwclock.sh


 * 1) OLD

apt-get install gpsd gpsd-clients python-gps

edit /etc/defaults/gpsd start_daemon = true devices="/dev/ttyAMA0" flags -b -n stty -F /dev/ttyAMA0 115200 set base_baud before gpsd starts, scans faster.

service gpsd enable reboot, confirm with cgps -s

apt-get install libncurses5-dev bc

edit modules, include pps-gpio

Instead of gpsd - symlink /dev/ttyAMA0 to /dev/gps0, use 127.127.20.0 mode 82 in ntp config, adds GPS_NEMA driver

Uninstall existing ntp, compile/install latest ntp