How it works
A CRC is the remainder of dividing the message, seen as a long binary polynomial, by a generator polynomial. Every CRC variant is fully described by six parameters (the Rocksoft model used by the CRC RevEng catalogue):
| Parameter | Meaning |
|---|---|
| width | number of bits in the result |
| poly | generator polynomial, without its top bit |
| init | register value before the first byte |
| refin | process each input byte LSB-first |
| refout | reverse the register before the final XOR |
| xorout | value XORed into the result |
Each preset shows its check value: the CRC of the ASCII string 123456789. If your firmware gives the same check value, your parameters match.
STM32 hardware CRC
With its reset configuration, the STM32 CRC unit uses polynomial 0x04C11DB7, init 0xFFFFFFFF, no reflection and no final XOR: that is CRC-32/MPEG-2, not the zlib CRC-32. Feeding it 32-bit words instead of bytes changes the result on little-endian parts. Set the input size to 8 bits, or enable input/output reversal and XOR with 0xFFFFFFFF in software, to get the Ethernet/zlib value.
C implementation
The generated C uses a 256-entry table and processes one byte per step. The same table logic is unit-tested against every preset’s check value.