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

Created 10/11/2022 | Last Updated: 30/07/2024

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 development 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.
 

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout