anyone have any nmea(4) stories?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

anyone have any nmea(4) stories?

jjhartley
Has anyone set up a GPS to serve as a ntp source yet?  Care to share any insights gained?  Thanks.

j

Reply | Threaded
Open this post in threaded view
|

Re: anyone have any nmea(4) stories?

Sam Chill
On 10/6/06, [hidden email] <[hidden email]> wrote:
> Has anyone set up a GPS to serve as a ntp source yet?  Care to share any insights gained?  Thanks.
>
> j

<inserts USB GPS device>
uplcom0 at uhub1 port 4
uplcom0: Prolific Technology PL2303 Serial, rev 1.10/2.02, addr 4
ucom0 at uplcom0
# nmeaattach cuaU0
# sysctl hw.sensors.30
hw.sensors.30=nmea0, GPS, 0.77 secs, OK, Fri Oct  6 21:23:53.453
# echo 'sensor nmea0' > /etc/ntpd.conf
# date
Fri Oct  6 21:29:29 EDT 2006
# date 35
Fri Oct  6 21:35:00 EDT 2006
# sysctl hw.sensors.30
hw.sensors.30=nmea0, GPS, 281.16 secs, OK, Fri Oct  6 21:35:28.815
# ntpd -ds
ntp engine ready
sensor nmea0 added
sensor nmea0: offset -280.827497
no reply received in time, skipping initial time setting
sensor nmea0: offset -280.817099
sensor nmea0: offset -280.817388
sensor nmea0: offset -280.841698
sensor nmea0: offset -280.843981
sensor nmea0: offset -280.829276
sensor nmea0: offset -280.840579
<snip>
This goes on forever and the time is never actually adjusted according
to the timedelta. The timedelta seems to be working quite well, but
ntpd isn't adjusting according to it. What am I doing wrong?
I think it would be very useful to make a note about nmeaattach(8) in
nmea(4) I almost couldn't find the darn thing.
Index: nmea.4
===================================================================
RCS file: /cvs/src/share/man/man4/nmea.4,v
retrieving revision 1.9
diff -u -r1.9 nmea.4
--- nmea.4      3 Sep 2006 18:26:05 -0000       1.9
+++ nmea.4      7 Oct 2006 01:22:36 -0000
@@ -67,6 +67,7 @@
 .El
 .Sh SEE ALSO
 .Xr tty 4 ,
+.Xr nmeaattach 8 ,
 .Xr ntpd 8 ,
 .Xr sysctl 8
 .Sh HISTORY

-Sam

Reply | Threaded
Open this post in threaded view
|

Re: anyone have any nmea(4) stories?

Sam Chill
On 10/7/06, Henning Brauer <[hidden email]> wrote:

> > <inserts USB GPS device>
> > uplcom0 at uhub1 port 4
> > uplcom0: Prolific Technology PL2303 Serial, rev 1.10/2.02, addr 4
> > ucom0 at uplcom0
> > # nmeaattach cuaU0
> > # sysctl hw.sensors.30
> > hw.sensors.30=nmea0, GPS, 0.77 secs, OK, Fri Oct  6 21:23:53.453
> > # echo 'sensor nmea0' > /etc/ntpd.conf
> > # date
> > Fri Oct  6 21:29:29 EDT 2006
> > # date 35
> > Fri Oct  6 21:35:00 EDT 2006
> > # sysctl hw.sensors.30
> > hw.sensors.30=nmea0, GPS, 281.16 secs, OK, Fri Oct  6 21:35:28.815
> > # ntpd -ds
> > ntp engine ready
> > sensor nmea0 added
> > sensor nmea0: offset -280.827497
> > no reply received in time, skipping initial time setting
> > sensor nmea0: offset -280.817099
> > sensor nmea0: offset -280.817388
> > sensor nmea0: offset -280.841698
> > sensor nmea0: offset -280.843981
> > sensor nmea0: offset -280.829276
> > sensor nmea0: offset -280.840579
> > <snip>
> > This goes on forever and the time is never actually adjusted according
> > to the timedelta. The timedelta seems to be working quite well, but
> > ntpd isn't adjusting according to it. What am I doing wrong?
>
> you never get a "adjusting local clock by ..." message?!?
Correct. I just keep getting this message forever: "sensor nmea0:
offset -280.800595". My ntpd.conf has no servers defined in it it only
has this one sensor. I ran it for a few hours and it never adjusted my
time at all (no messages in /var/log/daemon either about it adjusting
either. I'm running a box a week or so away from -current and it
doesn't seem like any of that code has been touched in a while.
# uname -a
samchill@pi:6$ uname -a
OpenBSD pi.local 4.0 GENERIC#3 i386
Any ideas...?
-Sam

Reply | Threaded
Open this post in threaded view
|

Re: anyone have any nmea(4) stories?

Sam Chill
On 10/7/06, Chris Kuethe <[hidden email]> wrote:
> usb gps receivers don't usually have any sort of PPS signal which is
> what this code depends on.
>
> CK
As I understand it, ntpd uses a timedelta sensor to make adjustments
to the clock. If nmeaattach properly creates a timedelta sensor (and
it does because I have one that properly shows my offset) then this
should work. ntpd doesn't know anything about my gps receiver it only
knows that there is a timedelta sensor on my computer. That's at least
how I understand it.
-Sam

Reply | Threaded
Open this post in threaded view
|

Re: anyone have any nmea(4) stories?

Theo de Raadt
> On 10/7/06, Chris Kuethe <[hidden email]> wrote:
> > usb gps receivers don't usually have any sort of PPS signal which is
> > what this code depends on.
> >
> > CK
> As I understand it, ntpd uses a timedelta sensor to make adjustments
> to the clock. If nmeaattach properly creates a timedelta sensor (and
> it does because I have one that properly shows my offset) then this
> should work. ntpd doesn't know anything about my gps receiver it only
> knows that there is a timedelta sensor on my computer. That's at least
> how I understand it.

That is correct.

You plug a GPS receiver into a serial port, or into a USB port which
makes it come up as a serial port.

But it is just some random device on a serial port.  We don't know
that there is a GPS on that particular serial port.  But you do -- so
you run the nmeaattach, indicating the serial port that the GPS is on.

nmeaattach tells the kernel to 'intercept' the data on that particular
serial port. If the kernel code notices that the little bytes flowing
by look like the GPS NMEA protocol, then the kernel creates a
timedelta sensor.

Every once in a while, ntpd checks to see if any new timedelta sensors
have showed up (or, likewise, if any have gone away).  And ntpd uses
their value as an offset against true time.