Fri 18 Oct 2013 07:08:11 AM UTC, original submission:
I'm working on a project with GPS on a Raspberry Pi, and searching the Internet I find that nearly without exception people report that gpsd does not start properly on the Raspberry Pi. At the very least, people, by and large, report having to "killall gpds" and restart it before it will function properly.
I have the latest version of the Raspberry Pi "B" from Element14, and have formatted the SD card and extracted the latest version of NOOBS_v1.3.zip (from wwww.raspberrypi.org/downloads) to it. It is powered by, and connected to, a powered hub (http://www.amazon.com/gp/product/B005P2BY5I/). Also connected to the powered hub is an ordinary USB mouse and USB keyboard (from some PC). An HDMI monitor is connected to the Raspberry Pi and a wired-Ethernet Internet connection. I booted the Raspberry Pi and installed the Raspian OS only; for configuration I changed the local to add en_US.UTF-8 and selected that as default, and set the timezone to US Pacific Ocean.
Upon booting up I did "sudo apt-get update" and "sudo apt-get install gpsd gpsd-clients python-gps" which got version 3.6-4. I then plugged a GlobalSat BU-353 USB GPS Navigation Receiver (http://www.amazon.com/gp/product/B000PKX2KA) into the powered hub, which I presume loaded the ttyUSB drivers. "tail /var/log/syslog -n50" confirmed a Prolific Technology 2303 serial port at ttyUSB0.
"cgps -s" to test the GPS device fails. "sudo killall gpsd" followed by "sudo gpsd -F /var/run/gpsd.sock -n /dev/ttyUSB0" and then "cgps -s" shows the GPS device working.
Next, "sudo nano /etc/ntp.conf" is used to add "server 127.127.28.0 minpoll 4" and "fudge 127.127.28.0 time1 0.072 refid GPS", comment out the 4 existing IPv4-based servers, and remove the comment from statsdir. "sudo dpkg-reconfigure gpsd" is used to set: start automatically yes, handle USB automatically yes, device (blank), options -n" and socket is left as shown.
Then "sudo poweroff". Unplug power to Raspberry Pi, unplug Ethernet cable from Raspberry Pi. Wait a few minutes (with power still applied to USB hub and therefore the GlobalSat BU-353). (NOTE: wait considerably less than 1000 seconds so after booting up the time will not be off by 1000 seconds or more.) Then plug power (from hub) into Raspberry Pi.
After booting up and logging in, "date" is used to check time, and the time is found to be a little later than the time when the Raspberry Pi was powered down (that is, it has NOT been updated by ntp connection to GPS). "tail /var/log/syslog -n50" was used to view errors: "can't bind to IPv4 port gpsd, Address already in use", "maybe gpsd is already running!", "can't create IPv6 socket". "tail /var/log/ntpstats/peerstats" reports there is no peerstats file.
"sudo killall gpsd", then "sudo gpsd -F /var/run/gpsd.sock -n /dev/ttyUSB0", then "sudo service ntp restart". Next I used "date" to verify the time has been set, which it has. "tail /var/log/ntpstats/peerstats" shows that ntp is logging the GPS results.
I have tried a wide variety of configurations in an attempt to simply cause ntp to set the time using GPS (without having to use "killall gpsd" or some equivalent). None of them work, though some result in different error messages from shown above. Suggestions I've found on the Internet, such as adding chmod to allow rw from all users on /dev/ttyUSB0 and disabling USB hotplug, do not work.
This is pretty much the simplest possible GPS installation on a Raspberry Pi, with as "clean" a software installation as possible, and a very simple task (updating with ntp, or testing with cgps). But from power-on it does not work. Ever. And on searching the Internet, it doesn't seem to be working for anyone else, either.
(The GPS setup could be slightly simpler by plugging the GlobalSat BU-353 directly into the Raspberry Pi, rather than into a USB hub, but I've tried that and it doesn't work either.)
|