Hi @VaneB ,
Thanks for the Reply.
Please check the below code, using below code i can able to receive all the message ID's
but the issue is, that while loop is blocking my remining functionality of the code.
Can you please suggest without while loop or please share the interrupt method code for Rx.
/***********************************************************************************************************************
* Function Name: UINT16 CAN_Rx(UINT32 Rx_Id, UINT8* Data, UINT8 Data_len)
* Description : This function is used to Receive the data on CAN
* Arguments : CAN_MSG_ID, Data, Data length
* Return Value : Status
***********************************************************************************************************************/
UINT16 CAN_Rx(UINT32 Rx_Id, UINT8* Data)
{
/* Set information about the data to be sent
* - Standard message ID
* - Bit rate switch enabled to use a different bitrate for the data segment
* - Flexible data rate enabled
* - Use zeros for FD padding
*/
can_buff_config_t buffCfg = {
.enableFD = true,
.enableBRS = true,
.fdPadding = 0U,
.idType = CAN_ID_TYPE,
.isRemote = false
};
/* Define receive buffer */
can_message_t recvMsg;
/* Configure RX buffer with index RX_MAILBOX */
CAN_ConfigRxBuff(INST_CAN_PAL1, RX_MAILBOX, &buffCfg, Rx_Id);
FLEXCAN_DRV_SetRxMbGlobalMask(INST_CAN_PAL1, FLEXCAN_MSG_ID_STD, 0); // All id received masking
/* Start receiving data in RX_MAILBOX. */
CAN_Receive(INST_CAN_PAL1, RX_MAILBOX, &recvMsg);
while(1)
{
/* Wait until the previous FlexCAN receive is completed */
if(CAN_GetTransferStatus(INST_CAN_PAL1, RX_MAILBOX) == STATUS_SUCCESS) //STATUS_BUSY
{
CAN_Rx_test_ID = recvMsg.id;
CAN_Receive(INST_CAN_PAL1, RX_MAILBOX, &recvMsg);
/* Check the received message ID and payload */
/* if(recvMsg.id == RX_MSG_ID)
{
CAN_Rx_test_ID = recvMsg.id;
}*/
}
}
}