Controller Area Network

Controller Area Network (CAN) bus is a serial communication bus, originally developed for automotive purposes. It was developed by Robert Bosch Gmbh in 1983. As the name suggests, this two-wire, half duplex bus is used for the communication between different microcontroller units and other peripherals without the presence of host system. This multi-master bus uses short messages which are used in high speed applications.

Bosch has come up with the CAN standard version 2.0 specification.  This specification is further divided in to two subdivisions, that is, Standard CAN and Extended CAN. The Standard CAN comes with 11-bit identifiers and signals at rate of 125kbps to 1mbps whereas the Extended CAN uses 29-bit identifiers.

Standard CAN

The message frame of standard CAN consists of different fields.

  • SOF – This dominant bit is known as the Start Of Frame bit and indicates the beginning of a message and this bit helps in synchronization of the nodes that is being connected to the bus and is initially idle.
  • Identifier – This 11-bit identifier determines the priority of the message. Keeping the numerical value low, the priority of the message is greater.
  • RTR – Remote Transmission Request bit determines whether it’s a data frame or remote frame. If the value is a dominant bit ( logic 0 ), then it is a data frame. Otherwise, it is a remote frame, where the node request for a data and some other node come with data.
  • IDE – Identifier Extension bit is a single dominant bit which indicates a CAN identifier is transmitted without extension.
  • r0 – This bit is reserved for future purpose.
  • DLC – Data Length Code is a 4-bit code which specifies the amount of data submitted in terms of bytes.
  • Next zero to eight bytes is the data field with application data.
  • CRC – The 16-bit consists of 15-bit Cyclic Redundancy Check bits for error detection plus a delimiter bit.
  • ACK – This 2 bit with an Acknowledgement bit plus recessive delimiter bit is said to acknowledge the message that is being send from one node to the other. When the receiver obtains the accurate message, then the receiver has to replace the upper bit to the dominant bit indicating a successful message transmission. Else keep the logic high as such and the receiver discard the message and transmitting node retransmits the message according to arbitration.
  • EOF – This End Of Frame, 7 bit field indicates end of the message frame. These 7 bits are usually recessive and in case it has dominant bits it indicates bit stuffing.
  • IFS – InterFrame Space is a 7-bit space, indicates the time that the controller has to move the received frame to message buffer area correctly.

 

Extended CAN

The Extended CAN has 29-bit identifier which consists of 11-bit identifier followed by SRR, IDE bits and another 18-bit identifier. This extended CAN is very much used in automotive industry. The SRR bit is the Substitute Remote Request, which in case of, standard data frame and extended data frame, when both messages have equal base identifier, then standard data frame has higher priority and hence it indicates the bit is always a recessive bit.

CAN Bus Working

CAN uses Carrier Sense Multiple Access\Collision Detection with Arbitration on Message Priority (CSMA/CD+AMP) for transmission of messages. Initially, the nodes check whether the bus is busy or not along with collision detection. But, on detection of collision the nodes does not stop from sending messages rather it does a special arbitration scheme. The messages send via CAN bus does not contain any addresses of the transmitting or receiving nodes. The message consists of unique identifier bits and as it moves through the bus, each node works out a test to check whether the message belongs to it, if so it processes it or else it just ignores the message.

The identifier bits determine the priority of the message. Lower the numerical value, the priority is higher. The message with higher priority accesses the bus readily and those with lower priority access the bus in the next cycles depending on the presence of high priority messages. The messages begin with identifier bits which can be either 11-bits or 29-bits depending upon the version. The contents in the message can be either low or high. Basically, the dominant bits are the logic low bits, so when message is transferred from one node to other, the node sending low bits will get access to the bus rather than the nodes sending high bits. In the network, two messages with same ID can’t be sent by the two nodes. In this case, arbitration gets cancelled.

The two kinds of frames in CAN bus is Data Frame and Remote Frame. In case of transmission of data, data frames are used. Remote frames are meant for requesting of information. A set RTR bit indicates that the node that is transmitting, is requesting for information. If any of the receiving nodes has the information should make it available to the transmitting node,

CAN bus find its application in engine control units and also in many embedded systems found in cars.

Related Items