I want to setup 1-16 message obj for FIFO receiving pkt, 17 for the last frame:
Msg no : 1----------------16 17
Frame No: 0----------------15 67
16---------------31
32---------------47
48----------------63
64-65-66
Now, My Init code:
void CanRecvMsgBoxInit()
{
tCANMsgObject sCANMessage = {0};
uint32_t i = 0;
/* mailbox 1-16 FIFO recv, 1-15 disable interrupt, 16 enable interrupt */
sCANMessage.ui32MsgID = 0x00360000;
sCANMessage.ui32MsgIDMask =0x00FF0000;
sCANMessage.ui32Flags = (MSG_OBJ_USE_ID_FILTER | MSG_OBJ_FIFO|\
MSG_OBJ_EXTENDED_ID);
sCANMessage.ui32MsgLen = 8;
for(i=canMESSAGE_BOX1;i<canMESSAGE_BOX16;i++)
{
CANMessageSet(CAN0_BASE, i, &sCANMessage, MSG_OBJ_TYPE_RX);
}
/* mailbox 16 FIFO last msg box, enable interrupt */
sCANMessage.ui32Flags = (MSG_OBJ_RX_INT_ENABLE | \
MSG_OBJ_USE_ID_FILTER | \
MSG_OBJ_EXTENDED_ID);
sCANMessage.ui32MsgLen = 8;
CANMessageSet(CAN0_BASE, canMESSAGE_BOX16, &sCANMessage, MSG_OBJ_TYPE_RX);
/* mailbox 17 recv last frame,enable interrupt*/
sCANMessage.ui32MsgID = 0x00370000;
sCANMessage.ui32MsgIDMask = 0x00ff0000;
sCANMessage.ui32Flags = (MSG_OBJ_RX_INT_ENABLE | \
MSG_OBJ_USE_ID_FILTER | \
MSG_OBJ_EXTENDED_ID);
CANMessageSet(CAN0_BASE, canMESSAGE_BOX17, &sCANMessage, MSG_OBJ_TYPE_RX);
return ;
}
Recv read message code:
uint32_t CanRecvPkt(uint8_t *pucDataBuf, uint32_t ui32Status)
{
uint32_t ulRet = 0;
uint32_t i = 0;
tCANMsgObject sCANMessage;
uint32_t ui32Flags = 0;
uint8_t pucMsgData[8] = {0};
for(i=canMESSAGE_BOX1;i<canMESSAGE_BOX18;i++)
{
memset(&sCANMessage, 0, sizeof(tCANMsgObject));
sCANMessage.pui8MsgData = pucMsgData;
CANMessageGet(CAN0_BASE, i, &sCANMessage, 1);
ui32Flags = sCANMessage.ui32Flags;
if(ui32Flags & MSG_OBJ_NEW_DATA)
{
memcpy(pucDataBuf+(i-1)*8,pucMsgData,8);
}
}
return 0;
}
when sent 35(more than 16) frames to this can, the No16 interrupt came in, i found that the data in msgbox 1--15 was right.
The same as the data in 0--14 frame. But the data in msgbox 16 was not the same with frame 15, and the data in frame 34
was in msgbox 16, the frame 35 data was in msgbox 17.
I found in TM4C1294 data sheet :
I try my best to check it, but failed.
Could anybody help me check this problem, thank you.