What is the difference between RX FIFO and message box

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is the difference between RX FIFO and message box

Jump to solution
5,276 Views
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 Kudos
1 Solution
3,783 Views
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

View solution in original post

0 Kudos
3 Replies
3,784 Views
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 Kudos
3,784 Views
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 Kudos
3,784 Views
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 Kudos