The CRC engine works in push-through mode, which works on streaming data. This section describes the steps for initializing the CRC module:
- Enable the clock to cryptography module (that includes CRC) by setting the R0 bit in the CRYPTOCLKEN register in the application reset and clock management module (physical address: 0x4402 50B8).
- Configure the desired CRC data size, bit order, endian configuration, and CRC type by programming the CRC Control (CRCCTRL) register, offset 0xC00.
- 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 0xC10.
- Repeatedly write the DATAIN field in the CRC Data Input (CRCDIN) register, offset 0xC14. 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 (LSByte) 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 0xC18. Post-processing options are selectable through the OBR and OLNV bits of the CRCCTRL register.