Theory: CAN-Bus: 1 General Information
Theory: CAN-Bus: 1 General Information
Theory: CAN-Bus
1 General Information
1.1 History
The abbreviation CAN stands for Controller Area Network. This bus system was developed by the Robert Bosch GmbH in the 1980s. The original area of application was the automotive sector. The reason for developing was the increasing share of controller and automating technology (ABS, ASR) that required a communication between different components. The foundations were laid by the high quantities and a wide distribution. This caused that meanwhile CAN is applied in wide areas that need a field bus.
1.2 Basics
There are strict temporal requirements in the area automobile electronics, as well as a lively data exchange i.e. a high number of communication process but only small data packets (todays extension: navigation system etc. other communication systems necessary) Minimization of wiring effort High error safety (fail-safe), robustness Small latency time (i.e. time between desired start of sending and actual start of sending is as small as possible) Distributed systems, several receiver Good extensibility Priorization of messages Lower-cost
In order to reduce the wiring effort the only choice was a bus system. The Robert Bosch GmbH realized the requirements in a protocol, the CAN protocol.
Industrial Automation
Theory: CAN-Bus
1 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
Presentation Layer (6) Session Layer (5) Transportation Layer (4) Network Layer (3) Data Link Layer (2)
Layer 2: Bus access, frame format and testing, addressing Layer 1:
Definition of transmission medium and plug-andsocket connection, level, coding, bit rate
Out of the 7 layers, only the blue colored ones ( 1, 2, and 7 ) are considered for field busses
Industrial Automation
Theory: CAN-Bus
2 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
2 Description of CAN
2.1 OSI Layer 1: physical layer
In principle, CAN is designed for serial data transmission in a bus topology. But the CAN specification doesnt determine the transmission medium. In the ISO standards it was planned that the transmission medium for CAN is an electrical differential two-wired line. However, in case of an error the transmission can also take place with a one-wired line and the same reference potential (ground). The advantage of the differential voltage transmission on a twowired line compared to a one-wired line is the low liability to potential differences and interferences on the line.
5V
bus
S1
E1
S2
E2
S3
E3
Industrial Automation
Theory: CAN-Bus
3 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
delimiter bit
dominant
number 1 of bits
11 1 object identifier
15 1 1 1
CRCsegment
7 End-ofFrame field
Interframe Space
Start of Frame: Arbitration field: Control field: Data field: CRC-field: ACK-field:
End of Frame:
1 dominant bit to identify start 11 bit identifier + 1 bit RTR (remote transmission request bit) 2 bits reserved for extended CAN, 4 bits for data length 0-8 byte of data possible, starting with MSB 15 bit generator polynom (x15+x14+x10+x8+x7+x4+x3+1) + 1 recessive CRC delimiter bit 1 bit ACK-slot + 1 bit ACK delimiter (recessive): transmitter sends recessive bit in the slot; recipients that received error free,send a dominant bit in the slot. 7 bit
In total the minimum frame length results in 44 bits. Additionally are the 0-64 data bits and potentially stuff bits.
Industrial Automation Theory: CAN-Bus 4 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
2.) Remote Frame A participant of the bus uses the remote frame to trigger the sending of a special data frame with the same identifier by a data source. Data frame and remote frame only differ in a varying RTR bit ( RTR bit of remote frame =1, RTR bit for data frame=0 ) and a missing data field of the remote frame. This results that the data frame will prevail when there is a simultaneous request and transmission of a frame. 3.) Error Frame If a participant of the bus recognizes an erroneous frame ( e.g. wrong checksum in CRC field), it reports this by sending an error frame. Therefore a sequence ( 6 bits with the same polarity) that isnt permissible during normal operation is switched on the bus. This implicates that all the other ( fully functional node) switch themselves an error frame on the bus as the bit stuffing rule was violated. An error frame is terminated with 8 recessive bits. 4.) Overload Frame An overload frame is used to enlarge the spacing between two frames. It can only be send at the beginning of the spacing. By switching of 6 dominant bits (overload flag) on the bus the defined form of the spacing is destroyed and overload is signalized. As a result all the nodes are also sending overload frames.
1.) Bit Monitoring Each transmitting network node monitors whether or not the bus level it has transmitted is actually present on the bus. Otherwise a fault has appeared that has to be dissolved or the sending process has to be terminated (arbitration phase). 2.) Frame Format Check As the frame format is fixed, every participant of the bus can check whether this format is maintained ( e.g. recessive delimiter bits). Otherwise a fault is existent.
Industrial Automation
Theory: CAN-Bus
5 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
3.) Cyclic Redundancy Check The transmitted message is secured again by CRC. Thereby the message is divided by a special polynominal generator and the result is deposit in the CRC field. The message is divided again by this polynominal generator by the receiver and the result is compared with the transmitted CRC field. If there are not identical a transmission error has appeared. (polynominal generator x15+x14+x10+x8+x7+x4+x3+1) 4.) Bit-Stuffing The CAN protocol uses the NRZ bit coding ( non-return to zero). But this means that there are longer phases without bit edges for synchronization. To avoid this an inverted stuff bit is set after 5 bits of the same polarity. This bit permits the synchronization of every node and is deleted when received.
Figure 3 : Bit Time Model of CAN The bit time of a CAN message consists of several controller time units and may / must be adapted to the network. One time unit corresponds the cycle time of the oscillator on the controller. Synchronization Segment 1 time unit, receiver starts internal bit timing Signal Propagation Segment 1..8 time units, absorbs double signal propagation time and electrical switching time Phase Segment 1 1..8 time units, serves for after-synchronization if the oscillator on the sender site is slower as the oscillator on the receiver side Phase Segment 2 Maximum value from phase segment 1 and information process time
Industrial Automation Theory: CAN-Bus 6 Mb, 27/04/2006
Industrial Automation
Theory: CAN-Bus
serves for after-synchronization if the oscillator on the sender site is slower as the oscillator on the receiver side
3 Appendix
3.1 Different Specifications
At first it must be differentiated between CAN controller of the specification 2.0A and 2.0B. 2.0A defines an identifier of 11 bits; so it can be distinguished between 2032 types of messages (the restriction opposite to the theoretical possible value of 2048 is determined by the Intel controller with restricted processing). The Extended CAN version 2.0B features an identifier of 29 bits with which over 500 million different types of messages can be defined. Indeed 2.0A and 2.0B controller can be operated in a CAN network at the same time, however only by using the 11 bits identifier.
Industrial Automation
Theory: CAN-Bus
7 Mb, 27/04/2006