Can controller operation, 1 error handling, 2 sleep mode – NXP Semiconductors LPC24XX UM10237 User Manual

Page 494: Nxp semiconductors

Advertising
background image

UM10237_4

© NXP B.V. 2009. All rights reserved.

User manual

Rev. 04 — 26 August 2009

494 of 792

NXP Semiconductors

UM10237

Chapter 18: LPC24XX CAN controllers CAN1/2

8.16 Transmit Data Register B (CAN1TDB[1/2/3] - 0xE004 40[3C/4C/5C],

CAN2TDB[1/2/3] - 0xE004 80[3C/4C/5C])

When the corresponding TBS bit in CANSR is 1, software can write to one of these
registers to define the 5th through 8th data bytes of the next transmit message. The Data
Length Code defines the number of transferred data bytes. The first bit transmitted is the
most significant bit of TX Data Byte 1.

9.

CAN controller operation

9.1 Error handling

The CAN Controllers count and handle transmit and receive errors as specified in CAN
Spec 2.0B. The Transmit and Receive Error Counters are incriminated for each detected
error and are decremented when operation is error-free. If the Transmit Error counter
contains 255 and another error occurs, the CAN Controller is forced into a state called
Bus-Off. In this state, the following register bits are set: BS in CANxSR, BEI and EI in
CANxIR if these are enabled, and RM in CANxMOD. RM resets and disables much of the
CAN Controller. Also at this time the Transmit Error Counter is set to 127 and the Receive
Error Counter is cleared. Software must next clear the RM bit. Thereafter the Transmit
Error Counter will count down 128 occurrences of the Bus Free condition (11 consecutive
recessive bits). Software can monitor this countdown by reading the Tx Error Counter.
When this countdown is complete, the CAN Controller clears BS and ES in CANxSR, and
sets EI in CANxSR if EIE in IER is 1.

The Tx and Rx error counters can be written if RM in CANxMOD is 1. Writing 255 to the
Tx Error Counter forces the CAN Controller to Bus-Off state. If Bus-Off (BS in CANxSR) is
1, writing any value 0 through 254 to the Tx Error Counter clears Bus-Off. When software
clears RM in CANxMOD thereafter, only one Bus Free condition (11 consecutive
recessive bits) is needed before operation resumes.

9.2 Sleep mode

The CAN Controller will enter sleep mode if the SM bit in the CAN Mode register is 1, no
CAN interrupt is pending, and there is no activity on the CAN bus. Software can only set
SM when RM in the CAN Mode register is 0; it can also set the WUIE bit in the CAN
Interrupt Enable register to enable an interrupt on any wake-up condition.

Table 437. Transmit Data Register B (CAN1TDB[1/2/3] - address 0xE004 40[3C/4C/5C],

CAN2TDB[1/2/3] - address 0xE004 80[3C/4C/5C]) bit description

Bit

Symbol Function

Reset
Value

RM
Set

7:0

Data 5

If RTR = 0 and DLC

0101 in the corresponding CANTFI, this

byte is sent as the 5th Data byte of the next transmit message.

0

X

15;8

Data 6

If RTR = 0 and DLC

0110 in the corresponding CANTFI, this

byte is sent as the 6th Data byte of the next transmit message.

0

X

23:16 Data 7

If RTR = 0 and DLC

0111 in the corresponding CANTFI, this

byte is sent as the 7th Data byte of the next transmit message.

0

X

31:24 Data 8

If RTR = 0 and DLC

1000 in the corresponding CANTFI, this

byte is sent as the 8th Data byte of the next transmit message.

0

X

Advertising