2024-01-12 12:58 AM - last edited on 2024-01-15 04:24 AM by SofLit
Why STM32G431 CAN get into bus off status? I cannot find the reason in the reference manual.
Solved! Go to Solution.
2024-01-12 01:38 AM
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:
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 }
2024-01-12 01:06 AM
Hello,
What is your HW configuration? how did you establish the CAN bus? are you using CAN in Normal or loopback mode?
2024-01-12 01:18 AM
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。
2024-01-12 01:38 AM
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:
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 }