beautypg.com

8 how to use can controller, How to use can controller – FUJITSU F2MCTM-16LX User Manual

Page 510

background image

494

CHAPTER 21 CAN CONTROLLER

21.8

How to Use CAN Controller

The following settings are required to use the CAN controller;
• Bit timing
• Frame format
• ID
• Acceptance filter
• Low-power consumption mode

Setting Bit Timing

The bit timing register (BTR) should be set during bus operation stop (when the bus operation stop bit

(HALT) of the control status register (CSR) is 1).

After the setting completion, write 0 to HALT to cancel bus operation stop.

Setting Frame Format

Set the frame format used by the message buffer (x). When using the standard frame format, set IDEx of

the IDE register (IDER) to 0. When using the extended frame format, set IDEx to 1.

This setting should be made when the message buffer (x) is invalid (BVALx of the message buffer valid

register (BVALR) is 0). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received

messages to be stored.

Setting ID

Set the message buffer (x) ID to ID28 to ID0 of ID register (IDRx). The message buffer (x) ID need not be

set to ID11 to ID0 in the standard frame format. The message buffer (x) ID is used as a transmission

message at transmission and is used as an acceptance code at reception.

This setting should be made when the message buffer (x) is invalid (BVALx of the message buffer valid

register (BVALR) is 0). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received

messages to be stored.

Setting Acceptance Filter

The acceptance filter of the message buffer (x) is set by an acceptance code and acceptance mask set. It

should be set when the acceptance message buffer (x) is invalid (BVALx of the message buffer enable

register (BVALR) is 0). Setting when the buffer is valid (BVALx = 1) may cause unnecessary received

messages to be stored.

Set the acceptance mask used in each message buffer (x) by the acceptance mask select register (AMSR).

The acceptance mask registers (AMR0 and AMR1) should also be set if used (For the setting details, see

"21.4.21 Acceptance Mask Select Register (AMSR)" and "21.4.22 Acceptance Mask Registers 0 and 1

(AMR0 and AMR1)").

The acceptance mask should be set so that a transmission request may not be canceled when unnecessary

received messages are stored. For example, it should be set to a full-bit comparison if only one specific ID

is used for the transmission.