Skip to main content
AT_it
Associate
July 24, 2019
Question

BUG in bxCAN HAL

  • July 24, 2019
  • 1 reply
  • 603 views

I'm using

STM32Cube FW_F7 V1.15.0

There is a bug in stm32f7xx_hal_msp.c which prevents reinitialization of CAN1

void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) {

....

  HAL_RCC_CAN1_CLK_ENABLED++;

  if(HAL_RCC_CAN1_CLK_ENABLED==1){

   __HAL_RCC_CAN1_CLK_ENABLE();

  }

....

}

and then there is no decrement of HAL_RCC_CAN1_CLK_ENABLED in

void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)

{

  /* Peripheral clock disable */

  __HAL_RCC_CAN1_CLK_DISABLE();

}

If you try to init Can1, then deinit It and then it won't init again

This topic has been closed for replies.

1 reply

AT_it
AT_itAuthor
Associate
July 24, 2019

When you disable CAN1, the clock is disabled and never enabled again