Skip to content

How to Enable Serial Port hardware on the Raspberry Pi

Dr. Takeyuki Ueda edited this page Nov 20, 2018 · 3 revisions

By raspi-config command

The screen interface of Raspi-config command depend on it release version.

RASPBIAN STRETCH 2018-06-27 Release:

By editing /boot/config.txt file

Add the line enable_uart=1 to the end of /boot/config.txt file as follows:


# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# ↓↓↓↓↓ Add this line ↓↓↓↓↓
enable_uart=1

Then, reboot to enable this setting as follows:

sudo reboot

Following shell script add the line to end of /boot/config.txt file and ask "Would you like to reboot now?". Actually, this is bottom half of setup.sh script.

sudo sed -i "s/^enable_uart=.*/enable_uart=1/" /boot/config.txt
read -p "Would you like to reboot now?  (y/n) :" YN
if [ "${YN}" = "y" ]; then
  sudo reboot
else
  exit 1;
fi
You can’t perform that action at this time.