cancel
Showing results for 
Search instead for 
Did you mean: 

CRC module init code

keebler411
Associate II

Is STM32CubeMX v5.01 supoosed to generate CRC intializtion code? All I get is an empty  MX_CRC_Init() function and no handle is created. Is this a bug? I can copy the init code from an example but I'm wondering how/where the CRC clock gets enabled or do I need to worry about this?

3 REPLIES 3

CubeMX tends to hide clock/pin stuff in the MSP callback code, would suggest grepping the source until you find it, or add it manually.

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

This is what I get in Cube Mx

static 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 */

}

The OP's also looking for this portion, nominally in stm32f7xx_hal_msp.c

/**
  * @brief CRC MSP Initialization
  *        This function configures the hardware resources used in this example:
  *           - Peripheral's clock enable
  * @param hcrc: CRC handle pointer
  * @retval None
  */
void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
{
  /* CRC Peripheral clock enable */
  __HAL_RCC_CRC_CLK_ENABLE();
}

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