Basicmicro.com

Cart:

You have 0 items in your shopping cart.

0

Configuring the Raspberry Pi 3 Serial Port

Configuring the Raspberry Pi 3 Serial Port

Introduction


The Raspberry Pi is a powerful single board computer that can be used as the "brains" of numerous robotics projects. It's serial port can be used to control one or more RoboClaws in packet serial mode or standard serial mode. However both of the serial ports available are tied to functionality on the Raspberry Pi. Before using a Pi to control a RoboClaw one of the serial ports must be freed up so that it is available at the board's GPIO pins. This Application Note explains how to free up the miniUART on a Raspberry Pi 3B or 3B+.

Materials


(1) Raspberry Pi 3B or 3B+
(1) USB power supply for Raspberry Pi
(1) HDMI cable
(1) monitor
(1) USB keyboard
(1) USB mouse

Let's get started


1. Connect the Raspberry Pi to your monitor with an HDMI cable.

2. Connect the USB keyboard and mouse to your Raspberry Pi's USB ports.

3. Power on the Pi by connecting the USB power supply.

4. Once the Pi's desktop loads, open a terminal window. This is where the configuartion for the serial port will be done.

5. Begin by enabling the miniUART. In the terminal enter the following to open the config file:

sudo nano /boot/config.txt


This opens the nano text editor so that an entry can be made to enable the UART. Scroll to the bottom of the file and add the following line:

enable_uart=1


After entering the previous line press control+x to exit nano. When nano asks to save the changes press Y followed by enter and the configuration will be saved. After exiting nano the terminal prompt will be ready for the next set of commands.

6. Disable the serial console by entering the following commands:

sudo systemctl stop [email protected]

sudo systemctl disable [email protected]


7. Finally remove the serial console from the system by opening the cmdline.txt file:

sudo nano /boot/cmdline.txt


Once the file is open delete this portion of the entry in the file:

console=serial0,115200


Exit nano and save your changes as done in step 5

8. Reboot the Raspberry Pi and the changes will take effect.

9. The Raspberry Pi will now be able to use the miniUART on GPIO pins 14 and 15.