Skip to main content
Visitor II
January 12, 2024
Solved

STM32G431 FDCAN get into bus off status

  • January 12, 2024
  • 2 replies
  • 2192 views

Why STM32G431 CAN get into bus off status? I cannot find the reason in the reference manual.

    This topic has been closed for replies.
    Best answer by mƎALLEm

    This is a pure CAN protocol question and it's not related to the MCU itself. 

    Example read this article: https://www.linkedin.com/pulse/can-buss-off-management-vikesh-kumar-mishra/

    Watch this: https://www.youtube.com/watch?v=jxLxf1Mnu68

    HOT connecting and disconnecting to the CAN bus during communication could result to CAN communication errors. So you need to recover from the bus off state as described in the reference manual:

    SofLit_0-1705052192205.png

    For example, try this code for example to recover from the bus off state:

    if((*FDCAN1).PSR & FDCAN_PSR_BO) /* If the node goes to the Bus-off state */
    {
     (*FDCAN1).CCCR &= ~FDCAN_CCCR_INIT; /* Clear CCCR.INIT bit to exit from Bus-off state*/
     while (((*FDCAN1).CCCR & FDCAN_CCCR_INIT) != 0); // wait for synchronization
    }

     

     

    2 replies

    Technical Moderator
    January 12, 2024

    Hello,

    What is your HW configuration? how did you establish the CAN bus? are you using CAN in Normal or loopback mode?

    LOMOAuthor
    Visitor II
    January 12, 2024

    I just want to know the logic that STM32G431 CAN get into can_off status,because it often get into that status when i link and unlink it to/from an upper cumputer。it worked in normal mode。

    mƎALLEmAnswer
    Technical Moderator
    January 12, 2024

    This is a pure CAN protocol question and it's not related to the MCU itself. 

    Example read this article: https://www.linkedin.com/pulse/can-buss-off-management-vikesh-kumar-mishra/

    Watch this: https://www.youtube.com/watch?v=jxLxf1Mnu68

    HOT connecting and disconnecting to the CAN bus during communication could result to CAN communication errors. So you need to recover from the bus off state as described in the reference manual:

    SofLit_0-1705052192205.png

    For example, try this code for example to recover from the bus off state:

    if((*FDCAN1).PSR & FDCAN_PSR_BO) /* If the node goes to the Bus-off state */
    {
     (*FDCAN1).CCCR &= ~FDCAN_CCCR_INIT; /* Clear CCCR.INIT bit to exit from Bus-off state*/
     while (((*FDCAN1).CCCR & FDCAN_CCCR_INIT) != 0); // wait for synchronization
    }