2 Replies Latest reply on Jul 14, 2015 11:22 PM by reshmir_26

    CAN Acceptance Filtering with Basic Mailbox


      I'm having a really hard time to set CAN AMR and ACR register to make acceptance filtering work.

      Maybe it's the setting of those registers that I don't do corretly, maybe it'S the sending or even de receiving of a CAN message.

      So here are the important part for it and how I'm trying to make it work.


      This exemple is to accept message from a range of 0x10 to 0x1F


      How I set AMR and ACR, this is something I saw somewhere on the internet and it make sense to me:



      uint32 rxAMR = 0x00F << 20;
      uint32 rxACR = 0x010 << 20;
      uint8 i;

      CAN_RX_CFG.rxmailbox = 1;
      CAN_RX_CFG.rxamr = 0x01FFFFFF9;
      CAN_RX_CFG.rxacr = 0x02000000;




      And this is how I send a message


      uint8 TX_Msg[DATALENGTH] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
      int i;

      CAN_TX_MSG CAN_Msg;
      CAN_Msg.id  = 11;
      CAN_Msg.rtr = 0;
      CAN_Msg.ide = 0;
      CAN_Msg.dlc = DATALENGTH;
      CAN_Msg.irq = 1;
      CAN_Msg.msg = &Data;

      for(i=0u; i<DATALENGTH; i++)


      Data.byte[i] = TX_Msg[i];







      The transmitting and receiving works great. The problem appears when I set the ID to an ID that it shouldn't accepts, like 33, the message is stille received. Is there some code I need to write at the receiving or this is all build-in?

      Also, do I need to set the ACR and AMR register for all the mailboxes? All my mailboxes are set to basic.

      Thank you in advance for your great advices!