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.
| Feature | PIC16F CRC | PIC18F CRC | PIC32CM CRC |
|---|---|---|---|
| Integration | Standalone (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 Configuration | Configurable polynomial and seed values | Configurable polynomial and seed values | Selectable region and polynomial (DMAC) |
| Supported Polynomials | Up to CRC-16 & CRC-32 | Up to CRC-16 & CRC-32 | DSU: CRC-32 DMAC: CRC-16-CCITT & CRC-32 |
| Memory Regions | Flash, 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/Control | Scanner and CRC control registers | Scanner and CRC control registers | Command issued through DSU or DMAC |
| Status/Result | Supported | Supported | Supported |
| Interrupts | Supported | Supported | No direct NMI, but can trigger interrupts/events |
| DMA Integration | N/A | DMA can move data into CRCDAT for manual calculation | DMAC can perform CRC on transferred data |
| Software Fallback | Supported | Supported | Supported |
