06-20-2019, 01:59 AM
I had a heck of a time configuring my GPS module. I shared this on another forum but thought it might be a good contribution here also. Credit to Gary Dalton and this blog post. Below is a step by step for configuring the neo-6m-gy-gps6m GPS module.
Lots of posts only specify the RP2 info. This was the key issue I was struggling with.
RP3 requires: /dev/ttyS0
RP2 requires: /dev/ttyAMA0
Lots of posts only specify the RP2 info. This was the key issue I was struggling with.
RP3 requires: /dev/ttyS0
RP2 requires: /dev/ttyAMA0
#Installs gpsd clients
sudo apt-get -y install gpsd gpsd-clients python-gps
#Disable the gpsd systemd service
sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket
#Now the gpsd needs to be started and pointed at the UART
sudo killall gpsd
sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock
#Disable the serial getty service
sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service
#Enable UART
sudo nano /boot/config.txt
#At the end of the file add
enable_uart=1
#Edit /boot/cmdline.txt
sudo mv /boot/cmdline.txt /boot/cmdline.txt.orig
sudo nano /boot/cmdline.txt
#Add the following line
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
sudo reboot now
#Connect gpsd to UART and test
sudo killall gpsd
sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock
# Start gpsd at boot
sudo nano /etc/default/gpsd
#Change options to look like this
START_DAEMON="true"
DEVICES="/dev/ttyS0"
GPSD_OPTIONS="-n"
sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket
sudo reboot now
#Test
cgps