Hello,
I would like to implement a gateway from CAN-FD to ethernet in the IMXRT1176. The gateway should forward all can-message-id's, so obviously I cannot assign one ID to one mailbox.
From the documents I see that a RX-Fifo is not supported when CAN-FD is activated. This means that for CAN-FD operation I need to use mailboxes. Correct?
What is the correct concept to receive ANY CAN-FD frames (without changing the receive order of the messages in the firmware)?
if I need to use mailboxes, I can activate all mailboxes, set a filter to "accept all". Then the CAN-engine will put the first received message into the first free mailbox. If the second message arrives before I read the first mailbox, I assume the engine will put the message into the second mailbox, because the first one is still full. Correct?
Now the firmware reads the first mailbox and puts the message into an internal software-fifo and frees that mailbox. If now a new CAN-message is received, the CAN-engine would store the new message into the first mailbox. At this point my firmwre needs to make sure that the second mailbox is read before the first mailbox is read to keep the correct message order. This means the order of the full mailboxes does not represent the receive order, which is important.
Is there a easier to implement option available that keeps the correct received order of the CNA-messages?
It would be much simpler to have a built-in fifo that supports CAN-FD...
Hi @gunnarbohlen ,
Thank you so much for your interest in our products and for using our community.
I suggest you refer to MIMXRT1170RM reference manual, especially chapter 66.
https://www.nxp.com/webapp/Download?colCode=IMXRT1170RM
Question1: From the documents I see that a RX-Fifo is not supported when CAN-FD is activated. This means that for CAN-FD operation I need to use mailboxes. Correct?
Answer1: Yes, in MIMXRT1170RM described that "Rx FIFO cannot be used in FD mode", but you can use mailboxes.
Question2: What is the correct concept to receive ANY CAN-FD frames (without changing the receive order of the messages in the firmware)?
Answer2: I am sorry that I don't understand your question.
You mean to receive all the CAN ID? If so, you can receive all CAN ID by setting FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, 0);
Question3: if I need to use mailboxes, I can activate all mailboxes, set a filter to "accept all". Then the CAN-engine will put the first received message into the first free mailbox. If the second message arrives before I read the first mailbox, I assume the engine will put the message into the second mailbox, because the first one is still full. Correct?
Answer3: chapter 66.3.5 Matching process described more detail.
Please pay attention about Registers setting.
Question4: Is there a easier to implement option available that keeps the correct received order of the CNA-messages?
Answer4:
1:I strongly recommend that you use timestamps. Timestamps can record the time when CAN data frame reaches the receiver. you can comparing the timestamps to get know that the receiving order of the data frames .
2:Please configure CAN filters and mask bits reasonably, it is also very import.
Question5: It would be much simpler to have a built-in fifo that supports CAN-FD...
Answer5: I am sorry about that, and MIMXRT1170RM tell us that CANFD can not use RX FIFO.
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
mayliu