Skip to content

Instantly share code, notes, and snippets.

@celeron55
Created December 18, 2017 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celeron55/a951799517850dfec9a793b5247fa046 to your computer and use it in GitHub Desktop.
Save celeron55/a951799517850dfec9a793b5247fa046 to your computer and use it in GitHub Desktop.
libsigrokdecode can crc last-bit-stuffing patch
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 5be3e99..72fb505 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -129,7 +129,7 @@ def is_stuff_bit(self):
# CAN uses NRZ encoding and bit stuffing.
# After 5 identical bits, a stuff bit of opposite value is added.
# But not in the CRC delimiter, ACK, and end of frame fields.
- if len(self.bits) > self.last_databit + 16:
+ if len(self.bits) > self.last_databit + 17:
return False
last_6_bits = self.rawbits[-6:]
if last_6_bits not in ([0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0]):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment