0

I am looking at using the BSD checksum described here at wiki BSD does anyone know if you can use it for basic error correction?

Chris James
  • 151
  • 2
  • 14

1 Answers1

1

Consider an 8 bit or 16 bit left rotating checksum where all the message bytes are supposed to be zero, but one them has a single bit error. The checksum will detect the error, but you'd get the same checksum for message[0] = 0x01, or message[1] = 0x02, ... , or message[7] = 0x80. The checksum can't determine which of these 8 (or more) possible error cases occurred, so it can't be used for error correction.

You'd need at least something like a Hamming code, BCH code or RS code to be able to correct one more bit errors. Since you have CRC as a tag, a single bit correcting binary BCH code is essentially the same as a CRC using a "primitive" polynomial that is the basis for a finite field, if the message length (including the CRC) is shorter than the number of possible values in the finite field. For example, a 15 bit message would have 11 data bits and 4 "parity" bits, based on a finite field of GF(2^4) (GF(16)).

rcgldr
  • 27,407
  • 3
  • 36
  • 61
  • Thanks that makes total sense il have to look more into alot of them to see if I can use them for my purpose I have 18 data bits and 4 left for CRC with atleast 2 bit error detection might be hoping for a bit much with error correction aswell. – Chris James Dec 20 '18 at 21:16
  • @ChrisJames - A 4 bit CRC can only detect all 2 bit errors for up to 11 data bits, and in that case only if the 4 bit CRC is based on a 5 bit primitive polynomial: x^4 + x + 1 or x^4 + x^3 + 1. Say you have 12 data bits and 4 CRC bits, then a message with errors in bit[0] and bit[15] will indicate good CRC, even though it's a 2 bit error. – rcgldr Dec 20 '18 at 22:55
  • @ChrisJames - for 18 bits of data and a 4 bit CRC, the odds of a 2 bit error not being detected are low, only 6 cases out of a possible 231 cases of 2 bits out of 22 being in error will indicate good CRC, about 2.6%. – rcgldr Dec 20 '18 at 23:05