5.7.4 Cyclic Redundancy Check (CRC)

The PIC16F, PIC18F and PIC32CM MCUs provide hardware support for Cyclic Redundancy Check (CRC) to ensure data and code integrity, which is crucial for safety and reliability in embedded systems. These MCUs can perform CRC checks over memory regions, such as Flash or SRAM, support standard CRC polynomials, and can trigger system responses (like interrupts or resets) if a CRC mismatch is detected. These features help prevent the execution of corrupted code and enable robust error detection in data transfers or memory checks. Table 5-30 provides a comparison of features between PIC16F, PIC18F and PIC32CM.

Table 5-30. PIC16F, PIC18F and PIC32CM CRC Features
FeaturePIC16F CRCPIC18F CRCPIC32CM CRC
IntegrationStand-alone (CRC) peripheral with a dedicated Memory ScannerStand-alone (CRC) peripheral with a dedicated Memory ScannerIntegrated into Device Service Unit (DSU) and Direct Memory Access Controller (DMAC)
User ConfigurationConfigurable polynomial and seed valuesConfigurable polynomial and seed valuesSelectable region and polynomial (DMAC)
Supported PolynomialsUp to CRC-16 and CRC-32Up to CRC-16 and CRC-32DSU: CRC-32 DMAC: CRC-16-CCITT and CRC-32
Memory RegionsFlash, EEPROM, user-input RAM data, and CLB configs (if supported)Flash, EEPROM, and user-input RAM dataAny memory accessible through bus matrix (Flash, SRAM)
Trigger/ControlScanner and CRC control registersScanner and CRC control registersCommand issued through DSU or DMAC
Status/ResultSupportedSupportedSupported
InterruptsSupportedSupportedNo direct NMI, but can trigger interrupts/events
DMA Integration N/ADMA can move data into CRCDAT for manual calculationDMAC can perform CRC on transferred data
Software FallbackSupportedSupportedSupported