A general introduction to the Controller Area Network. When you have large system that comprises of subsystems and these subsystems happen to be micro controllers, one of the simpler networking stacks that exist is CAN and CAN bus.

Introduction

The CAN protocol was developed in the late 1980s by Bosch, it is a multi master serial communication bus. Designed for high speed with capability to operate in high noise environments such as Automotive systems. Classic CAN can operate with speeds up to 1Mbps, where CANFD can operate with speeds up to 8Mbps. CAN also comes with Error confinement and detection which makes it highly reliable.

Advantages of using CAN

  • Low cost, the protocol, physical interface and protocol are all low cost.
  • Functional addressing, rather than source and destination addresses CAN messages contain an identifier to indicate function and priority. Making CAN a broadcast message system.
  • Auto retransmission of faulty messages.
  • Auto detection and disconnection of physically faulty nodes.
  • With speeds of up to 1Mbps and 8Mbps it is considered fast.
  • Reliable and Robust.

CAN links all nodes on a bus and enables them to communicate with each other, the bus may or may not have a central controlling node.

CAN Network

CAN Nodes

A CAN node is a collection of items.

  1. A CPU that has the messages it is sending and identifiers it is listening for.
  2. A CAN controller can be internal to the CPU or can be added to the CPU.
  3. A CAN transceiver that can also be internal to the CPU or added.

A CAN controller will expose 2 single ended output CAN_TX and CAN_RX these will hooked up to a CAN transceiver. The transceiver’s function into construct differential signals that are used to communicate with other node on a CAN bus.

N/B: These differential signals that are generated by the transceiver aid many of CANs best features such as noise immunity and range.

CAN Bus

These is a pair of connection lines, one for CAN_H and another for CAN_L that are resistor terminated at both ends. Any node that whats to participate in this line’s communication can have its transceivers H and L signals hooked up to these lines.

Single Ended vs Differential Signals

Single Ended: This kind of signal involves one active wire (signal) and a reference wire (ground), the voltage in the signal line varies with respect to ground. These variations carry the information. Consider a GPIO signal.

Differential: Contrary to the single ended signal a differential signal comprises of two complementary lines. Each carrying the same signal but with opposite polarities. The information is conveyed by the difference between these two lines. Consider CAN signals, RS232, PCIe signals as examples.

CAN Signalling.

  • CAN signalling is differential, this aids in robustness and noise immunity.
  • Balanced (current in lines is equal but travelling in opposite directions) differential signaling allows reduction of noise coupled with high data rates.
  • CAN cable can be shielded or unshielded and is specified as a twisted pair, with the bus terminated by resistors on both ends.
  • CAN standard is now maintained by ISO 11898.

Welcome to Industrial Automation.


<
Previous Post
To Stack or To heap FreeRTOS Allocation
>
Next Post
Demystifying Bluetooth Low Energy with Zephyr