Hello Yaran,
To enable RxFIFO you could create a new function/define that accesses to CAN registers and sets RFEN bit in MCR register. For example, in your main.c:
(This is code generated in processor expert for Init_CAN component).
#define CAN_PDD_EnableRxFIFO(PeripheralBase, State) ( \
CAN_MCR_REG(PeripheralBase) = \
(uint32_t)(( \
(uint32_t)(CAN_MCR_REG(PeripheralBase) & (uint32_t)(~(uint32_t)CAN_MCR_RFEN_MASK))) | ( \
(uint32_t)((uint32_t)(State) << CAN_MCR_RFEN_SHIFT))) \
)
And this is used as follows:
CAN_PDD_EnableRxFIFO(CAN1_BASE_PTR,1); /* Enable RxFIFO */
Once RxFIFO is enabled, take care when polling for new incoming messages in CANx_IFLAG1 register, there are 3 flags BUF7I, BUF6I and BUF5I, BUF5I known as "Frames available in Rx FIFO", BUF6I "Rx FIFO Warning" and BUF7I "Rx FIFO Overflow".
- BUF5I (Frames availble in RxFIFO) is asserted when there is at least one frame available to be read from FIFO. (If interrupt for BUF5 is enabled in CANx_IMASK1 register)
- BUF6I (Rx FIFO warning) is asserted when the number of unread messages is increased to 5 from 4.
- BUF7I (Rx FIFO Overflow) is asserted when an incoming message was lost because the Rx FIFO is full.
So basically, you should modify current driver in order to polled for these flags.
For more details, you can consult Rx FIFO section (Section 46.4.7 in Reference manual)
I hope this can help you.
Best Regards,
Isaac
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------