Skip to content

Latest commit

 

History

History
70 lines (61 loc) · 2.58 KB

01-TheRightUART.md

File metadata and controls

70 lines (61 loc) · 2.58 KB

The Right UART

So Here is my quest to use the Adafruit Ultimate GPS which comes in 2 flavors,
one is a breakout, https://www.adafruit.com/products/746),
and the other is a hat (https://www.adafruit.com/products/2324)
The issue with it working straight out of the box are

  1. The UART configured to use the GPIO is disabled
  2. The default UART for the GPIO is a mini-UART (i.e. software assisted)
  3. The Hardware UART is enabled and configured to use bluetooth.

There is a fantastic write-up on how to get things back on track, which I am ultimately going to follow:
http://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3

First, I am using a Raspberry Pi 3+, Which I bought from Amazon, but you can get it here:
https://www.adafruit.com/products/3055

With the Jessie Version of Raspian on my Pi3, the default serial port configuration is:

  • /dev/serial0 -> ttyS0
    • a.k.a. mini-UART
    • Is configured for GPIO
    • Is disabled
    • uses the service getty to provide console access
  • /dev/serial1 -> ttyAMA0
    • Is configured for bluetooth
    • Is enabled

These points are demonstrated by displaying the current status of the serial ports:

pi@raspberrypi:~/balloon $ ls -l /dev/ser*
lrwxrwxrwx 1 root root 7 Aug 25 03:46 /dev/serial1 -> ttyAMA0

We enable the GPIO UART by adding the line enable_uart=1 to the bottom of /boot/config.txt file and reboot.

Now we can see both UARTs enabled, but backwards for our purposes:

pi@raspberrypi:~/balloon $ ls -l /dev/ser*
lrwxrwxrwx 1 root root 5 Aug 26 02:48 /dev/serial0 -> ttyS0
lrwxrwxrwx 1 root root 7 Aug 26 02:48 /dev/serial1 -> ttyAMA0

Now it's time to stop the console service, which is unnecessary for the balloon project:
sudo systemctl stop [email protected]
sudo systemctl disable [email protected]

Now, let's not reference the console service in future boots.
Remove the console=serial0,115200 entry from the /boot/cmdline.txt file, and reboot.

Here is my new /boot/cmdline.txt file:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Finally we can disable that pesky bluetooth service by adding the line `dtoverlay=pi3-disable-bt` to the bottom of /boot/config.txt and reboot.

Viola!

pi@raspberrypi:~ $ ls -l /dev/ser*
lrwxrwxrwx 1 root root 7 Aug 26 03:24 /dev/serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Aug 26 03:24 /dev/serial1 -> ttyS0