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.

TMS570LS3137: Reading of message box CAN ID

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello,

In our application we are configure some DCAN1 message boxes in halcogen.

During runtime depending on the CAN ID to be sent, we loop through the messageboxes and find the one with the correct CAN ID.

This is done b using `canGetID` function from the halcogen. 

Recently we made some changes to our RTOS tasks,(halcogen generated code is the same) since then we have issues in identifying the correct message boxes.

As a result message payload is being sent with on wrong CAN ID.

To simulate the issue, I created a test function to loop through all message boxes and read all CAN IDs at bootup.

here is the code for this read(insprired from halcogen):

for (curr_msg_box = 1; curr_msg_box < 10U; curr_msg_box++) {
        if((curr_msg_box % 2) == 0) {
            /** - Wait until IF2 is ready for use */
            while ((canREG1->IF1STAT & 0x80U) ==0x80U)
            {
            } /* Wait */
            canREG1->IF1CMD = 0x20U;
            canREG1->IF1NO = (uint8) curr_msg_box;
            while ((canREG1->IF1STAT & 0x80U) ==0x80U)
            {
            } /* Wait */
            curr_id32 = (canREG1->IF1ARB & 0x1FFFFFFFU);
        } else {
            /** - Wait until IF2 is ready for use */
            while ((canREG1->IF2STAT & 0x80U) ==0x80U)
            {
            } /* Wait */
            canREG1->IF2CMD = 0x20U;
            canREG1->IF2NO = (uint8) curr_msg_box;
            while ((canREG1->IF2STAT & 0x80U) ==0x80U)
            {
            } /* Wait */
            curr_id32 = (canREG1->IF2ARB & 0x1FFFFFFFU);
        }
        idList[curr_msg_box] = curr_id32;
        idListShifted[curr_msg_box] = ((curr_id32 >> 18) & 0x7FF);
    }

I noticed some strange behavior during running this, If I run thorough this code step by step I read all the CAN ID as expected (refer the snapshot):

But if I run through piece of code the result is as below:

As you can see there is a shift in the CAN ID positions.

Could you please help me with this?