2019-06-18 02:29 AM
Hi all,
I am generating a CRC using the hardware CRC module in my STM32L0 of which I fetch only the bottom byte.
I want corresponding C code to generate the same result as the hardware calculator, I have tried many different settings and Polynomials, bit reversal etc, but I cannot get a match between the two.
Here are my STM32L0 CRC settings:
hcrc.Instance = CRC;
hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;
hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;//CRC_INPUTDATA_INVERSION_BYTE;
hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;//CRC_OUTPUTDATA_INVERSION_ENABLE;
hcrc.Init.GeneratingPolynomial = 0x4C11DB7;
hcrc.Init.CRCLength= CRC_POLYLENGTH_32B;
hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
__HAL_RCC_CRC_CLK_ENABLE();
HAL_CRC_Init(&hcrc);
__HAL_RCC_CRC_CLK_DISABLE();
and here is how I call the function to generate the CRC for me, flashbuff is a char buffer:
crc= HAL_CRC_Calculate(&hcrc,(uint32_t *) flashbuff, 12);
What C code can I use to generate the same value in the lower byte as the hardware internal generator using software?
Eoin
2019-06-21 07:53 AM
Provide a test pattern, I take a look