Using UART instead of USB

Author Gravatar Image KEVIN TOWNSEND
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:
Copy Code
$ 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

to:

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

Step Two: Edit /etc/inittab

From the command prompt enter the following command:
Copy Code
$ sudo nano /etc/inittab
And change:

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

to:

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

Step Three: Reboot your Pi

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

Step Four: 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:
Copy Code
$ sudo killall gpsd
$ sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
As with the USB example, you can test the output with:
Copy Code
$ cgps -s
Last updated on 2014-04-22 at 04.37.40 PM Published on 2013-01-24 at 04.34.25 PM