I have a Raspberry Pi B and a Raspberry Pi 3. I am trying to get the Raspberry Pi 3's serial port working. I have put a jumper across pins 8 and 10 to check the serial port is working.

I've executed the following code:

import serial
import time

port = serial.Serial("/dev/ttyS0", baudrate = 9600, timeout = 2)

port.write("test data")


rcv = port.read(9)
print "received", rcv

My problem is that I'm not receiving anything.

I have tried the same code on /dev/ttyAMA0 on the Pi B and it works fine.

I have disabled the console from using the serial port in raspi-config and rebooted.

What could I be doing wrong?

  • Have you seen this raspberrypi.stackexchange.com/questions/45570/… Commented Apr 23, 2016 at 20:43
  • Thank you for your input. I have switched to using /dev/serial0 and introduced the core_freq=250 line to no avail.
    – piaaw
    Commented Apr 23, 2016 at 21:11
  • Having the same problem, only using Cpp and wiringPi serial. Similarly I tested it with Pi 2 and the code was working but Pi 3 seems to require some tricks.
    – ozgeneral
    Commented May 24, 2016 at 23:36
  • where is your "while Ture:" what was the error exactly?
    – yangfan
    Commented Mar 8, 2017 at 11:36
  • Sounds like you're missing enable_uart=1 in /boot/config.txt. Commented Aug 8, 2017 at 16:15

3 Answers 3


Its because in RPI3 ttyS0 is disabled by default. enable the ttyS0 in file sudo nano /boot/config.txt and at the bottom of file change 0 to 1 to enable ttyS0 enable_uart=1 and reboot.

I followed this: https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/


Make sure the login shell is off and that the harwdare is enable: Use the raspi-config for that. the login shell keeps changing the permission of your port and will cause problems

check the group of /dev/ttyS0 with the command ls -la /dev/ttyS0. The group should be dialout. If not, setup the proper permission with sudo chgrp dialout /dev/ttyS0


first, list all your serial files:

$ ls -l /dev/serial*

then, change /dev/ttyS0 to /dev/serial0 if your serial0 is your ttyS0 device.

  • 4
    This is not exactly an answer to the question, and probably not a good idea. If you want to use a different name, use a symlink (ln -s /dev/ttyS0 /dev/serial0), don't move or delete the original node.
    – goldilocks
    Commented Jul 8, 2017 at 16:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.