Created
November 19, 2018 09:41
-
-
Save kohlerdominik/fc169238df94a33f8a05c65da57aaee2 to your computer and use it in GitHub Desktop.
Enable Serial Interface via UART for the Raspberry PI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# # # # # # # # # # # # # # # # # # # | |
# Enable Serial Interface via UART # | |
# # # # # # # # # # # # # # # # # # # | |
# Dominik Kohler @ 19.11.2018 | |
# Tested on Raspbian Stretch (9.4) | |
# Disabling Linux's use of console UART (https://www.raspberrypi.org/documentation/configuration/uart.md) | |
sed -i -e 's/console=serial0,115200 //g' /boot/cmdline.txt | |
# Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. | |
printf "\ndtoverlay=pi3-disable-bt\n" >> /boot/config.txt | |
# Disable Systemd service that initialises the modem which uses the UART usually. | |
systemctl disable hciuart | |
echo "Reboot is required for changes to take effect" | |
# Configure the UART interface to 9600/8/1. Output all received data in terminal (end with CTRL+C) | |
# stty -F /dev/ttyAMA0 9600 min 1 time 0 -brkint -icrnl -imaxbel -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke | |
# cat /dev/ttyAMA0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment