28
8.3.12 Getting Status Flags
User can use the command F[CR] to get the status bits when an error occurs. A two-
byte BCD number is returned to correspond to the 8-bits of the internal register of the
CAN controller.
Return Codes
XX[CR]
XX = CAN bus status (A bit set to “1” indicates a true condition):
Bits 2, 1, 0: Last Error Code(LEC), The LEC field holds a code, which indicates the type
of the last error to occur on the CAN bus.
No error.
Stuff error: more than 5 equal bits in a sequence have occurred in a
part of a received message where this is not allowed.
Form error: a fixed format part of a received frame has the wrong
format.
ACK Error: the message this CAN core transmitted was not
acknowledged by another node.
Error Code 4
1, 0, 0
Bit 1 error: during the transmission of a message (with the exception
of the arbitration field), the device wanted to send a recessive level
(bit of logical value “1”), but the monitored bus value was dominant.
Error Code 5
1, 0, 1
Bit 0 error: Bit 1 error: during the transmission of a message (or
acknowledged bit, or active error flag, or overload flag), the device
wanted to send a dominant level (bit of logical value “0”), but the
monitored bus value was recessive.
During the bus-off recovery, this status is set each time a sequence
of 11 recessive bits have been monitored. This enables the CPU to
monitor the proceedings of the bus-
off recovery sequence
(indicating the bus is not stuck at dominant or continuously
disturbed).
Error Code 6
1, 1, 0
CRC error: the CRC checksum was incorrect in the message received,
the CRC received for an incoming message does not match with the
calculated CRC for the received data.
Unused: no CAN bus event was detected since the CPU wrote this
value to the LEC.