Configuring the Raspberry Pi 5 Serial Port

Spread the love

To use the Raspberry Pi 5’s serial port, enable it with sudo raspi-config: open Interface Options, select Serial Port, answer No to the login shell question and Yes to the serial port hardware question, then reboot. The port appears at /dev/ttyAMA0 on GPIO pins 14 and 15; the Linux console stays on the Pi 5’s dedicated debug connector.

The Raspberry Pi 5 handles its serial ports differently from every model before it. Peripheral I/O moved to the RP1 controller chip, the Linux console moved to a dedicated three-pin UART debug connector, and the UART on the GPIO header is a full-featured PL011 that Bluetooth never touches. The practical result is that on the Pi 5 the serial port mostly just needs to be switched on.

This application note covers the Raspberry Pi 5 running current Raspberry Pi OS, the operating system installed by Raspberry Pi Imager; the same steps apply to the Raspberry Pi 500. Once enabled, the port can drive any 3.3V serial device, including RoboClaw motor controllers in packet serial or standard serial mode.

What You Need

  • Raspberry Pi 5
  • USB-C power supply for the Raspberry Pi
  • MicroSD card with current Raspberry Pi OS installed
  • Monitor, keyboard, and mouse, or an SSH connection to the Pi

How Is the Pi 5’s Serial Port Different?

Earlier Raspberry Pi models had to share two UARTs between the GPIO header, the Bluetooth radio, and the Linux console, which is why configuring them means shuffling assignments. The Pi 5’s RP1 I/O controller provides its own PL011 UARTs for the GPIO header, Bluetooth is served by a separate UART on the main processor, and the Linux console lives on the dedicated debug connector rather than on GPIO 14 and 15.

Port Linux device Default role
UART0 (GPIO 14 and 15) /dev/ttyAMA0 Disabled by default
Debug connector (3-pin) /dev/ttyAMA10 Linux console

Because the console is not on the GPIO header, there is nothing to evict. Enabling UART0 is the only required change, and as a full PL011 it has none of the mini UART’s baud rate quirks found on earlier models.

How Do You Enable the Serial Port with raspi-config?

The raspi-config tool is the recommended method on current Raspberry Pi OS and works on both the desktop and Lite versions of the operating system.

  1. Open a terminal window on the Pi’s desktop, or connect to the Pi over SSH.
  2. Start the configuration tool:
    sudo raspi-config
  3. Select Interface Options.
  4. Select Serial Port.
  5. When asked if you would like a login shell to be accessible over serial, select No. This keeps the login console off the GPIO serial port.
  6. When asked if you would like the serial port hardware to be enabled, select Yes. On the Pi 5 this enables UART0 on the GPIO header.
  7. Select Finish, then reboot the Pi so the changes take effect:
    sudo reboot

How Do You Enable the Serial Port Manually?

A single line in the boot configuration enables UART0. The file lives on the SD card’s boot partition, so it can be edited from another computer before the Pi ever boots, which is convenient for headless setups.

  1. Open the boot configuration file:
    sudo nano /boot/firmware/config.txt
  2. Scroll to the bottom of the file and add the following line, then press Ctrl+X, Y, and Enter to save:
    dtparam=uart0=on
  3. Reboot the Raspberry Pi.

The RP1 provides additional UARTs that can be enabled on other GPIO pins with device tree overlays if your project needs more than one serial port. The official Raspberry Pi UART configuration documentation covers the available overlays and options.

How Do You Verify the Serial Port Is Working?

After the reboot UART0 is available on GPIO 14 (transmit, physical pin 8) and GPIO 15 (receive, physical pin 10). Confirm the device exists with:

ls -l /dev/ttyAMA0

Use /dev/ttyAMA0 as the port name in Python or other code on the Pi 5. Note that /dev/serial0, the alias used on earlier Raspberry Pi models, points at the debug connector’s UART on the Pi 5, so code written for earlier models needs its port name updated.

The Raspberry Pi’s GPIO pins, including the serial port pins, are 3.3V only. Devices with 3.3V logic connect directly; RoboClaw motor controllers, for example, output 3.3V logic and tolerate up to 5V on their inputs, so no level shifter is needed. Never connect 5V logic or an RS-232 port directly to the Pi’s GPIO pins; doing so will damage the Pi.

Next Steps

If you are using the serial port to drive a motor controller, Packet Serial with the Raspberry Pi 3 and Standard Serial with the Raspberry Pi 3 walk through wiring a RoboClaw to the GPIO serial pins and controlling it from Python. The pins are the same on the Pi 5; the only change needed in the code is the port name, /dev/ttyAMA0. If you are configuring an earlier model, see Configuring the Raspberry Pi 3 Serial Port.