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. Both 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. The following table provides a comparison of CRC features of the PIC16F, PIC18F, and PIC32CM.

Table 5-29. PIC16F, PIC18F, and PIC32CM CRC Features
FeaturePIC16F CRCPIC18F CRCPIC32CM CRC
IntegrationStandalone (CRC) peripheral with a dedicated Memory Scanner.Standalone (CRC) peripheral with a dedicated Memory Scanner.Integrated 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 & CRC-32Up to CRC-16 & CRC-32DSU: CRC-32 DMAC: CRC-16-CCITT & CRC-32
Memory RegionsFlash, EEPROM, user-input RAM data, and CLB configs (if supported)Flash, EEPROM, and user-input RAM data.Any 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