cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Hardware CRC from MCU and validate on other software system.

Bpana.1
Associate II

I have to generate CRC on MCU (STM32L476VG). I am using code as below for generating CRC.

uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
{
      uint32_t temp = 0U; /* CRC output (read from hcrc->Instance->DR register) */
      for (index = 0U; index < BufferLength; index++)
        {
             hcrc->Instance->DR = pBuffer[index];
        }
        temp = hcrc->Instance->DR;
       /* Change CRC peripheral state */
       hcrc->State = HAL_CRC_STATE_READY;
       /* Return the CRC computed value */
    return temp;
}

Can you give some reference code for validating this CRC on another machine (OS environment) .

My data packet and CRC as per below.

072300210c000001f900000000000a0001001e000000000000012c0000 3a7040ef

|----------------------------------Data Packet-------------------------------------------|----CRC----|

Please let me know if you need any further information.

Thank you,

Bhavin.

10 REPLIES 10

Here was a old worked example using the SPL on the STM32F3-Discovery board

https://github.com/cturvey/RandomNinjaChef/blob/main/STM32F3_DISCO_Programmable_CRC_SPL_Example.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..