What are CRC features in STM32 MCUs?
1. Cyclic Redundancy Check
Cyclic Redundancy Check (CRC) is an error detection method for digital data based on binary division.
CRC algorithm generates a fixed checksum code length.
2. What are CRC features in STM32 MCUs?
The hardware CRC peripheral features vary from one STM32 to another, the main features are listed in table below:
If the feature “Reversibility option on I/O data” is enabled, each input and/or output byte is reflected before being used in the calculation. Bits of the input or/and output byte are used in reverse order.
Refer to the products’ Reference manual for detailed functional description of the CRC peripheral.
3. About errors detections and collisions
A collision is a CRC similar for two different input datas.
The more bits the CRC value has the less is the probability of a collision.
For CRC-8 there are 2^8 different CRC values --> there is a probability of 1/256 that two different datas have the same CRC.
Increasing the CRC width results in better error protection.
CRC can not correct errors, it only detects errors to send a data again for instance, or only as information.
The generator polynomial must be chosen to maximize the error-detecting capabilities while minimizing overall collision probabilities.
4. Is a CRC a hash?
Both CRCs and hash functions share the property that they take an input value and reduce it to an output value, usually shorter.
Hash is a secure function, used to compare large data sets. It is commonly used with cryptographic mechanisms for protecting digital signatures for instance.
CRC is used for smaller data to prevent accidental changes, random error detection when data are sent. It is not adapted to prevent external attack.