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.

TMS320F28388D: Implementing DCAN FIFO on F28388D

Part Number: TMS320F28388D
Other Parts Discussed in Thread: SYSBIOS, C2000WARE

Hi expert,

I have implemented a DCAN receive FIFO demo on my side (F28388D’s CM core, based on SYSBIOS) and get it generally function properly. But I may need your further advice on using FIFO on F28388D’s CM core.

1. I didn’t even see a DCAN transmit FIFO demo, does this kind of FIFO exist or not?

2. Typically, we are using a FIFO to reduce the times for CPU to response an interrupt. If we already programming DCAN using Tx or Rx interrupts, will it still be beneficial to using a FIFO? I ask this for I didn’t find an interrupt configuration specially designed for FIFO mode like a SCI or SPI.

3. Based on my code, what should I do to reset the FIFO for further data to come if we use driverlib API? Could you demo for this part?

4. Any advice for this code is welcomed.

Thanks

Sheldon

Main_CAN.zip

  • 1. I didn’t even see a DCAN transmit FIFO demo, does this kind of FIFO exist or not?

    No, we don’t have this example in C2000Ware, as of now. 

    2. Typically, we are using a FIFO to reduce the times for CPU to response an interrupt. If we already programming DCAN using Tx or Rx interrupts, will it still be beneficial to using a FIFO? I ask this for I didn’t find an interrupt configuration specially designed for FIFO mode like a SCI or SPI.

    What do you do when the FIFO is filled?

  • Hi Hareesh,

    Currently, I don't know what event can be triggered with a CAN receive FIFO is filled. So I just read the first mail box and move the receive buffer as shown below.

        else if(status == RX_MSG_OBJ_ID)
        {
            //
            // Get the received message
            //
            // CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
    
    
            CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxbuffer_pointer);
            if(i == 3){
                __asm("   bkpt #0");
            }else{
                rxbuffer_pointer = rxbuffer_pointer + 4;
            }
            i ++;
    
            //
            // Getting to this point means that the RX interrupt occurred on
            // message object 2, and the message RX is complete.  Clear the
            // message object interrupt.
            //
            CAN_clearInterruptStatus(CANA_BASE, RX_MSG_OBJ_ID);
    
            //
            // Increment a counter to keep track of how many messages have been
            // received. In a real application this could be used to set flags to
            // indicate when a message is received.
            //
            rxMsgCount++;
    
            //
            // Since the message was received, clear any error flags.
            //
            errorFlag = 0;
    
        }

    I initialize the FIFO as below:

        //
        // Initialize the receive message object used for receiving CAN messages.
        // Message Object Parameters:
        //      Message Object ID Number: 2
        //      Message Identifier: 0x1
        //      Message Frame: Standard
        //      Message Type: Receive
        //      Message ID Mask: 0x0
        //      Message Object Flags: Receive Interrupt
        //      Message Data Length: 4 Bytes
        //
        CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE | CAN_MSG_OBJ_FIFO,
                               MSG_DATA_LENGTH);
    
        //
        // Initialize the receive message object used for receiving CAN messages.
        // Message Object Parameters:
        //      Message Object ID Number: 3
        //      Message Identifier: 0x1 (same)
        //      Message Frame: Standard
        //      Message Type: Receive
        //      Message ID Mask: 0x0 (same)
        //      Message Object Flags: Receive Interrupt
        //      Message Data Length: 4 Bytes
        //
        CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID_0, 0x1, CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE | CAN_MSG_OBJ_FIFO,
                               MSG_DATA_LENGTH);
    
        //
        // This receive message object with higher ID number is the last member of a receive FIFO
        //
        // Initialize the receive message object used for receiving CAN messages.
        // Message Object Parameters:
        //      Message Object ID Number: 4
        //      Message Identifier: 0x1 (same)
        //      Message Frame: Standard
        //      Message Type: Receive
        //      Message ID Mask: 0x0 (same)
        //      Message Object Flags: Receive Interrupt
        //      Message Data Length: 4 Bytes
        //
        CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID_1, 0x1, CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
                               MSG_DATA_LENGTH);

    Do you have any recommendation for what to be done when FIFO is filled? Do we have any event to signal a FIFO is filled?

    Thanks

    Sheldon

  • Hi Hareesh,

    Any updates for my questions here? I'd like to generating an interrupt on receiving all the three message object in one FIFO. How could I do that?

    Thanks

    Sheldon

  • Sheldon,

    Since this was handled offline, please close this thread if the issue was resolved.