1.41.3 Cyclic Redundancy Check Calculation Unit (CRCCU)
The Cyclic Redundancy Check Calculation Unit (CRCCU) has its own DMA which functions as a Master with the Bus Matrix. Three different polynomials are available: CCITT802.3, CASTAGNOLI and CCITT16.
The CRCCU is designed to perform data integrity checks of off-/on-chip memories as a background task without CPU intervention.
Using The Library
CRC calculation for a memory range is started after writing the start address into the Address register and the size of the memory range into the Length register. Both must be word aligned.
The initial seed value used for the CRC calculation must be written to the Data register. This value will usually be 0xFFFFFFFF, but can be, for example, the result of a previous CRC calculation if generating a common CRC of separate memory blocks.
Once completed, the calculated CRC value can be read out of the Data register. The read value must be complemented to match standard CRC implementations or kept non-inverted if used as starting point for subsequent CRC calculations.
Here is an example code to calculate a CRC-32 value
const uint8_t crc_data[16] = {0xf0, 0x7f, 0x00, 0x20, 0x19,0x0c, 0x00, 0x00, 0x39, 0x0e, 0x00, 0x00, 0x3b, 0x0e, 0x00, 0x00} uint32_t crc = 0; CRCCU_Initialize(); if (CRCCU_CRCCalculate((uint32_t)&crc_data, 16, &crc, false) == true) { //application specific code }
Library Interface
Cyclic Redundancy Check Calculation Unit peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
CRCCUx_Initialize | Initializes given instance of CRCCU peripheral |
CRCCUx_CRCCalculate | Calculates the CRC Value for the specified address range |
CRCCUx_Setup | Reconfigure the CRCCU peripheral |
Data types and constants
Name | Type | Description |
---|---|---|
CRCCU_POLYNOMIAL | Enum | Identifies the CRC Polynomial to be used |
CRCCU_TWIDTH | Enum | Identifies transfer width for the CRCCU |