| Introduction to Controller Area Network (CAN Bus) |
|
|
| Written by Parthiban Kesavan | |
|
Page 2 of 4 Operation of CAN
CAN is a bit stream oriented communication protocol through which the complete transmission of message is carried stand alone by the CAN controller. CAN is a broadcast communication system in which the message frames which are transmitted on the bus do not have any source or destination addresses. Instead the Frames have identifiers with which the nodes which receive the messages can run an acceptance test (filtering) to make sure whether to accept the corresponding message or to ignore it. The Identifier has information about the content of data inside the frame and also the priority of the message. Higher the priority, lower the number. The length of the Identifier is normally 11bits (Standard CAN) and the second generation CAN have an Identifier 29 bits (Extended CAN).
Bus Arbitration CAN use”Carrier-Sense Multiple Access with Collision Avoidance“(CSMA/CA) for the bus access. Every node in the network can access the bus when the bus is free for 3 bit period. In case of collision, the message with a higher priority wins the bus access and transmits. If more than one node tries to send data through the bus, then the bus access is decided by a bitwise arbitration. The nodes which needs to send the message transmits the message bits at the same time. The node which sends a dominant (0) bit will gain the access on the bus there on. The other node which sends a recessive (1) bit changes its state to a receiver and starts to receive the message frame which is on the bus. The transmission of lower priority message is stalled and transmitted again automatically when the bus is free. The message contains 0-8 bytes of date which is specified as Data Length Code (DLC) in the Control Bits of the message frame. For the error detection a 15 bit checksum is transmitted along with the message. Bit Stuffing The receiving node synchronises itself with every start bit of the message. CAN uses a technique called Bit stuffing to have the proper communication of the messages. After every consecutive bit levels, the transmitter will automatically stuff a bit of opposite polarity in to the bit stream. The receiver of the message will automatically destuff (delete) this stuff bit. So if any receiving node detects six consecutive bits of the same level, then a stuff error is flagged. Theoretically for every 5 bits a stuff bit is sent by the sender. On an average every message has 3 to 4 stuff bits. The CAN controller of every receiving node checks the message format and also the checksum. It sends an acknowledgement or Error frame within the Acknowledge and EOF (End of Frame) fields in the frame. In case of an error frame, the received message is ignored by all the nodes in the network. The sender will automatically try to send the message later on the bus. Bit timing The nominal bit timing is the time needed to transmit a bit across the network. All the nodes in the network should have the same bit rate. That is why the synchronisation is being done in several ways. Maximum transmission time for a message with 8 data bytes and of higher priority is 225 micro seconds. And with 29 bit identifier is 260 micro seconds. Therefore the maximum data rate is 35KB/sec for 11 bit identifier and 30KB/sec for 29 bit identifier |



