2024-04-20 02:53 AM
Hi
I'm trying to understand how to configure the hal/peripheral to evaluate the CRC32 MPEG2 over a block of datas.
I'm comparing the result with this site where as input I've used the vector 0x01, 0x01. Expected result is 0xD66FB816
https://crccalc.com/?crc=0x01,0x01&method=crc32&datatype=hex&outtype=0
I've configured the hal in the following way
hcrc.Instance = CRC;
hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
hcrc.Init.GeneratingPolynomial = 0x04C11DB7;
hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE;
hcrc.Init.InitValue = 0xFFFFFFFF;
hcrc.Init.CRCLength=CRC_POLYLENGTH_32B;
hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
NOTE that poly and init value that I've set are equal to the default values
but I get this result
0xeec8fd24
Does someone has an idea how to configure this peripheral to get the expected result?
Solved! Go to Solution.
2024-04-20 01:29 PM
0xeec8fd24 is from pattern { 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00 };
Look at how you'd feeding data into the CRC peripheral. What function are you using to pass data?
Feed bytes via *((volatile uint8_t *)&CRC->DR) = byte;
2024-04-20 01:29 PM
0xeec8fd24 is from pattern { 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00 };
Look at how you'd feeding data into the CRC peripheral. What function are you using to pass data?
Feed bytes via *((volatile uint8_t *)&CRC->DR) = byte;
2024-04-20 01:40 PM
Hi Tesla
Perfect! I've found the issue.