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.

TMS320F28379D: CAN bus avalability detection during power up

Part Number: TMS320F28379D

Hi 

I have two TMS320F28379Ds communicating over the CAN bus.

They are setup in a master - slave configuration, meaning that only when the master MCU sends data(data request frame) , the slave MCU will send back the requested data.

The master periodically sends the data request frame, (and the slave responds).

This is the initialization function of the CAN bus. Thie same function runs on both the master and slave MCUs

void HAL_setupCAN_CTRL(uint32_t base)
{
    //
    // Initialize the CAN controllers
    //
    CAN_initModule(CTRL_BRD_CAN);
    //
    // CAN bit rate is 500 KHz , derived from the system clock
    //
    CAN_setBitRate(CTRL_BRD_CAN, DEVICE_SYSCLK_FREQ, 500000, 16);

    CAN_disableInterrupt(CTRL_BRD_CAN, CAN_INT_IE0 | CAN_INT_ERROR |
                            CAN_INT_STATUS);
    //
    // Start CAN module
    CAN_startModule(CTRL_BRD_CAN);
}

1.When both the master and slave MCUs are active(powered on at the same time) and then the can bus is properly initialized, everything works!,

2.When the slave is powered on first, and then the master is powered on second,  communication is established after the CAN bus in the master is initialized.!

3.But the other way around, when the master is powered on first and then the slave is powered on second  , the slave does not get the data request frames any more from the Master. Probing the Master's TXB pin, i don't see any activity on that line. Its as though the Master's CAN module has not initialized. Any idea why does this happen?

Looking at the Master's error status i only see the LEC bit set to 7 in CAN_ES register.

One way to get around this is, in the Masters side, if i don't recieve data from the slave MCU, i just re-initialize the Can bus again and the bus starts working:

        //If there is no reception of data for more than 200 ms, reset the can module
        if(canReTryCounter > CAN_DELAY(CAN_RETRY_TIME))
        {
            //Reset the can bus configuration
            HAL_setupCAN_CTRL(CTRL_BRD_CAN);
            canReTryCounter = 0;
        }

Is there a better way to detect that there is no can bus available? I am not talking about the CAN errors here, but the bus avalability itself.

Thanks,

AK

  • OK, so the Master sends a remote frame and the slave responds. Since there are only 2 nodes, when the Master sends the first remote frame when the slave is not ready, the master will keep re-transmitting the frame forever. I have explained this in www.ti.com/lit/SPRACE5:

    When the transmitting node does not receive an ACK, it results in an ACK error and the transmitting node keeps re-transmitting the frame forever. The Transmit Error Counter (TEC) will increment to 128 and stop there. REC stays at 0. Node will not go bus-off. In this situation, the TxRqst bit for the transmitting mailbox does not get set. No interrupts will be generated either. If another node is brought into the network, the TEC will start decrementing (all the way to 0) with every successful transmit. 

    Now, the transmitter will keep re-transmitting forever. i.e. it should not stop. This is the behavior with data frames. I wonder if teh behavior is different with remote frames. Also, your CANES.LEC value does not reflect ACKE. What is the value of CAN_ERRC.TEC? 

  • AK,

                On a slightly different note, please refrain from naming any individual in your first post. Based on the nature of your query and the availability of personnel, the forum moderator would assign it to the most appropriate expert. Thank you for your understanding.

  • Noted sir!. I was able to figure out the issue. Thanks you for your help