Layers The CAN protocol, like many networking protocols, can be decomposed into the following
abstraction layers: ; Application layer • Application-specific logic ; Object layer • Message filtering (mailboxes) • Message and status handling ; Transfer layer Most of the CAN standard applies to the transfer layer. The transfer layer receives messages from the physical layer and transmits those messages to the object layer. The transfer layer is responsible for bit timing and synchronization, message framing, arbitration, acknowledgment, error detection and signaling, and fault confinement. It performs: • Fault confinement • Error detection • Message validation • Acknowledgement • Arbitration • Message framing • Transfer rate and timing • Information routing ; Physical layer CAN bus (
ISO 11898-1:2003) originally specified the
link layer protocol with only abstract requirements for the physical layer, e.g., asserting the use of a medium with multiple-access at the bit level through the use of dominant and recessive states. The electrical aspects of the physical layer (voltage, current, number of conductors) were specified in
ISO 11898-2:2003, which is now widely accepted. However, the mechanical aspects of the physical layer (connector type and number, colors, labels, pin-outs) have yet to be formally specified. As a result, an automotive ECU will typically have a particular—often custom—connector with various sorts of cables, of which two are the CAN bus lines. Nonetheless, several de facto standards for mechanical implementation have emerged, the most common being the
9-pin D-sub type male connector with the following pin-out: • pin 2: CAN-Low (CAN−) • pin 3: GND (ground) • pin 7: CAN-High (CAN+) • pin 9: CAN V+ (power) connector (plug) This
de facto mechanical standard for CAN could be implemented with the node having both male and female 9-pin D-sub connectors electrically wired to each other in parallel within the node. Bus power is fed to a node's male connector and the bus draws power from the node's female connector. This follows the electrical engineering convention that power sources are terminated at female connectors. Adoption of this standard avoids the need to fabricate custom splitters to connect two sets of bus wires to a single D connector at each node. Such nonstandard (custom) wire harnesses (splitters) that join conductors outside the node reduce bus reliability, eliminate cable interchangeability, reduce compatibility of wiring harnesses, and increase cost. The absence of a complete physical layer specification (mechanical in addition to electrical) freed the CAN bus specification from the constraints and complexity of physical implementation. However, it left CAN bus implementations open to interoperability issues due to mechanical incompatibility. In order to improve interoperability, many vehicle makers have generated specifications describing a set of allowed CAN transceivers in combination with requirements on the parasitic capacitance on the line. The allowed parasitic capacitance includes both capacitors as well as ESD protection (ESD against ISO 7637-3). In addition to parasitic capacitance, 12V and 24V systems do not have the same requirements in terms of line maximum voltage. Indeed, during jump start events light vehicle lines can go up to 24V while truck systems can go as high as 36V. New solutions are emerging, allowing the same component to be used for CAN as well as
CAN FD (see ). Noise immunity on
ISO 11898-2:2003 is achieved by maintaining the differential impedance of the bus at a low level with low-value resistors (120 ohms) at each end of the bus. However, when dormant, a low-impedance bus such as CAN draws more current (and power) than other voltage-based signaling buses. On CAN bus systems,
balanced line operation, where current in one signal line is exactly balanced by current in the opposite direction in the other signal provides an independent, stable 0V reference for the receivers. Best practice determines that CAN bus balanced pair signals be carried in
twisted pair wires in a shielded cable to minimize RF emission and reduce interference susceptibility in the already noisy RF environment of an automobile.
ISO 11898-2 provides some immunity to common mode voltage between transmitter and receiver by having a 0V rail running along the bus to maintain a high degree of voltage association between the nodes. Also, in the de facto mechanical configuration mentioned above, a supply rail is included to distribute power to each of the transceiver nodes. The design provides a common supply for all the transceivers. The actual voltage to be applied by the bus and which nodes apply to it are application-specific and not formally specified. Common practice node design provides each node with transceivers that are optically isolated from their node host and derive a 5V linearly regulated supply voltage for the transceivers from the universal supply rail provided by the bus. This usually allows operating margin on the supply rail sufficient to allow interoperability across many node types. Typical values of supply voltage on such networks are 7 to 30 V. However, the lack of a formal standard means that system designers are responsible for supply rail compatibility.
ISO 11898-2 describes the electrical implementation formed from a multi-dropped single-ended balanced line configuration with resistor termination at each end of the bus. In this configuration a dominant state is asserted by one or more transmitters switching the CAN− to supply 0V and (simultaneously) switching CAN+ to the +5V bus voltage thereby forming a current path through the resistors that terminate the bus. As such the terminating resistors form an essential component of the signaling system, and are included, not just to limit wave reflection at high frequency. During a recessive state, the signal lines and resistor(s) remain in a high-impedance state with respect to both rails. Voltages on both CAN+ and CAN− tend (weakly) towards a voltage midway between the rails. A recessive state is present on the bus only when none of the transmitters on the bus is asserting a dominant state. During a dominant state, the signal lines and resistor(s) move to a low-impedance state with respect to the rails so that current flows through the resistor. CAN+ voltage tends to +5V and CAN− tends to 0V. Irrespective of signal state the signal lines are always in a low-impedance state with respect to one another by virtue of the terminating resistors at the end of the bus. This signaling strategy differs significantly from other balanced line transmission technologies such as
RS-422/3,
RS-485, etc. which employ differential line drivers/ receivers and use a signaling system based on the differential mode voltage of the balanced line crossing a notional 0V. Multiple access on such systems normally relies on the media supporting three states (active high, active low and inactive tri-state) and is dealt with in the time domain. Multiple access on CAN bus is achieved by the electrical logic of the system supporting just two states that are conceptually analogous to a ‘wired AND’ network.
Physical organization CAN is a
multi-master serial bus standard for connecting electronic control units (ECUs) also known as nodes (
automotive electronics is a major application domain). Two or more nodes are required on the CAN bus to communicate. A node may interface to devices from simple digital logic e.g.
PLD, via
FPGA up to an embedded computer running extensive software. Such a computer may also be a gateway allowing a general-purpose computer (like a laptop) to communicate over a USB or Ethernet port to the devices on a CAN bus. All nodes are connected to each other through a physically conventional
two-wire bus. The wires are a twisted pair with a 120 Ω (nominal)
characteristic impedance. This bus uses
differential wired-AND signals. Two signals, CAN high (CANH) and CAN low (CANL) are either driven to a "dominant" state with CANH > CANL, or not driven and pulled by passive resistors to a "recessive" state with CANH ≤ CANL. A 0 data bit encodes a dominant state, while a 1 data bit encodes a recessive state, supporting a wired-AND convention, which gives nodes with lower ID numbers priority on the bus.
ISO 11898-2, also called
high-speed CAN (bit speeds up to 1Mbit/s on CAN, 5Mbit/s on CAN-FD), uses a linear bus terminated at each end with a 120 Ω resistor. High-speed CAN signaling drives the CANH wire towards 3.5 V and the CANL wire towards 1.5V when any device is transmitting a dominant (0), while if no device is transmitting a dominant, the terminating resistors passively return the two wires to the recessive (1) state with a nominal differential voltage of 0V. (Receivers consider any differential voltage of less than 0.5V to be recessive.) The dominant differential voltage is a nominal 2V. The dominant common mode voltage (CANH+CANL)/2 must be within 1.5 to 3.5V of common, while the recessive common mode voltage must be within ±12 of common.
ISO 11898-3, also called
low-speed or
fault-tolerant CAN (up to 125kbit/s), uses a linear bus, star bus or multiple star buses connected by a linear bus and is terminated at each node by a fraction of the overall termination resistance. The overall termination resistance should be close to, but not less than, 100Ω. Low-speed fault-tolerant CAN signaling operates similarly to high-speed CAN, but with larger voltage swings. The dominant state is transmitted by driving CANH towards the device power supply voltage (5V or 3.3V), and CANL towards 0V when transmitting a dominant (0), while the termination resistors pull the bus to a recessive state with CANH at 0V and CANL at 5V. This allows a simpler receiver that just considers the sign of CANH−CANL. Both wires must be able to handle −27 to +40V without damage.
Electrical properties With both high-speed and low-speed CAN, the speed of the transition is faster when a recessive-to-dominant transition occurs since the CAN wires are being actively driven. The speed of the dominant-to-recessive transition depends primarily on the length of the CAN network and the capacitance of the wire used. High-speed CAN is usually used in automotive and industrial applications where the bus runs from one end of the environment to the other. Fault-tolerant CAN is often used where groups of nodes need to be connected together. The specifications require the bus be kept within a minimum and maximum common mode bus voltage but do not define how to keep the bus within this range. The CAN bus must be terminated. The termination resistors are needed to suppress
reflections as well as return the bus to its recessive or idle state. High-speed CAN uses a 120 Ω resistor at each end of a linear bus. Low-speed CAN uses resistors at each node. Other types of terminations may be used such as the Terminating Bias Circuit defined in
ISO11783. A provides
power and ground in addition to the CAN signaling on a four-wire cable. This provides automatic
electrical bias and
termination at each end of each
bus segment. An ISO11783 network is designed for hot plug-in and removal of bus segments and ECUs.
Nodes Each node requires a •
Central processing unit, microprocessor, or host processor • The host processor decides what the received messages mean and what messages it wants to transmit. • Sensors, actuators and control devices can be connected to the host processor. • CAN controller- often an integral part of the microcontroller • Receiving: the CAN controller stores the received serial bits from the bus until an entire message is available, which can then be fetched by the host processor (usually by the CAN controller triggering an interrupt). • Sending: the host processor sends the transmit message(s) to a CAN controller, which transmits the bits serially onto the bus when the bus is free. •
Transceiver Defined by ISO 11898-2/3 Medium Access Unit [MAU] standards • Receiving: it converts the data stream from CAN bus levels to levels that the CAN controller uses. It usually has protective circuitry to protect the CAN controller. • Transmitting: it converts the data stream from the CAN controller to CAN bus levels. Each node is able to send and receive messages, but not simultaneously. A message or
Frame consists primarily of the ID (identifier), which represents the priority of the message, and up to eight data bytes. A CRC, acknowledge slot [ACK] and other overhead are also part of the message. The improved CAN FD extends the length of the data section to up to 64 bytes per frame. The message is transmitted serially onto the bus using a
non-return-to-zero (NRZ) format and may be received by all nodes. The devices that are connected by a CAN network are typically
sensors,
actuators, and other control devices. These devices are connected to the bus through a
host processor, a CAN controller, and a CAN transceiver. == Data transmission & arbitration ==