31.3.10.1 CRC Overview
The Flash system supports automated CRC of any contiguous Flash region. It supports both 16-bit and 32-bit CRC with a programmable polynomial, initial value, final XOR value, and checksum compare value. The CRC can run on-command or continuously with auto repeat.
All control registers must be setup prior to enabling CRC operation. Once setup, writing CRCCTRL.CRCEN = 1 loads the Initial Value into the Accumulator, the Message Length into the Message Length counter, and the Period into the Period counter. After the Period counter decrements to zero the logic reads the data at the Message Address. For each byte shifted through the LFSR, it decrements the byte counter.
Bytes shift into the LFSR lowest addressed to highest addressed. The Reflected Input bit, CRCCTRL.RIN, determines if it is MSbit first or LSbit first. During the shifting the Accumulator bits toggle showing the result. Once the state machine completely shifts in the last byte from the current Flash read, it reloads the Period counter and starts counting.
If no error occurs and CRCCTRL.AUTOR is not set, the CRC logic sets INTFLAG.CRCDONE and INTFLAG.CRCERR remains cleared. If CRCCTRL.AUTOR is set, then the CRC logic reloads all initial settings are restarts the CRC calculation without setting INTFLAG.CRCDONE.