Saturday, November 14, 2009

CAN BUS MESSAGE FRAMES - Error Frame




An error frame is generated by any node that detects a
bus error. An error frame, shown in Figure 2-4, consists
of two fields: an error flag field followed by an error
delimiter field. There are two types of error flag fields.
The type of error flag field sent depends upon the error
status of the node that detects and generates the error
flag field.


2.4.1 ACTIVE ERRORS
If an error-active node detects a bus error, the node
interrupts transmission of the current message by
generating an active error flag. The active error flag is
composed of six consecutive dominant bits. This bit
sequence actively violates the bit-stuffing rule. All other
stations recognize the resulting bit-stuffing error and, in
turn, generate error frames themselves, called error
echo flags.

The error flag field, therefore, consists of between six
and twelve consecutive dominant bits (generated by
one or more nodes). The error delimiter field (eight
recessive bits) completes the error frame. Upon
completion of the error frame, bus activity returns to
normal and the interrupted node attempts to resend the
aborted message.

2.4.2 PASSIVE ERRORS
If an error-passive node detects a bus error, the node
transmits an error-passive flag followed by the error
delimiter field. The error-passive flag consists of six
consecutive recessive bits. The error frame for an errorpassive
node consists of 14 recessive bits. From this it
follows that, unless the bus error is detected by an erroractive
node or the transmitting node, the message will
continue transmission because the error-passive flag
does not interfere with the bus.

If the transmitting node generates an error-passive flag,
it will cause other nodes to generate error frames due
to the resulting bit-stuffing violation. After transmission
of an error frame, an error-passive node must wait for
six consecutive recessive bits on the bus before
attempting to rejoin bus communications.
The error delimiter consists of eight recessive bits and
allows the bus nodes to restart bus communications
cleanly after an error has occurred.

http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf

Tuesday, November 10, 2009

CAN BUS MESSAGE FRAMES - Remote Frame



Normally, data transmission is performed on an
autonomous basis by the data source node (e.g., a
sensor sending out a data frame). It is possible,
however, for a destination node to request data from
the source. To accomplish this, the destination node
sends a remote frame with an identifier that matches
the identifier of the required data frame. The
appropriate data source node will then send a data
frame in response to the remote frame request.
There are two differences between a remote frame
(shown in Figure 2-3) and a data frame. First, the RTR
bit is at the recessive state and, second, there is no
data field. In the event of a data frame and a remote
frame with the same identifier being transmitted at the
same time, the data frame wins arbitration due to the
dominant RTR bit following the identifier. In this way,
the node that transmitted the remote frame receives
the desired data immediately.

http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf

Saturday, November 07, 2009

CAN BUS MESSAGE FRAMES - Extended Data Frame



In the extended CAN data frame, shown in Figure 2-2,
the SOF bit is followed by the arbitration field, which
consists of 32 bits. The first 11 bits are the Most
Significant bits (MSb) (Base-lD) of the 29-bit identifier.
These 11 bits are followed by the Substitute Remote
Request (SRR) bit, which is defined to be recessive.
The SRR bit is followed by the lDE bit, which is
recessive to denote an extended CAN frame.
It should be noted that if arbitration remains unresolved
after transmission of the first 11 bits of the identifier,
and one of the nodes involved in the arbitration is
sending a standard CAN frame (11-bit identifier), the
standard CAN frame will win arbitration due to the
assertion of a dominant lDE bit. Also, the SRR bit in an
extended CAN frame must be recessive to allow the
assertion of a dominant RTR bit by a node that is
sending a standard CAN remote frame.
The SRR and lDE bits are followed by the remaining
18 bits of the identifier (Extended lD) and the remote
transmission request bit.
To enable standard and extended frames to be sent
across a shared network, the 29-bit extended message
identifier is split into 11-bit (most significant) and 18-bit
(least significant) sections. This split ensures that the
lDE bit can remain at the same bit position in both the
standard and extended frames.
Following the arbitration field is the six-bit control field.
The first two bits of this field are reserved and must be
dominant. The remaining four bits of the control field
are the DLC, which specifies the number of data bytes
contained in the message.
The remaining portion of the frame (data field, CRC
field, acknowledge field, end-of-frame and intermission)
is constructed in the same way as a standard data
frame

http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf

Monday, November 02, 2009

CAN BUS MESSAGE FRAMES - Standard Data Frame

Standard Data Frame


The CAN standard data frame is shown in Figure 2-1.
As with all other frames, the frame begins with a Start-
Of-Frame (SOF) bit, which is of the dominant state and
allows hard synchronization of all nodes.
The SOF is followed by the arbitration field, consisting
of 12 bits: the 11-bit identifier and the Remote
Transmission Request (RTR) bit. The RTR bit is used
to distinguish a data frame (RTR bit dominant) from a
remote frame (RTR bit recessive).
Following the arbitration field is the control field,
consisting of six bits. The first bit of this field is the
Identifier Extension (IDE) bit, which must be dominant
to specify a standard frame. The following bit, Reserved
Bit Zero (RB0), is reserved and is defined as a dominant
bit by the CAN protocol. The remaining four bits of the
control field are the Data Length Code (DLC), which
specifies the number of bytes of data (0 – 8 bytes)
contained in the message.
After the control field is the data field, which contains
any data bytes that are being sent, and is of the length
defined by the DLC (0 – 8 bytes).
The Cyclic Redundancy Check (CRC) field follows the
data field and is used to detect transmission errors. The
CRC field consists of a 15-bit CRC sequence, followed
by the recessive CRC Delimiter bit.
The final field is the two-bit Acknowledge (ACK) field.
During the ACK Slot bit, the transmitting node sends
out a recessive bit. Any node that has received an
error-free frame acknowledges the correct reception of
the frame by sending back a dominant bit (regardless
of whether the node is configured to accept that
specific message or not). The recessive acknowledge
delimiter completes the acknowledge field and may not
be overwritten by a dominant bit.

http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf