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.