cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 FDCAN get into bus off status

LOMO
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

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
}

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
SofLit
ST Employee

Hello,

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

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
LOMO
Associate III

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。

SofLit
ST Employee

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
}

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.