What is the difference between RX FIFO and message box

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

What is the difference between RX FIFO and message box

跳至解决方案
5,302 次查看
christianmächle
Contributor II

Hello,

 

if you want to receive more than 32 messages via CAN and use the FlexCAN driver you can either do this by using a message box and setting an appropriate mask in order to receive more than one message ID with that message box. Or you can use the RX FIFO and set an appropriate ID table.

However, it seems like as soon as a message is received, the interrupt handler of the FlexCAN driver is called and the data from the message box or RX FIFO gets copied to the given buffer variable.

After this, the FlexCAN driver is not able to receive another message, unless the 

FLEXCAN_DRV_RxFifo

or the

FLEXCAN_DRV_Receive

function is called again, which if you want to receive adjacent messages has to be done by the callback function of said interrupt handler.

 

In this case, what is the difference between the message box and the RX FIFO if the FIFO is not able to receive another message before calling the receive function again?

0 项奖励
1 解答
3,809 次查看
AnaAldescu
NXP Employee
NXP Employee

Hello,

The RxFIFO is 6-message deep and the application can read the received messages sequentially, in the order they were received, by repeatedly reading a Message Buffer structure at the output of the FIFO, which is the Message Buffer with the index 0 (zero).

If you install an event callback you can be notified each time a frame was received in the FIFO, or when the number of unread messages within the Rx FIFO is increased to 5 from 4 due to the reception of a new one (Rx FIFO Warning event), or when an incoming message was lost because the Rx FIFO is full (Rx FIFO Overflow event).

When you call FLEXCAN_DRV_RxFifo, RxFIFO interrupts are enabled and if multiple frames match the ID filter table, they will be stored in the internal FIFO structure. The application needs to call FLEXCAN_DRV_RxFifo for each frame stored in the FIFO in order to pop the data from the FIFO into the user buffer. You cannot read all the entries in the FIFO in a single operation.

Please let me know if you have any other questions.

Best regards,

Ana

在原帖中查看解决方案

0 项奖励
3 回复数
3,810 次查看
AnaAldescu
NXP Employee
NXP Employee

Hello,

The RxFIFO is 6-message deep and the application can read the received messages sequentially, in the order they were received, by repeatedly reading a Message Buffer structure at the output of the FIFO, which is the Message Buffer with the index 0 (zero).

If you install an event callback you can be notified each time a frame was received in the FIFO, or when the number of unread messages within the Rx FIFO is increased to 5 from 4 due to the reception of a new one (Rx FIFO Warning event), or when an incoming message was lost because the Rx FIFO is full (Rx FIFO Overflow event).

When you call FLEXCAN_DRV_RxFifo, RxFIFO interrupts are enabled and if multiple frames match the ID filter table, they will be stored in the internal FIFO structure. The application needs to call FLEXCAN_DRV_RxFifo for each frame stored in the FIFO in order to pop the data from the FIFO into the user buffer. You cannot read all the entries in the FIFO in a single operation.

Please let me know if you have any other questions.

Best regards,

Ana

0 项奖励
3,810 次查看
christianmächle
Contributor II

Thanks!

So the main difference is that the RX FIFO goes on working in the backround by receiving frames and stores them until the application is requesting the data.

This maybe also the explains the problem that I am having with the RX FIFO:

If the application is not polling the data fast enough and the RX FIFO is overrun., the FlexCAN driver seems to get stuck and looping through the IRQ Handler.

0 项奖励
3,810 次查看
alexandrunan
NXP Employee
NXP Employee

Regard to RX FIFO is overrun and continuous looping of IRQ  is because the driver IRQ Handler will clear the over flow status and on the next frame this will be triggered again if the application callback don't do something in this case.

0 项奖励