Hi to all!
I want to use a 9 bit serial protocol to interact between a win32 machine and a selfmade hardware. I use pyserial 2.5 and a FT232R USB UART chip by FTDI. Because pyserial seems not to support 9bit data protocols, I found a way to emulate this behavior with a fixed parity setting. Transmission from PC to hardware already works as follows:
ser = serial.Serial()
ser.baudrate = 3000000
ser.parity = serial.PARITY_MARK
# ser.parity = serial.PARITY_SPACE
ser.port = 3
This works fine; I do not often change the 9th bit / parity.
But I can't get the reception working. With parity=PARITY_MARK or PARITY_SPACE I can receive ALL bytes using read(), even the ones with wrong parity. Alternatively, I've checked the same using PARITY_EVEN or PARITY_ODD: in these cases, only the bytes with correct parity are returned using read(). This behaviour is what I want: I need to receive all bytes without checking the correct parity, because I can't guarantee a correct parity transmission due to asynchronously changing the parity settings on transmission side. But I also need to know the parity value of every received byte to simulate a true 9bit communication.
Is there any possibility to read the parity bit's raw value when receiving a byte?
Any comments are welcome!
Thanks in advance