You are here

Acceptance Filter Implementation in CAN Controller Receive message | Cypress Semiconductor

Acceptance Filter Implementation in CAN Controller Receive message

Summary: 3 Replies, Latest post by dboyette on 26 Jul 2016 07:33 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
SRAM's picture
Cypress Employee
50 posts

Question : PSoC3/5 CAN controller has 16 receive mailbox . Is it possible to group a set of similar Identifiers to one Mailbox and receive it? If yes , how do I do it ?

Answer : Yes, you   can group a set of similar identifiers and receive it in one mailbox.

Example Scenario: You want to receive messages whose identifier ends with 100h to 1FFh in Mailbox 0. This can be done by configuring the Acceptance filter of the CAN receive Mailbox.

The Acceptance filter configuration is the same for both the FULL and Basic CAN . There are 16 mailboxes. Once CAN message is received, it is compared with the acceptance filter of the mailboxes and the accepted message is stored in the corresponding mailbox. The acceptance filter is configured by the Acceptance Mask Register (AMR) and the Acceptance Code Register (ACR).  AMR defines whether the respective incoming bit is compared to the respective bit in the ACR. If a bit in the AMR is ‘0’, then the corresponding bit in the ACR is compared to the corresponding bit that is received. If the bit in AMR is ‘1’, then the corresponding bit in ACR is not compared to the bit that is received.

 A mailbox can be configured to receive message from a group of identifier by writing to the registers corresponding to the AMR and ACR filter of that mailbox. In PSoC3 implementation the AMR and ACR are 32 bit registers.  In case of a standard CAN, the Most Significant 11 bits of the AMR and ACR register store the filter values. In case of Extended CAN, the Most Significant 29 bits stores the filter values

 For example you want to receive messages with identifier from 100h to 1FFh in mailbox 0 , then AMR and ACR should be set as shown in the below picture . The following code has to be added in the program

/* Sets the AMR value for RX buffer 0 */

CAN_RXRegisterInit((uint32)CAN_CanIP__RX0_AMR, 0x1ffffff9);

      /* Sets the ACR value for RX buffer 0 */       

CAN_RXRegisterInit((uint32)CAN_CanIP__RX0_ACR, 0x20000000);

Attached is an example project implementing the same .



user_1128375's picture
35 posts

 I'm having a heck of a time piecing together the CAN interface.  From your post, it looks like you can set an acceptance filter on a basic mailbox.  Why would the GUI disable the ID field if you are still able to filter by the ID?

SRAM's picture
Cypress Employee
50 posts

 The Acceptance filter can be set for both Full and Basic CAN . You need to write to AMR and ACR registers in both the cases . The GUI will disable the ID ,RTR and IDE fields if you are using a Basic CAN. 

dboyette's picture
3 posts

How is this done on PSoC 4M? CAN_CanIP__RX0_AMR and CAN_CanIP__RX0_ACR are not defined in CAN.h!

Log in to post new comments.