![]() |
|
| Home Analog Devices Feedback Subscribe Archives 简体中文 日本語 | |
|
|
|
|
Cyclic Redundancy Checking Ensures Correct Data Communications Electronic systems operating in industrial environments must often endure temperature extremes, electrically noisy environments, or other harsh conditionsnevertheless, it is critical that they work correctly. For example, if the data sent to a DAC controlling the position of a robotic arm were corrupted, the arm could move in an unintended direction. This could not only be dangerous but costly: imagine the arm smashing into the side of a new car on a production lineor, worse yet, into a production worker. Several methods are available to ensure that the correct data has been received before action is taken. The simplest is for the controller to read back the data that was sent. If the received data doesn't match the sent data, one of them has been corruptedand new data must be sent and verified. This method is reliable, but it also comes with a large overhead: each piece of data must be verified, doubling the amount of data transferred. An alternative, cyclic redundancy checking (CRC), is to send a checksum with each packet of data. The receiving device will indicate if a problem has occurred, so the controller does not need to verify reception. Checksums are commonly generated by applying a polynomial equation to the data. CRC-8 produces an 8-bit checksum when applied to a 24-bit word. Combining the checksum with the data, transmitting all 32 bits to a device that can analyze the combination, and indicating errors that occurthough not a totally perfect solutionis more efficient than the write-and-read method. Many Analog Devices DACs implement CRC in the form of a packet error check (PEC). 24-bit data is written when the PEC function is not required. To add the PEC function, the 24-bit data is augmented with a corresponding 8-bit checksum. If the received checksum does not agree with the data, an output pin is brought low to indicate the error. The controller clears the error, returns the pin high, and resends the data. Figure 1 shows an example of how the data is applied using an SPI interface. Table 1 lists a sample of Analog Devices parts that can use packet error checking.
Figure 1. SPI write with and without packet error checking. Table 1. Examples of Analog Devices Parts That Use Packet Error Checking
Generating
the Packet Error Checksum
Figure 2. Generating a checksum for a 24-bit number (0x654321).
Conclusion
|
||||||||||||||||||||||||||