Cyclic Redundancy Checksums generation and checking were among the challenging things in implementing ASH1. Looking for the accurate way to calculate/check CRCs took me a lot of time as it was confusing in terms of the following:
- Bit Orientations (LSB first or MSB first).
- The Initial Value of the CRC register (0s or 1s).
- CRC Orientation and Inversion.
Through checking some online resources, I found out that it is not only me who faced this problem. People here were struggling to get the correct values of different CRCs.
My implementation of a CRC generator/checker was 100% correct..but yet different tools showed different CRCs until I found this online tool which enabled me to check along with ASH1 CRC unit the different conditions that might be used in CRC calculation/generation… and here’s what I got:( I calculated the CRC-32 for 0x16 and then check for it’s validity… and the result was 0xc704dd7b ( the complement of 0x38fb2284) which is the residue for CRC-32…. So people, if you want to deal with CRCs… pay attention to the 3 points mentioned above!