Currently I am using the Auto Bus-Off recovery feature of MSCAN of MC9S12X.
However, the problem with this is that when the Bus-Off occurs, due to the auto-recovery, the uC starts sending the error frames continuously in the Bus-Off state.
If i want to stop the Error frames for certain period, how can i do it?
It looks like you are going into the same error after buss off recovery. If the MCU is in the bus off then it does not sends any frames. A bus-off node is not allowed to have any influence on the bus (e.g. output drivers switched off). It looks like you are facing behavior presented in attached files.
What I would like to suggest you is to abort the messages and fix all mistakes:
if (CAN0TFLG != 0x07)
{
do
{
if( !CAN0TFLG_TXE0 )
{ CAN0TARQ_ABTRQ0 = 1; // abort the transmission
while ( ! CAN0TAAK_ABTAK0 ) {}
}
if( !CAN0TFLG_TXE1 )
{ CAN0TARQ_ABTRQ1 = 1; // abort the transmission
while ( ! CAN0TAAK_ABTAK1 ) {}
}
if( !CAN0TFLG_TXE2 )
{ CAN0TARQ_ABTRQ2 = 1; // abort the transmission
while ( ! CAN0TAAK_ABTAK2 ) {}
}
}
while(CAN0TFLG != 7);
}
Best Regards, Ladislav
Ladislav, do you know whether this technique should fail on the KE06? I tried it, modified for the different register names, but I'm not consistently getting bus-off interrupts with the KE06's MSCAN peripheral. After a bus off interrupt and abort I back off for 5 seconds and then try again. I can do that twice before the KE06/MSCAN gives up and stops generating bus off interrupts.