cancel
Showing results for 
Search instead for 
Did you mean: 

Why my crc is not configurable ?

hanguofu
Associate

I tried to use the hardware crc for my device stm32f103  . But the STM32CubeMX ( version : 6.10 ) doesnot provide any parameters configuration for this IP. The generated  crc.c is as follows :


/* CRC init function */
void MX_CRC_Init(void)
{

/* USER CODE BEGIN CRC_Init 0 */

/* USER CODE END CRC_Init 0 */

/* USER CODE BEGIN CRC_Init 1 */

/* USER CODE END CRC_Init 1 */
hcrc.Instance = CRC;
if (HAL_CRC_Init(&hcrc) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN CRC_Init 2 */

/* USER CODE END CRC_Init 2 */

}

 

Is it possible to config the crc ? I would like to use the crc16 func. for MODBUS communication. Thanks !

2 REPLIES 2
STOne-32
ST Employee

Hi @hanguofu ,

 

this is normal behavior and expected, CRC of First STM32F1 series is fixed to Ethernet Polynomial : have a look to our Reference Manual RM0008 . To have a configurable CRC you can select STM32F3 or STM32F0 or others series or to use Software function .

 

Cheers,

STOne-32

The MODBUS CRC can be done in software quite efficiently.

Posted multiple examples to the forum.

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