13.3.1 CRC Initialization and Configuration
The CRC engine works in push through mode, which means it works on streaming data. This section describes the steps for initializing the CRC module:
- Enable the CRC by setting the R0 bit in the CRC and Cryptographic Module s (RCGCCM) register, System Control offset 0x674.
- Configure the desired CRC data size, bit order, endian configuration and CRC type by programming the CRC Control (CRCCTRL) register, offset 0x400.
- If the CRC value has not been initialized to all 0s or all 1s using the INIT field in the CRCCTRL register, program the initial value in the CRC SEED/Context (CRCSEED) register, offset 0x410.
- Repeatedly write the DATAIN field in the CRC Data Input (CRCDIN) register, offset 0x414. If the SIZE bit in the CRCCTRL register is set to select byte, the CRC engine operates in byte mode and only the least significant byte is used for CRC calculation.
- When CRC is finished, read the CRCSEED register for the final result. If using post-processing, the raw CRC result is stored in the CRCSEED register and the final, post-processed result can be read from the CRC Post-Processing Result (CRCRSLTPP) register, offset 0x418. Post-processing options are selectable through the OBR and OLNV bits of the CRCCTRL register.
Alternatively a software µDMA channel can be configured to copy data from the source into the CRCDIN register. When configuring the µDMA, the destination should be configured to not increment. For more information on how to configure the µDMA, see Section 8.