Skip to main content
Visitor II
March 20, 2025
Question

How to recovery CAN communication after STM32H5 entered into CAN bus-off?

  • March 20, 2025
  • 1 reply
  • 583 views

Hi, I found that when STM32H5 entered into CAN bus-off, it couldn't recovery CAN communication by itself. And there is no "Automatic bus-off option" for this MCU. I have read the MCU Manual to know related registers about CAN bus-off for this MCU, but I still have no idea about how to recovery from bus-off on STM32H5. Could you give me some examples or configuration codes that I can take a reference to? 

    This topic has been closed for replies.

    1 reply

    lzyAuthor
    Visitor II
    March 20, 2025

    Solved by clear INIT bit of FDCAN_CCCR register when MCU detected there is a CAN bus-off. If you have the same problem, maybe you can take a reference as below codes.

    HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_BUS_OFF, 0);

    void  HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs)

    {

      if((ErrorStatusITs & FDCAN_IE_BOE) != 0)  /* If Bus-Off error occured */

      {

         hfdcan->Instance->CCCR &= ~FDCAN_CCCR_INIT; /* Recover from Bus-Off */

      }

    }

    But I just wondering why STM32H563ZITx MCU demo board could automatically recovery from CAN bus-off state even without above codes, is there any hardware mechanism to recovery from bus-off for this demo board?