Module crccu

Source
Expand description

Implementation of the SAM4L CRCCU.

See datasheet section “41. Cyclic Redundancy Check Calculation Unit (CRCCU)”.

The SAM4L can compute CRCs using three different polynomials:

  • 0x04C11DB7 (as used in “CRC-32”; Atmel calls this “CCIT8023”)
  • 0x1EDC6F41 (as used in “CRC-32C”; Atmel calls this “CASTAGNOLI”)
  • 0x1021 (as used in “CRC-16-CCITT”; Atmel calls this “CCIT16”)

(The integers above give each polynomial from most-significant to least-significant bit, except that the most significant bit is omitted because it is always 1.)

In all cases, the unit consumes each input byte from LSB to MSB.

Note that the chip’s behavior differs from some “standard” CRC algorithms, which may do some of these things:

  • Consume input from MSB to LSB (CRC-16-CCITT?)
  • Bit-reverse and then bit-invert the output (CRC-32)

§Notes

This calculator may be used to generate CRC values. To match the output of the SAM4L, the parameters must be set as follows:

  • Final XOR value: 0 (equivalent to no final XOR)
  • reverse data bytes: yes
  • reverse CRC result before Final XOR: no

For one example, the SAM4L calculates 0x1541 for “ABCDEFG” when using polynomial 0x1021.

Structs§

Crccu
State for managing the CRCCU
CrccuRegisters

Constants§

BASE_ADDRESS