AnsweredAssumed Answered

How to stop HAL_CAN_ErrorCallback

Question asked by Mark Shoe on Apr 25, 2017
Latest reply on Jan 6, 2018 by T J

My hardware has to disconnect the CAN bus sometimes. When i do the callback HAL_CAN_ErrorCallback will pop up. My CAN bus has to continue work so i clear all flags that i found:

 

__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_EWG);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_EPV);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_BOF);

__HAL_CAN_CLEAR_FLAG(hcan,CAN_TSR_RQCP0);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_TSR_RQCP1);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_TSR_RQCP2);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TXOK0);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TXOK1);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TXOK2);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TME0);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TME1);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_TME2);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_FF0);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_FOV0);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_FF1);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_FOV1);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_WKU);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_SLAKI);
__HAL_CAN_CLEAR_FLAG(hcan,CAN_FLAG_BOF);

 

The CAN bus does work after that however every receive message the ErrorCallback comes back, what do i need to clear?

Outcomes