Im working on a project where i going to communicate between a STM32F407VGT and a LTC6804 BMS chip. for communication im going to use SPI with 8Bit datasize. For the communication im going to use a Packet error code which is a 15-bit cyclic redundancy chech (CRC-16) calculation.
sending a message (0x00 0x01) should return CRC value (0x3D 0x6E). I have trid to use the CRC calculation in the SPI driver stm32f4xx_spi.h but i can't figure out how i can initialize the CRC register with a value of: 0x000000000010000.
Has anybody worked with the CRC calculation and knows if this is possible to initialize the crc polynomial calculation?.
Best Regards Helge
Table driven example posted here community.st.com/.../141411-stm32f407-spi-crccalculation
Thank you very much Clive. I will look into you solution for Table driven example. It seems to solve my problems quite easy. Im just wondering for the "Byte wide buffer method", how did you find the 256 CRCTable values?
Best regards Helge
It's easy to compute the table. Some programs save flash space by building the table directly after boot.
The tables were all calculated using the polynomial, and based on how many bit states you want to advance and the XOR math of the taps.
It might be more efficient from a coding standpoint to use the upper 15-bit than the lower, and seed it with 0x0020.