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.

TMS320F28388D: CAN receive on Connectivity Manager CM4

Part Number: TMS320F28388D


Hello,

I'm looking for a way to decrypt a CAN mailbox received with its ID and DLC.

I can see in "../device/driverlib_cm/can.h" the function CAN_readMessageWithID which returns the ID of the received frame, but, unless I'm mistaken, no function which returns the dlc...

How can I read the dlc of the received frame?

Thanks for your help!

Eric F.

  • Hi Eric,

    Yes, there currently is no available function to read out DLC but you can create a short routine based of the current functions in driverlib.  CAN receive functions use IF2 in driverlib.  Transmit functions use IF1 registers so you need to inspect CAN_IF2MCTL register for the DLC field.  Function CAN_readMessageWithID calls function CAN_readMessage and you can have a snippet in your code similar below to read out DLC

    uint16_t msgCtrl, dlc;
    
    msgCtrl = HWREGH(base + CAN_O_IF2MCTL);
    
    dlc = msgCtrl & CAN_IF2MCTL_DLC_M;

    Hope this helps!

    Regards,

    Joseph

  • Hi Joseph,

    thanks very much, I will try this solution.

    Regards,

    Eric