{"id":157,"date":"2012-11-20T17:01:20","date_gmt":"2012-11-20T16:01:20","guid":{"rendered":"http:\/\/www.kanda.com\/blog\/?p=157"},"modified":"2024-04-02T13:56:31","modified_gmt":"2024-04-02T12:56:31","slug":"bus","status":"publish","type":"post","link":"https:\/\/www.kanda.com\/blog\/microcontrollers\/bus\/","title":{"rendered":"All About CAN Bus, CAN USB and CAN-FD"},"content":{"rendered":"\n

What is CAN bus? Officially, CAN is a Controller Area Network, which is a network of independent controllers communicating securely. It was first developed by Bosch and Intel in 1990 and has been amended since. The International Standards Organisation (ISO) has further defined CAN using their OSI model.<\/p>\n\n\n\n\n\n\n\n


Open System Interconnect or OSI is a standard model for communication architecture, consisting of 7 layers<\/p>\n\n\n\n


\"OSI<\/center>\n\n\n\n

CAN Bus is defined in ISO 11898 but this only covers the bottom two layers. Other standards such as CAN Open and SAE J1939 are extensions to the CAN standard that define high level layers, but specific (expensive) software is needed to deal with these protocols.<\/p>\n\n\n\n

Physical Hardware<\/h4>\n\n\n\n

On the physical layer, CAN consists of two dedicated wires for communication. These wires are called CAN high and CAN low. When the CAN bus is in idle mode, both of these lines carry 2.5V but when data bits are being transmitted, the CAN high line goes to 3.75V and the CAN low drops to 1.25V. This generates a 2.5V voltage differential between the two lines, so the CAN bus is NOT sensitive to inductive spikes, electrical fields or other noise. This makes CAN bus very resilient in an electrically noisy environment, like a vehicle. Using twisted-pairs makes it even more robust. The lines must be terminated at each end with a 120R resistor.<\/p>\n\n\n\n

Power can be supplied through CAN bus wires, or a power supply for the CAN bus modules can be arranged separately. The power supply wiring can be either totally separate from the CAN bus lines (using suitable gauge wiring for each module) resulting in two 2-wire cables being utilized for the network, or it can be integrated into the same cable as the CAN bus lines giving a single 4-wire cable.<\/p>\n\n\n\n

This hardware interface is best achieved using a CAN Transceiver chip that deals with all the necessary electrical interfacing.<\/p>\n\n\n\n

Data Transmission<\/h4>\n\n\n\n

The Data Link Layer allows all modules to transmit and receive data on the bus, ie no master. Each module is given a unique CAN ID, either 11-bit (CAN 2.0 A) or 29-bits (CAN 2.0 B), that it uses when it sends messages and it responds to. All modules will also respond to a broadcast message.<\/p>\n\n\n\n

The maximum data throughput defined by the standard is 1Mbit\/s and common rates are 125Kbits\/sec for Can Open and 250Kbits\/sec for J1939. Communication distances also varies with the bit rate. 1Mbit\/sec has a maximum distance of 40 metres, 250Kbit\/sec up to 250 metres and 10 Kbits\/sec up to 1Km.<\/p>\n\n\n\n

CAN Frame<\/h4>\n\n\n\n

CAN communication relies on frames, whose format is defined by the standard. A frame can be a data frame, an error frame or remote frames. Each frame includes start and stop bits, CAN ID or address, data, check bits and frame type.<\/p>\n\n\n\n

Each CAN node will only respond to a message that has its ID or a broadcast ID. and other frames are ignored. <\/p>\n\n\n\n