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.

TMS320F280025C: CAN - What is the Bitrate and can I disable the auto-retransmit?

Part Number: TMS320F280025C


Hi,

I'm using the evaluation board with the TMS320F280025C controller for some motor control and it works great so far. Now I would like to use CAN, but I have some trouble with it. I set the switch S4 in the lower setting and I see CANL and CANH working correctly. Now I connected a CAN device (Testen in another system, where it works for years now) and I send a CAN message every second. I implemented an interrupt ISR counter for CAN, but it is never triggered when the message is sent. Also the TI controller seems to auto resend any message, which is fine, but not practical when I try to setup the connection and something does not fit.

So, my first concern is the bitrate, the following is implemented in the initialization:

// Set up the CAN bus bit rate to 200kHz
    // Refer to the Driver Library User Guide for information on how to set
    // tighter timing control. Additionally, consult the device data sheet
    // for more information about the CAN module clocking.
    CAN_setBitRate(obj->canHandle, DEVICE_SYSCLK_FREQ, 500000, 16);

In the comment is stated, this is 200kHz bitrate, but somehow 500baud is choosen, why?

Is there a way to deactivate the auto retransmission, such that it only sends and forget? Otherwise it locks up the CAN bus.

Edit: The CAN frame I send looks like this (speed reference of 100Hz). What I also see is, that canComVars.errorFlag is always == 1. So CAN_getStatus(halHandle->canHandle) seems always to give an error.

	txFrame.rtr = 0;
	txFrame.extended = false;
	txFrame.id = 0x001;
	txFrame.length = 8;
	txFrame.data.uint8[0] = 0x00;
	txFrame.data.uint8[1] = 0x00;
	txFrame.data.uint8[2] = 0x03;
	txFrame.data.uint8[3] = 0xE8;
	txFrame.data.uint8[4] = 0x00;
	txFrame.data.uint8[5] = 0x00;
	txFrame.data.uint8[6] = 0x00;
	txFrame.data.uint8[7] = 0x00;

Edit2: My further investigations showed, that the CAN interrupt is always triggered with a controller status interrupt:

    // If the cause is a controller status interrupt, then get the status
    if(status == CAN_INT_INT0ID_STATUS)
    {
        //
        // Read the controller status.  This will return a field of status
        // error bits that can indicate various errors.  Error processing
        // is not done in this example for simplicity.  Refer to the
        // API documentation for details about the error status bits.
        // The act of reading this status will clear the interrupt.
        status = CAN_getStatus(halHandle->canHandle);
        canComVars.status = status;

        // Check to see if an error occurred.
        if(((status  & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 7) &&
           ((status  & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 0))
        {
            // Set a flag to indicate some errors may have occurred.
            canComVars.errorFlag = 1;
        }

    }

The status I read back has the value 99 = 0b01100011. This means the following registers are high in the CAN_ES register:

So LEC bit 0 and 1 means Stuff Error and Form Error. Bit 5 and 6 means EPass and EWarn, so somehow the controller goes into a passiv state. But I really don't know what to do with this errors. They are found in the reference manual on site 2134 here: www.ti.com/.../spruin7a.pdf

Edit3: After changing the BitTime to 10, it seems at least to stop spamming the CANBus. Now the problem is, that when i send a message, it always gets a CAN_INT_INT0ID_STATUS interrupt instead of a RX_MSG_OBJ_ID. The CAN_ES is 16, so the Rx indication works. But the interrupt status is wrong.