1

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:

#!/usr/bin/python

import serial
import time

ser = serial.Serial("/dev/ttyAMA0")
while True:
    data=ser.read(1)
    print data
    time.sleep(0.01)

The write side feeds five characters, then exit:

#!/usr/bin/python

import serial

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

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.
jiandingzhe
  • 197
  • 1
  • 10

1 Answers1

4

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).

joan
  • 71,024
  • 5
  • 73
  • 106