I made a pair of programs to test UART function (GPIO 14 and 15 connected together). The read side works in a infinite loop and prints everything it got:


import serial
import time

ser = serial.Serial("/dev/ttyAMA0")
while True:
    print data

The write side feeds five characters, then exit:


import serial

ser = serial.Serial("/dev/ttyAMA0")

However, both programs just stuck and got nothing output.

My configuration is:

  • raspberry Pi 3;
  • GPIO 14 and 15 connected together;
  • removed console declaration from /boot/cmdline.txt;
  • added enable_uart=1 into /boot/config.txt;
  • no dtoverlay used.

Isn't /dev/ttyAMA0 used for Bluetooth on the Raspberry Pi3?

You may need to use /dev/ttyS0 or /dev/serial1 on the Pi3 (check in /boot/overlays/README).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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