From 32bfbda15c0f152dc645bb0a264d322186db763e Mon Sep 17 00:00:00 2001 From: Stuart Baker Date: Wed, 30 Nov 2022 20:03:29 -0600 Subject: [PATCH] Fix bus-off error handling. --- src/freertos_drivers/ti/TivaCan.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/freertos_drivers/ti/TivaCan.cxx b/src/freertos_drivers/ti/TivaCan.cxx index d08607a60..6a7bce120 100644 --- a/src/freertos_drivers/ti/TivaCan.cxx +++ b/src/freertos_drivers/ti/TivaCan.cxx @@ -210,17 +210,15 @@ void TivaCan::interrupt_handler() txBuf->flush(); txPending = false; txBuf->signal_condition_from_isr(); + + /* attempt recovery */ + MAP_CANEnable(base); } if (status & CAN_STATUS_EWARN) { /* One of the error counters has exceded a value of 96 */ ++softErrorCount; canState = CAN_STATE_BUS_PASSIVE; - - /* flush data in the tx pipeline */ - txBuf->flush(); - txPending = false; - txBuf->signal_condition_from_isr(); } if (status & CAN_STATUS_EPASS) {