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.

TMS570LC4357: Issue with CAN data reception when CAN id is updated using canUpdateID.

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi TI-experts,

We are using TMS570LC43xx Microcontroller and frertos.

We need to update CAN id at run time for data reception.

I have updated can id using halcogen generated function canUpdateID.

Issue is CAN data is not received for this updated CAN id.

Please guide 

Thanks and Regards,

Anil

  • Hi Anil,

    Is the ID updated successfully? You can use canGetID() to checkif the message ID has been updated. 

    Did you change msk[x] of the MASK register?

  • Hi QJ Wang,

    Thanks for your reply.

    Is the ID updated successfully? You can use canGetID() to checkif the message ID has been updated. 

    Yes. message ID has been updated successfully.

    Did you change msk[x] of the MASK register?

    No. how to change msk[x] of the MASK register?

    Is there any function generated by Halcogen?

    Please share example code if any. 

    Thanks and Regards,

    Anil 

     

  • Hi Anil,

    I just tested the canUpdateID(), it works. I can get the new message with new message ID:

    This is my test code using CAN1 loopback:

    int main(void)
    {
    /* USER CODE BEGIN (3) */
    unsigned int readID1, readID2;

    canInit();
    canEnableloopback(canREG1,Internal_Lbk);

    canUpdateID(canREG1, 0x1, 0x60000028);
    canUpdateID(canREG1, 0x2, 0x40000028);

    /* transmit on can1 */
    canTransmit(canREG1, canMESSAGE_BOX1, tx_data);

    readID1 = canGetID(canREG1, 0x1);
    readID2 = canGetID(canREG1, 0x2);

    /*... wait until message receive on can2 */
    while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX2));
    canGetData(canREG1, canMESSAGE_BOX2, rx_data); /* receive on can2 */

    }

    Mail Box1 is for TX and mail Box2 is for receive.