Other Parts Discussed in Thread: C2000WARE
Dear team:
When the customer tested the DCAN module, he found that the filtering functions such as direction, arbitration bit, and length were not used, but only the data frame matching the arbitration bit was actually received, and the data frame with any arbitration bit could not be received.
The following is the configuration code, what is the problem?
1. Initialization
//CODE_START
while(CanaRegs.CAN_IF1CMD.bit.Busy == 1);
CanaRegs.CAN_IF1MSK.all= 0;
CanaRegs.CAN_IF1ARB.all= CAN_IF1ARB_MSGVAL;
CanaRegs.CAN_IF1MCTL.all= CAN_IF1MCTL_EOB;
CanaRegs.CAN_IF1CMD.all= m_u32MsgobjectID|CAN_IF1CMD_DIR|CAN_IF1CMD_CONTROL|CAN_IF1CMD_ARB; //m_u32RxMsgobjectID is the mailbox number
//CODE_END
2. Receive part of the code:
//CODE_START
CanaRegs.CAN_IF2CMD.all = m_u32RxMsgobjectID|CAN_IF2CMD_DATA_A|CAN_IF2CMD_DATA_B|CAN_IF2CMD_CONTROL|CAN_IF2CMD_ARB;
while(CanaRegs.CAN_IF2CMD.bit.Busy == 1);
读取DATA数据 = (UINT16)(CanaRegs.CAN_IF2DATA.all&0xFF)~~~~~~
CanaRegs.CAN_IF2CMD.all = m_u32RxMsgobjectID|CAN_IF2CMD_TXRQST; //m_u32RxMsgobjectID is the mailbox number
while(CanaRegs.CAN_IF2CMD.bit.Busy == 1);
//CODE_END
Best regards,
Green