Here goes a story of frustration...
I'm developing a Modbus over RS485 device. Modbus standard says that default configuration of the serial port must be 19200 baud, 8 bits, *Even parity*, 1 stop bit.
Fair enough, you usually never use this parity setting, but this time have to enable it. No problem, let's do it...
It just does not work. Why? Whatever setting I set, there is no parity bit generated. WTF? Ok, I finally get that my ust-to-rs485 dongle is CH340 based and Linux driver still does not support parity setting for it while there is a patch available for over a year. Well, typical Linux - takes time and effort.
Ok, i switch to another dongle - Silabs CP2102 based "6 in 1" off the ebay. Woo hoo - the parity bit gets generated! ...It's ...just ...wrong... If Even parity is set, it's always high, if Odd parity - always low, no matter the number of bits in the byte. Seems that it's implemented as if it's Space and Mark parity.
Now I'm just rummaging through my stock of usb to serial dongles and trying everyone - Prolific PL2303 -- the same results, FTDI FT232 (most probably fake) -- the same results!
I grab a genuine Arduino with atmega8u as usb to serial converter - AH!, it works. I grab a chinese clone with the same atmega8u - it also works properly!
I wander if it's Linux drivers for 3 different chips that are broken or if there is the same broken state machine in all of those seemingly different chips?
I don't have a windows machine to test those and would appreciate if someone with access to one could grab a bunch of cheap dongles and run some tests to see if Parity bit is set properly when connected to Windows?
... it seems for now I will have to release a not quite Modbus compatible device, just because this shitty situation and because I want my users to have an easy access to it... doh!