Hi Team,
referenced demo : can_ex5_simple_receive
The routine mentions : Message Data Length: "Don't care" for a Receive mailbox
But our customer need to know the DLC of receive data. How to get it?
Thanks & Regards
Yale Li
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.
Hi Team,
referenced demo : can_ex5_simple_receive
The routine mentions : Message Data Length: "Don't care" for a Receive mailbox
But our customer need to know the DLC of receive data. How to get it?
Thanks & Regards
Yale Li
Yale,
The following function can be used to read the DLC field using the IFx registers:
//*****************************************************************************
//
// CAN_readMessageWithDLC
//
//*****************************************************************************
bool CAN_readMessageWithDLC(uint32_t base,
uint32_t objID,
uint16_t *msgData,
uint16_t *msgLen)
{
bool status;
//
// Check the pointers.
//
ASSERT(msgLen != 0U);
//
//Read the message first this fills the IF2 registers
//with received message for that mailbox
//
status = CAN_readMessage(base, objID, msgData);
//
// See if there is new data available.
//
if(status == true)
{
*msgLen = (HWREG_BP(base + CAN_O_IF2MCTL) & CAN_IF2MCTL_DLC_M);
}
return(status);
}
Thanks.