Can tire repair in a car. CAN bus - how does electronics work in modern cars? CAN bus: how it works

Can tire repair in a car. CAN bus - how does electronics work in modern cars? CAN bus: how it works

In order to streamline the work of all controllers that facilitate control and increase control of driving a car, a CAN bus is used. You can connect such a device to the car alarm with your own hands.

[ Hide ]

What is a CAN bus and how it works

CAN bus is a network of controllers. The device is used to combine all the control modules of the car into one working network with a common wire. This device consists of one pair of cables called CAN. Information transmitted through channels from one module to another is sent in an encoded form.

Scheme for connecting devices to the CAN bus in Mercedes

What functions can the CAN bus perform:

  • connection to the car on-board network of any devices and devices;
  • simplification of the algorithm for connecting and functioning of auxiliary systems of the machine;
  • the unit can simultaneously receive and transmit digital data from different sources;
  • the use of the bus reduces the impact of external electromagnetic fields on the functioning of the main and auxiliary systems of the machine;
  • The CAN bus allows you to speed up the procedure for transferring information to certain devices and vehicle components.

This system operates in several modes:

  1. Background. All devices are off, but the bus is powered. The voltage value is too low, so the bus will not be able to discharge the battery.
  2. Launch mode. When the car enthusiast inserts the key into the lock and turns it or presses the Start button, the device is activated. The option to stabilize the power supplied to the controllers and sensors is enabled.
  3. Active mode. In this case, data is exchanged between all controllers and sensors. When operating in active mode, the power consumption parameter can be increased up to 85 mA.
  4. Sleep or shutdown mode. When the power unit is turned off, the KAN controllers cease to function. When the sleep mode is turned on, all machine nodes are disconnected from the on-board network.

Channel Vialon Sushka in his video told about the CAN bus and what you need to know about its operation.

Advantages and disadvantages

What are the advantages of CAN-bus:

  1. Easy to install the device in the car. The owner of the machine does not have to spend money on installation, since you can do this task yourself.
  2. Device performance. The device allows you to quickly exchange information between systems.
  3. Immunity to interference.
  4. All tires have a multi-level control system. Its use makes it possible to prevent errors in the transmission and reception of data.
  5. During operation, the bus automatically spreads the speed over different channels. This ensures that all systems work optimally.
  6. High security of the device, if necessary, the system blocks unauthorized access.
  7. Large selection of devices of various types from different manufacturers. You can choose an option designed for a specific car model.

What are the disadvantages of the device:

  1. In devices there are restrictions on the amount of transmitted data. Modern cars use a lot of electronic devices. Their large number leads to high congestion of the information transmission channel. This causes an increase in response time.
  2. Most of the data sent over the bus has a specific purpose. A small part of the traffic is allocated to useful information.
  3. When using a higher-level protocol, a car owner may face the problem of a lack of standardization.

Types and markings

The most popular type of tires are devices designed by Robert Bosch. The device can function sequentially, that is, the signal is transmitted after the signal. Such devices are called Serial BUS. On sale you can also find parallel buses Parallel BUS. In them, data transmission is carried out through several communication channels.

You can learn about the varieties, the principle of operation, as well as the capabilities of the CAN bus from the video shot by the DIYorDIE channel.

Taking into account different types of identifiers, several types of devices can be distinguished:

  1. CH2, 0A Active This is how devices that support 11-bit data exchange are marked. These nodes do not indicate pulse errors of the 29-bit node.
  2. CH2, 0V Active This is how devices operating in 11-bit format are marked. The main difference is that when a 29-bit identifier is found in the system, they will send an error message to the control module.

It should be noted that in modern machines these types of devices are not used. This is due to the fact that the operation of the system must be consistent and logical. And in this case, it can operate at several pulse rates - at 125 or 250 kbps. A lower speed is used to control auxiliary devices such as interior lights, power windows, wipers, etc. A high speed is needed to ensure the operation of the transmission, powertrain, ABS system, etc.

Variety of bus functions

Consider what functions exist for various devices.

Device for car engine

When connecting the device, a fast data transmission channel is provided, through which information is distributed at a speed of 500 kbps. The main purpose of the bus is to synchronize the operation of the control module, for example, the gearbox and the motor.

Comfort device

The data transfer rate on this channel is lower and is 100 kbps. The function of such a bus is to connect all devices belonging to this class.

Information and command device

The data transfer rate is the same as in the case of Comfort type devices. The main task of the bus is to provide communication between serving nodes, for example, a mobile device and a navigation system.

Tires from different manufacturers are shown in the photo.

1. Device for automobile internal combustion engines 2. Interface analyzer

Can there be problems with the CAN bus?

In a modern car, a digital bus is constantly used. It works simultaneously with several systems, and information is constantly transmitted through its communication channels. Over time, the device may experience problems. As a result, the data analyzer will not function correctly. If problems are found, the car owner must find the cause.

For what reasons there are failures in work:

  • damage or breakage of electrical circuits of the device;
  • there was a short circuit in the system to the battery or ground;
  • could close the CAN-High or CAN-Low systems;
  • there was damage to the rubberized jumpers;
  • discharge of the battery or a decrease in voltage in the on-board network caused by incorrect operation of the generator device;
  • the ignition coil has failed.

When looking for causes, keep in mind that the malfunction may be the incorrect operation of auxiliary devices that are installed additionally. For example, the reason may be the malfunctioning of the anti-theft system, controllers and devices.

You can learn about repairing the dashboard CAN bus in a Ford Focus 2 car from a video shot by a Brock user - Video Corporation.

The troubleshooting process is as follows:

  1. First, the car owner diagnoses the state of the system. It is advisable to carry out a computer check to identify any problems.
  2. At the next stage, the voltage level and resistance of electrical circuits are diagnosed.
  3. If everything is in order, then the resistance parameter of the rubberized jumpers is checked.

Diagnostics of the CAN bus performance requires certain skills and experience, so it is better to entrust the troubleshooting procedure to specialists.

How to connect an alarm via CAN bus

To connect the CAN bus with your own hands to the car alarm of a car with or without auto start, you need to know where the anti-theft system control unit is located. If the alarm was installed independently, then the search process will not cause difficulties for the car owner. The control module is usually placed under the dashboard near the steering wheel or behind the control panel.

How to make the connection procedure:

  1. The anti-theft system must be installed and connected to all nodes and elements.
  2. Find a thick orange cable, it connects to the digital bus.
  3. The anti-theft system adapter is connected to the contact of the found tire.
  4. The device is mounted in a safe and convenient place, the device is fixed. It is necessary to insulate all electrical circuits in order to prevent their grinding and leakage of current. Diagnostics of the correctness of the performed task is carried out.
  5. At the final stage, all channels are configured to ensure the working state of the system. You also need to set the functional number of the device.

The number of installed sensors on modern car models often allows us to call them "computers on wheels". In order to tidy up the management of numerous electronic systems, a CAN bus was created. What is it and what are the principles of its work, we will consider in this article.

Historical reference

The first products of the automotive industry did without electrical circuits at all. To start the car engine, a special magnetoelectric device was used that generates electricity from kinetic energy.

However, gradually the cars became more and more entangled with wires, and in 1970 they competed with airplanes in terms of the degree of stuffing with various sensors. And the more devices were placed in the car, the more obvious the need to rationalize the wiring circuits became.

The solution to the problem became possible with the microprocessor revolution and took place in several stages:

  • In 1983, the German concern Bosch began developing a new data transfer protocol for use in the automotive industry;
  • Three years later, at a conference in Detroit, this protocol was officially presented to the general public under the name "Sensor Area Network" (Controller Area Network), or abbreviated in English as CAN;
  • The practical implementation of the German invention was taken up by the companies "Intel" and "Philips". The first prototypes date back to 1987;
  • In 1988, the BMW 8-series became the first car to roll off the assembly line, on which all sensors were organized according to the "CAN" technology;
  • Three years later, Bosch updated the standard and added new features;
  • In 1993, the KAN standard became international and received the ISO classifier;
  • In 2001, every four-wheeled vehicle in Europe became mandatory to be equipped with a CAN bus;
  • In 2012, a new version of the bus was released: the information transfer rate was increased, and compatibility with a number of new devices was also organized.

CAN bus: how it works

The bus includes only a pair of wires connected to a single microchip. Each cable transmits several hundred signals simultaneously to various vehicle controllers. Data transfer speed is comparable to broadband internet. In addition, if necessary, the signal will be amplified to the required level.

The work of technology can be divided into several stages:

  1. Background mode- all nodes of the system are turned off, but the power supply continues to be supplied to the CAN-microchip. The level of energy consumption is extremely small and amounts to tiny fractions of milliamps;
  2. launch- as soon as the driver turns the ignition key (or presses the "Start" button to start the engine - on some car models), the system literally "wakes up". The mode of stabilization of the power supplied to the sensors is turned on;
  3. active work- all controllers exchange the necessary (both diagnostic and current) information. The level of electricity consumption increases at peak loads to a record 85 milliamps;
  4. falling asleep- as soon as the car's engine is turned off, the "KAN" sensors instantly stop working. Each of the nodes of the system is independently disconnected from the electrical network and goes into sleep mode.

What is a CAN bus in a car?

CAN in relation to the car can be called the "backbone" to which all electrical devices are connected. The signals are digital and the wires to each controller are connected in parallel. This results in high network performance.

In modern cars, sensors from the following devices are combined into a single network:

  • Motor;
  • Gear box;
  • Airbags (airbags);
  • Anti-lock braking system;
  • Power steering;
  • Ignition;
  • Dashboard;
  • Tires (controllers that determine the level of pressure);
  • "Wipers" on the windshield;
  • multimedia system;
  • Navigation (GLONASS, GPS);
  • On-board computer.

Application in other industries

The lightness and simplicity of CAN technology reveals the possibilities of its application not only for iron horses. The tire is also used in the following areas:

  • Bicycle production. The Japanese brand Shimano announced in 2009 a bicycle with a multi-level control system for the CAN-based gearshift mechanism. The effectiveness of this step was so obvious that other firms, Marants and Bayon X, decided to follow in the footsteps of Shimano. The last manufacturer uses a bus for a direct drive system;
  • Known for the implementation of the so-called "smart home" on the principle of the CAN-bus. Many devices that can solve certain tasks without the participation of people (automatic lawn watering, thermostat, video surveillance system, lighting control, climate control, etc.) are combined into a single data transmission system. True, experts find the use of purely automotive technology in a human dwelling rather doubtful. Among the weaknesses of such a move is the lack of a single international CAS standard for smart homes.

Advantages and disadvantages

"KAN-bus" is valued in mechanical engineering for such positive qualities:

  • Speed: the system is adapted to work in conditions of hard time pressure;
  • Relative ease of embedding in the machine and a low level of installation costs;
  • Increased tolerance to interference;
  • A multi-level control system that allows you to avoid many errors in the process of data entry and exit;
  • The spread of work speeds allows you to adapt to almost any situation;
  • Increased security level: blocking unauthorized access from the outside;
  • A variety of standards, as well as manufacturing companies. The palette of tires available on the market allows you to find an option for even the cheapest car.

Despite the abundance of advantages, CAN technology is not without a number of weaknesses:

  • The amount of information that is available for simultaneous transmission in a "data packet" is quite limited for today's requirements;
  • A significant part of the transmitted data has official and technical purposes. The useful data itself accounts for a tiny fraction of the traffic on the network;
  • The top layer protocol is not standardized at all.

Bosch invented not only the spark plug and fuel filter, but also a kind of “Internet” for car sensors called the CAN bus. What is this standard in the field of linking together all controllers into a single neural network became known about 30 years ago.

Video: how can-bus works in a car

In this video, mechanic Arthur Kamalyan will tell you what the can-bus is used for in a car and how to connect to it:

CAN Bus - Introduction

The CAN protocol is an ISO standard (ISO 11898) for serial communication. The protocol was developed with an eye to use in transport applications. Today, CAN has become widespread and is used in industrial production automation systems, as well as in transport.

The CAN standard consists of a physical layer and a data layer that defines several different message types, bus access conflict resolution rules, and fault protection.

CAN protocol

The CAN protocol is described in the ISO 11898-1 standard and can be summarized as follows:

The physical layer uses differential data transmission over twisted pair;

Non-destructive bit-wise conflict resolution is used to control access to the bus;

Messages are small (mostly 8 bytes of data) and are protected by a checksum;

Messages do not have explicit addresses, instead each message contains a numeric value that controls its order on the bus and can also serve as an identifier for the message content;

A well-thought-out error handling scheme that ensures that messages are retransmitted if they were not received properly;
effective means are available to isolate faults and remove faulty nodes from the bus.

Higher level protocols

The CAN protocol itself only defines how small data packets can be safely moved from point A to point B via the communication medium. It, as you might expect, doesn't say anything about how to control the flow; transfer a large amount of data than fits in an 8-byte message; nor about node addresses; establishing a connection, etc. These points are defined by the Higher Layer Protocol (HLP). The term HLP comes from the OSI model and its seven layers.

Higher level protocols are used to:

Standardization of the startup procedure, including the choice of data rate;

Distribution of addresses among interacting nodes or types of messages;

Message markup definitions;
ensuring error handling at the system level.

User groups, etc.

One of the most effective ways to increase your CAN competence is to participate in the work being done within existing user groups. Even if you don't plan to actively participate, user groups can be a good source of information. Attending conferences is another good way to get comprehensive and accurate information.

CAN products

At a low level, a fundamental distinction is made between two types of CAN products available on the open market – CAN chips and CAN development tools. At a higher level, the other two types of products are CAN modules and CAN engineering tools. A wide range of these products is currently available on the open market.

CAN Patents

Patents related to CAN applications can be of various types: implementation of timing and frequencies, transmission of large data sets (the CAN protocol uses data frames only 8 bytes long), etc.

Distributed control systems

The CAN protocol is a good basis for developing distributed control systems. The conflict resolution method used by CAN ensures that each CAN node will interact with those messages that are relevant to this node.

A distributed control system can be described as a system whose computing power is distributed among all nodes of the system. The opposite is a system with a central processing unit and local I/O points.

CAN messages

The CAN bus is a broadcast bus. This means that all nodes can "listen" to all transmissions. There is no way to send a message to a specific node, all nodes without exception will receive all messages. The CAN hardware, however, provides local filtering capability so that each module can only respond to the message it is interested in.

CAN message addressing

CAN uses relatively short messages - the maximum length of the information field is 94 bits. The messages do not have an explicit address, they can be called content-addressed: the content of the message implicitly (implicitly) determines the addressee.

Message types

There are 4 types of messages (or frames) transmitted on the CAN bus:

Data frame (Data Frame);

Remote frame (Remote Frame);

Error frame;

Overload frame.

data frame

Briefly: “Hello everyone, there is data marked X, I hope you like it!”
A data frame is the most common type of message. It contains the following main parts (some details are omitted for brevity):

The Arbitration Field, which determines the order of the message when two or more nodes compete for the bus. The arbitration field contains:

In the case of CAN 2.0A, an 11-bit identifier and one bit, the RTR bit which is the defining data frame.

In the case of CAN 2.0B, a 29-bit identifier (which also contains two recessive bits: SRR and IDE) and an RTR bit.

Data Field, which contains 0 to 8 bytes of data.

CRC field (CRC Field), containing a 15-bit checksum calculated for most parts of the message. This checksum is used for error detection.

Acknowledgment Slot. Each CAN controller capable of correctly receiving the message sends an Acknowledgment bit at the end of each message. The transceiver checks for the presence of the recognition bit and, if none is found, resends the message.

Note 1: The presence of the recognize bit on the bus means nothing more than that each scheduled destination has received the message. The only thing known is that the message was correctly received by one or more bus nodes.

Note 2: The identifier in the arbitration field, despite its name, does not necessarily identify the content of the message.

CAN 2.0B data frame ("standard CAN").

CAN 2.0B data frame ("extended CAN").

Remote Frame

Briefly: "Hello everyone, can anyone produce data labeled X?"
A deleted frame is very similar to a data frame, but with two important differences:

It is explicitly marked as a deleted frame (the RTR bit in the arbitration field is recessive), and

Missing data field.

The main task of a remote frame is to request the transmission of a proper data frame. If, say, node A forwards a remote frame with an arbitration field parameter of 234, then node B, if properly initialized, should send back a data frame with an arbitration field parameter of 234 as well.

Remote frames can be used to implement request-response bus traffic control. In practice, however, the remote frame is little used. This is not so important, since the CAN standard does not prescribe exactly how it is indicated here. Most CAN controllers can be programmed to automatically respond to a remote frame, or notify the local processor instead.

There is one trick with the remote frame: the Data Length Code must be set to the length of the expected response message. Otherwise, conflict resolution will not work.

Sometimes it is required that a node responding to a remote frame start its transmission as soon as it recognizes the identifier, thus "filling" the empty remote frame. This is a different case.

Error Frame

Briefly (together, loudly): "Oh, DEAR, LET'S TRY ONE ONE ONE ONE"
An Error Frame is a special message that violates the framing rules of a CAN message. It is sent when a node detects a failure and helps other nodes detect the failure - and they will send error frames too. The transmitter will automatically try to send the message again. There is a well-thought-out error counter scheme to ensure that a node cannot disrupt the bus communication by repeatedly sending error frames.

The error frame contains an Error Flag, which consists of 6 bits of the same value (thus violating the bit stuffing rule) and an Error Delimiter, which consists of 8 recessive bits. The error delimiter provides some space in which other bus nodes can send their error flags after they themselves detect the first error flag.

Overload Frame

Briefly: "I'm very busy 82526 small, could you wait a minute?"
The overload frame is mentioned here only for the sake of completeness. It is very similar in format to an error frame and is transmitted by a busy node. The overload frame is used infrequently because modern CAN controllers are powerful enough not to use it. In fact, the only controller that will generate overload frames is the now obsolete 82526.

Standard and Extended CAN

Initially, the CAN standard set the length of the identifier in the arbitration field to 11 bits. Later, at the request of buyers, the standard was expanded. The new format is often referred to as extended CAN (Extended CAN) and allows at least 29 bits in the identifier. A reserved bit in the Control Field is used to distinguish between the two types of frames.

Formally, the standards are named as follows −

2.0A - only with 11-bit identifiers;
2.0B is an extended version with 29-bit or 11-bit identifiers (they can be mixed). Node 2.0B can be

2.0B active capable of transmitting and receiving spread frames, or

2.0B passive (passive), i.e. it will silently discard received extended frames (but see below).

1.x - refers to the original specification and its revisions.

Currently, newer CAN controllers are usually type 2.0B. A 1.x or 2.0A type controller will be confused when receiving messages with 29 arbitration bits. The 2.0B passive type controller will accept them, recognize them if they are correct, and then discard them; a controller 2.0B active type will be able to both transmit and receive such messages.

Controllers 2.0B and 2.0A (as well as 1.x) are compatible. You can use them all on the same bus as long as the 2.0B controllers refrain from sending spread frames.

Sometimes people claim that standard CAN is "better" than extended CAN because there is more overhead in extended CAN messages. This is not necessarily so. If you are using an arbitration field to transmit data, then an extended CAN frame may contain less overhead than a standard CAN frame.

Basic CAN (Basic CAN) and full CAN (Full CAN)

The terms Basic CAN and Full CAN originate in the "childhood" of CAN. Once upon a time, there was an Intel 82526 CAN controller that provided the programmer with a DPRAM-style interface. Then came Philips with the 82C200, which used a FIFO-oriented programming model and limited filtering capabilities. To distinguish between the two programming models, people have come to call the Intel method Full CAN and the Philips method Basic CAN. Today, most CAN controllers support both programming models, so there is no point in using the terms Full CAN and Basic CAN - in fact, these terms can cause confusion and should be avoided.

In fact, a Full CAN controller can communicate with a Basic CAN controller and vice versa. There are no compatibility issues.

Bus Conflict Resolution and Message Priority

Message conflict resolution (the process by which two or more CAN controllers decide who will use the bus) is very important in determining the actual bandwidth availability for data transmission.

Any CAN controller can initiate transmission when it detects that the bus is idle. This can cause two or more controllers to start transmitting a message (almost) at the same time. The conflict is resolved as follows. Transmitting nodes monitor the bus while the message is being sent. If a node detects a dominant level while it is itself sending a recessive level, it will immediately withdraw from the conflict resolution process and become the receiver. Collision resolution is performed over the entire arbitration field, and after this field is sent, only one transmitter remains on the bus. This node will continue to transmit if nothing happens. Other potential transmitters will try to transmit their messages later, when the bus is free. No time is wasted in the conflict resolution process.

An important condition for the successful resolution of the conflict is the impossibility of a situation in which two nodes can transmit the same arbitration field. There is one exception to this rule: if the message contains no data, then any node can transmit this message.

Since the CAN bus is a wired-AND bus and the Dominant bit is a logical 0, the message with the numerically lowest arbitration field will win the conflict resolution.

Question: What happens if a single bus node tries to send a message?

Answer: The node will, of course, win in resolving the conflict and successfully transfer the message. But when recognition time comes... no node will send the dominant bit of the recognition area, so the transmitter detects a recognition error, sends an error flag, raises its transmit error counter by 8, and starts retransmitting. This cycle will repeat 16 times, then the transmitter will go into passive error status. According to a special rule in the error limiting algorithm, the value of the transmission error counter will no longer increase if the node has a passive error status and the error is a recognition error. Therefore, the node will transmit forever, until someone recognizes the message.

Message addressing and identification

Again, there is nothing wrong with the fact that CAN messages do not contain exact addresses. Each CAN controller will receive all bus traffic, and using a combination of hardware filters and software, determine whether it is “interested” in this message or not.

In fact, the CAN protocol lacks the concept of a message address. Instead, the content of the message is defined by an identifier that resides somewhere in the message. CAN messages can be called "content-addressed".

A specific address works like this: "This is a message for node X." A content-addressed message can be described as: "This message contains data marked X." The difference between the two concepts is small but significant.

The content of the arbitration field is used, according to the standard, to determine the order of the message on the bus. All CAN controllers will also use all (some only part) of the arbitration field as a key in the hardware filtering process.

The standard does not say that the arbitration field must necessarily be used as a message identifier. However, this is a very common use case.

A note about identifier values

We said that 11 (CAN 2.0A) or 29 (CAN 2.0B) bits are available to the identifier. This is not entirely true. For compatibility with a certain old CAN controller (guess which one?), identifiers should not have the 7 most significant bits set to logic one, so 0..2031 values ​​are available for 11-bit identifiers, and users of 29-bit identifiers can use 532676608 different values.

Note that all other CAN controllers accept "wrong" identifiers, so identifiers 2032..2047 can be used without restrictions in modern CAN systems.

CAN physical layers

CAN bus

The CAN bus uses a non return to zero (NRZ) code with bit stuffing. There are two different signal states: dominant (logical 0) and recessive (logical 1). They correspond to certain electrical levels, depending on the physical layer used (there are several). The modules are wired-AND to the bus: if at least one node puts the bus in the dominant state, then the entire bus is in this state, regardless of how many nodes transmit the recessive state.

Various physical levels

Physical layer defines electrical levels and bus signaling scheme, cable impedance, etc.

There are several different versions of the physical layers: The most common is the one defined by the CAN standard, part of ISO 11898-2, which is a two-wire balanced signal circuit. It is also sometimes called high-speed CAN.

Another part of the same ISO 11898-3 standard describes a different two-wire balanced signal scheme for a slower bus. It is fault tolerant, so signaling can continue even if one of the wires is cut, shorted to ground, or in the Vbat state. Sometimes this scheme is called low-speed CAN.

SAE J2411 describes a single-wire (plus ground, of course) physical layer. It is used mainly in cars - for example GM-LAN.

There are several proprietary physical layers.

In the old days, when CAN drivers did not exist, RS485 modifications were used.

Different physical levels, as a rule, cannot interact with each other. Some combinations may work (or appear to work) in good conditions. For example, high-speed and low-speed transceivers may only occasionally operate on the same bus.

The vast majority of CAN transceiver chips are manufactured by Philips; other manufacturers include Bosch, Infineon, Siliconix and Unitrode.

The most common transceiver is the 82C250, which implements the physical layer described by the ISO 11898 standard. An improved version is the 82C251.

A common low-speed CAN transceiver is the Philips TJA1054.

Maximum bus data rate

Maximum data transfer rate on the CAN bus, according to standard, is equal to 1 Mbps. However, some CAN controllers support speeds above 1 Mbps and can be used in specialized applications.

Low-speed CAN (ISO 11898-3, see above) operates at speeds up to 125 kbps.

A single-wire CAN bus in standard mode can transmit data at a rate of about 50 kbps, and in a special high-speed mode, for example, for programming an ECU (ECU), about 100 kbps.

Minimum data transfer rate on the bus

Be aware that some transceivers will not allow you to select a rate below a certain value. For example, if you use 82C250 or 82C251, you can set the speed to 10 kbps without problems, but if you use the TJA1050, you will not be able to set the speed below 50 kbps. Check out the specification.

Maximum cable length

At a data rate of 1 Mbps, the maximum length of the cable used can be about 40 meters. This is due to the requirement of the conflict resolution scheme that the wavefront of the signal must be able to reach the farthest node and return back before the bit is read. In other words, the cable length is limited by the speed of light. Proposals to increase the speed of light were considered, but were rejected due to intergalactic problems.

Other maximum cable lengths (values ​​are approximate):

100 meters at 500 kbps;

200 meters at 250 kbps;

500 meters at 125 kbps;
6 kilometers at 10 kbps.

If optocouplers are used for galvanic isolation, the maximum bus length is reduced accordingly. Tip: use fast optocouplers, and look at the signal delay in the device, not the maximum data rate in the data sheet.

Bus termination

The ISO 11898 CAN bus must be terminated with a terminator. This is achieved by installing a 120 ohm resistor at each end of the bus. Termination serves two purposes:

1. Remove signal reflections at the end of the bus.

2. Verify that it is receiving correct DC levels.

The ISO 11898 CAN bus must be terminated regardless of its speed. I repeat: the ISO 11898 CAN bus must be terminated regardless of its speed. For laboratory work, one terminator may be enough. If your CAN bus works even in the absence of terminators, you are just lucky.

Notice that other physical levels, such as low-speed CAN, single-wire CAN, and others, may or may not require a bus terminator. But your ISO 11898 high speed CAN bus will always require at least one terminator.

Cable

The ISO 11898 standard specifies that the characteristic impedance of the cable should be nominally 120 ohms, but a range of ohm impedances is allowed.

Few cables on the market today meet these requirements. There is a strong possibility that the range of resistance values ​​will be extended in the future.

ISO 11898 describes twisted pair, shielded or unshielded. Work is underway on the SAE J2411 single-wire cable standard.

Administrator

18702

In order to understand the principles of the CAN bus, we decided to write / translate a number of articles on this topic, as usual, based on materials from foreign sources.

One of these sources, which, as it seemed to us, quite appropriately illustrates the principles of the CAN bus, was the video presentation of the training product CANBASIC by Igendi Engineering (http://canbasic.com) .

Welcome to the presentation of a new CANBASIC product, a training system (board) dedicated to the functioning of the CAN bus (CAN).

We'll start with the basics of building a CAN bus network. The diagram shows a car with its lighting system.



Conventional wiring is shown, with each lamp directly connected to some kind of switch or brake pedal contact.



Now similar functionality is shown using CAN bus technology. The front and rear lights are connected to the control modules. The control modules are connected in parallel with the same bus wires.



This small example demonstrates that the volume of electrical wiring is reduced. On top of that, the control modules can detect burned out bulbs and inform the driver about it.

The car in the specified view contains four control modules and clearly reflects the construction of the training system (board) CANBASIC



In the above, there are four bus nodes (CAN nodes).

The front module controls the front lights.

The alarm unit provides control of the interior of the vehicle.

The main control module connects all vehicle systems for diagnostic purposes.

The rear node controls the rear lights.

On the CANBASIC training board, you can see the routing (location) of three signals: "Power", "CAN-Hi" and "ground", connected in the control module.



In most vehicles, you need an OBD-USB converter to connect the main control module to a PC using diagnostic software.



The CANBASIC board already contains an OBD-USB converter and can be directly connected to a PC.

The board is powered by the USB interface, so no additional cables are needed.



Bus wires are used to transfer a lot of data. How it works?

How the CAN bus works

This data is transmitted sequentially. Here is an example.

The person with the lamp, the transmitter, wants to send some information to the person with the telescope, the recipient (receiver). He wants to send data.



In order to do this, they agreed that the recipient monitors the status of the lamp every 10 seconds.



It looks like this:







After 80 seconds:



Now 8 bits of data have been transmitted at a rate of 0.1 bits per second (i.e. 1 bit per 10 seconds). This is called serial communication.



To use this approach in an automotive application, the time interval is shortened from 10 seconds to 0.000006 seconds. To transfer information by changing the voltage level on the data bus.



An oscilloscope is used to measure the electrical signals of the CAN bus. Two test pads on the CANBASIC board allow this signal to be measured.



To show the full CAN message, the oscilloscope resolution is reduced.



As a result, single CAN bits can no longer be recognized. To solve this problem, the CANBASIC module is equipped with a digital storage oscilloscope.

We insert the CANBASIC module into a free USB socket, after which it will be automatically detected. The CANBASIC software can be launched right now.



You can see the view of the software oscilloscope with the bit values ​​attached. Red shows the data passed in the previous example.

To explain other parts of the CAN message, we colorize the CAN frame and attach descriptive captions to it.



Each colored part of the CAN message corresponds to an input field of the same color. The area marked in red contains user data information, which can be specified in bits, nibbles, or hexadecimal format.

The yellow area determines the amount of user data. A unique identifier can be set in the green zone.

The blue area allows you to set a CAN message for a remote request. This means that a response from another CAN node will be expected. (The system developers themselves recommend not using remote requests for a number of reasons leading to system glitches, but this will be another article.)

Many CAN bus systems are protected from interference by a second CAN-LO data channel that is inverted with respect to the CAN-HI signal (i.e. the same signal is transmitted, only with the opposite sign).



Six consecutive bits with the same level define the end of the CAN frame.



Coincidentally, other parts of the CAN frame may contain more than five consecutive bits with the same level.



To avoid this bit mark, if five consecutive bits with the same level appear, the opposite bit is inserted at the end of the CAN frame. These bits are called staff bits (garbage bits). CAN receivers (signal receivers) ignore these bits.



With input fields, all data of a CAN frame can be specified and therefore every CAN message can be sent.

The inserted data is immediately updated in the CAN frame, in this example the data length will be changed from one byte to 8 bytes and shifted back one byte.



The description text indicates that the turn signal will be controlled with the identifier "2C1" and data bits 0 and 1. All data bits are reset to 0.



The identifier is set to ""2C1". To activate the turn signal, the data bit must be set from 0 to 1.



In salon mode, you can control the entire module with simple mouse clicks. The CAN data is set automatically according to the desired action.

Turn signal lamps can be set to low beam to work as a DRL. The brightness will be controlled by pulse-width modulation (PWM), in accordance with the capabilities of modern diode technology.

Now we can activate the low beam headlights, fog lights, brake lights and high beam headlights.



When the dipped beam is turned off, the fog lights are also turned off. The control logic of the CANBASIC light system corresponds to Volkswagen cars. Ignition and "come home" features are also included.

With a signal node, you can read the sensor signal after an initiating remote request.

In remote request mode, the second CAN frame will be received and displayed below the sent CAN frame.



The CAN data byte now contains the result of the sensor measurement. By approaching the finger sensor, you can change the measured value.



The pause key freezes the current CAN frame and allows accurate analysis.

As already shown, various parts of the CAN frame can be hidden.



In addition, the hiding of each bit in the CAN frame is supported.

This is very useful if you want to use the CAN frame representation in your own documents, such as an exercise sheet.

In this article, we will not fully describe the CAN protocol, but will only pay attention to things that you must know and understand in order to use or develop CAN-enabled electronic devices.

The CAN protocol was developed for the automotive industry and subsequently became the standard in the field of on-board networking for cars, rail transport, etc. CAN allows you to create networks with advanced error control tools, transfer rates up to 1 Mbps and packets containing no more than eight bytes of data.

Link and physical layersCAN

There is no strict definition of the physical layer in the CAN protocol, so, for example, twisted pair or optical fiber can be used to transmit messages. Essentially, CAN implements the link layer, i.e. performs the formation of message packets, limiting the propagation of errors, acknowledgment and arbitration. Of course, there are also common application-level standards, such as CANopen, but if there is no need to ensure interaction between equipment from different manufacturers, then it is better to use an internal protocol.

Host structureCAN

The CAN network node we are considering consists of a microcontroller, a CAN controller and a transceiver (Figure 1). Most often, we use microcontrollers with a built-in CAN controller to simplify the circuit, but sometimes a stand-alone CAN controller with an SPI interface (MCP2510) is used. Next, the transceiver is connected to a twisted pair, at the ends of which there are terminating resistors (terminator) with a resistance of 120 ohms.

Figure 1 - CAN network node

To form a logical one in a twisted pair, or free bus, a voltage equal to half the voltage difference between 0 or Vcc is applied to both wires. Logical zero corresponds to the supply of differential voltage to the wires of the line (Figure 2).




Figure 2 - Logic levels on the CAN bus

The CAN bus allows you to transfer data at a speed of 1 Mbit / s with a cable length of not more than 40 m. In the training literature it is written that by reducing the transfer rate to 10 kbit / s, you can achieve a network length of 1.5 km.

message packageCAN

The CAN message format is shown in Figure 3.




Figure 3 - CAN message packet

In fact, the message packet is formed by the CAN controller, and the application software only sets the message identifier, message length and provides data bytes, so we will not fully consider the packet, but look at the data that we change when working with the CAN bus.

The message ID is used to identify the data sent in this packet. Each sent message is received by all network nodes, and in this case, the identifier allows a particular device to understand whether it is necessary to process this message. The maximum message length is 8 bytes, but you can reduce this value to save bandwidth on the CAN bus. For example, below in the text there are several screenshots of CAN messages from the car network.

Arbitration on the busCAN

Without details, the message with the smallest identifier is always transmitted first on the CAN bus.

Setting the bus baud rateCAN

The data transfer rate on the CAN bus is adjusted by the formation of time slices, and not, as in many other serial data transfer protocols, by a rate divider. In most cases, speeds of 10Kbps, 20Kbps, 50Kbps, 100Kbps, 125Kbps, 500Kbps, 800Kbps, 1MBaud are used and the settings for these speeds have already been calculated. Figure 4 shows the speed selection window in PcanView.



Figure 4 - Selecting the baud rate in the PcanView program

As we can see, when setting the standard speed, the settings are set automatically, but there are times when it is necessary to use a different data transfer rate. For example, the vehicle's on-board CAN can operate at 83Kbps. In this case, you will have to calculate the settings yourself or look for a specialized speed calculator on the Internet. To independently calculate the speed, it is necessary to understand that several quanta are used to transmit one bit of a message, and the transmission interval consists of three segments (Figure 5).




Figure 5 - Time of transmission of one bit

The first segment is always fixed and equals one quantum. Then there are two segments Tseg1 and Tseg2, and the number of quanta in each segment is user-defined and can be from 8 to 25. The sampling point is between Tseg1 and Tseg2, i.e. at the end of the first and at the beginning of the second segment. The user can also define the width of the synchronization jump (Synchronization Jump Width - SJW) to adjust the bit rate of the receiving device, which can be in the range of 1 - 4 time slices.

Now we give the formula for calculating the speed (Example of calculating the speed for the CAN controller SJA1000):

BTR = Pclk/(BRP * (1 + Tseg1 + Tseg2))

BTR - data transfer rate,

Pclk – frequency of CAN controller operation,

BRP - baud rate generator frequency prescaler value

Tseg1 - first segment

Tseg2 - Second segment

To check, let's take the already calculated speed of 125Kbps and try to get the settings manually. Pclk take 16 MHz.

BRP = 16MHz /(125K * (1 + Tseg1 + Tseg2))

Then we select the bit transmission interval, which is in the range from 8 to 25 time slices, so that an integer value of BRP would be obtained. In our case, if we take (1 + Tseg1 + Tseg2) = 16, then BRP will be equal to 30.

SP = ((1 + Tseg1 + Tseg2) * 70)/100

We substitute the values ​​and get 16 * 0.7 = 11.2, which corresponds to the relation Tseg1 = 10, Tseg2 = 5, i.e. 1 + 10 + 5 = 16. Then we look if Tseg2 >= 5, then SJW = 4, if Tseg2< 5, то SJW = (Tseg2 – 1). В нашем случае SJW = 4.

In total, to get a speed of 125Kbps, you must specify in the parameters BRP = 30, Tseg1 = 10, Tseg2 = 5, SJW = 4.

P.S. The baud rate configuration differs significantly between the old USB-CANmoduls (GW-001 and GW-002) with the SJA1000 controller and the new sysWORXX modules with the AT91SAM7A3 controller. In the article describing the work with the on-board CAN of the car at a speed of 83kbit / s, the calculation of the speed for the AT91SAM7A3 controller is given.


An example of receiving and transmitting data viaCAN interface

In the example, we will use a CAN adapter with the PcanView program from SYSTEC and connect to the car's interior CAN operating at a speed of 125Kbps. The car we are considering is equipped with electric seats and therefore we will examine the data responsible for the position of the seats and try to change the position of the backrest by replacing the package using a computer.

To begin with, on the car diagram, we find the most conveniently located connector with the CANH and CANL lines and connect our adapter to it. If the connector and wires could not be found, then you can crawl to the seat control unit, find two wires twisted together and carefully cut the wires to connect the adapter. If after connecting and configuring the adapter messages do not come, then first of all try to change CANH CANL among themselves and check if the ignition is on.
Next, run the PcanView program, in the settings window that opens, set Baudrate = 125Kbps and click OK (Figure 4). In the next window, set Message filter = Standard, address range from 000 to 7FF and click OK (Figure 6).



Figure 6 - Setting up the CAN filter

If everything is done correctly, then we will see messages from the chairs (Figure 7), and when you press the backrest tilt button on the control panel, we will see another message with the address 1F4 coming from the remote control to the chair (Figure 8).



Figure 7 - CAN messages from the power chair


Figure 8 - CAN messages from the power chair and message from the control panel to the chair

Now we know what the address, length and data in the CAN packet should be to simulate pressing the button to change the back position. In the Transmit tab, click NEW and in the window that opens, create a copy of the 1F4 package, i.e. ID = 1F4, Length = 3, Data = 40 80 00. Period can be left at 0 ms, then messages will be sent upon pressing the spacebar (Figure 9).



Figure 9 - Creating a CAN message

Figure 10 shows the Transmit field of the main window containing all messages sent to CAN and information about them. When a message is highlighted and the space button is pressed, a packet will be sent to the CAN network and the chair will move slightly in the desired direction.



It is clear that in this case it will not be possible to achieve full-fledged control of the chair, because. we can't exclude the factory remote control packages from the network, but this problem is quite solvable.

Outcome

We saw how, with some effort and skill, you can create your own electronic systems using the high-tech CAN protocol and how you can connect, explore and control devices connected to the car CAN bus.

© 2023 globusks.ru - Car repair and maintenance for beginners