This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCAN4550: TCAN4550 - CAN bus off recovery

Part Number: TCAN4550

Tool/software:

Dear TI,

i tried by generating bus  off condition by shorting CANH and CANL signals,

I can confirm from register REG_MCAN_IR that CAN bus off condition occurs upon shorting CANH,CANL pins 

bool_t TCAN4550_IsBusOff(void)
{
return (TCAN4x5x_ReadRegister(REG_MCAN_IR) & REG_BITS_MCAN_IR_BO) != 0U; // Check Bus-Off interrupt flag
}

when bus off condition is detected i used below code to recover from it, but bus never recovers from busoff conditiion and i am unable to transmit more messages 

until i restart the tcan4550x from scratch

static inline void TCAN4550_BusRecoveryInit(void)
{
// Step 1: Clear the bus-off interrupt flag
// This writes to the MCAN Interrupt Register (IR) to clear the Bus-Off (BO) interrupt flag.
// Clearing this flag ensures that subsequent bus-off events can be detected by the controller.
TCAN4x5x_WriteRegister(REG_MCAN_IR, REG_BITS_MCAN_IR_BO);

// Step 2: Read the current value of the CCCR register
// The CAN Controller Configuration Register (CCCR) holds various control bits for the TCAN4550.
// Here, we read its current value to modify specific bits while preserving others.
uint32_t cccrValue = TCAN4x5x_ReadRegister(REG_MCAN_CCCR);

// Step 3: Clear the INIT bit in the CCCR value
// The INIT bit controls the initialization mode of the CAN controller.
// Clearing this bit allows the controller to exit initialization mode, starting the bus-off recovery sequence.
// The bitwise AND with the complement of REG_BITS_MCAN_CCCR_INIT ensures that only the INIT bit is cleared.
cccrValue &= ~REG_BITS_MCAN_CCCR_INIT;

// Step 4: Write the modified value back to CCCR to apply the change
// Writing this modified value back to the CCCR register takes the controller out of initialization mode.
// This initiates the bus-off recovery sequence, where the controller waits for 129 idle sequences on the CAN bus
// (each consisting of 11 consecutive recessive bits) before rejoining the bus.
TCAN4x5x_WriteRegister(REG_MCAN_CCCR, cccrValue);
}

It will be very much thankful if you can provide some suggestions for this 

  • Hi LS,

    Do you have any other devices on the bus that are sending CAN messages after you have shorted CANH and CANL together to create the Bus Off condition?  I've seen such a short cause all devices on the bus to enter Bus Off at the same time due to a fault like this and then there is no functional nodes to send the required messages to create the  129 idles for the other devices to recover.  When this occurs, a device reset and re-configuration may be required in order to completely clear the CAN Error Counters and allow the device to immediately start communicating again.

    Regards,

    Jonathan

  • Hi,Jonathan,

    I tried your suggestion and opted for device reset and reconfiguration option,ok fine