Serial Comms on a Raspberry Pi

Having spent an very frustrating afternoon trying to get a simple loop back serial test to work on a Rpi 3 I finally managed to succeed.

The basic problem is that over time things have changed in both Pi s/w and h/w, particularly with the Pi3. The net result is that nearly all the instructions  you can find are wrong in some way or another. I’m sure in time the follow will become obsolete but as of Sunday 8th Jan 2017 they worked for me !

Note these assume you don’t need the built in Bluetooth interface, they are largely based on the following post on Raspberrypi .stackexchange http://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3  – thanks naseer mohamad

And assume you have worked for me using an up to date 2.1 version of Noobs

from a terminal enable serial communications using

sudo raspi-config

in /boot/config.txt  disable Bluetooth

sudo nano /boot/config.txt

Add at the end of the file

 

dtoverlay=pi3-disable-bt

then save and exit

Disable the Serial Console edit the file using

sudo nano /boot/cmdline.txt

remove the word phase “console=serial0,115200” or “console=ttyAMA0,115200

Exit and save your changes

Connection example to Arduino – not pi is 3.3 most Arduino’s are 5 hence some form of level shift is needed on the Pi Rx input [ credit toto Oscar Liang  for pic]

Installing ‘minicom’ terminal App  – to test serial link

sudo apt-get install minicom

to run  – assuming Arduino is set to 9600

minicom -b 9600 -o -D /dev/ttyAMA0