How to set Raspberry UART

Introduction to the UART setup

In this article, we will try to set up the UART on the Raspberry Pi 3 and Raspberry Pi Zero W running the latest debian “Jessy” release of the kernel.

This used to be pretty easy on the previous versions of the Raspberry Pi models but on the Raspberry Pi 3 model, it is a little bit different.
The BCM2837 on the Raspberry Pi3 has 2 UARTs (as did its predecessors), however, to support the Bluetooth functionality the fully featured PL011 UART was moved from the header pins to the Bluetooth chip and the mini UART made available on the header pins 8 and 10. Hence, the miniUART is now available on /dev/ttyS0.
Now the bluetooth module occupies the UART channel /dev/ttyAMA0 which on previous models was used as the primary serial GPIO UART interface.
So on the Raspberry Pi 3, the UART hardware interface used for the Bluetooth is named /dev/ttyAMA0 and the new UART connected to pins 8 and 10 on the GPIO connector J8 is named /dev/ttyS0.

Unfortunately, there are a number of other consequences:

The mini UART is a secondary low throughput UART intended to be used as a console.
The mini UART has the following features:

  • 8 symbols deep FIFOs for receive and transmit.
  • 7 or 8-bit operation.
  • 1 start and 1 stop bit.
  • No parties.
  • Break generation.
  • SW controlled RTS, SW readable CTS.
  • Auto flow control with programmable FIFO level.
  • Baudrate derived from the system clock.

There is no support for parity and the throughput is limited, but the latter should not affect most uses.

Before beginning, there is usually wise to update your installation to the latest version of the debian “jessy”:
First, update your system’s package list by entering the following command:

sudo apt-get update

Next, upgrade all your installed packages to their latest versions with the command:

sudo apt-get dist-upgrade

Generally speaking, doing this regularly will keep your installation up to date.
Also be aware that downloaded package files (.deb files) are kept in /var/cache/apt/archives. You can remove these in order to free up space with sudo apt-get clean.

To find the kernel version and distribution version, run:
Kernel version:

uname -a

Distribution version:

cat /etc/os-release

Some issues:
There is an issue with some of the releases of jessy which makes the UART work not as intended in some situations:
See post on raspi org here.
And follow up post on git here.

 

 

https://medium.com/@DefCon_007/using-a-gps-module-neo-7m-with-raspberry-pi-3-45100bc0bb41

http://www.hobbytronics.co.uk/raspberry-pi-serial-port

 

Rasp UART

ประเภทเนื้อหาของ article
Raspberry Pi Zero
Rating
No votes yet