CAN, the full name of "Controller Area Network", is the controller LAN, which is one of the most widely used fieldbuses in the world. A single network composed of CAN bus is limited by the electrical characteristics of the network hardware. As a multi-master serial communication bus, CAN's basic design specification requires high bit rate and high anti-electromagnetic interference performance, and it can detect any errors generated on the communication bus. When the signal transmission distance is up to 10km, CAN can still provide data transmission rate of up to 50kbit/s. Table 1 shows the correspondence between the maximum transmission distance between any two nodes on the CAN bus and its bit rate.
There are two functions of the CAN bus terminating resistor:
First, improve the anti-interference ability, ensure that the bus quickly enters the hidden state.
Second, improve signal quality.
Improve anti-interference abilityThe CAN bus has two states: "dominant" and "recessive". "dominant" stands for "0" and "recessive" stands for "1", which is determined by CAN. The figure below shows a typical internal structure of a CAN transceiver, CANH, CANL connection bus.
When the bus is dominant, the internal Q1 and Q2 of the transceiver are turned on, and the voltage difference between CANH and CANL; when recessive, Q1 and Q2 are cut off, CANH and CANL are in a passive state, and the voltage difference is 0.
If there is no load on the bus, the resistance of the resistor is large when it is hidden. The external interference requires only a small amount of energy to make the bus dominant (the general transceiver dominant threshold is only 500mV minimum voltage). In order to improve the anti-interference ability of the bus recessive, a differential load resistor can be added, and the resistance value is as small as possible to eliminate the influence of most energy. However, in order to avoid the need for an excessive bus to enter the dominant, the resistance should not be too small. Ensure fast entry into recessive state
During the dominant state, the parasitic capacitance of the bus is taken, and when it returns to the recessive state, these capacitors need to be discharged. If no resistive load is placed between CANH and CANL, the capacitor can only be discharged through the differential resistor inside the transceiver. We add a 220PF capacitor between the CANH and CANL of the transceiver for simulation test, and the bit rate is 500kbit/s. Waveform as shown below
As can be seen from the above figure, the dominant recovery to recessive time is as long as 1.44μS, and it can barely communicate when the point is high. If the communication rate is higher, or the parasitic capacitance is larger, it is difficult to ensure normal communication.
In order to quickly discharge the bus parasitic capacitance and ensure that the bus enters the recessive state quickly, a load resistor needs to be placed between CANH and CANL. After adding a 60Ω resistor, the waveform is as follows. It can be seen from the figure that the time for explicit recovery to recessiveness is reduced to 128 nS, which is equivalent to the dominant setup time.
Signals at a higher slew rate will produce signal reflections when the signal edge energy encounters a mismatch; the geometry of the cross section of the transmission cable changes, the characteristic impedance of the cable changes, and reflections are also caused.
At the end of the bus cable, the sharp change in impedance causes the edge energy of the signal to be reflected, and the bus signal will be generated. If the ringing amplitude is too large, the communication quality will be affected. Add a terminating resistor that matches the characteristic impedance of the cable at the end of the cable to absorb this energy and avoid ringing.
We conducted a simulation test with a bit rate of 1 Mbit/s. The transceivers CANH and CANL were connected to a twisted pair of about 10 m. The transceiver was terminated with a 120 Ω resistor to ensure the implicit conversion time. The end was not loaded. The end signal waveform is shown below, and ringing occurs on the rising edge of the signal.
If a 120Ω resistor is added to the end of the twisted pair, the end signal waveform is significantly improved and the ringing disappears, as shown below.
Generally, in the straight type, the two ends of the cable are the transmitting end and the receiving end, so each end of the cable needs to be added with a terminating resistor.
Why choose 120Ω?The characteristic impedance of any cable can be obtained experimentally. Connect one end of the cable to the other end and observe the waveform on the resistor. Adjust the resistance value until the signal on the resistor is a good square wave without ringing. The resistance value at this time can be considered to be consistent with the characteristic impedance of the cable.
Most cables are single-wire. If you use a typical cable used in two cars and twist them into twisted pairs, you can get a characteristic impedance of about 120Ω according to the above method, which is also the recommended terminal resistance of the CAN standard.
note:(1) There is a 120Ω resistor connected to both ends of the CAN bus. Its function is to match the bus impedance and improve the anti-interference and reliable operation of data communication. However, in practice, it is only necessary to ensure that the jumper resistance between "CAN_H" and "CAN_L" in the CAN network is 60Ω.
(2) SJA1000's 20-pin RX1 can be grounded when not in use (see software design for specific reasons). With the setting of CDR.6, the bus length can be greatly increased.
(3) The connection of pins TX0 and TX1 determines the level of the serial output. For the specific relationship, refer to the setting of the output control register OCR.
(4) The RS pin of the AT82C250 has a slope resistor indirectly with the ground. The size of the resistor can be adjusted according to the bus communication speed, generally between 16kΩ and 140kΩ.
(5) The external capacitors of the MAX232 require four electrolytic capacitors C1, C2, C3, and C4. These capacitors are also required for internal power conversion. The values ​​are 1μF/25V. The tantalum capacitor should be used and the position application amount should be close to the chip. The power supply VCC Connect a 0.1μF decoupling capacitor to ground.
Ningbo Xingchuangzhi Electric Appliance Co.,Ltd. , https://www.xingchuangzhi.com