2021-10-21 02:33 AM
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.
2021-10-22 12:14 PM
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