Hi all,
I am using the s32k118 MCU and need to interface with a CAN bus. I've been polling the CAN bus every 100ms with the CAN_Receive() function to retrieve any messages from the bus, but unfortunately I do miss a lot of messages, since there are more than one message on the bus every 100ms.
My end goal is to asynchronously add all received messages to a Queue of CAN messages, which I can parse periodically. I was hoping to accomplish this with a CAN Rx Interrupt, which would be triggered whenever the MCU detects a message on the bus. Unfortunately, I'm not able to set up such an ISR.
I've tried setting up an ISR with the interrupt_manager component, on the CAN0_ORed_0_31_MB_IRQn IRQ. But it seems my ISR is being triggered only after I call CAN_Receive() in my main() function. This does not meet my requirements, as I was hoping to all the CAN_Receive() function exclusively in the ISR. Furthermore, after being triggered once, the code appears to get stuck in continuously calling the ISR over and over.
I tried installing a callback function with CAN_InstallEventCallback(), but again, the callback function is only called after I call CAN_Receive() or CAN_Send(). So again, it doesn't seem like I can depend on the Callback to catch all messages from the bus.
Finally, I used the Rx FIFO feature, which does successfully add all messages to a the Mailbox 0 in a buffer-type format. This is what I need... except it's limited to a maximum of 6 messages.

I'm anticipating a need for ~16 messages to be buffered at a time.
To illustrate the issues I've faced with Polling, ISR and Callback, I've attached a "CAN_Example" project. Hope it serves to further clarify the problem.
How do I accomplish this task, of buffering incoming CAN messages for future parsing?