The test case is shorting CANH & CANL repeatedly.
If the load of S32K118 is low, the recovery strategy works fine.
Step1. Busoff raised interrupt & set a flag. Step2. In the main loop, if the flag is set, DeInit & Init CAN. Step 3. wait 100ms. Step 4. Send a frame of data. Step 5. Busoff raised again.
But when the load is high ( ADC interrupt raised every 10ms ), there is a different symptom that occurs in a very low probability. The beginning 4 steps are the same.
Step1. Busoff raised interrupt & set a flag. Step2. In the main loop, if the flag is set, DeInit & Init CAN. Step 3. wait 100ms. Step 4. Send a frame of data.
But in step 5, Busoff interrupt is not raised. Instead, Busoff Done Int ( Bit 19 of ESR1) is set and FLTCONF of ESR1 changed from 0x00 to 0x11, which means busoff status.
I don't know why the status of CAN has been changed to BusOff. But the BufOff Int Flag ( bit 2 of ESR1 ) is not set. Instead, Busoff Done Int is set.