Tool/software:
I use CAN of AM3352 and want to receive of Remote Frames,but I do not know how to configure receive message object。Currently, I have done the following test.
t_entry.flag = (CAN_DATA_FRAME | CAN_MSG_DIR_RX);//rxflag msgnum = 32;
t_entry.id = 0x701;//CAN_RX_HEART_CMD;
t_entry.mskid = 0x780;//CAN_RX_MSK_CMD;
CANRxObjectConfig(SOC_DCAN_0_REGS, &t_entry);
t_entry.flag = (CAN_DATA_FRAME | CAN_MSG_DIR_RX);//rxflag msgnum = 33;
t_entry.id = 0x00;//CAN_RX_NMT_CMD;
t_entry.mskid = 0x780;//CAN_RX_MSK_CMD;
CANRxObjectConfig(SOC_DCAN_0_REGS, &t_entry);
void CANRxObjectConfig(unsigned int baseAdd, can_frame* canPtr)
{
unsigned int idLen;
unsigned int msgIndex;
msgIndex = (CAN_NUM_OF_MSG_OBJS / 2);
idLen = (canPtr->flag & CAN_EXT_FRAME) ? DCAN_29_BIT_ID : DCAN_11_BIT_ID;
/* Use Acceptance mask. */
DCANUseAcceptanceMaskControl(baseAdd, DCAN_MASK_USED, DCAN_IF2_REG);
/* Configure the DCAN mask registers for acceptance filtering. */
DCANMsgObjectMskConfig(baseAdd, DCAN_IDENTIFIER_MSK(canPtr->mskid,
DCAN_ID_MSK_11_BIT), DCAN_MSK_MSGDIR_DISABLE,
DCAN_MSK_EXT_ID_ENABLE, DCAN_IF2_REG);
/* Set the message valid bit */
DCANMsgObjValidate(baseAdd, DCAN_IF2_REG);
/* Set the message id of the frame to be received */
DCANMsgIdSet(baseAdd, canPtr->id, idLen, DCAN_IF2_REG);
/* Set the message object direction as receive */
DCANMsgDirectionSet(baseAdd, DCAN_RX_DIR, DCAN_IF2_REG);
/* Enable the receive interrupt for the message object */
DCANMsgObjIntEnable(baseAdd, DCAN_RECEIVE_INT, DCAN_IF2_REG);
if(canPtr->flag & CAN_MSG_FLAG)
{
/* Enable the FIFO end of block */
DCANFIFOEndOfBlockControl(baseAdd, DCAN_END_OF_BLOCK_ENABLE, DCAN_IF2_REG);
}
else
{
DCANFIFOEndOfBlockControl(baseAdd, 0, DCAN_IF2_REG);
}
/* Check for the message valid status for receive objects */
while((DCANMsgValidStatusGet(baseAdd, msgIndex)) &&
(msgIndex <= (CAN_NUM_OF_MSG_OBJS - 1)))
{
msgIndex++;
}
/* Configure the command register */
DCANCommandRegSet(baseAdd, (DCAN_ACCESS_CTL_BITS | DCAN_MSG_WRITE |
DCAN_ACCESS_MSK_BITS | DCAN_ACCESS_ARB_BITS),
msgIndex, DCAN_IF2_REG);
}
the result of testing is following:
when Sending the remote frame CANID is 0x00,I can receive the remote frame and the msgNum is 33,but when Sending the remote frame CANID is 0x701,I can not receive the remote frame.
I look forward to your reply, thank you!