Skip to main content
1 of 4
jonathanjo
  • 16.2k
  • 3
  • 36
  • 74

If you specifically want to know what the sender is doing: as opposed to making communications work ...

Background

enter image description here

Case 1 is a sender sending back-to-back 8N1 (ASCII 'J' = 0x4a). If the sender is a little slow, we get a short delay (case 2), a whole bit delay (case 3) or more (case 4).

Case 5 is back-to-back 8N2, with a little delay (case 7).

Note that 8N2 is indistinguishable from 8N1 with a 1-bit delay (cases 3 and 5), and so 8N2-with-small-delay is indistinguishable from 8N1-with-longer-delay (cases 4 and 6). Exact 1-bit delay is extremely uncommon.

However, if the baud rate is slow enough or the computer is fast enough, you will have case 1 or 5.

Method 1: Timing

You can tell 8N1 vs 8N2 by timing. If you can get the timing accurate enough, either blocks of data with stopwatch, special program to time incoming bytes (might be tricky in Windows), or oscilloscope.

Method 2: Parity

If your sender is sending back-to-back data, you can use the receiver's parity detection to look at the position of the second stop bit:

If you set the receiver to have parity (either 8E1 or 8O1), then you will have either:

  • Case A (sender sending 8N1 followed by the next byte's start bit), which will be a parity error on half the byte values and a framing error on every byte. (Because the receiver will always see the stop bit as a 1, which will be often be an error, and the new start bit where the stop bit should be.)
  • Case B (sender sending 8N2), which will be a parity error on half the byte values and no framing errors. (Because the receiver will always see the stop bit as a 1, which will be often be an error, and the second stop bit where a stop bit should be.)

enter image description here

jonathanjo
  • 16.2k
  • 3
  • 36
  • 74