2024-01-20 03:10 AM
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 !
2024-01-20 04:21 AM - edited 2024-01-20 04:22 AM
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
2024-01-20 08:37 AM
The MODBUS CRC can be done in software quite efficiently.
Posted multiple examples to the forum.