Reputation: 1201
If I have a certain number of bytes to transfer serially, how do I determine which CRC (CRC8, CRC16, etc., basically a how many bit CRC?) to use and still have error detection percentage be high? Is there a formula for this?
Upvotes: 5
Views: 4340
Reputation: 3411
A good reference for selecting CRCs is Philip Koopman's CRC Zoo. He has exhaustively computed the number of message bits that guarantee a minimum Hamming distance for common polynomials. To use this data, given a polynomial and a Hamming distance set as one more than the tolerable number of bit flips, you lookup the maximum number of message bits that can be protected. If that is too low for your needs, look for a different polynomial or a larger CRC. Note that he uses a different notation for the polynomials than those usually used but there is a cross reference.
Upvotes: 0
Reputation: 43487
To answer this question, you need to know the bit error rate of your channel which can only be determined empirically. And then once you have the measured BER, you have to decide what detection rate is "high" enough for your purposes.
Sending each message, for example, 5 times will give you pretty pretty good detection even on a very noisy channel, but it does crimp your throughput a bit. However, if you are sending commands to a deep-space-probe you may need that redundancy.
Upvotes: 5
Reputation: 33167
From a standpoint of the length of the CRC, normal statistics apply. For a bit-width of CRC, you have 1/(2^n)
chance of having a false positive. So for a 8 bit CRC, you have a 1/255 chance, etc.
However, the polynomial chosen also makes a big impact. The math is highly dependent on the data being transferred and isn't an easy answer.
You should evaluate more than just CRC depending on your communication mechanism (FEC with systems such a turbo codes is very useful and common).
Upvotes: 6