Skip to main content
270284440
Associate II
Feb 17, 2015 2:46 PM UTC
Solved

How CAN Filter Work on Pictus

Posted on February 17, 2015 at 15:46

I am testing CAN filtering Function on SPC560P,But am not clear about how CAN Mask working.

Configure as following:

Rx ID =0, Rx Individual Mask = 0xFFFFFF8; BCC = 1; From my understanding, then the CAN Node can Receive ID from 0  to 7, but cannot , only still can receive ID = 0; stop at

BUF00 Rx Flag checked;

But , when I set Rx Individual Mask = 0; all CAN ID can be received (stop at BUF00 Rx Flag checked);

So, How the CAN ID Mask Working?

-----------------

 CAN_0.RXIMR[0].R = 0xFFFFFFF8; /*Rx Individual Mask*/

  CAN_0.BUF[0].ID.B.STD_ID = 0x0; /*Rx ID = 0*/

/*Check ID Receive*/

  if(1== CAN_0.IFRL.B.BUF00I){

   CAN_0.IFRL.B.BUF00I = 1;

    // rx completed

   

  }

 
    This topic has been closed for replies.
    Erwan YVIN
    Erwan YVINBest answer
    ST Technical Moderator
    Feb 24, 2015 3:30 PM UTC
    Posted on February 24, 2015 at 16:30

    Hello Chu ,

    Rx ID =0, Rx Individual Mask = 0xFFFFFF8; BCC = 1 Rx Individual Mask is used for acceptance for ID Filtering and the FIFO

    Mask Bits

    For normal Rx MBs, the mask bits affect the ID filter programmed on the MB. For the Rx FIFO,the mask bits affect all bits programmed in the filter table (ID, IDE, RTR).0 The corresponding bit in the filter is “don’t care.�?1 The corresponding bit in the filter is checked against the one received. I do not think that for STD_ID=0, RXIMR is useful with mask system you should use a STD_ID different of 0. do you use the interrupt handler to retrieve the CAN Data ?

    /*
    * @brief interrupt handler.
    *
    * @isr
    */
    OSAL_IRQ_HANDLER(vector88) {
    OSAL_IRQ_PROLOGUE();
    // .. your handler ...
    OSAL_IRQ_EPILOGUE();
    }

    Best regards Erwan
    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.

    1 reply

    Erwan YVIN
    Erwan YVINBest answer
    ST Technical Moderator
    Feb 24, 2015 3:30 PM UTC
    Posted on February 24, 2015 at 16:30

    Hello Chu ,

    Rx ID =0, Rx Individual Mask = 0xFFFFFF8; BCC = 1 Rx Individual Mask is used for acceptance for ID Filtering and the FIFO

    Mask Bits

    For normal Rx MBs, the mask bits affect the ID filter programmed on the MB. For the Rx FIFO,the mask bits affect all bits programmed in the filter table (ID, IDE, RTR).0 The corresponding bit in the filter is “don’t care.�?1 The corresponding bit in the filter is checked against the one received. I do not think that for STD_ID=0, RXIMR is useful with mask system you should use a STD_ID different of 0. do you use the interrupt handler to retrieve the CAN Data ?

    /*
    * @brief interrupt handler.
    *
    * @isr
    */
    OSAL_IRQ_HANDLER(vector88) {
    OSAL_IRQ_PROLOGUE();
    // .. your handler ...
    OSAL_IRQ_EPILOGUE();
    }

    Best regards Erwan
    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.