Which register i need to set for CAN ID and Masking filter?

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

Which register i need to set for CAN ID and Masking filter?

1,688 Views
shivamshankarg
Contributor III

Hello Team, 
For masking and filtering which register we need to set, so our Rx can allow only those message id to be received.

PetrS

is it Rx Individual mask register for masking? and for id filtering from where id will be check if masking bit will be 1.

Labels (1)
Tags (2)
0 Kudos
3 Replies

1,579 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the Accepance mask registers are used to filter incoming ID. There is bit2bit correspondence between received ID, mask and programmed MB ID (or RXFIFO ID filter elements). The mask says if corresponding incoming ID bit is compared with programmed ID bit.

If mask bit is cleared the incoming ID bit is not compared, it is don’t care. If mask bit is set, then there must be exact match between incoming ID bit and programmed ID bit. To receive a message into a MB/RXFIFO all relevant bits with mask bit set must be equal to programmed one.

 

There are following rules for message filtering for different FlexCAN module configuration (assume module with 32 MBs)

a) When MCR[FEN]=0, no RX FIFO

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

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

b) When MCR[FEN]=1, RX FIFO used

   MCR[IRMQ]=0: all RX FIFO ID elements uses RXFGMASK, rest od MBs use RXGMASK except MB14 uses RX14MASK and MB15 used RX15MASK (only if MB14/15 are not occupied by RXFIFO ID table)

   MCR[IRMQ]=1: RX FIFO ID elements uses RXIMRx and RXFGMASK depending the CTRL2[RFFN] setting

BR, Petr

0 Kudos

1,560 Views
yogish_krishna
Contributor I

Hi PetrS ,

I need to filter CAN incoming messages from 0x00001561 to 0x00001567 .

MCR[FEN]=0, no RX FIFO used

MCR[IRMQ]=0,using only RXMGMASK

How to assign value of RXMGMASK for this CAN IDs ?

Should I use RXFGMASK also for filtering ?

Kindly explain the relationship between CAN ID, RXMGMASK and RXFGMASK .

 

BR,

Yogish

0 Kudos

900 Views
krishan_saini
Contributor I

Hi @yogish_krishna 

The below API can filter 0x00001560 to 0x00001567. I hope this helps for you.

Mask value:  0xFFFFFF8

FLEXCAN_DRV_SetRxIndividualMask(INST_FLEXCAN_CONFIG_1, MSG_TYPE_ID, MB_index , 0xFFFFFF8)

BR, 

Krishan

0 Kudos