#46 parity bit access

v1.0 (example)

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:

import serial
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


  • Chris Liechti

    Chris Liechti - 2011-08-05

    no, this is currently not possible. it seems that not all operating systems give access to the value of the parity bit anyways. :/

  • Chris Liechti

    Chris Liechti - 2011-08-05
    • assigned_to: nobody --> cliechti
    • status: open --> pending
  • Chris Liechti

    Chris Liechti - 2014-08-04
    • status: pending --> closed
    • Group: --> v1.0 (example)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks