139
www.national.com
CP3
BT26
19.10.15 CAN Error Counter Register (CANEC)
The CANEC register reports the values of the CAN Receive
Error Counter and the CAN Transmit Error Counter.
REC
The CAN Receive Error Counter field reports
the value of the receive error counter.
TEC
The CAN Transmit Error Counter field reports
the value of the transmit error counter.
19.10.16 CAN Error Diagnostic Register (CEDIAG)
The CEDIAG register reports information about the last de-
tected error. The CAN module identifies the field within the
CAN frame format in which the error occurred, and it identi-
fies the bit number of the erroneous bit within the frame
field. The CPU bus master has read-only access to this reg-
ister, and all bits are cleared on reset.
EFID
The Error Field Identifier field identifies the
frame field in which the last error occurred.
The encoding of the frame fields is shown in
Table 63.
EBID
The Error Bit Identifier field reports the bit po-
sition of the incorrect bit within the erroneous
frame field. The bit number starts with the val-
ue equal to the respective frame field length
minus one at the beginning of each field and
is decremented with each CAN bit. Figure 63
shows an example on how the EBID is calcu-
lated.
Figure 63.
EBID Example
For example, assume the EFID field shows
1110b and the EBID field shows 111001b.
This means the faulty field was the data field.
To calculate the bit position of the error, the
DLC of the message needs to be known. For
example, for a DLC of 8 data bytes, the bit
counter starts with the value: (8 × 8) - 1 = 63;
so when EBID[5:0] = 111001b = 57, then the
bit number was 63 - 57 = 6.
TXE
The Transmit Error bit indicates whether the
CAN module was an active transmitter at the
time the error occurred.
0 – The CAN module was a receiver at the
time the error occurred.
1 – The CAN module was an active transmit-
ter at the time the error occurred.
STUFF
The Stuff Error bit indicates whether the bit
stuffing rule was violated at the time the error
occurred. Note that certain bit fields do not
use bit stuffing and therefore this bit may be
ignored for those fields.
0 – No bit stuffing error.
1 – The bit stuffing rule was violated at the
time the error occurred.
CRC
The CRC Error bit indicates whether the CRC
is invalid. This bit should only be checked if
the EFID field shows the code of the ACK
field.
0 – No CRC error occurred.
1 – CRC error occurred.
MON
The Monitor bit shows the bus value on the
CANRX pin as sampled by the CAN module at
the time of the error.
15
8
7
0
REC
TEC
0
R
15
14
13
12
11
10
9
4 3
0
Res. DRIVE MON CRC STUFF TXE
EBID
EFID
0
R
Table 63
Error Field Identifier
EFID3:0
Field
0000
ERROR
0001
ERROR DEL
0010
ERROR ECHO
0011
BUS IDLE
0100
ACK
0101
EOF
0110
INTERMISSION
0111
SUSPEND
TRANSMISSION
1000
SOF
1001
ARBITRATION
1010
IDE
1011
EXTENDED
ARBITRATION
1100
R1/R0
1101
DLC
1110
DATA
1111
CRC
Table 63
Error Field Identifier
EFID3:0
Field
Data Field
Incorrect
Bit
r
r
r
r
r
r
DS047