2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Arch Linux + GPS18xLVC + ntpdでPPSが動かない

Last updated at Posted at 2015-12-05

元々ntpdでStratum 1を運用していたのに、pacman -Syuしていたら、動かなくなりました。
GPS18xLVCとの接続等は、既存記事にお任せします。RS-232CのCD信号にPPS信号をつないで、# ldattach PPS /dev/ttyS0している前提です。

確認

PPSは動作しているでしょうか。/dev/pps1をpps-toolsで確認します。なお、自分の環境では、/dev/pps0はigbがPTP用に占有している模様。

$ sudo ./ppstest /dev/pps1
trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1449307365.000003704, sequence: 597116 - clear  1448717727.100462350, sequence: 7479
source 0 - assert 1449307366.000001027, sequence: 597117 - clear  1448717727.100462350, sequence: 7479
source 0 - assert 1449307367.000002126, sequence: 597118 - clear  1448717727.100462350, sequence: 7479
source 0 - assert 1449307368.000002811, sequence: 597119 - clear  1448717727.100462350, sequence: 7479

問題ないようです。

原因

pacmanで入れるntpdは、PPS readyでないようです。例えばType22のPPS refclockを使う設定でjournalctlすると、refclock_newpeer: clock type 22 invalidといったエラーが出ます。

対策

とりあえず自分でコンパイルして、ntpdを上書きしました。
記載時の最新版ntp-4.2.8p4では、/usr/include/timepps.hがある状態でconfigureすれば、PPS readyとなるようです。
timepps.hは、LinuxPPSから入手して/usr/include/に設置。configure; makeし、ntpd/ntpdを/usr/sbin/にinstall。

設定

詳細追えていませんが、Linux arch-rm 4.2.5-1-ARCHとntp-4.2.8p4の組み合わせ?では、flag3が1だと、PPSにならないようでした。flag3 0にして、clock disciplineは、一旦ntpdのものを使用。

19200bpsのNMEAが/dev/gps0、PPSが/dev/gpspps0の場合の/etc/ntp.confの例
# NMEA driver
server 127.127.20.0 minpoll 4 maxpoll 4 mode 32 iburst prefer
fudge  127.127.20.0 flag1 1 flag2 0 flag3 0 time2 0.600

結果

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l   12   16  377    0.000   -0.001   0.001

こうでなくっちゃね。

LinuxPTP!

元々も自分でbuildしていたのかも?

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?