User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 571
UG585 (v1.11) September 27, 2016
Chapter 18: CAN Controller
The user must ensure proper programming of the IDE bit for standard and extended frames. If the
user sets the IDE bit in AMIR to 0, then it is considered to be a standard frame ID check only.
Example: Program Acceptance Filter
Each acceptance filter has its own mask, can.AFMR{1,2,3,4}, and ID register, can.AFIR{1,2,3,4}.
1. Disable acceptance filters. Write 0 to the can.AFR register.
2. Wait for filter to be not busy. Poll on can.SR[ACFBSY] for 0.
3. Write a filter mask and ID. Write to a pair of AFMR and AFIR registers (refer to the example
below).
4. Write additional filter masks and IDs. Go to step 2.
5. Enable one or more Filters. To enable all filters, write 0x0000_000F to the can.AFR register.
Program the AFMR and AFIR Registers
The valid fields for sending Tx messages to the controller are summarized in Table 18-5. These fields
are described in section 18.2.2 Message Format.
In the AFMR mask register, enable (unmask) the compare functions for each field for the incoming Rx
CAN message by writing a 1 to the bit field. In the AFIR register, write the values that are to be
compared to the in-coming Tx CAN message.
Example: Program the AFMR and AFIR for Standard Frames
This example sets up the acceptance filter for standard frames. The frame ID number is shown to be
0x5DF, but could be set to desired value for the application.
1. Configure filter mask for standard frames. Write 0xFFF8_0000 to the can.AFMR register:
a. Enable the compare for the standard message ID, [AMIDE] = 1.
b. Compare all bits in the standard message ID, [AMIDH] = 0x7FF.
c. Enable the compare for substitute remote transmission request, [AMSRR] = 1.
d. Zero-out the extended frame bits, [AMIDL, AMRTR] = 0.
2. Configure filter ID for standard frames. Write 0xABC0_0000 to the can.AFIR register:
a. Select the standard frame message mode, [AIIDE] = 0.
b. Program the standard message ID, [AIIDH] = 0x55E.
c. Disable substitute remote transmission request, [AISRR] = 0.
d. Zero-out extended frame bits, [AIIDL, AIRTR] = 0.
Table 18-5: CAN Message Identifier Register (IDR) Fields
ID[28:18] STR/RTR IDE ID[17:0] RTR
Standard
Frame
Valid Valid Valid Ignored Ignored
Extended
Frame
Valid Valid Valid Valid Valid