I have little experience on UART communication. I am using the PL011 UART instead of mini mart in a Raspberry Pi 3, therefore I should have parity bit. The thing is when I enable the parity bit in my script the message is misunderstood. My question is, do I have parity bit on PL011 UART or I am doing something wrong? I hope that you will be able to help me.
Raspberry Pi code:
import serial, time
ser = serial.Serial(
port="/dev/ttyAMA0",
baudrate=57600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
xonxoff=True
)
print ("START")
time.sleep(2)
while True:
print(ser.read())
Output:
h
Y
?
?
?
K
?
d
h
Y
?
?
?
K
?
d
h
Y
?
?
?
K
?
d
h
Y
?
?
The message sent is:
hello world
The client's code: import serial, time
ser = serial.Serial(
port="/dev/cu.usbserial-AH01W3BD",
baudrate=57600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
xonxoff=True
)
print "START SENDING"
while True:
time.sleep(2)
ser.write("hello world")
print("Outputting transmiter buffer: " + str(ser.out_waiting))
print("Outputting reciver buffer: " + str(ser.in_waiting))
Client's OS: macOS High Sierra