S32K3 FLEXCAN LEGACY RX FIFO

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

S32K3 FLEXCAN LEGACY RX FIFO

Jump to solution
1,181 Views
Neo1096
Contributor I

In LEGACY RX FIFO mode using FLEXCAN, is there no storage depth for the hardware?
If you have a storage depth, such as the 16 Rx FIFO Filters I use here, which take up 10 mailboxes, you can add 16 filters. But I only have FlexCAN_Ip_RxFifo(INST_FLEXCAN_0,&Rxbuf) in the interrupt; This function can read FIFO values under CAN0. If my CAN interrupt priority is low, how can I read other frames stored in the FIFO? In addition, why do these 10 mailboxes also need to set masks?
I want to implement CAN frames CAN be saved in the mailbox, at a low CAN priority, or use a query to read CAN frames, and ensure that no frames are lost.
I see in the routine what seems to be a software-implemented FIFO, which is not what I want.
Or I might as well use the standard mail function and set up a few more mailboxes that match the ID that receives the most frequently.
Or do you use FIFO and open DMA?

Neo1096_0-1717141722967.pngNeo1096_1-1717141756907.png

Neo1096_3-1717141932798.png

 

Neo1096_2-1717141805934.png

 

0 Kudos
Reply
1 Solution
1,161 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

legacy RXFIFO can hold up to 6 messages without CPU intervention, if more messages comes it can be lost if RXFIFO is not read out in time. RTD driver is written in a way you need to call FlexCAN_Ip_RxFifo first, an interrupt is called once there is at least 1 message in the RXFIFO, driver reads single message from RXFIFO and user have to call FlexCAN_Ip_RxFifo again to enable interrupt again. Similar operation is done if DMA mode is selected, still FlexCAN_Ip_RxFifo must be called to get a data.
If 16 filter elements are selected, first 10 elements use first 10 individual mask acceptance registers to provide acceptance mask (assuming individual masking scheme is selected).
Beside RXFIFO you can use rest of available MBs for TX or RX functionality.

You can refer to below example ...
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-CAN-Transmit-amp-Receive-Using-MB-a...

BR, Petr

View solution in original post

0 Kudos
Reply
5 Replies
1,162 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

legacy RXFIFO can hold up to 6 messages without CPU intervention, if more messages comes it can be lost if RXFIFO is not read out in time. RTD driver is written in a way you need to call FlexCAN_Ip_RxFifo first, an interrupt is called once there is at least 1 message in the RXFIFO, driver reads single message from RXFIFO and user have to call FlexCAN_Ip_RxFifo again to enable interrupt again. Similar operation is done if DMA mode is selected, still FlexCAN_Ip_RxFifo must be called to get a data.
If 16 filter elements are selected, first 10 elements use first 10 individual mask acceptance registers to provide acceptance mask (assuming individual masking scheme is selected).
Beside RXFIFO you can use rest of available MBs for TX or RX functionality.

You can refer to below example ...
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-CAN-Transmit-amp-Receive-Using-MB-a...

BR, Petr

0 Kudos
Reply
1,158 Views
Neo1096
Contributor I
Thank you very much, you mentioned in your reply, written in a way that calls FlexCAN_Ip_RxFifo first, once there is at least 1 message in RXFIFO, the call breaks.
CAN I understand that I first call this function once during initialization, so if I have a message I will enter the interrupt, and if there are more than two messages, I will immediately enter the CAN interrupt again after reading the message for the first time and exiting the interrupt?
0 Kudos
Reply
1,093 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

for more messages, if you call FlexCAN_Ip_RxFifo again after entering interrupt, it will be called again, as RXFIFO contains message to be read.

BR, Petr

0 Kudos
Reply
1,077 Views
Neo1096
Contributor I
If I receive a message through a FIFO mode interrupt, how do I know what filter value I set for the message? Can you search through the register? It's still just the software that walks through the filter values that I set.
0 Kudos
Reply
1,055 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can use CAN2_FIFO_Received_MB[x].id_hit, which is Identifier Acceptance Filter Hit Indicator.

BR, Petr

0 Kudos
Reply