The CAN bus terminal resistance is generally 120 ohms. In fact, in the design, two 60 ohm resistors are connected in series, and there are generally two 120 ohm nodes on the bus. Basically, people who know a little about CAN bus Everyone knows this.

But as a scumbag, I know that this is a commonly used resistance value in various standards and various data sheets and application notes, but what is the specific function of these two terminal resistors? I knew the impedance matching before, but what is the matching? what is it?

Then I went to Zhihu for a while, and half-copied and half-written to summarize the following knowledge points. Knowing the function of the terminal resistor can also find the cause of the problem faster for problems such as unstable waveforms in daily work.

The role of terminating resistors

There are three functions of the CAN bus terminal resistor: 1. Improve the anti-interference ability and let the high-frequency and low-energy signals go away quickly. 2. Ensure that the bus quickly enters a recessive state, so that the energy of the parasitic capacitance can go away faster; 3. Improve the signal Masses, placed at both ends of the bus, keep the reflected energy down.

1. Improve the anti-interference ability

The CAN bus has two states of “dominant” and “recessive”, “dominant” represents “0”, “recessive” represents “1”, which is determined by the CAN transceiver. The following figure is a typical internal structure diagram of a CAN transceiver, CANH and CANL are connected to the bus.

When the bus is dominant, Q1 and Q2 inside the transceiver are turned on, and a pressure difference is generated between CANH and CANL; when the bus is recessive, Q1 and Q2 are turned off, CANH and CANL are in a passive state, and the pressure difference is 0.

If there is no load on the bus, the differential resistance value is very large when it is recessive, and the internal MOS transistor is in a high-impedance state. External interference only needs a very small amount of energy to make the bus enter the dominant (general transceiver dominant threshold minimum voltage). 500mV only). At this time, if there is differential mode interference, there will be obvious fluctuations on the bus, and these fluctuations have no place to absorb them, and a dominant bit will be created on the bus. Therefore, in order to improve the anti-interference ability of the bus when it is recessive, a differential load resistor can be added, and the resistance value is as small as possible to avoid the influence of most of the noise energy. However, to avoid requiring too much current from the bus to go dominant, the resistance should not be too small.

2. Ensure fast entry into recessive state

During the dominant state, the parasitic capacitances of the bus are charged, and when returning to the recessive state, these capacitances need to be discharged. If there is no resistive load placed between CANH and CANL, the capacitor can only be discharged through the differential resistance inside the transceiver. This impedance is relatively large. According to the characteristics of the RC filter circuit, the discharge time will be significantly longer. We add a 220PF capacitor between CANH and CANL of the transceiver to conduct the simulation test. The bit rate is 500kbit/s. The waveform is shown in the figure. The falling edge of this waveform is a relatively long state.

In order to quickly discharge the bus parasitic capacitance and ensure that the bus quickly enters the recessive state, a load resistor needs to be placed between CANH and CANL. After adding a 60Ω resistor, the waveform is shown in the figure. It can be seen from the figure that the time from dominant recovery to recessive is reduced to 128nS, which is equivalent to the dominant settling time.

3. Improve signal quality

When the signal is at a high slew rate, when the signal edge energy encounters impedance mismatch, signal reflection will occur; the geometry of the cross-section of the transmission cable changes, and the characteristic impedance of the cable changes accordingly, which will also cause reflections .

When energy is reflected, the reflected waveform is superimposed with the original waveform, resulting in ringing.

At the end of the bus cable, the rapid change of impedance causes the energy reflection of the signal edge, and ringing occurs on the bus signal. If the ringing amplitude is too large, the communication quality will be affected. Adding a terminal resistance consistent with the characteristic impedance of the cable at the end of the cable can absorb this part of the energy and avoid ringing.

Someone else conducted a simulation test (the pictures are all copied by me), the bit rate is 1Mbit/s, the transceiver CANH and CANL are connected to a twisted pair of about 10m, and the transceiver is terminated with a 120Ω resistor to ensure the recessive conversion time, The end is not loaded. The waveform of the signal at the end is shown in the figure, and there is ringing on the rising edge of the signal.

If a 120Ω resistance is added to the end of the twisted pair, the signal waveform at the end is significantly improved and the ringing disappears.

Generally, in a linear topology, both ends of the cable are the sending end and the receiving end, so a terminating resistor needs to be added at each end of the cable.

In the actual application process, the CAN bus is generally not a perfect bus design, and is often a hybrid structure of the bus and star. The standard structure of the analog CAN bus.

Why choose 120Ω?

What is impedance? In electricity, the resistance to current in a circuit is often called impedance. Impedance unit is ohm, usually expressed as Z, which is a complex number Z= R+i(ωL–1/(ωC)). Specifically, impedance can be divided into two parts, resistance (real part) and reactance (imaginary part). The reactance includes capacitive reactance and inductive reactance. The current obstruction caused by capacitance is called capacitive reactance, and the current obstruction caused by inductance is called inductive reactance. Impedance here refers to the mode of Z.

The characteristic impedance of any cable can be obtained experimentally. One end of the cable is connected to a square wave generator, the other end is connected to an adjustable resistor, and the waveform on the resistor is observed through an oscilloscope. Adjust the resistance value of the resistor until the signal on the resistor is a good square wave without ringing: impedance matching and signal integrity, the resistance value at this time can be considered to be consistent with the characteristic impedance of the cable.

Using two typical cables used in automobiles and twisting them into twisted pairs, the characteristic impedance can be obtained according to the above method to be about 120Ω, which is also the resistance value of the terminal resistance recommended by the CAN standard, so this 120Ω is measured. It is not calculated, it is calculated based on the actual wiring harness characteristics. Of course, it is also defined in the ISO 11898-2 standard.

Why choose 0.25W for power?

This needs to be calculated in combination with some fault states. All interfaces of the car ECU need to consider the short-circuit to the power supply and the short-circuit to the ground, so we also need to consider the short-circuit of the CAN bus node to the power supply. According to the standard, short-circuit to 18V needs to be considered If CANH is short-circuited to 18V, the current will flow to CANL through the terminal resistor, and the maximum injection current is 50mA (marked on the specification of TJA1145) due to the current limit inside CANL, at this time, the power of the 120Ω resistor is 50mA *50mA*120Ω=0.3W. Considering the derating at high temperature, the power of the terminal resistor is 0.5W.

Reviewing Editor: Tang Zihong