TMS570LC4357: Auto-bus-on functionality

Part Number: TMS570LC4357

I am trying to use the auto-bus-on functioality in the microcontroller.  I have set the ABO bit in the CAN Contgrol Register and set the Auto-Bus-On Time Register to a value corresponding to 2 seconds.

The though i to try reconnection to the bus once every 2 seconds for 10 seconds before giving up and clearing the ABO bit.

We are polling the BOff bit in the Error and Status Register once every 10 ms until it has been set for 10 seconds.

We are testing by short circuit the CAN wired to each other.  But... during this time the BOff bit seems to be cleared for a short time resulting in that my 10 second time will be restarted.

My question is if the BOff bit should behave in this way?  I though that it would be set until the bus is reestablished.

Regards,
Örjan

  • Hi Örjan,

    Yes, the behavior you're seeing is expected. Here's what's happening:

    How Auto-Bus-On Works

    1. When Bus-Off Occurs: The BOff bit is set in the Error and Status Register when the CAN controller enters the Bus-Off state.

    2. Auto-Bus-On Timer: When the ABO bit is set in the CAN Control Register, the Auto-Bus-On timer (configured via the ABOTR register) starts counting down when the module goes Bus-Off.

    3. Recovery Sequence: After the timer expires (your 2 seconds), the recovery sequence is initiated by automatically clearing the Init bit. This starts the Bus-Off recovery process.

    4. During Recovery: According to the CAN specification, the Bus-Off recovery sequence requires monitoring 128 occurrences of 11 consecutive recessive bits on the bus.

    Why BOff Clears Temporarily

    The BOff bit will be cleared when:

    • The recovery sequence completes successfully (128 occurrences of 11 recessive bits monitored)
    • The error counters are reset
    • The module attempts to resume normal operation

    However, in your test scenario (CAN wires shorted together):

    • The recovery sequence starts every 2 seconds (per your ABO timer setting)
    • The controller briefly attempts recovery and may temporarily clear BOff
    • But the bus fault (short circuit) immediately causes errors again
    • The controller re-enters Bus-Off state, setting BOff again
    • This cycle repeats every 2 seconds

    Monitoring Bus-Off Recovery

    The documentation indicates that during Bus-Off recovery, the LEC (Last Error Code) field in the Error and Status Register is set to 5h (Bit0 Error) each time a sequence of 11 recessive bits is monitored. This allows you to track the recovery progress.

    Recommended Approach

    Instead of only polling the BOff bit, consider:

    1. Monitor both BOff and LEC fields in the Error and Status Register
    2. Track recovery attempts by counting how many times the Auto-Bus-On timer expires
    3. Implement a counter that increments each time you detect a recovery attempt (BOff transitions)
    4. After 5 recovery attempts (5 × 2 seconds = 10 seconds), disable ABO

    Example Logic:

    static uint8_t recovery_attempts = 0;
    static bool previous_boff_state = false;
    
    // Every 10ms polling
    bool current_boff = read_boff_bit();
    
    // Detect when BOff transitions from 0 to 1 (re-entering bus-off after recovery attempt)
    if (current_boff && !previous_boff_state) {
    recovery_attempts++;
    
    if (recovery_attempts >= 5) { // 5 attempts over ~10 seconds
    // Disable Auto-Bus-On
    clear_abo_bit();
    // Handle permanent failure
    }
    }
    
    previous_boff_state = current_boff;

    Documentation Reference

    From the TMS570LC4357 Technical Reference Manual (SPNU563A):

    • Page 1469: Auto-Bus-On Time Register (ABOTR) - Timer reloads after each recovery phase
    • Page 1456: CAN Control Register - ABO bit and recovery sequence behavior
    • Page 1460: Error and Status Register - LEC field behavior during recovery

    The BOff bit clearing temporarily during recovery attempts is normal behavior and part of the automatic recovery mechanism. Your software needs to account for these transient state changes.

    Best Regards,

    Zackary Fleenor