Knowledge Base
The AB Electronics UK Knowledge Base provides support solutions, tutorials and troubleshooting guides.
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.
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.
Related Expansion Boards
Related Articles
Getting Started with PySerial & RS232 Serial Communication on the Raspberry Pi