]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/can/pd.py
can: Skip stuff bit inspection where not applicable
[libsigrokdecode.git] / decoders / can / pd.py
index 46054cda851865be1abc33c911368cb9761f4832..375069f2042a1b1ea0d10a36857fc874cc27fc16 100644 (file)
@@ -113,6 +113,9 @@ class Decoder(srd.Decoder):
     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:
+            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]):
             return False