12 063
правки
м |
(Отметить эту версию для перевода) |
||
Строка 1: | Строка 1: | ||
<languages/> | <languages/> | ||
<translate> | <translate> | ||
<!--T:1--> | |||
'''Статья носит рекомендательный характер и не предназначена для конечных пользователей.''' | '''Статья носит рекомендательный характер и не предназначена для конечных пользователей.''' | ||
<!--T:2--> | |||
Значит что надо сделать чтобы собрать правильный нтп (собирал на виренборде ~1ч) | Значит что надо сделать чтобы собрать правильный нтп (собирал на виренборде ~1ч) | ||
<!--T:3--> | |||
Поставить libcap-dev – без него не будет работать нтп с настройками кот по умолчанию в системе и после ребута все сломается и придется через дебаг консоль убирать из загрузки нтп. | Поставить libcap-dev – без него не будет работать нтп с настройками кот по умолчанию в системе и после ребута все сломается и придется через дебаг консоль убирать из загрузки нтп. | ||
Через apt-get не получилось – ставил через dpkg брал тут: https://packages.debian.org/wheezy/armel/libcap-dev/download | Через apt-get не получилось – ставил через dpkg брал тут: https://packages.debian.org/wheezy/armel/libcap-dev/download | ||
Строка 17: | Строка 20: | ||
cp /usr/local/bin/ntp* /usr/bin/ && sudo cp /usr/local/sbin/ntp* /usr/sbin/ #заменяем системный нтп новым улучшенным | cp /usr/local/bin/ntp* /usr/bin/ && sudo cp /usr/local/sbin/ntp* /usr/sbin/ #заменяем системный нтп новым улучшенным | ||
<!--T:4--> | |||
Далее настраиваем нтп – надо создать алиалсы для драйвера 20 (https://www.eecis.udel.edu/~mills/ntp/html/drivers/driver20.html) | Далее настраиваем нтп – надо создать алиалсы для драйвера 20 (https://www.eecis.udel.edu/~mills/ntp/html/drivers/driver20.html) | ||
<!--T:5--> | |||
vi /etc/udev/rules.d/10-gps.rules | vi /etc/udev/rules.d/10-gps.rules | ||
<!--T:6--> | |||
KERNEL=="ttyAPP2",NAME="%k",SYMLINK+="gps0",MODE="0660",GROUP="ntp" | KERNEL=="ttyAPP2",NAME="%k",SYMLINK+="gps0",MODE="0660",GROUP="ntp" | ||
<!--T:7--> | |||
KERNEL==“pps0",NAME="%k",SYMLINK+="gpspps0",MODE="0660",GROUP="ntp" | KERNEL==“pps0",NAME="%k",SYMLINK+="gpspps0",MODE="0660",GROUP="ntp" | ||
<!--T:8--> | |||
Можно еще использовать драйвер 22 – нтп + драйвер 20 (нмеа) или 28 (гпсд) | Можно еще использовать драйвер 22 – нтп + драйвер 20 (нмеа) или 28 (гпсд) | ||
Но 20 и так умеет ппс (flag1 1) и экспериментально я остановился на нем. (https://www.eecis.udel.edu/~mills/ntp/html/refclock.html) | Но 20 и так умеет ппс (flag1 1) и экспериментально я остановился на нем. (https://www.eecis.udel.edu/~mills/ntp/html/refclock.html) | ||
<!--T:9--> | |||
Правим /etc/ntp.conf | Правим /etc/ntp.conf | ||
<!--T:10--> | |||
server 127.127.20.0 mode 17 minpoll 4 maxpoll 4 iburst prefer | server 127.127.20.0 mode 17 minpoll 4 maxpoll 4 iburst prefer | ||
<!--T:11--> | |||
fudge 127.127.20.0 flag1 1 flag2 0 time2 1.0 refid GPSP | fudge 127.127.20.0 flag1 1 flag2 0 time2 1.0 refid GPSP | ||
<!--T:12--> | |||
time2 1.0 - это смещение времени гпс от ппс тк гпс и ппс асинхронны и если нет смещения то нтп отбранкует драйвер 20 – подбирается экспериментально по методике ниже (но думаю что для всех виренбордов 5 будет 1.0 (для пи2 у меня получилось 0.7)) https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks | time2 1.0 - это смещение времени гпс от ппс тк гпс и ппс асинхронны и если нет смещения то нтп отбранкует драйвер 20 – подбирается экспериментально по методике ниже (но думаю что для всех виренбордов 5 будет 1.0 (для пи2 у меня получилось 0.7)) https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks | ||
<!--T:13--> | |||
if you want a good estimation for fudge time2 (perhaps because PPS is not an option for you) you could use the following procedure: | if you want a good estimation for fudge time2 (perhaps because PPS is not an option for you) you could use the following procedure: | ||
Switch off the PPS processing for the NMEA driver and mark the clock as noselect. Set the fudge time2 to zero. Add a few good public time servers or another clock; here in Germany I can use my DCF77 radio clock for that purpose. Disable all output sentences of the GPS18x LVC but the GPRMC sentence. | <!--T:14--> | ||
Switch off the PPS processing for the NMEA driver and mark the clock as noselect. Set the fudge time2 to zero. Add a few good public time servers or another clock; here in Germany I can use my DCF77 radio clock for that purpose. Disable all output sentences of the GPS18x LVC but the GPRMC sentence. | |||
Restart the daemon and watch the offset for the NMEA clock. When the value gets stable, use the absolute value of the offset as fudge time2 for the NMEA driver. | Restart the daemon and watch the offset for the NMEA clock. When the value gets stable, use the absolute value of the offset as fudge time2 for the NMEA driver. | ||
Optionally restart ntpd and verify that the offset remains small. Note the jitter, which is probably in the order of 5-10msec. If the offset is small enough (better than 2ms is doable, but takes a long time to stabilise), go to the next step. Otherwise fine-tune fudge time2 and repeat this step. | Optionally restart ntpd and verify that the offset remains small. Note the jitter, which is probably in the order of 5-10msec. If the offset is small enough (better than 2ms is doable, but takes a long time to stabilise), go to the next step. Otherwise fine-tune fudge time2 and repeat this step. | ||
Строка 47: | Строка 61: | ||
<!--T:15--> | |||
Перезагружаемся и смотрим что есть наши алиасы | Перезагружаемся и смотрим что есть наши алиасы | ||
<!--T:16--> | |||
root@wirenboard:~# ls /dev/gps* | root@wirenboard:~# ls /dev/gps* | ||
<!--T:17--> | |||
/dev/gps0 /dev/gpspps0 | /dev/gps0 /dev/gpspps0 | ||
<!--T:18--> | |||
Далее ждем минут 10 и ntpq -nc peer -c as -c rl | Далее ждем минут 10 и ntpq -nc peer -c as -c rl | ||
Буква о у 127.127.20.0 – значит что последняя синхронизации с ппс (http://citrin.ru/net:ntpq) | Буква о у 127.127.20.0 – значит что последняя синхронизации с ппс (http://citrin.ru/net:ntpq) | ||
<!--T:19--> | |||
root@wirenboard:~# ntpq -nc peer -c as -c rl | root@wirenboard:~# ntpq -nc peer -c as -c rl | ||
remote refid st t when poll reach delay offset jitter | <!--T:20--> | ||
remote refid st t when poll reach delay offset jitter | |||
============================================================================== | ============================================================================== <!--T:21--> | ||
<!--T:22--> | |||
o127.127.20.0 .GPSP. 0 l 8 16 377 0.000 0.000 0.008 | o127.127.20.0 .GPSP. 0 l 8 16 377 0.000 0.000 0.008 | ||
<!--T:23--> | |||
*185.22.60.71 212.20.50.208 2 u 21 64 377 3.510 -0.048 0.132 | *185.22.60.71 212.20.50.208 2 u 21 64 377 3.510 -0.048 0.132 | ||
<!--T:24--> | |||
+95.104.192.10 194.190.168.1 2 u 55 64 377 18.911 -1.880 0.093 | +95.104.192.10 194.190.168.1 2 u 55 64 377 18.911 -1.880 0.093 | ||
<!--T:25--> | |||
-144.76.115.197 131.188.3.221 2 u 4 64 377 51.630 -6.302 0.509 | -144.76.115.197 131.188.3.221 2 u 4 64 377 51.630 -6.302 0.509 | ||
<!--T:26--> | |||
+89.111.54.85 194.29.130.252 2 u 46 64 377 25.978 0.225 0.088 | +89.111.54.85 194.29.130.252 2 u 46 64 377 25.978 0.225 0.088 | ||
<!--T:27--> | |||
ind assid status conf reach auth condition last_event cnt | ind assid status conf reach auth condition last_event cnt | ||
=========================================================== | =========================================================== <!--T:28--> | ||
1 30454 974a yes yes none pps.peer sys_peer 4 | <!--T:29--> | ||
1 30454 974a yes yes none pps.peer sys_peer 4 | |||
2 30455 963a yes yes none sys.peer sys_peer 3 | <!--T:30--> | ||
2 30455 963a yes yes none sys.peer sys_peer 3 | |||
3 30456 9424 yes yes none candidate reachable 2 | <!--T:31--> | ||
3 30456 9424 yes yes none candidate reachable 2 | |||
4 30457 933d yes yes none outlier 3 | <!--T:32--> | ||
4 30457 933d yes yes none outlier 3 | |||
5 30458 943a yes yes none candidate sys_peer 3 | <!--T:33--> | ||
5 30458 943a yes yes none candidate sys_peer 3 | |||
<!--T:34--> | |||
associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync, | associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync, | ||
<!--T:35--> | |||
version="ntpd 4.2.8p6@1.3265 Wed Apr 6 16:13:39 UTC 2016 (2)", | version="ntpd 4.2.8p6@1.3265 Wed Apr 6 16:13:39 UTC 2016 (2)", | ||
<!--T:36--> | |||
processor="armv5tejl", system="Linux/4.1.15-imxv5-x0.1", leap=00, | processor="armv5tejl", system="Linux/4.1.15-imxv5-x0.1", leap=00, | ||
<!--T:37--> | |||
stratum=1, precision=-17, rootdelay=0.000, rootdisp=1.120, refid=GPSP, | stratum=1, precision=-17, rootdelay=0.000, rootdisp=1.120, refid=GPSP, | ||
<!--T:38--> | |||
reftime=dab9e00e.9c7d01b8 Thu, Apr 14 2016 9:23:26.611, | reftime=dab9e00e.9c7d01b8 Thu, Apr 14 2016 9:23:26.611, | ||
<!--T:39--> | |||
clock=dab9e016.a2b1d422 Thu, Apr 14 2016 9:23:34.635, peer=30454, tc=4, | clock=dab9e016.a2b1d422 Thu, Apr 14 2016 9:23:34.635, peer=30454, tc=4, | ||
<!--T:40--> | |||
mintc=3, offset=0.000121, frequency=91.858, sys_jitter=0.007629, | mintc=3, offset=0.000121, frequency=91.858, sys_jitter=0.007629, | ||
<!--T:41--> | |||
clk_jitter=0.008, clk_wander=0.000 | clk_jitter=0.008, clk_wander=0.000 | ||
<!--T:42--> | |||
Это чтобы посмотреть ошибки и что выдает гпс | Это чтобы посмотреть ошибки и что выдает гпс | ||
<!--T:43--> | |||
root@wirenboard:~# ntpq -c clockvar | root@wirenboard:~# ntpq -c clockvar | ||
<!--T:44--> | |||
associd=0 status=0011 1 event, clk_no_reply, | associd=0 status=0011 1 event, clk_no_reply, | ||
<!--T:45--> | |||
device="NMEA GPS Clock", | device="NMEA GPS Clock", | ||
<!--T:46--> | |||
timecode="$GNRMC,092359.000,A,5549.0526,N,03735.1798,E,0.00,172.16,140416,,,A*78", | timecode="$GNRMC,092359.000,A,5549.0526,N,03735.1798,E,0.00,172.16,140416,,,A*78", | ||
<!--T:47--> | |||
poll=3426, noreply=1, badformat=0, baddata=0, fudgetime2=1000.000, | poll=3426, noreply=1, badformat=0, baddata=0, fudgetime2=1000.000, | ||
<!--T:48--> | |||
stratum=0, refid=GPSP, flags=1 | stratum=0, refid=GPSP, flags=1 | ||
правки