Cyclic Redundancy test application

Source: Internet
Author: User

In industrial environments, electronic systems usually work in extreme temperature conditions, in an electronic noise environment, or in other harsh conditions, and whether the system works normally under such conditions is crucial. For example, if the data sent to the DAC controlling the machine arm location is damaged, the machine arm will move in an unexpected direction, which is not only dangerous, but also costly. Imagine what would happen if a machine arm hits a new car on the production line, or worse, it hits a production worker?
There are several ways to ensure that the action is performed only after the correct data is received. The simplest way is to read back the data sent by the Controller. If the received data does not match the sent data, it indicates that one of them has been damaged and new data must be sent for verification. This method is indeed reliable, but the cost is also high. Each segment of data must be verified, and the amount of data transmitted must be doubled.
Another alternative is cyclic redundancy check (CRC, cyclic redundancy check), that is, when each packet sends a Checksum, the receiver will indicate whether there is a problem, therefore, the controller does not need to receive verification messages. A checksum is generally generated by applying a polynomial equation to the data. When applied to a 24-bit word, the CRC-8 produces an 8-bit checksum. The Checksum and data are combined, and all 32-bit messages are sent to devices that can analyze the combination and indicate whether an error occurs. Although this method is not an impeccable solution, but it is more efficient than the read/write method.

Figure 1. Using and not using group error verification SPI writing

CRC-8AlgorithmUse polynomial C (x) = X8 + X2 + X1 + 1. If X = 2, this formula is equivalent to the binary value of 100000111. To generate a Checksum, You need to shift the 24-Bit Data eight places to the left to generate a 32-bit logical 0 for the last eight digits. Alignment the CRC polynomial so that MSB is aligned with the leftmost logical 1 of the 32-bit data. Apply an exclusive or (XOR) function to the data to generate a new (shorter) number. (Logical 0 for digit matching and logical 1 for non-matching .) Alignment again the CRC polynomial so that MSB is aligned with the logical 1 on the left of the first result. Repeat the preceding steps. Finally, the original data is reduced to a value smaller than the CRC polynomial. This value is the 8-bit checksum. Figure 2 shows how to calculate the checksum.

Figure 2. Generate a 24-digit (0x654321) checksum

The example in Figure 2 uses the (hexadecimal) value 0x654321 as the 24-Bit Data word. The application of the CRC-8 polynomial can generate a checksum of 0x86. When data and checksum are sent, the data will be received only when both data segments arrive correctly. This method improves the reliability of data transmission and ensures that damaged data is almost never received.

 

Reference: ADI simulation journal 20120220: Circular redundancy Verification ensures correct data communication Author: Ken Kavanagh

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.