如何确定使用哪个 CRC?
如果我有一定数量的字节要串行传输,如何确定使用哪种 CRC(CRC8、CRC16 等,基本上是多少位 CRC?)并且错误检测百分比仍然很高?有这个公式吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 CRC 长度的角度来看,适用正常统计。对于 CRC 位宽,出现误报的几率为
1/(2^n)
。因此,对于 8 位 CRC,您有 1/255 的机会,等等。但是,所选择的多项式也会产生很大的影响。数学高度依赖于正在传输的数据,这并不是一个简单的答案。
您应该根据您的通信机制评估不仅仅是 CRC(使用 Turbo 码等系统的 FEC 非常有用且常见)。
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).
要回答这个问题,您需要知道您频道的误码率,该误码率只能确定凭经验。然后,一旦获得测量的 BER,您就必须决定什么检测率对于您的目的来说足够“高”。
例如,发送每条消息 5 次,即使在非常嘈杂的通道上,也会给您带来相当好的检测效果,但它确实会稍微降低您的吞吐量。但是,如果您要向深空探测器发送命令,则可能需要这种冗余。
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.
选择 CRC 的一个很好的参考是 Philip Koopman 的 CRC Zoo。他详尽地计算了保证常用多项式的最小汉明距离的消息位数。要使用此数据,请将多项式和汉明距离设置为比可容忍的位翻转数量大 1,您可以查找可以保护的消息位的最大数量。如果这对于您的需求来说太低,请寻找不同的多项式或更大的 CRC。请注意,他对多项式使用的表示法与通常使用的表示法不同,但存在交叉引用。
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.