2025-04-09 8:22 AM
Hi,
I am trying to initialize and use the internal CRC peripheral in the STM32F412 MCU. My application is based on Zephyr RTOS, using the STM32 HAL.
My application defines the CONFIG_USE_STM32_HAL_CRC, so the stm32f4xx_hal_crc.c is included in the build.
The application builds and links just fine, and I can call the HAL_CRC_Init, HAL_CRC_GetState and HAL_CRC_Calculate without any problems.
Only problem is the calculation is 0 for my 4 test bytes (0x01, 0x02, 0x03, 0x04).
Debugging through the code, it does set the "hcrc->Instance->DR" in stm32f4xx_hal_crc.c
Are there any additional settings I need to include? Maybe clock configurations?
Solved! Go to Solution.
2025-04-09 9:45 AM
If registers be zero, check you've enabled the peripheral clock before use, either in main.c or your stm32f4xx_hal_msp.c
/* CRC Peripheral clock enable */
__HAL_RCC_CRC_CLK_ENABLE();
2025-04-09 9:45 AM
If registers be zero, check you've enabled the peripheral clock before use, either in main.c or your stm32f4xx_hal_msp.c
/* CRC Peripheral clock enable */
__HAL_RCC_CRC_CLK_ENABLE();
2025-04-10 8:58 AM
Thank you! That solved the issue.