Datasheet
Copyright © 2013 ARM Ltd. All rights reserved
CAN: Controller Area Network Lab using ST STM32 Cortex-M processors. www.keil.com
3
Main Features of CAN:
For the purposes of this article; we will assume a CAN network consists of the physical layer (the voltages and the wires), a
frame consisting of an ID and a varying number of data bytes all with the following general attributes:
1. 11 or 29 bit ID and from zero to 8 data bytes. TIP: These attributes can be dynamically changed “on the fly”.
2. Peer to Peer network. Every node can see all messages from all other nodes but it normally can’t see its own.
3. Nodes are really easy to add. Just attach one to the network with two wires plus a ground.
4. Higher priority messages are sent first depending on the value of the ID. The lower ID has a higher priority.
5. Automatic retransmission of defective frames. A node will “bus-off” if it causes too many errors.
6. Speeds from approximately 10 Kbps to 1 Mbps. TIP: All nodes must operate at the same frequency.
7. The twisted differential pair provides excellent noise immunity and some decent bus fault protection.
8. The CAN system will work with the ground connection at different DC levels. TIP: Or no ground at all.
The Ground:
This is a contentious issue. A CAN system, especially in vehicles, sometimes must endure large ground loops or corrosion
that can compromise signal integrity. CAN is designed using its differential pair to ignore ground voltage differences of
many volts. The differential pair also cancels out incoming common mode interference and cancels potential outgoing EMI.
This means that if the ground wire is cut or doesn’t exist, as long as CAN-Hi and CAN-Lo are intact, the system will perform
at high performance capabilities. CAN, depending on the transceiver chip, can handle various bus problems such as open or
shorted lines. This capability is lost without the ground. Therefore, it is recommended to always include a ground in your
system design. If the ground is made through a chassis connection or negative power supply rail, any shielded CAN cables
must have the ground connected at one end only to minimize ground loop problems.
The CAN System Layout:
A CAN network consists of at least two nodes connected together with a twisted pair of wires as shown below. A ground
wire can be included with the twisted pair or separately as part of the chassis. One twist per inch (or more) will suffice and
the integrity of the ground is not important for normal operation as described above. As in any differential systems; the
important signal is the voltage levels between the wire pair and not their values to ground or a voltage supply.
The maximum length of the network is dependent on the frequency, number of nodes and propagation speed of the wire. It is
relatively easy to have a 20 node (or more), 500 Kbps system running 30 or 40 feet (or more).
TIP: The drops should be less than 3 feet and randomly spaced to reduce standing waves. These issues all become more
important at higher bus speeds i.e. 500Kbps and higher. CAN is completely described in ISO 11898.
Since the twisted pair is a transmission line, 120 ohm termination resistors are needed at both ends of the backbone. Do not
put any resistors at the nodes unless a node is at the end of the backbone. Sometimes the resistors are not at the end of a
backbone but very close and this seems to work. Resistors are often installed inside an end node chassis or module.
TIP: Your total resistance value as measured between the two twisted wires will therefore be 60 ohms. 10% is good enough.
CAN is a broadcast system. Any node can “broadcast” a message using a CAN frame on a bus that is in idle mode. Idle is at
least 11 successive recessive bit times (“1” or ~0 volts CAN Hi to CAN Lo). Multiple controllers tend to start their messages
at the same time. Every node will see this message. A “message” can be considered the same as a CAN frame until you need
to use more than one frame to send a long message. In this case, you would use some sort of a multi-packet protocol.
TIP: It is up to a receiving node if it must keep or ignore a frame. This can be handled in either your processor software
and/or by configuring the CAN controller acceptance filters.
Node 1 Node 3 Node 6 Node 5 Node 4 Node 2
a b
a,b = 120 Ω ½ watt termination resistors. Drops use the same twisted pair of wires as the backbone.
drops
The main CAN backbone and dro
p
s are com
p
rised of a twisted
p
air of wires.