38.3.1 Initialization

To enable a CRC scan in software (or via the debugger):

Sleep Mode

  1. Select between CRC32 and CRC16 modes with the CRC Mode Select (CRCSEL) bit in the Control A (CRCSCAN.CTRLA) register.
  2. Write the CRC Source (SRC) bit field in the CRCSCAN.CTRLA register to select the desired region of the Flash to be scanned.
  3. Enable the CRCSCAN by writing a ‘1’ to the ENABLE bit in the CRCSCAN.CTRLA register. The CRC Busy (BUSY) bit in the Status A (CRCSCAN.STATUSA) register will be set.
  4. The CRC will begin scanning when the CPU enters the Idle sleep mode.
Note: If sectioning the Flash and using interrupt-driven CRCSCAN, the interrupt vector table may need to be moved from its default location at the start of the Application Code (APPCODE) section of the Flash. For information on changing the expected location of the vector table, refer to the CPU Interrupt Controller section.

Manual Mode

  1. Select CRC32 or CRC16 mode with the CRCSEL bit in the CRCSCAN.CTRLA register.
  2. Write the SRC bit field in the CRCSCAN.CTRLA register to MANUAL.
  3. Enable the CRCSCAN by writing a ‘1’ to the ENABLE bit in the CRCSCAN.CTRLA register.
  4. Write the byte to the Input Data (CRCSCAN.DATA) register for the CRC calculation.
  5. Read the CRC result from the CRC Result (CRCSCAN.CRC) register.