cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong CRC-32 — HAL_CRC_Calculate output on STM32F401CCU6 Blackpill

BGasy.1
Associate II

I've been implementing I2C communication between F401CCU6 and Nucleo F746ZG, while adding CRC I got different outputs, Nucleo provides configurable CRC peripheral, while F401 is by default set to 0x4C11DB7 (https://www.st.com/resource/en/reference_manual/rm0368-stm32f401xbc-and-stm32f401xde-advanced-armbased-32bit-mcus-stmicroelectronics.pdf#page=68&zoom=100,89,116)0693W00000QKxkCQAT.pngIt also provides reseting initial value to 0xFFFF FFFF, ("The CRC calculator can be reset to 0xFFFF FFFF with the RESET control bit in the CRC_CR register. This operation does not affect the contents of the CRC_IDR register")

I've set Nucleo CRC polynomial, init value to match those on BlackPill. Calculated value matches with CRC-32/MPEG-2 standard (available at https://crccalc.com/ for example).

Did anyone has experienced this too?

10 REPLIES 10

> HAL_CRC_Calculate(&hcrc, (uint32_t*)test_crc, 1);

> Should be working? 

Sure. If you followed the often poorly documented way it was intended​ to be used by Cube's authors, it "works" exactly as those Cube authors intended. Which is not necessarily the same way you want, and it also may change with changing Cube version.

Use direct register access, if you want to have control ​over how it works.

JW​