In CRC mode, the checksum byte is the 8-bit remainder of the bitwise exclusive-OR (XOR) of the data bytes by a CRC polynomial. For ADC1, use four conversion data bytes in the calculation; for ADC2, use three conversion data bytes. The CRC is based on the CRC-8-ATM (HEC) polynomial: X8 + X2 + X + 1.
The nine binary coefficients of the polynomial are: 100000111. Calculate the CRC by dividing (XOR operation) the data bytes (excluding the CRC) with the polynomial and compare the calculated CRC values to the ADC CRC value. If the values do not match, a data transmission error has occurred. In the event of a data transmission error, read the data again. The CRC provides a higher level of detection of multiple-bit errors.
The following list shows a general procedure to compute the CRC value:
- Left shift the initial ADC1 32-bit data value by 8 bits, with zeros padded to the right, creating a new 40-bit data value (the starting data value). For ADC2, left shift the 24-bit value to create a new 32-bit starting data value.
- Align the MSB of the CRC polynomial (100000111) to the left-most, logic-one value of the data.
- Perform an XOR operation on the data value with the aligned CRC polynomial. The XOR operation creates a new, shorter-length value. The bits of the data values that are not in alignment with the CRC polynomial drop down and append to the right of the new XOR result.
- When the XOR result is less than 100h, the procedure ends, yielding the 8-bit CRC value. Otherwise, continue with the XOR operation shown in step 2, using the current data value. The number of loop iterations depends on the value of the initial data.