4.9.9 CRC
An 8-bit CRC generator with byte access is provided as a standard AVR peripheral module. The ATA8210/15 firmware does not support the CRC module but it is available for use by customer application software, for example, to verify the validity of memory data. The user must not use this CRC generator to check the received telegrams as there are more flexible CRC modules available in the RX data path of the ATA8210/15.
Key properties:
- Very fast parallel CRC computation
- Accessible via AVR bus
- Fixed polynomial
Generally, CRC checkers detect the following types of errors:
- Single-bit errors
- Two-bit errors
- Three-bit and other odd-number-bit errors
- Burst errors that are less than or equal to the CRC length
- Most burst errors that are greater than the CRC length
- The types of errors that CRC checker detects depending on the generator polynomial
The implemented CRC checker is using the following polynomial: CRC(x) = x^8 + x^2 + x^1 + 1.
The parallel implementation of the polynomial is equivalent to the linear feedback shift register (LFSR) (see the preceding figure). The initial value of the 8-bit CRC data register is 0x00. With some standards, the data is expected to enter the processor LSBF (least significant bit first). In this case, the incoming data and the resulting CRC must be bit reflected. A binary number is reflected by swapping all of its bits around the central point. For example, 1101 is the reflection of 1011. The bits REFLI and REFLO of the CRC control register are required to configure the bit order of incoming and outgoing data. If REFLI is FALSE (initial value), input bytes are processed with bit 7 being treated as the most significant bit (MSB) and bit 0 being treated as the least significant bit (LSB). If REFLI is TRUE, each byte is reflected before being processed. If REFLO is set to FALSE (initial value), the final value in the CRC register is fed into the output stage directly; otherwise, if this parameter is TRUE, the final CRC register value is reflected first.
CRC computation:
- Initialize the CRC data register
- Write message byte to CRC data register
- Continue with step 2 until there are no message bytes left
- Read CRC data register
- Continue with step 1