CAN_IF2MSK register not showing proper values for F2838x in CCS register window

Other Parts Discussed in Thread: C2000WARE

I am configuring the receive mailbox, as below:

  • Message-ID: 0x00000003
  • Message-ID mask: 0x00000007
  • Message type: Extended

For F2837xD, the register window shows the proper value for the CAN_IF2MSK register. Please refer to the below screenshot.

But the F2838x, the register window does not show the proper value for the CAN_IF2MSK register. Please refer to the below screenshot.

The attached image for F2838x and F2837xD is from CCS 10.1.

I have checked the register values using CCS 10.2 as well after suggested in the post. But the values for the F2838x CAN_IF2Msk register are still the same as shown in the image.

Can you please check and let me know about this behavior?

Thanks,

Dhanashree

  • Hi Dhanashree,

    Can you confirm the value of CAN_IF2MSK register through inline C-code?  Just wanted to know if this is also giving you the same value as what the register view displays.

    Thanks,

    Joseph

  • Hi Joseph,

    Can you please let me know how to confirm the value of the CAN_IF2MSK register through the inline C-code?

    Thanks,

    Dhanashree

  • Hi Dhanashree,

    You can assign a temporary variable and assignment and just monitor the value of that variable (e.g. - tempvar)

         tempvar = HWREGH(base + CAN_O_IF2MSK);

    This is just to confirm that what you are seeing in the registers view is consistent with the actual variable value.

    Regards,

    Joseph

  • Hi Joseph,

    Sorry for the delay in response.

    Yes, the variable is also showing the same value.

    Attaching the screenshot of expressions and register window. 

     

    Thanks,

    Dhanashree

  • Hi Dhanashree,

    Thanks for running the inline code.  After each CAN transaction, all the CAN attributes and data are updated in the message RAM.  You would need to transfer the contents of the message RAM to the IFx registers and then poll/inspect their values.  My guess is that the transfer between message RAM and IFx registers did not happen.  There is a function in driverlib that will manage this transfer called CAN_transferMessage().  Please try running this function and see if you can read the correct value of IF2MSK register.

    Best regards,

    Joseph

  • Hi Joseph,

    Yes, after using the CAN_transferMessage() the IF2MSK register updating properly.
    But below is my doubt:

    1. Why only CAN_IF2MSK depends on CAN_transferMessage() and other IF2 registers (CAN_IF2MCTL, CAN_IF2ARB, CAN_IF2DATA, CAN_IF2DATB) are updating properly without using CAN_transferMessage()?

    Thanks,

    Dhanashree

  • Hi Dhanashree,

    Good question, but my guess is that the previous operation probably did not use the CAN_transferMessage function but has directly written to register IF2CMD and the Mask bit (bit 22) has not been set, hence not updated the contents of IF2MSK.

    Regards,

    Joseph

  • Hi Joseph,

    Regarding functions used in code, I am just setting up mailbox in the initialize function using CAN_setupMessageObject() and then reading the message continuously in the main function  using CAN_readMessageWithID().

    Below is the screen shot attached for CAN_IF1CMD register just after setting up the message object.

    Question1: How the values can be updated in between?

     

    Now, the CAN_transferMessage() is used before CAN_readMessageWithID() to read the IF2MSK value from message RAM.

    Whenever the CAN_transferMessage() is used, it is observed that the IF2ARB register values are updating as per the received message, as shown in the below attached image.

    But, the CAN_readMessageWithID() is not able to read the values in the passed variables to function when the free run is given. Please refer the attached image where Data and ID in expression window are not updated depending on passed variables to the CAN_readMessageWithID().

    Surprisingly, it works when we go inside the CAN_readMessageWithID() and  CAN_readMessage() functions using Step into.

    The CAN_readMessageWithID() is able to read the values properly in the passed variables to function when the free run is given and CAN_transferMessage() is not used in the code. Please refer the attached image where Data and ID in expression window are updated depending on passed variables to the CAN_readMessageWithID().

    Question2Can you please let us know reason behind this behavior? Is there any need to provide delay after using CAN_transferMessage()?

    Thanks,

    Dhanashree

  • Hi Dhanashree,

    If you examine function CAN_readMessageWithID, it calls function CAN_readMessage and if you take a closer look at CAN_readMessage function, it is basically writing to CAN_IF2CMD register, however its is not setting the bit for MASK (bit 22) hence MASK data from message RAM is not being transferred to CAN_IF2MSK.

    CAN_transferMessage function has the flexibility to set all the bits -  MASK, ARB, CONTROL, CLRINTPND, DATA_A, and DATA_B - to flag the transfer to the corresponding IFx registers.

    This is not a question of adding a delay.  It is just that the two functions do not write the same information to CAN_IFxCMD.  Hope this clarifies what you are observing.

    Regards,

    Joseph

  • Hi Joseph,

    From above, I understood that the CAN_readMessage function is basically writing to CAN_IF2CMD register and it is not setting the bit for MASK, hence the MASK data from message RAM is not being transferred to CAN_IF2MSK.

    Is there any specific reason for not setting the MASK bit of CAN_IF2CMD register in  the CAN_readMessage function?

    I spent lot of time in debugging that why only the CAN_IF2MSK register is not reflecting the proper values  in CCS register window as per the message RAM. Someone might face the similar issue in the future. 

    Can you please consider setting the MASK bit of CAN_IF2CMD register in the CAN_readMessage function in next C2000Ware version so that IF2Mask register will reflect proper values as per the message RAM while reading data from the mailbox?

    Thanks,

    Dhanashree

  • Hi Dhanashree,

    Good point.  I'll close with our SW team to see if MASK info can also be transferred to IFx registers when CAN_readMessage function is invoked.

    Regards,

    Joseph