hi
thank you. One more question,if I use FLEXCAN_DRV_SetRxIndividualMask to configue each message buffer when fifo is not enabled,the mask is working.
as shown in FLEXCAN_DRV_SetRxIndividualMask,when fifo is enabled and message buffer index is greater than fifo element threshold,it will quit from freeze mode,and I can't set individul mask for some specific Mb.
In fact, I have the requirement to use both fifo and message Id MASK,in this case,how to deal with it?
here is the function for setting individual mask:
status_t FLEXCAN_DRV_SetRxIndividualMask(
uint8_t instance,
flexcan_msgbuff_id_type_t id_type,
uint8_t mb_idx,
uint32_t mask)
{
DEV_ASSERT(instance < CAN_INSTANCE_COUNT);
CAN_Type * base = g_flexcanBase[instance];
flexcan_rx_fifo_id_element_format_t formatType;
FLEXCAN_EnterFreezeMode(base);
if ((mb_idx > FLEXCAN_GetMaxMsgBuffNum(base)) || (mb_idx >= CAN_RXIMR_COUNT))
{
FLEXCAN_ExitFreezeMode(base);
return STATUS_CAN_BUFF_OUT_OF_RANGE;
}
if (false == FLEXCAN_IsRxFifoEnabled(base))
{
if (id_type == FLEXCAN_MSG_ID_STD)
{
/* Set standard individual mask*/
FLEXCAN_SetRxIndividualStdMask(base, mb_idx, mask);
}
else if (id_type == FLEXCAN_MSG_ID_EXT)
{
/* Set extended individual mask*/
FLEXCAN_SetRxIndividualExtMask(base, mb_idx, mask);
}
else
{
/* Should not get here */
}
}
else
{
if (mb_idx > FLEXCAN_GetNoOfIndividualMBsRxFIFO(base))
{
FLEXCAN_ExitFreezeMode(base);
return STATUS_CAN_BUFF_OUT_OF_RANGE;
}
/* In FIFO Mode get the Id Filter Format already configured by FLEXCAN_DRV_ConfigRxFifo */
formatType = FLEXCAN_GetRxFifoIdFormat(base);
FLEXCAN_SetRxIndividualMask(base, mb_idx,
FLEXCAN_GetRxFifoMask(id_type, formatType, mask));
}
FLEXCAN_ExitFreezeMode(base);
return STATUS_SUCCESS;
}