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.

1 Answer 1

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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