Hi cybaaluke,
I have checked the SDK sample code, it doesn't have the bus off code, so we need to write it by referring the user manual.
Here, I will give you the step:
1. check the PSR[BO], if it is set, it means the bus off, we can do the bus off recovery process.
2. Clear INIT bit, to start the bus off recovery
3. use while to wait the bus off recovery is finished,
Check PSR[LEC], if it is 0x5 and PSR[BO] =1, just wait.
Eg, while((PSR[LEC] ==0x5)||(PSR[BO] ==1));
After the while is run over, it means your bus off is recovery.
You can try it on your side.
Besides, you also can use the interrupt to detect the bus off, but you need to enable IE[BOE], and clear IR[BO]in interrupt handler. then do the bus off recovery process.
Please try it on your side, if you still have question about it, please kindly let me know.
Yes, you need to check the errors status when you do the CAN operation.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------