-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to detect Parity errors? #40
Comments
First invoke configureComPortData and then configureComPortControl. scm.configureComPortData(handle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_EVEN, BAUDRATE.B9600, 0); |
Hi @RishiGupta12 . Thanks for prompt response. Here is the code that i tested on Windows 10 x64 :
` Output: [DCBlength : 28, BaudRate : 9600, fBinary : TRUE, fParity : FALSE, fOutxCtsFlow : FALSE, fOutxDsrFlow : FALSE, fDtrControl : DTR_CONTROL_ENABLE, fDsrSensitivity : FALSE, fTXContinueOnXoff : TRUE, fOutX : FALSE, fInX : FALSE, fErrorChar : FALSE, fNull : FALSE, fRtsControl : RTS_CONTROL_ENABLE, fAbortOnError : FALSE, fDummy2 : NA, wReserved : NA, XonLim : 2048, XoffLim : 2048, ByteSize : 8, Parity : 3, StopBits : 0, XonChar : �, XoffChar : �, ErrorChar : , EofChar : , EvtChar : , wReserved1 : NA] fParity : FALSE I tested this on two different Windows 10 x64 machines the output is the same, parity is not enabled. I also tested parity check functionality on Ubuntu 19 :
Output: [0, 8216, 0, 1073745853, 0, 0, 3, 28, 127, 21, 4, 1, 0, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 9600, 9600] Data read: -1 SerilComLineErrors class didn't picked up parity error. The POSIX did mark the parity error that is why the app received -1 and 0 before the byte value 127. SerilComLineErrors mechanism does not work on Ubuntu 19. |
|
I'm working on implementation of full duplex host that uses RS 232 physical interface. How are you ensuring that parity error happens in hardware?
Test scenario: My host app expects the parity bit to be set, but i send data from serial monitor that does not have the bit set, this is the way i ensure parity error should happen. Note: I only use parity type that OS supports. I have tested your library on Windows 10 x64.
Parity checking does work on Ubuntu 19.
|
Your test case will generate Framing error not parity error. Receiving end will see logic high as parity bit. This means receiving end will always receive 1 as parity bit value. Try this set odd parity at receiver side and send 8 bit data as 00011111 from sending side (odd number of once in data frame). Due to odd parity setting, receiving side will expect 0 as parity bit value which it will not get as sender side will always send 1 as parity bit, hence parity error will be generate at receiving end. |
@RishiGupta12 |
The library won't enable parity check on Windows 10 x64.
I've tried this example that you provided https://github.com/RishiGupta12/SerialPundit/tree/master/applications/d1-blocking-read-com
with enabling ParFraError like this:
scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', true, false);
after this i printed:
System.out.println(Arrays.toString(scm.getCurrentConfiguration(handle)));
and i got this:
[DCBlength : 28, BaudRate : 19200, fBinary : TRUE, fParity : FALSE, fOutxCtsFlow : FALSE, fOutxDsrFlow : FALSE, fDtrControl : DTR_CONTROL_ENABLE, fDsrSensitivity : FALSE, fTXContinueOnXoff : TRUE, fOutX : FALSE, fInX : FALSE, fErrorChar : FALSE, fNull : FALSE, fRtsControl : RTS_CONTROL_ENABLE, fAbortOnError : FALSE, fDummy2 : NA, wReserved : NA, XonLim : 2048, XoffLim : 2048, ByteSize : 5, Parity : 1, StopBits : 0, XonChar : �, XoffChar : �, ErrorChar : , EofChar : , EvtChar : , wReserved1 : NA]
fParity is false, but it should be true
The text was updated successfully, but these errors were encountered: