Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


dragino_lora_gps_hat_ntp

This is an old revision of the document!


Dragino LoRa / GPS hat - NTP PPS

Configure NTPd with PPS

Configure Raspberry Pi

Based on Raspbian Stretch

  • Disable hardware; Wifi, Bluetooth, HDMI.
  • Disable services; avahi, triggerhappy, wpa_supplicant
  • Add user, remove pi user.
  • Set correct timezone.
  • Update packages.

Configure serial port

  • Disable Bluetooth:
    echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt
  • Disable the HCI UART:
    sudo systemctl disable hciuart
  • Disable getty:
    systemctl mask serial-getty@serial0.service
  • Remove console=serial0,115200 from /boot/cmdline.txt
  • Reboot
  • Test GPS output: cat /dev/serial0

Configure Pulse Per Second (PPS)

  • Install PPS tools:
    apt install pps-tools
  • Configure GPIO for PPS:
    echo "dtoverlay=pps-gpio,gpiopin=18" >> /boot/config.txt
  • Reboot
  • There should be a /dev/pps0 device
  • Check for pulse
    # 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 1552847111.000139273, sequence: 152 - clear  0.000000000, sequence: 0
    source 0 - assert 1552847112.000135096, sequence: 153 - clear  0.000000000, sequence: 0
    source 0 - assert 1552847113.000135337, sequence: 154 - clear  0.000000000, sequence: 0
    source 0 - assert 1552847114.000134886, sequence: 155 - clear  0.000000000, sequence: 0
    source 0 - assert 1552847115.000135615, sequence: 156 - clear  0.000000000, sequence: 0
    source 0 - assert 1552847116.000137416, sequence: 157 - clear  0.000000000, sequence: 0

Configure GPS

  • Install packages:
    apt install gpsd gpsd-clients
  • Configure udev rules in /etc/udev/rules.d/gps.rules
    KERNEL=="ttyAMA0", SUBSYSTEM=="tty", DRIVER=="", SYMLINK+="gps0", MODE="0666"
    KERNEL=="pps0", SUBSYSTEM=="pps", DRIVER=="", SYMLINK+="gpspps0", MODE="0666"
  • Configure devices in /etc/default/gpsd
    DEVICES="/dev/ttyAMA0 /dev/pps0"
  • Reboot
  • Test GPS output with cgps or gpsmon.

Configure NTPd

  • Disable systemd timesyncd:
    systemctl stop systemd-timesyncd
    systemctl disable systemd-timesyncd
  • Install NTP:
    apt install ntp
  • Add to /etc/ntp.conf
    # GPS Serial
    server 127.127.28.0
    fudge 127.127.28.0 time1 refid GPS
    
    # GPS PPS
    server 127.127.28.1 prefer
    fudge 127.127.28.1 refid PPS
  • Enable and start ntpd:
    systemctl enable ntp
    systemctl start ntp
  • Comment ntp option in /etc/dhcpcd.conf
    #option ntp_servers
  • Reboot
dragino_lora_gps_hat_ntp.1552848921.txt.gz · Last modified: 2019/03/17 18:55 by admin