cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone managed to get the STM32 hardware CRC on STM32F7XX to match the output of srec_cat.exe when using the -STM32_Little_Endian flag?

HMcKi
Associate III

srec_cat.exe has a flag -STM32_Little_Endian described in the srec_cat manual as

"These filters many be use to generate the CRC used by the hardware CRC unit on the STM32 series of ARM MPUs.".

I can successfully append a CRC to my firmware file using this flag but am unable to get the hardware CRC to match the result. The Micro I am using is a STM32F765, with the default CubeMX initialisations as below:

 hcrc.Instance = CRC;

 hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;

 hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;

 hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;

 hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;

 hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;

Has anyone else out there managed to get this working?

2 REPLIES 2

The standard STM32 32-bit CRC is done as 32-bit wide word the byte ordering is not consistent with the natural endian order, nor the notional CRC shift direction. Processes fourth byte first, and first byte last.

Example computation code at the end of this thread.

https://community.st.com/s/question/0D50X00009Xkhp1SAB/flash-crc-integrity

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Post a small example.

JW