Skip to main content
sbend
Associate II
Solved

Using Zephyr, enabling and using STM32F412 CRC peripheral

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?

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru

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();

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

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru

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();

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
sbend
sbendAuthor
Associate II

Thank you! That solved the issue.