Knowledge Base

The AB Electronics UK Knowledge Base provides support solutions, tutorials and troubleshooting guides.

Knowledge Base

Serial Port Loopback Test

Testing the status of the Serial Port on a Raspberry Pi

You can test if the UART port on your Raspberry Pi works by performing a loopback.

Connect the RX and TX pins on the Serial Pi Plus or Serial Pi Zero, as shown in the image below.  

Conencting the RX and TX pins together on a Raspberry Pi

If you are using the UART port without any expansion boards attached, you can connect the UART RX (pin 8) and TX (pin 10) pins on the 40-pin GPIO header.   Connecting the RX and TX together will send any data transmitted from the Raspberry Pi through the TX pin back to the receive buffer through the RX pin.

We will use the minicom terminal program to perform the test.  If you do not have minicom installed, install it using apt.

sudo apt install minicom

 

Launch minicom with the following command.

minicom -b 115200 -D /dev/ttyS0

The -b parameter sets the baud rate at 115200, and the -D parameter specifies the target UART port as ttyS0.

Note: If you have changed the Raspberry Pi to use the PL011 UART driver you will need to use the /dev/ttyAMA0 device.

When minicom starts, try typing some characters on your keyboard.  If the UART port works, anything you type will be echoed or looped back into the receive buffer and appear on the minicom display.  If you only get a blank screen as you type, there is a problem with the UART connection. In this case, try going through the serial port setup tutorial steps to check that the Raspberry Pi is configured correctly.

You can exit minicom using the keyboard keys CTRL-A q ENTER.
 


Was this article helpful? Yes No

Please tell us how we can improve this article:

Submit
Created 10/11/2022 | Last Updated: 29/10/2023

Related Expansion Boards

Order a Serial Pi Plus Photo of Serial Pi Plus
Serial Pi Plus

RS232 Serial Port for the Raspberry Pi

£13.19 Ex VAT: £10.99
Add to Cart
Order a Serial Pi Zero Photo of Serial Pi Zero
Serial Pi Zero

RS232 serial interface for the Raspberry Pi Zero

£11.39 Ex VAT: £9.49
Add to Cart

Related Articles

Serial Port setup in Raspberry Pi OS Bookworm
Configuring the serial port on the Raspberry Pi
Serial Port Loopback Test
Testing the status of the Serial Port on a Raspberry Pi
PySerial & RS232 Serial Communication
Getting Started with PySerial & RS232 Serial Communication on the Raspberry Pi