FlexCan S32K142 Need "simple" CAN0 Filters / matching example

cancel
Showing results for 
Search instead for 
Did you mean: 

FlexCan S32K142 Need "simple" CAN0 Filters / matching example

160 Views
Contributor I

I am looking for a simple S32K142 FlexCan CAN0 Filter matching example.

By "simple" I mean 

No SDK

No FIFO 

Priority of search not an issue.

Standard CAN 2.0 message with NO extended ID.

6 messages with message ID's 

0x0510

0x0511

0x0514

0x0516

0x1020

0x2012

Having trouble setting up 

CAN0->RXIMR[i] = ??

And

CAN0->RXMGMASK

AS well as any other CAN0 register I would need to set up to do the filtering i.e.

CAN0->MCR  etc.

No SDK please.

Thanks

Brian

0 Kudos
1 Reply

48 Views
NXP TechSupport
NXP TechSupport

Hi,

the MB’s ID is checked against the received one while the filtering/masking is applied.

There are following rules for filtering for different FlexCAN module configuration in case no RXFIFO is used MCR[FEN]=0:

   MCR[IRMQ]=0: MB0-MB31 use RXMGMASK except MB14 uses RX14MASK and MB15 uses RX15MASK

   MCR[IRMQ]=1: MB0-MB31 use RXIMR0-RXIMR31

 

The mask bit in respective mask register have following meaning.

1 = The corresponding bit in the MB’s ID is checked against the one received

0 = the corresponding bit in the MB’s ID is “don’t care”

 

The ID range cannot be simply done assuming the ID you wrote, so exact match will be used and you should set more MBs for receiving, one for each ID. For example set, using individual masking registers

MB[0] ID = 0x0510<<18 and RXIMR2 = 0x7FF<<18

MB[1] ID = 0x0511<<18 and RXIMR2 = 0x7FF<<18

MB[2] ID = 0x0514<<18 and RXIMR2 = 0x7FF<<18

MB[3] ID = 0x0516<<18 and RXIMR2 = 0x7FF<<18

 

The last 2 IDs are not standard (11 bit) but extended (29 bit) so MBs IDE bit will be set and you can have

MB[4] ID = 0x1020 and RXIMR4 = 0x1FFFFFFF

MB[5] ID = 0x2012 and RXIMR5 = 0x1FFFFFFF

 

BR, Petr

0 Kudos