A simple device driver for the U-blox NEO6M (might be compatible with other NEO-6 series although it is now deprecated according to the product page). It uses software-serial to communicate with the GPS receiver over the Raspberry Pi GPIO pins. See the datasheet for the module itself and the NMEA-0183 protocol for more information about the hardware.
Besides the actual hardware, to connect and use the GPS receiver with the Raspberry Pi (running Raspbian), it needs the following packages/executables.
- kernel headers : the kernel headers are needed to compile this kernel module. The version to download will depend on your (target) kernel version which can be found running
uname -r
. - dtc : RPi uses device tree for hardware enumeration. The
dtc
command will be used to compile the overlay and it may already be installed by default. The compiled overlay can be placed in the overlays directory and configured to be applied on boot.
By default, the GPS receiver uses the NMEA 0183 protocol with the following UART settings:
- Baudrate : 9600 bps
- Data bits : 8
- Parity bit : None
- Stop bit : 1
- Supported messages : GSV, RMC, GSA, GGA, GLL, VTG, TXT
Although the GPS receiver can handle other communication protocols and messages, this is the configuration used for this project. For more information on the configuration, see the datasheet for the GPS receiver.
Clone the repository, run make
to compile the device tree overlay and the kernel module.
This kernel module uses the GPIO pins specified in overlay.dts
.
Therefore, the overlay must be compiled, and put into /boot/firmware/overlays/
for it to be accessible.
Specify the overlay in /boot/config.txt
to apply the overlay.
For example,
# Compile the overlay
dtc -@ -I dts -O dtb -o $(DT_OVERLAY).dtbo $(DT_OVERLAY).dts
# Place the overlay in the overlays dir
cp $(DT_OVERLAY).dtbo /boot/firmware/overlays/.
# Edit config.txt to include the overlay
echo "dtoverlay=$(DT_OVERLAY)" >> /boot/config.txt
After rebooting, check that the overlay has been properly applied to the device tree by running
dtc -I fs /sys/firmware/devicetree/base | less
There should be the module name in the device tree.
To install the kernel module, run :
insmod gps.ko
sudo
may be needed due to permission.
modprobe
may be used instead of insmod
but there are no other dependencies for this module.
To ensure that the kernel module has been installed, check the messages from the kernel by running :
dmesg -wH
To remove (uninstall) the kernel module, run :
rmmod gps
As it is a kernel module, you can use applications like cat
and echo
to read and write data to the device.
For example:
TODO:
GPL