27.3.1 Polynomial Interface

The CRC module can be programmed for CRC polynomials of up to the 32nd order using up to 32 bits. Polynomial length, which reflects the highest exponent in the equation, is selected by the PLEN[4:0] bits (CRCCON[20:16]). The CRCXOR registers control which exponent terms are included in the equation. Setting a particular bit includes that exponent term in the equation functionally; this includes an XOR operation on the corresponding bit in the CRC engine. Clearing the bit disables the XOR.

For example, consider two CRC polynomials, one a 16-bit equation and the other a 32-bit equation. To program these polynomials into the CRC generator, set the register bits as shown in Table 27-5.

x16 + x12 + x5 + 1 and

and

x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
Table 27-5. CRC Setup Examples for 16 and 32-Bit Polynomials
CRC Control BitsBit Values
16-Bit Polynomial32-Bit Polynomial
PLEN[4:0]0111111111
X[31:16]0000 0000 0000 00000000 0100 1100 0001
X[15:1]0001 0000 0010 00010001 1101 1011 0111

Note that the appropriate positions are set to ‘1’ to indicate that they are used in the equation (e.g., X26 and X23). The MSb of the polynomial does not affect the calculation and can be set to any value.