0

I would like to calculate a 3bytes CRC value using the crc calculation unit of the Nucleo L053R8. The generator Polynomial is the following: g(X)=x^24 + x^10 + x^9 + x^6 + x^4 + x^3 + x + 1

It seems that using this CRC calculation unit I can only generate a 32bits length CRC and smaller values are just the LSBS of the 32bit result. I also know that the LSB of CRC32 in not equal to a CRC16.

Any idea on what operations I should perform on the input/output data to get the correct CRC24 I want ?

Abyr
  • 117
  • 1
  • 3
  • 14
  • If you want a CRC-24 then why are you using the polynomial for CRC-16-CCITT? – Lundin May 09 '19 at 11:26
  • I am generating a crc for a BLE packet and got this polynomial from the official specification of Bluetooth, But I guess you are right I might misunderstood – Abyr May 09 '19 at 11:36
  • i still need hints to know how to get this right – Abyr May 09 '19 at 11:37
  • I know very little of this, but I believe BLE uses some 24 bit CRC, maybe like this one? https://electronics.stackexchange.com/questions/90472/how-can-i-implement-bluetooth-low-energy-crc-in-24-bits – Lundin May 09 '19 at 11:42
  • yes thanks for drawing my attention I was referring to the wrong section now I have the correct polynomial I assume how can I proceed ? – Abyr May 09 '19 at 11:44

1 Answers1

0

Multiply the generator polynomial by x^8, by shifting it left 8 bits. If you have an initial value, also multiply it by x^8, by shifting it left 8 bits. Use the 32 bit CRC code with the shifted polynomial and initial value, then shift the resulting 32 bit CRC right by 8 bits.

g(X)*x^8 = x^32 + x^18 + x^17+ x^14 + x^12 + x^11 + x^9 + x^8
rcgldr
  • 27,407
  • 3
  • 36
  • 61