CAN Bus Protocol - Page 2
Physical Medium (Wiring, Connectors, Devices etc.)
Do I need expensive cabling?
In standard industrial environments, the CAN Bus can use standard cabling without shielding or twisted-pair wiring. If very low EMI is required, a twisted-pair cable is recommended. However, this will normally not be required in most applications
Key Points:
- The maximum CAN bus length is 1 kilometer at 50k bps
- The bus line should be as close as possible to a straight line to keep reflections to a minimum.
- To extend the cable length (or to provide galvanic isolation) a bridge-device or repeater can be used.
- If a cable stub (un-terminated cable) or T-connector is used to tap into the bus line, then the stub distance should not exceed 0.3m at 1M bps.
Connectors and cabling:
A twisted-pair cable is widely used with RJ45 or DB9 connectors.
CAN Protocol Framing
CAN works with two different messages formats:
- Standard or base frame format (11 bit identifier)
- Extended frame format (29 bit identifier)
The only difference between Standard and Extended are the number of bits for the identifiers All frames begin with a start-of-frame (SOF) bit that denotes the start of the frame transmission.
CAN has four frame types:
- Data frame: a frame containing node data for transmission
- Remote frame: a frame requesting the transmission of a specific identifier
- Error frame: a frame transmitted by any node detecting an error
- Overload frame: a frame to inject a delay between data or remote frame
Fig1: CAN bus Base Format
CAN Advantages and Disadvantages
Advantages:
- Multi-master - All nodes can transmit and receive messages
- Automatic prioritization of messages - Based on message identifier
- Automatic arbitration - Based on message identifier
- High reliability - Achieved through built-in error checking
- Robust - High performance, even in difficult electrical environments
- Configuration flexibility - Nodes can be added to and removed from the bus without modifying other nodes
- Many nodes can be connected on the same bus - CAN 2.0B defines identifiers as 29 bits, providing over 500,000 unique codes
- Buses can be very long - On the order of miles and kilometers
- Low cost
Disadvantages:
- Low-bandwidth - CAN supports a maximum data rate of 1 Mbps. This is not good for high-bandwidth applications
- Small data transfers - data frames can only carry 8 bytes, so CAN is not good for large data transfers
- Protocol overhead - The CAN protocol has a moderate amount of overhead (strict message formatting, CRC checking, bit-stuffing, etc.) and is more complicated than other protocols such as I2C and SPI
- CAN is more geared to using devices that share a low amount of data.
CAN Hardware and Security
There are special software and hardware tools available to work with CAN devices. A basic Logic analyzer serves majority of the requirement. In advance application scenarios there are versatile hardware tools available serve the purposes like CAN BUS analyzer from MicroChip (as shown in the image above). Extensive software support is also available from different corresponding IC manufacturers for development, testing and commissioning.
How Secure is CAN?
CAN is a low-level protocol and does not support any security features intrinsically. There is also no encryption in standard CAN implementations, which leaves these networks open to man-in-the-middle packet interception. In most implementations, applications are expected to deploy their own security mechanisms; e.g., to authenticate incoming commands or the presence of certain devices on the network. Failure to implement adequate security measures may result in various sorts of attacks if the opponent manages to insert messages on the bus. While passwords exist for some safety-critical functions, such as modifying firmware, programming keys, or controlling antilock brake actuators, these systems are not implemented universally and have a limited number of seed/key pairs.
Related CAN Bus Links:
- https://en.wikipedia.org/wiki/CAN_bus
- https://www.csselectronics.com/screen/page/simple-intro-to-can-bus/language/en
- http://www.ni.com/white-paper/2732/en/
- http://www.ti.com/lit/an/sloa101b/sloa101b.pdf
- https://www.elprocus.com/controller-area-network-can/
- https://www.can-cia.org/can-knowledge/
- https://www.totalphase.com/support/articles/200472276-CAN-Background
- https://pubweb.eng.utah.edu/~cs5785/slides-f10/18-1up.pdf
- http://www.microchip.com/stellent/groups/SiteComm_sg/documents/DeviceDoc/en558265.pdf
- http://copperhilltech.com/content/CAN-Bus.pdf
- http://www.esd-electronics-usa.com/CAN-Bus-Troubleshooting-Guide.html
- http://www.libelium.com/downloads/documentation/canbus_communication_guide.pdf