Skip to main content
LOMO
Associate III
January 12, 2024
Solved

STM32G431 FDCAN get into bus off status

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

This topic has been closed for replies.
mƎALLEm
mƎALLEmBest answer
ST 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
}

 

 

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

3 replies

mƎALLEm
ST 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?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
LOMO
LOMOAuthor
Associate III
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ƎALLEm
mƎALLEmBest answer
ST 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
}

 

 

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