cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Project fails to enable CRC clock

Steve H
Associate III
Posted on December 21, 2015 at 20:12

I'm building a test program under STM32CubeMX 4.12.0 (with latest peripheral libraries as of 12/21/15) that uses the STM32F207's CRC peripheral, and I have discovered that the autogenerated code isn't enabling the CRC peripheral's clock. The CRC peripheral is listed as ''Activated'' in the Configuration pane, and the stm32f2xx_hal_conf.h header file contains uncommented ''#define HAL_CRC_MODULE_ENABLED'' as it should, BUT: the debugger shows the CRC clock not enabled in the RCC registers.

To make the peripheral operate, I needed to insert ''__HAL_RCC_CRC_CLK_ENABLE()'' into one of the user code blocks in main.c. I rather think that the code generator ought to be putting this into MX_CRC_Init(), as that's more or less what the initializer is for. Of course, if I insert the call there manually, the next autogeneration of code will nuke it. Looks like a bug to me.

1 REPLY 1
matic
Associate III
Posted on December 22, 2015 at 06:59

Not sure now, but I think __HAL_RCC_CRC_CLK_ENABLE() should be called from ''msp'' file. Which is one out of three files that CubeMX generates (beside ''main'' and ''it'' file).