AnsweredAssumed Answered

Getting Stuck After CAN Bus Disconnect/Reconnect

Question asked by gbrowne on Jul 4, 2018
Latest reply on Jul 6, 2018 by Alexandru Nan



I have this simple CAN send and receive routine running every 100ms:


FLEXCAN_HAL_ClearMsgBuffIntStatusFlag(CAN0, 0xFFFFFFFF);


if (STATUS_SUCCESS == FLEXCAN_DRV_Send(INST_HSCAN, 8, &data_info, 0x123, txBuff))

   FLEXCAN_DRV_RxFifoBlocking(INST_HSCAN, &rxBuff, 100);


This works fine on a stable, active CAN bus network.  But I need to be able to recover and continue communication if the CAN bus is temporarily physically disconnected and then reconnected.


When I pull the connector to my CAN bus, the routine keeps running, but when I reconnect the CAN bus connector, the program triggers CAN0_ORed_0_15_MB_IRQHandler() and gets caught inside FLEXCAN_DRV_IRQHandler().


Any idea why this is happening and either how I can prevent it or break out of it?