Benedikt Kleinmeier
2014-09-11 07:56:07 UTC
Hi,
I use a u-blox NEO-7 GPS receiver as stratum 1 source and gpsd/ntpd to set the time of a connected PC very precisely.
I used the following HOWTO:
http://www.catb.org/gpsd/gpsd-time-service-howto.html
Now, I'm interested in the accuracy of this solution.
Default, u-blox GPS receiver only sends NMEA 0183 Version 2.3 sentences. According to NMEA specification, in NMEA messages, time is always reported rounded to the nearest hundredth of a second (i.e. at least 10 ms). This is not very accurate for a stratum 1 source.
On the other hand, u-blox GPS receiver supports the binary UBX protocol. According to protocol specification [1], some UBX messages provide a field, called "nano", to allow nano precision. When analyzing logs, I only can recognize second precision:
gpsd:DATA: TIMEGPS: time=1410420630.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420631.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420632.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420633.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420634.000000 mask={TIME}
Where are the fractions of a seconds?
Note: logs where generated by
gpsctl -b /dev/ttyACM0 # Switch to binary UBX protocol.
gpsd -b -N -n -D 6 /dev/ttyACM0 # Use log level 6 to make "gpsd:DATA" messages visible.
Looking at the code in "drivers_ubx.c", reveals that only "tow" field is read (time of GPS week in milliseconds) but the millisecond digits are always zero and "ftow" field (which provides "nano" precision" is completely ignored. See the following log of a slightly modified version of "drivers_ubx.c". Look at the "tow=" strings:
gpsd:DATA: TIMEGPS: gw=1809 tow=372408000 ftow=-262153 tow_with_fractional_part=372407.999738
gpsd:DATA: TIMEGPS: time=1410420391.999738 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372409000 ftow=-261526 tow_with_fractional_part=372408.999738
gpsd:DATA: TIMEGPS: time=1410420392.999738 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372410000 ftow=-260899 tow_with_fractional_part=372409.999739
gpsd:DATA: TIMEGPS: time=1410420393.999739 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372411000 ftow=-260276 tow_with_fractional_part=372410.999740
gpsd:DATA: TIMEGPS: time=1410420394.999740 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372412000 ftow=-259652 tow_with_fractional_part=372411.999740
gpsd:DATA: TIMEGPS: time=1410420395.999740 mask={TIME}
Is it only possible to get second precision with this setup (u-blox UBX/gpsd/ntpd)?
Thanks for your help,
Benedikt
[1] http://www.u-blox.com/images/downloads/Product_Docs/u-blox7-V14_ReceiverDescriptionProtocolSpec_Public_%28GPS.G7-SW-12001%29.pdf
[2] http://git.savannah.gnu.org/cgit/gpsd.git/tree/driver_ubx.c#n213
I use a u-blox NEO-7 GPS receiver as stratum 1 source and gpsd/ntpd to set the time of a connected PC very precisely.
I used the following HOWTO:
http://www.catb.org/gpsd/gpsd-time-service-howto.html
Now, I'm interested in the accuracy of this solution.
Default, u-blox GPS receiver only sends NMEA 0183 Version 2.3 sentences. According to NMEA specification, in NMEA messages, time is always reported rounded to the nearest hundredth of a second (i.e. at least 10 ms). This is not very accurate for a stratum 1 source.
On the other hand, u-blox GPS receiver supports the binary UBX protocol. According to protocol specification [1], some UBX messages provide a field, called "nano", to allow nano precision. When analyzing logs, I only can recognize second precision:
gpsd:DATA: TIMEGPS: time=1410420630.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420631.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420632.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420633.000000 mask={TIME}
gpsd:DATA: TIMEGPS: time=1410420634.000000 mask={TIME}
Where are the fractions of a seconds?
Note: logs where generated by
gpsctl -b /dev/ttyACM0 # Switch to binary UBX protocol.
gpsd -b -N -n -D 6 /dev/ttyACM0 # Use log level 6 to make "gpsd:DATA" messages visible.
Looking at the code in "drivers_ubx.c", reveals that only "tow" field is read (time of GPS week in milliseconds) but the millisecond digits are always zero and "ftow" field (which provides "nano" precision" is completely ignored. See the following log of a slightly modified version of "drivers_ubx.c". Look at the "tow=" strings:
gpsd:DATA: TIMEGPS: gw=1809 tow=372408000 ftow=-262153 tow_with_fractional_part=372407.999738
gpsd:DATA: TIMEGPS: time=1410420391.999738 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372409000 ftow=-261526 tow_with_fractional_part=372408.999738
gpsd:DATA: TIMEGPS: time=1410420392.999738 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372410000 ftow=-260899 tow_with_fractional_part=372409.999739
gpsd:DATA: TIMEGPS: time=1410420393.999739 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372411000 ftow=-260276 tow_with_fractional_part=372410.999740
gpsd:DATA: TIMEGPS: time=1410420394.999740 mask={TIME}
gpsd:DATA: TIMEGPS: gw=1809 tow=372412000 ftow=-259652 tow_with_fractional_part=372411.999740
gpsd:DATA: TIMEGPS: time=1410420395.999740 mask={TIME}
Is it only possible to get second precision with this setup (u-blox UBX/gpsd/ntpd)?
Thanks for your help,
Benedikt
[1] http://www.u-blox.com/images/downloads/Product_Docs/u-blox7-V14_ReceiverDescriptionProtocolSpec_Public_%28GPS.G7-SW-12001%29.pdf
[2] http://git.savannah.gnu.org/cgit/gpsd.git/tree/driver_ubx.c#n213