CAN rx mailboxes and FIFO linking

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi there,

   

can someone please explain the FIFO mechanism behind linked CAN rx mailboxes, please?

   

I already noticed that there is only one interrupt every Xth message, when X is the FIFO size. Does this mean that I have to handle all messages at once in the interrupt and that the complete FIFO will be replaced when the next interrupt occurs?

   

If yes, this doesn't really feel like a usual FIFO queue where I usually can pop (get and delete) messages from the front end. Am I using it wrong? Is there maybe some example showing how to do it right?

   

 

   

Thanks in advance!

0 Likes
3 Replies
Anonymous
Not applicable

 Hi

   

Only one receive message interrupt function will be generated for all the linked mailboxes. And this will be for the last mailbox in the chain.  Inside this function ACK for all the linked mailboxes are set. This indicates that you would receive an interrupt only when the last message int he FIFO is received. 

0 Likes
Anonymous
Not applicable

OK, thank you! In my current implementation i use a polling mechanism to process my FIFO. Thus, I read the My_CAN_Controller_BUF_SR_REG register for new messages in the last mailbox of my FIFO. Since I linked mailboxes 0, 1, 2 and 3 I read the flag for mailbox with id 3. When I am ready with message processing I set the My_CAN_Controller_RX_ACK_MSG bit for mailbox 3. Then I would expect the FIFO to automatically push the remaining messages in the FIFO one index further so that I can read a 1 in the My_CAN_Controller_BUF_SR_REG for mailbox 3 again.

   

Every message that I process is sent out afterwards. The first strange thing is, that I need to receive 4 messages (which is equal to my FIFO size) until I get the first interrupt. The second strange thing is that the first message that is sent out is the answer to the 4th message I received. From then on, all is working properly despite the fact that the second, third and fourth message are not answered. Can you explain this behavior?

   

Thanks in advance!

0 Likes
Anonymous
Not applicable

Can somebody please reply on that? The system still doesn't behave like I expect it to do.

0 Likes