AnsweredAssumed Answered

STM32F407 and CRC

Question asked by Pilous Droip on Jan 19, 2018
Latest reply on Jan 19, 2018 by Clive One

Hello friends.

 

I created CRC calculator, but I don't know, how to compare results.

 

My input data:

uint32_t data[16] = {
      0x1234, 0x456, 0x78, 0x09,
      0x10, 0x100, 0x1000, 0x01,
      0x54, 0x35, 0x98, 0x2432,
      0x2255, 0xAEFB, 0xAAAA, 0xFFFF
};

 

Function to calculation:

uint32_t CRC_Calculate32(uint32_t* arr, uint32_t count, uint8_t reset)
{
      /* Reset CRC data register if necessary */
      if (reset) {
            /* Reset generator */
            LL_CRC_ResetCRCCalculationUnit(CRC); 
      }

      /* Calculate CRC */
      while (count--) {
            /* Set new value */
            LL_CRC_FeedData32(CRC, *arr++); 
      }

      /* Return data */
      return LL_CRC_ReadData32(CRC); 

}

 

And I call this function:

uint32_t result;
Init_CRC();
result = CRC_Calculate32(data, 16, 1);

 

And result is: 0xb0829f24

Outcomes