2020-02-11 08:05 PM
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?
2020-02-11 08:27 PM
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
2020-02-11 11:03 PM
Post a small example.
JW