Question
Calculating crc32 on stm32f769NI
Posted on March 20, 2018 at 10:15
Hello,
I am trying to calculate crc32 on stm32f769NI MCU and found that the generated crc doesn't match the standard crc32 algorithm with 0x4C11DB7 as the polynomial and 0xFFFFFFFF as the initial value.
I am using this link(
http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
) to compare the crc obtained from stm.I have configured the board as below.
CRC_HandleTypeDef hcrc;
__HAL_RCC_CRC_CLK_ENABLE(); hcrc.Instance = CRC; hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE; hcrc.Init.CRCLength= CRC_POLYLENGTH_32B; 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; HAL_CRC_Init(&hcrc);I am calculating crc on a test buffer as below
uint32_t test[] ={49,50,51,52};
CRCValue = HAL_CRC_Calculate(&hcrc,(uint32_t *)test, 4);Please let me know if something is wrong or should I add something.
Any help is appreciated.
Thanks
