Raspberry Pi Zero Serial Port


Overview

The Raspberry Pi has two serial ports; one is very robust (the PL011) and the other is less powerful (the mini-UART).

On the older Pis, the PL011 was used to drive the console and was freely available for other uses by disconnecting the console from the UART.

On the Pis with wireless/Bluetooth modules (such as the Pi 3 and Pi Zero W), the PL011 is used to drive the module. It is not readily available at the GPIO connector as it was on the previous Pi models.

On the wireless/Bluetooth models, the mini-UART is used to drive the console and is available at the GPIO connector. Unfortunately, it is tied to the CPU clock which varies in speed depending on the load. It can be stabilized by forcing the CPU to a lower constant frequency, but this cripples the CPU somewhat.

By default:

  • /dev/ttyS0 refers to the mini UART
  • /dev/ttyAMA0 refers to the PL011
  • The primary UART is that assigned to the Linux console, which depends on the Raspberry Pi model as described above, and can be accessed via /dev/serial0.

The author has verified that the core frequency is limited to 250 Mhz when UART=1 on the Pi Zero W.

Disconnecting Bluetooth to Allow Use of the UART

The Bluetooth module can be disconnected from the UART and the UART remapped to the GPIO header by the following:

  • add line dtoverlay=pi3-disable-b to /boot/config.txt
  • execute command sudo systemctl disable hciuart so the modem no longer uses the UART (only needs to be executed once)

 

Official Info

https://www.raspberrypi.org/documentation/configuration/uart.md

,

Leave a Reply

Your email address will not be published. Required fields are marked *