Search code examples
embeddedcrccrc32crc16

Can a CRC32 calculation be derived in terms of CRC16 calculations?


I need to calculate a 32-bit CRC but the microprocessor I am using only has a 16-bit CRC peripheral. Would it be possible to still use this 16-bit peripheral as part of my 32-bit calculations, and then assemble the 32-bit result from 16-bit pieces? (As in, using the hardware for subcalculations toward the final result.)

Or would the polynomial built in for the 16-bit hardware version be essentially useless mathematically/algorithmically, and I'd be better off just going straight for a pure software version of the 32-bit CRC that I need?


Solution

  • Unfortunately not, no. You will need to do it in software. There are many table-based approaches to speeding up the code.

    You imply that there is a specific CRC, "the 32-bit CRC that I need". If you do not need a specific CRC, and instead just need the protection that would be offered by a 32-bit CRC, and you can program your hardware with different polynomials, then you could compute two different 16-bit CRCs on the data, with the resulting 32 bits providing almost as much protection as a 32-bit CRC.