hello:
I have a problem description bellow:
CAN0 is not FIFO,CAN0 Receives the two IDs Data, mailbox 8 rx ID = 0x01, mailbox 9 rx ID = 0x101.
Now, CANoe sends one ID = 0x01, mailbox 8 rx 0x01 ,first and second Recieve OK,but from third and after cannot rx id 0x01, now if CANoe stop send 0x01, and start sends one anthor ID = 0x101, the mailbox 8 can rx id 0x01 once, and the mailbox 9 can rx id 0x101, but after second time mailbox 9 cannot rx id 0x101, and now CANoe send id = 0x01, mailbox 9 rx ID 0x101 once and mailbox 8 rx ID = 0x01.........
CANoe : 0x01 - 0x01 - 0x01 - 0x01 - 0x101 - 0x101 - 0x101 - 0x1
R274: rx ok rx ok rx ng rx ng - rx ok(ID0x01 and 0x101) rx ok(0x101) rx ng rx ok(ID0x101 and 0x01)
why????
hello :
The problem is solved. I forgot to mention that I use the pal and Flexcan library‘s interrupt callback functions form the SDK. bellow:
intial:
void CANDrv_ReceiveBufInit(void){
uint32_t idx,iStaIdx;
iStaIdx = TX1_MAILBOX_START_INDEX + CAN1_TxMsg_MaxCount;
for(idx = 0; idx < CAN1_RxValidMsg_MaxCount; idx++){
/* Configure RX buffer with index RX_MAILBOX */
CAN_ConfigRxBuff(&can_pal2_instance, iStaIdx+idx, &Can1MailBufCfg[idx], Can1RxValidMsgPara[idx].CANID);
CAN_Receive(&can_pal2_instance, iStaIdx+idx, &g_Rx1MessageBuff[idx]);
}
}
interrupt callback function:
void CANDrv_IRQHandle(
uint8_t instance,
can_event_t eventType,
uint32_t buffIdx,
flexcan_state_t *flexcanState){
COM_uint16 idx,iWriteIdx;
if(instance == can_pal2_instance.instIdx){
if(CAN_EVENT_TX_COMPLETE == eventType){
// here clear flag
} else if(CAN_EVENT_RX_COMPLETE == eventType){
if(buffIdx < TX_MAILBOX_START_INDEX){
} else {
// continue next frame
idx = buffIdx - TX1_MAILBOX_START_INDEX - CAN1_TxMsg_MaxCount;
// here must reset the mailbox , Call the CAN_ConfigRxBuff function, Otherwise, the above error will occur
CAN_ConfigRxBuff(&can_pal2_instance, buffIdx, &Can1MailBufCfg[idx], Can1RxValidMsgPara[idx].CANID);
CAN_Receive(&can_pal2_instance, buffIdx, &g_Rx1MessageBuff[idx]);
}
}
}
}