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.

Compiler/LAUNCHXL-F28377S: F28377D DCan NewDat Flag reset

Part Number: LAUNCHXL-F28377S

Tool/software: TI C/C++ Compiler

Hi

There is a new driverlib inside the C2000 Ware package.

From there I took the can_ex1_loopback example and modified it to send a message only if I set a sendMsg flag (over the debugger).

I send it once but it receives endless messages....

I think the NewDat flag will not be reset after reading but I didn't find a way to do this.

Here is the part that I modified.

        if(SendMsg) {
            //
            // Send CAN message data from message object 1
            //
            CAN_sendMessage(CANA_BASE, 1, MSG_DATA_LENGTH, txMsgData);
            SendMsg = 0;
        }
        //
        // Delay before receiving the data
        //
        DEVICE_DELAY_US(500000);

        //
        // Read CAN message object 2 and check for new data
        //
        if (CAN_readMessage(CANA_BASE, 2, rxMsgData))
        {

            msgCount++;           
        }

  • Hello

    I can confirm this is a bug in the driver. I will have this fixed before the next C2000Ware release.

    For now, if you receive data (in your 2nd if-statement), use the following to clear the NewData:

                //
                // Now clear out the new data flag
                //
                HWREG_BP(CANA_BASE + CAN_O_IF2CMD) |= CAN_IF2CMD_TXRQST;
    
                //
                // Transfer the message object to the message object specified by
                // objID.
                //
                HWREG_BP(CANA_BASE + CAN_O_IF2CMD) = 2 & CAN_IF2CMD_MSG_NUM_M;
    
                //
                // Wait for busy bit to clear
                //
                while((HWREGH(CANA_BASE + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY) == CAN_IF2CMD_BUSY)
                {
                }

    Thank you!

    Best regards

    Chris