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.

TMS320F280049: How to auto separate information of a received CAN frame?

Part Number: TMS320F280049

Hi team,

I got a question from my customer:

How to automatically separate different field of a received CAN frame? 

For example, they need to know the following information:

1. Identifier of the received frame. 

2.They want to know how many frames is included in a data.

Can we support these need automatically? Or we need to achieve this in software by using mask and bit shift?

Thanks!

  • Dear Weiqi Wang, 

    That is a fairly basic question.  It is likely that this customer is just getting started with CAN.  To prevent lots of basic questions, we have addressed those types of questions with the following information.  Please let us know if this is appropriate for your customer and if you think it will enable them to make progress with their CAN project.

    =====================================================================================================

    For information about the CAN protocol itself (which is not covered in our documentation), there are excellent resources online.

    •          Wikipedia & many videos on YouTube cover the protocol extensively.

    •          Good resource for a tutorial is https://www.kvaser.com/about-can/the-can-protocol/ .

    •          I have benefited immensely from reading the book “A Comprehensible Guide to Controller Area Network” by Wilfried Voss.

    •          There are also good Application Notes on our website. You can find them listed in the References section of my own app.note SPRA876.

    ===========================================================================================================

     Thanks,

    Krishna

  • Hi Allam,
    Your materials does help. However, the key to my question is whether we can support an automatic handling when received a data frame. Or we can only handle the data via software.
  • Hi Weiqi,

    There is no driverlib API for the identifier and frame.
    You need to mask and shift the bit from the respective CAN IF Register.

    Regards
    Harshmeet
  • Hi Harshmeet,

    The problem is in C2000 CAN module, if the ID of received data frame match the configured value. Than the data field of the received frame will be transferred into CanaRegs.CAN_IFx. But other bits of the frame will not be transferred into a register.
    Thus, how can we get access to the raw frame and do the mask and shift operation?

    Thanks
  • Weiqi

    You can't access the raw frame, it is processed by the CAN IP. You only have the information that is available to be transferred into the various IFx registers.

    Edit: If you're looking for API to perform the transfer of data into the IFx registers, see CAN_transferMessage()

    best regards
    Chris

  • Weiqi,
    I presume your question is about extracting the MSGID & DLC fields of a received CAN frame with the help of a API function, correct?

    But other bits of the frame will not be transferred into a register

    Sorry, I don’t understand. Which other bit-fields are you talking about? The 3 most important fields are the MSGID, DLC value and the data-bytes themselves. All 3 fields will be correctly stored in the IFx registers. Other bit-fields are protocol related and are not useful to the application.


    Thus, how can we get access to the raw frame and do the mask and shift operation?

    Why do you need access to the "raw frame"? Which bit-field other than the 3 mentioned above are you interested in (and why)?

  • Weiqi

    We haven't heard from you in over a week. Did you get the answers you needed? Otherwise please clarify by responding to Hareesh's questions.

    Best regards
    Chris
  • Sorry for the delay.
    My questions has been solved and this post could be closed.

    Thanks,
    Brian
  • Hi Weiqi,

    What was the solution you found?

    Regards
    Harshmeet
  • Hi Harshmeet,

    At first, our customer want to get access to the raw data to analysis the CAN frame according to their own protocol.
    Since you suggest it hard to get the raw data, I managed to work with them and changed their protocol, and achieved the same function by setting multiple mailboxes to identify different types of message.
    Thanks for you help and follow up.

    Brian