1

I noticed two approaches to get an accurate time from GPS (with PPS). Using ntpd either with

My problem: I want to have a very accurate time and access to GPS position data. Therefore using Shared Memory via gpsd is possibly to slow.

In my ntp configuration I currently use a NMEA reference clock. The GPS reciever (with PPS) is connected to /dev/ttyS0 and /dev/gps0 respectively.

I cannot use both, ntpd with NMEA and gpsd to get position data, in parallel. If ntpd is running gpsd will get no data and exits after timeout. But if ntpd is running cat /dev/ttyS0 print NMEA data on the console. So I can read from the serial line. So why gpsd cannot access the serial data if ntpd is running? The debug messages of gpsd I pasted here. I start gpsd and then try to connect with cgps.

I know thats maybe a question of opening devices in parallel in general...

EDIT

Right now I use

server 127.127.20.0 mode 18 minpoll 4 maxpoll 4 iburst prefer true
fudge 127.127.20.0 flag1 1 flag2 0 flag3 1 flag4 0 time2 0.475

Retrieve the position data from the clockstats file will work. May there is a better solution for that than parsing this file?

wenzul
  • 215
  • 1
  • 4
  • 11

1 Answers1

2

Why use gpsd? Just use the NMEA driver and enable PPS with flag1:

server 127.127.20.0 minpoll 4  mode 18 prefer   # NMEA serial port, 16 = 9600 baud, 2 = $GPGGA
fudge 127.127.20.0  time2 0.435 flag1 1 flag3 0

You should change your fudge time to whatever is appropriate.

You can get the position data from the clockstats file.

dfc
  • 1,331
  • 8
  • 16
  • Thank you. That's a good hint. Actually I enabled flag1 already. I also don't know if flag3=1 is better then 0. I have ativated the stats. Now I have something like `$GPGGA,025111.000,4748.1202,N,00716.8470,E,1,08,1.04,168.6,M,48.0,M,,*6C` in there. The approach why I tought to use gpsd, because because I want to use the coordinates in a program. It would be easy to get it over gpsd. Now I have to parse the clockstats file... now I have a yet small logfile increasing (on a SSD) which I have to parse... is there no better solution? Thanks. – wenzul Oct 19 '14 at 05:05
  • If this answer was helpful please mark it as accepted. When you first tried gpsd+ntpd your ntp did not suport PPS. You might want to retry the gpsd setup. – dfc Oct 20 '14 at 21:03
  • Yes with parsing clockstats I can extract the position. The next discovery was that ntpd started with NMEA driver (127.127.20.x) and then starting gpsd is not working. gpsd times out and serves no gps data. So my suggestion was it hangs due to an access problem of ttyS0. The [logfile of gpsd](http://pastebin.com/YMrdmRbA) is here. And the question was why because I can easily cat ttyS0 but gpsd cannot access the data? – wenzul Oct 20 '14 at 22:13
  • Thank you for answering the other questions too. But here there is may a better solution. And also I want to know why gpsd cannot get gps data. – wenzul Oct 20 '14 at 22:50