Using UART instead of USB

If you wish to use HW UART instead of the USB cable, it's perfectly possible ... you just need to do a bit more work to free the UART up on your Pi.

To get started, hook the GPS module up to your Pi as follows, cross-connecting the TX and RX pins (TX on one device goes to RX on the other and vice versa), and supply 5V from the Pi to the VIN pin on the GPS module:
We designed the Ultimate GPS with a built-in regulator, so even if it's powered with 5V, the signal levels are still 3.3V - safe for your Pi!

Step One: Edit /boot/cmdline.txt

Next, enter the following command from the command line:
$ sudo nano /boot/cmdline.txt

And change:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

(eg, remove console=ttyAMA0,115200 and if there, kgdboc=ttyAMA0,115200)

Note you might see console=serial0,115200 or console=ttyS0,115200 and should remove those parts of the line if present.

Raspbian Wheezy only

Step Two: Edit /etc/inittab

From the command prompt enter the following command:

$ sudo nano /etc/inittab

And change:

#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100


#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

That is, add a # to the beginning of the line!


Raspbian Jessie

Step Two:

For the Raspberry Pi 1 or 2 (but NOT the 3!) Run the following two commands to stop and disable the tty service:

sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.service 

However for the Raspberry Pi 3 you need to use the /dev/ttyS0 port since that is what is normally connected to the GPIO serial port pins.  Use these two commands instead:

sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

Step Three: Raspberry Pi 3 Only

For the Raspberry Pi 3 you need to explicitly enable the serial port on the GPIO pins.  The reason for this is a change with the Pi 3 to use the hardware serial port for Bluetooth and instead use a slightly different software serial port for the GPIO pins.  A side effect of this change is that the serial port will actually change speed as the Pi CPU clock throttles up and down--this will unfortunately cause problems for most serial devices like GPS receivers!  

Luckily there's an easy fix detailed in this excellet blog post to force the Pi CPU into a fixed frequency which prevents speed changes on the serial port.  The Pi might not perform as well but it will have a stable serial port speed.

To make this change edit the /boot/config.txt file by running:

sudo nano /boot/config.txt

At the very bottom of the file add this on a new line:


Save the file (press Ctrl-O, then enter) and exit (press Ctrl-X).  You're all set!

Step Four: Reboot your Pi

After rebooting the Pi for the above changes to take effect, you can proceed with running gpsd ...

Step Five: Restart GPSD with HW UART

Restart gpsd and redirect it to use HW UART instead of the USB port we pointed it to earlier. Simply entering the following two commands.

For the Raspberry Pi 1 or 2 (but NOT the 3!) run these commands:

$ sudo killall gpsd
$ sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock

And for the Raspberry Pi 3 run these commands to use the different serial port:

sudo killall gpsd
sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock
As with the USB example, you can test the output with:
$ cgps -s
Last updated on 2016-07-08 at 01.20.20 AM Published on 2013-01-24 at 11.34.25 AM