Skip to main content
Explorer
April 20, 2024
Solved

CRC32 MPEG2 configuration for ST32C0x1 CRC driver

  • April 20, 2024
  • 1 reply
  • 1531 views

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?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    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;

    1 reply

    Graduate II
    April 20, 2024

    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;

    STDoomAuthor
    Explorer
    April 20, 2024

    Hi Tesla

    Perfect! I've found the issue.