Using shorter CRC polynomials on Kinetis CRC module (e. g. CRC-5 or CRC-12)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using shorter CRC polynomials on Kinetis CRC module (e. g. CRC-5 or CRC-12)

439 Views
doxy-oxyd
Contributor I

Hey!

I am planning an application that involves CRC with polynomials of unusual degrees.

Several Kinetis microcontrollers have a fast CRC engine, which supports either degree 16 polynomials or degree 32 polynomials (like Ethernet’s CRC-32). So far the documentation.

In general it is possible to use a certain CRC algorithm for polynomials of lower degree. (Already pointed out here on the forum or on Wikipedia.) Just append the necessary amount of zeros to the least significant end of the polynomial, and remove them from the result. The input data does not need any modification. Once understood, it’s really that simple.

However, the documentation on the CRC module misses one certain thing: If the polynomial has degree 16 of 32, there will always be the lowest bit set in the CRC_GPOLY register (which uses normal polynomial representation). Therefore it may be sensible to optimize the hardware, such that the XOR operation on the lowest bit is not configurable, but always enabled.

When a polynomial of lower degree shall be used, it is neccesary to clear the lowest bit.

Does the CRC module support polynomials with the lowest bit cleared? If yes, is this support general, or specific to a few devices?

Thanks in advance,

doxy

Labels (1)
0 Kudos
2 Replies

391 Views
bobpaddock
Senior Contributor III
"I am planning an application that involves CRC with polynomials of unusual degrees."

I am curious as to why?

If you didn't already come across this, it might be helpful:

https://users.ece.cmu.edu/~koopman/crc/
0 Kudos

372 Views
doxy-oxyd
Contributor I
Why? Simple:

I settled on a protocol based on the SPI bus with a frame size of 32 bits.
I think that SPI with 32 bits is the best tradeoff for all my requirements.
There I have at most 12 bits available for CRC.

Another operating mode in the same application must use larger frame sizes,
which allow for 16–24 bit CRC.

If Kinetis CRC modules support clearing the lowest polynomial bit, that allows
me to use both 24 bit and 8 bit CRC performed in hardware, which is definitely
the most simple solution.

Yes bobpaddock, Koopman’s resources are great and helpful!
0 Kudos