AnsweredAssumed Answered

Flexcan Acceptance filter mechanism

Question asked by Steffen Rose on Sep 23, 2014
Latest reply on Sep 24, 2014 by Steffen Rose

I use the K60 Flexcan to receive CAN messages. I use the RX Fifo. RFFN is set to 3, MB0..13 are part of the RX Fifo.

I can set the Filters to receive all messages. This works.

 

Now I want to use the filter mecahnism. I want to use the ID Filter table Format B. Individual filter are activated.

 

My problem:

All messages are receiving. Filterhit is 1.

 

I do not find detail information in case I use the Format B ID Table.

 

Which ID Filter works with which Indiviual mask?

Which entrie (combination) receive my messages and set the filterhit to 1.

 

My test setting (later I want to receive only specific IDs):

 

/* compare all mask bits */

    pCan->CTRL2 |= FLEXCAN_CTRL2_EACEN;

    /* store RTR frames */

    pCan->CTRL2 |= FLEXCAN_CTRL2_RRS;

    /* Set Scan priority (RX Fifo first) */

    pCan->CTRL2 &= ~FLEXCAN_CTRL2_MRP;

 

    /* RX Fifo */

    pCan->MCR |= FLEXCAN_MCR_FEN;

 

     // RFFN is 3

     pCan->CTRL2 = (pCan->CTRL2 & ~FLEXCAN_CTRL2_RFFN )

             | (FLEXCAN_RFFN_VAL << FLEXCAN_CTRL2_RFFN_BIT_NO);

 

    /* Set ID filter table format (RX Fifo mask - Format B / 01 ) */

    pCan->MCR = (pCan->MCR & ~FLEXCAN_MCR_IDAM_MASK) |  FLEXCAN_MCR_IDAM(1);

 

/* Initialize mask registers - not relevant, I think */

    pCan->RXMGMASK = 0x1FFFFFFFul;

    pCan->RX14MASK = 0x1FFFFFFFul;

    pCan->RX15MASK = 0x1FFFFFFFul;

 

//Test setting

// first should only receive, if bit 0 is set

// second only, if Bit1 is set

// next Bit 2 is set

// and so on

// the higher ID (RXIDB_0) should only receive 0x7FF - ignored for this test

for(i = 0; i <= 13 ; i++)
    {
   pCan->RXIMR[i] = 0xFFFF0000ul | (1ul<<i);// individual masks

    }

    for(i = 0; i < (14-6)*4 ; i++)

    {

   FLEXCAN1_IDFLT_TAB(i) = 0x07FF07FFul;

    }

 

    pCan->RXFGMASK = 0xFFFFFFFFul; //mask for all other IDs

Attachments

Outcomes