GPS control and configuration for U-Blox GPS on Raspberry Pi 3B...
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea Satellites query is now working. Nov 9, 2017
CMakeLists.txt I lied in my last commit message: I forgot to implement test PPS. Tha… Nov 10, 2017
README.md Fixed some formatting in README.md. Nov 10, 2017
build.sh I lied in my last commit message: I forgot to implement test PPS. Tha… Nov 10, 2017
cJSON.c Much more added. Change baud rate now works, NMEA data can be turned … Oct 26, 2017
cJSON.h Much more added. Change baud rate now works, NMEA data can be turned … Oct 26, 2017
gdbserver.cmd I lied in my last commit message: I forgot to implement test PPS. Tha… Nov 10, 2017
gdbserver.sh Initial commit of rewrite. Oct 19, 2017
gpsctl.c Minor formatting changes in satellites query. Nov 12, 2017
gpsctl_output.sh Added quite a bit more to the rewrite. Most of the added stuff has be… Oct 20, 2017
kill.cmd Baud rate inference and synchronization is now working. Oct 22, 2017
kill.sh Baud rate inference and synchronization is now working. Oct 22, 2017
prepare.sh Initial commit of rewrite. Oct 19, 2017
remote_options.txt I lied in my last commit message: I forgot to implement test PPS. Tha… Nov 10, 2017
run.sh Added quite a bit more to the rewrite. Most of the added stuff has be… Oct 20, 2017
sl_bits.c Fixed the NMEA reliability problem noted in the previous commit. The … Nov 6, 2017
sl_bits.h Fixed a few bugs, added a "save configuration" command. Nov 6, 2017
sl_buffer.c Fixed a few bugs, added a "save configuration" command. Nov 6, 2017
sl_buffer.h Have a much nicer slBuffer implementation, with opaque data type. I m… Oct 24, 2017
sl_general.c Satellites query is now working. Nov 9, 2017
sl_general.h Satellites query is now working. Nov 9, 2017
sl_options.c Implemented GPS reset and configure for timing (setting up the GPS to… Nov 10, 2017
sl_options.h Lots of cleanup and some improvement on slReturn. It's looking pretty… Nov 5, 2017
sl_options.txt Option definitions for --help, --version, and --usage are now added a… Oct 30, 2017
sl_return.c Lots of cleanup and some improvement on slReturn. It's looking pretty… Nov 5, 2017
sl_return.h Fixed the NMEA reliability problem noted in the previous commit. The … Nov 6, 2017
sl_serial.c Satellites query is now working. Nov 9, 2017
sl_serial.h Operation is now very stable and reliable. Changing baud rates on bot… Nov 8, 2017
ublox.c Implemented GPS reset and configure for timing (setting up the GPS to… Nov 10, 2017
ublox.h Implemented GPS reset and configure for timing (setting up the GPS to… Nov 10, 2017

README.md

gpsctl 0.5

What is gpsctl?

gpsctl is a utility program written for Raspberry Pi computers using a U-Blox GPS board. The author's rig is a Raspberry Pi 3 Model B with a Uputronix GPS board, which uses a U-Blox MAX-M8Q GPS module. Some of gpsctl's functions are generic for any GPS that streams NMEA data to a Linux serial port, and these should work on any Linux system. Most of gpsctl's functions, however, are quite specific to the U-Blox products, and use their proprietary UBX protocol (again, on a serial port).

Why does the world need gpsctl?

Well, probably the world doesn't actually need gpsctl - but if you happen to be attempting the same thing the author was, you might find it useful. Configuring and controlling a U-Blox GPS connected to a Linux host is a frustrating exercise. The author ran into this when implementing a stratum 1 NTP server using the aforementioned hardware. He needed to make some configuration changes to better support this. Those configuration changes required the use of the UBX protocol, and support for this on Linux is ... minimal. Hence gpsctl!

On the other hand, anyone trying to "talk" to a U-Blox GPS from a C program might find the code in gpsctl to be a useful building block. The code in gpsctl includes functions for sending and receiving UBX protocol messages, for interpreting them, modifying them, etc. This could easily be extended to serve other purposes; after all, not everyone lusts for a stratum 1 NTP server, and there might actually be other useful purposes for a GPS (though I can't think of one right now).

What, exactly, does gpsctl do?

Some gpsctl functions work for any GPS streaming NMEA data over a serial port:

  • Echoes NMEA data to stdout, optionally filtered by NMEA message type.
  • Infers the GPS' baud rate from the stream of NMEA data.

Other gpsctl functions are specific to U-Blox GPS hardware:

  • Configures the baud rate that the U-Blox GPS uses for communication.
  • Configures whether the U-Blox GPS transmits NMEA data.
  • Infers the GPS' baud rate using the UBX protocol only.
  • Queries the U-Blox GPS for position, time, GPS version, GPS configuration, and GPS satellite information. The format of query results are selectable: either plain English or JSON.
  • Tests the pulse-per-second output of the U-Blox GPS (fundamental for NTP).
  • Configures the U-Blox GPS for maximum timing pulse accuracy (useful for building a stratum 1 NTP server based on the GPS' notion of time).
  • Saves the U-Blox GPS configuration to on-module battery-backed memory.
  • Resets the U-Blox GPS.

Dependencies

The only dependencies gpsctl has (other than the standard C library) is on the JSON library cJSON and the popular Raspberry Pi I/O library WiringPi. The source for cJSON (which has an MIT license) is incorporated in this project.
The WiringPi library must be present and linked.

Why is gpsctl's code so awful?

Mainly because this is the first C program the author has written in over 30 years, but also because the author has serious deficiencies in aptitude, intelligence, and knowledge (not to mention choices of hobbies).

How is gpsctl licensed?

gpsctl is licensed with the quite permissive MIT license:

Created: October 18, 2017 Author: Tom Dilatush tom@dilatush.com
Github:
License: MIT

Copyright 2017 Tom Dilatush

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE A AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.