diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2016-10-16 18:26:18 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2016-10-19 22:36:49 +0200 |
commit | 711d0602317e28ddc123ab540036b37979df70c4 (patch) | |
tree | 73839fd6e16a6f5b48424f310bd6d9707fc2ffbf /decoders | |
parent | 6ffd71c169f0562134b5e7548ea0a36f93604d86 (diff) | |
download | libsigrokdecode-711d0602317e28ddc123ab540036b37979df70c4.tar.gz libsigrokdecode-711d0602317e28ddc123ab540036b37979df70c4.zip |
uart: skip frames with invalid start bits
When the start bit is not low at its sample point, then stop trying
to interpret the remaining frame -- it's already known to be invalid,
anyway.
Wait for the next start bit instead, assuming that either the falling
edge which started the inspection of the UART frame and its start bit
was a spurious glitch or that the captured signal does not communicate
at the decoder's configured bitrate.
Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/uart/pd.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index af773b4..093f3fc 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -223,11 +223,13 @@ class Decoder(srd.Decoder): self.startbit[rxtx] = signal - # The startbit must be 0. If not, we report an error. + # The startbit must be 0. If not, we report an error and wait + # for the next start bit (assuming this one was spurious). if self.startbit[rxtx] != 0: self.putp(['INVALID STARTBIT', rxtx, self.startbit[rxtx]]) self.putg([rxtx + 10, ['Frame error', 'Frame err', 'FE']]) - # TODO: Abort? Ignore rest of the frame? + self.state[rxtx] = 'WAIT FOR START BIT' + return self.cur_data_bit[rxtx] = 0 self.datavalue[rxtx] = 0 |