AnsweredAssumed Answered

FlexCAN RxFIFO working example

Question asked by Robert York on Aug 27, 2015
Latest reply on Nov 9, 2016 by sivakrishna bandaru

I'm using Codewarrior 10.6.4, MQX 4.1 and a K70 board, and have been using the fsl_flexcan drivers for CAN. I've gotten them working to a point, but I need to switch to the RxFIFO mode, and I've been having troubles. I've used the example code to get the mailbox method working, but I swapped the flags for what mode it's in, and it won't run. Here's the flags from the example:

 

    flexcan1_data.is_rx_fifo_needed = TRUE;

    flexcan1_data.is_rx_mb_needed = FALSE;

 

So I changed these as above, and I'm not getting any CAN data now. Is there something else I need to modify in the example to change from MB to FIFO mode? Does anyone have another working example of FIFO operation? I'm kind of stuck here.

 

Just to clarify, taking the example FlexCAN code (fsl_flexcan_test.c) and in the default state, using MBs, it works fine. I just don't know exactly how to enable the RxFIFO mode, and when I've tried to figure it out, it seems to run and transmit fine, I just can't receive anything.

 

Edit:

 

I've found out my problem with getting the RxFIFO version working. It was an issue with my ID masks. Now I have that working, I've run into another small problem; I can't seem to get anything but the front element in the FIFO. I've been digging through the driver source and I can't seem to figure out how you tell the driver to give you the next message in the FIFO. Any one have ideas on this? As far as I can tell, the line:

 

        result = (flexcan_start_receive(instance, &flexcan1_data, RX_mailbox_num, RX_identifier, 1,

                                  &is_rx_mb_data, &is_rx_fifo_data, &rx_mb, &rx_fifo));

 

Only returns back if there's new messages, but it starts out with several blank messages that I have to empty out, so I always seem to be a few messages behind. I imagine if I received a message while parsing another, I would get even further behind. How do I just jump through the elements in the FIFO?

Outcomes