Tag Archives: ntp

ODROID-C1 NTP Server

odroidc1-gpsBased on the gps receiver from hab supplies, the work of jgilje and debian jessie I have been able to compile a minimal image which can work as a Stratum-1 ntp server.

The image itself is ~90MB compressed, and contains a minimal installation of debian jessie, kernel from hardkernel with the pps-gpio patch from jgilje. ntp package was recompiled and is held from future updates. ntpd is preconfigured to use NMEA(127.127.20.0) driver with PPS sync. And udev rules to create the apropriate devices for ntpd to use. I also removed all of the dvb drivers in the kernel provided by hardkernel.

odroidc1-gps1If you want to relocate the PPS signal to a different gpio pin, this can be done by altering the meson8b_odroidc.dts file and compiling it to an apropriate .dtb file.

Image can be written to memory card using win32diskimager or dd, it will use dhcp for network configuration. Only user enabled is root with the password root. Framebuffer should also work, so you can connect it to a screen and configure it locally.

Things to do at first boot. Use fdisk to delete partition 2, and recreate the partition with the same size as the sd-card. Then resize the root partition.

Please note that on cold boot, it will take some time to lock onto the PPS.

Sources:
https://github.com/jgilje/pps-gpio-amlogic
http://ava.upuaut.net/store/index.php?route=product/product&path=59_60&product_id=117

Download:
odroidc1.img

Some ntpd output.


root@odroid-c1:~# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+ntp.fnutt.net 192.36.134.17 2 u 5 64 377 11.512 0.230 0.812
+2.81-166-42.cus 85.89.3.25 2 u 36 64 377 4.607 -0.430 0.612
+langbein.monslo 129.242.4.241 2 u 40 64 377 15.449 -1.063 0.953
-ntp-ext.cosng.n 146.213.3.181 2 u 24 64 377 14.528 1.604 1.253
oGPS_NMEA(0) .GPS. 0 l 12 16 377 0.000 -0.001 0.001


root@odroid-c1:~# ntpq -c rl
associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync,
version="ntpd 4.2.6p5@1.2349-o Mon May 25 18:52:44 UTC 2015 (1)",
processor="armv7l", system="Linux/3.10.75", leap=00, stratum=1,
precision=-20, rootdelay=0.000, rootdisp=0.354, refid=GPS,
reftime=d90ed892.9bbc5b1d Tue, May 26 2015 11:33:38.608,
clock=d90ed89b.4cfcafe8 Tue, May 26 2015 11:33:47.300, peer=59860, tc=4,
mintc=3, offset=-0.001, frequency=9.542, sys_jitter=0.001,
clk_jitter=0.001, clk_wander=0.000

Raspberry Pi Stratum 1 NTP server

ntpi-2-1024x760I forbindelse med vær stasjon prosjektet jeg er igang med, så trenger jeg presis tid i forhold til logging av data. Siden 3g forbindelsen på fjellet er forventet å være høyst ustabil ønsker jeg og ha en Stratum 1 NTP server kjørende lokalt.

Den billigste, og beste løsningen har vist seg å være basert på Raspberry Pi, pluss en GPS modul laget for GPIO pinnene, med egen PPS(Pulse Per Second).

Gikk utifra endel “guider” på nettet, men har endret noe på “imaget” jeg bruker på min rPi for å forbedre ytelsen. I det store og det hele brukte “imaget” jeg lastet ned, gpsd daemonen. Forsåvidt helt kurant og gå gjennom shared memory, men hvorfor ikke la ntpd snakke direkte med GPS modulen, når den har muligheten til det.

Endringene som er gjort i forhold til http://ntpi.openchaos.org/downloads/ sitt image.

[code]
## /etc/udev/rules.d/99-pps.rules ##
KERNEL=="ttyAMA0",SYMLINK+="gps0"
KERNEL=="pps0",SYMLINK+="gpspps0"
[/code]
[code]
## /etc/ntp.conf ##
server 127.127.20.0 mode 18 minpoll 4 prefer
fudge 127.127.20.0 flag1 1 flag3 1 refid GPS
[/code]
[code]
pi@ntpi ~ $ sudo update-rc.d gpsd disable
[/code]

Så over til det viktigste…Hvor bra er den egentlig? Kort sagt, meeeeget bra. Har ett par bilder for sammenlikning.

[code]
pi@ntpi ~ $ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
oGPS_NMEA(0) .GPS. 0 l 12 16 377 0.000 0.003 0.002
[/code]

rPi:
rpi_ntp

vs

Windows:
windows_ntp

Kilder:
http://ava.upuaut.net/store/index.php?route=product/product&path=59_60&product_id=95
http://ava.upuaut.net/?p=600
http://ntpi.openchaos.org/downloads/