System and method for adaptively adjusting RS485 bus drive

By dynamically adjusting the bias resistor in the RS485 bus system, the error risk and driving loss problems caused by unreasonable bias resistor settings in the prior art are solved, adaptive control is realized, and the stability and anti-interference ability of the system are improved. , reduces costs.

CN119066004AActive Publication Date: 2024-12-03BENGBU EI FIRE ELECTRONICS CO LTD

Patent Information

Application Number
CN202411129321.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-03
Estimated Expiration
2044-08-16

AI Technical Summary

Technical Problem

In the prior art, the bias resistor setting of the RS485 bus is unreasonable, resulting in a small bias differential voltage and a risk of bit error, or complex driving results in unnecessary losses, especially when there are fewer nodes or no terminal resistance at the end.

Method used

A system for adaptively adjusting the RS485 bus driver is designed. Through the control unit, adjustment unit and acquisition unit of the master and slave, the resistance value of the bias resistor pair is dynamically adjusted. According to whether the termination resistor is set at the end of the bus, the bias will be offset. The resistor pair is divided into two groups, and the appropriate resistance values ​​are calculated and set separately to achieve adaptive control.

Benefits of technology

Improves the stability and anti-interference ability of the bus, reduces labor costs, ensures effective driving under different nodes and termination resistances, avoids unnecessary losses, and ensures sufficient margin for the bus idle voltage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066004A_ABST
    Figure CN119066004A_ABST
Patent Text Reader

Abstract

The invention discloses a system for adaptively adjusting RS485 bus drive and an adjusting method, relates to the technical field of communication, and solves the technical problems of low bias differential voltage, error code risk or large drive complexity and unnecessary loss caused by unreasonable bias resistor arrangement in the prior art. The system comprises a host and a slave, wherein the host comprises a control unit, an adjusting unit, an RS485 interface unit and an acquisition unit; the slave machine comprises a control unit and an RS485 interface unit; the control unit is used for adjusting and controlling the bias resistor; the adjusting unit comprises n bias resistor pairs and n selection switches, and is used for adjusting the resistance values of the bias resistor pairs; the acquisition unit acquires a bus differential bias voltage when the bus is idle; the host is located at the head end of the total network and is externally provided with a terminating resistor; a terminating resistor can be arranged at the tail end of the tail-end slave; the self-adaptive adjustment of the bus is realized, and the error code risk or unnecessary loss is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of communication technology, and relates to an adjustment technology for adaptively adjusting an RS485 bus driver, in particular to a system and an adjustment method for adaptively adjusting an RS485 bus driver. Background Art

[0002] The RS485 bus transmission protocol is a serial bus communication protocol that uses a differential working mode. It adopts a balanced transmission and differential reception structure design, which enables it to suppress common-mode interference, thereby maintaining high stability and reliability during data transmission. The RS485 communication network generally adopts a master-slave communication mode, that is, a host with multiple slaves. For applications where the bus has signal reflection, termination resistors are usually added at the beginning and end of the bus. When the RS485 network is in an idle state, all nodes are in a listening mode. In this case, there are no active drivers on the network; all drivers are in tri-state; in the absence of any device driving the network, the state of the line is unknown; in order to maintain the appropriate idle voltage state, a bias resistor must be used to force the data line to be in an idle state; the bias resistor is usually a pull-up resistor on the data A line to the power supply and a pull-down resistor on the data B line to ground, and the pull-up resistor and the pull-down resistor are generally the same.

[0003] In order to ensure a reasonable idle bias voltage, the prior art sets bias resistors at all nodes in the network. The pull-up resistors and pull-down resistors are usually too large to ensure that the equivalent pull-up resistors and pull-down resistors are not too small when more nodes are used, so as to avoid insufficient driving capability of the transceiver. The problem is that the same pull-up resistor and pull-down resistor configuration, when there are fewer nodes and termination resistors, will cause the idle level to fail to meet the minimum differential input requirements of the transceiver, resulting in a risk of bit errors. When a bias resistor is set at a node in the network, the pull-up resistor and pull-down resistor are generally set too small according to the terminal configuration termination resistor and the maximum node application. For actual applications with fewer nodes or no termination resistors at the end, the drive load is too large, resulting in unnecessary drive losses.

[0004] The present invention provides a system and method for adaptively adjusting RS485 bus drive to solve the above technical problems. Summary of the invention

[0005] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a system and an adjustment method for adaptively adjusting the RS485 bus drive, which are used to solve the technical problems in the prior art that the bias resistor is set irrationally, resulting in a small bias differential voltage, a risk of bit error, or causing the drive to be complex and large, resulting in unnecessary losses.

[0006] To achieve the above object, a first aspect of the present invention provides a system for adaptively adjusting RS485 bus drive, comprising: a host and a plurality of slaves;

[0007] The host includes a control unit, an adjustment unit, an RS485 interface unit and a collection unit; the slave includes a control unit and an RS485 interface unit;

[0008] The control unit is used to adjust and control the bias resistor; the adjustment unit includes n bias resistor pairs and n selection switches, which are used to adjust the resistance values ​​of the n bias resistor pairs; the collection unit is used to collect the bus differential bias voltage when the bus is idle;

[0009] The host is located at the head end of the total network and is provided with a termination resistor externally; the end of the end slave can select and set the termination resistor according to the signal wavelength and the length of the transmission line; wherein, the end slave refers to the slave provided at the end of the total network.

[0010] Preferably, the system comprises a host and M-1 slaves, wherein a maximum value Mmax of M is determined by an input impedance of the RS485 transceiver.

[0011] Preferably, the total number of the bias resistor pairs is n, n is an even number, and the value range of n is 4≤n≤Mmax; each bias resistor pair x includes a pull-up resistor Rux and a pull-down resistor Rdx; the pull-up resistor Rux and the pull-down resistor Rdx can be selectively switched by selecting a dual-way switch Sx; the n bias resistor pairs are divided into two groups.

[0012] The total number of bias resistor pairs of the present invention is an even number, and each group of bias resistor pairs corresponds to a two-way switch. The bias resistor pairs can be accurately controlled by the two-way selection switch, which is beneficial to improving the accuracy of bus adaptive control.

[0013] Preferably, dividing the n bias resistor pairs into two groups comprises:

[0014] The 1st to n / 2nd bias resistor pairs are applicable when there is a terminating resistor at the end of the bus; Calculate the bias resistor value R;

[0015] The n / 2+1 to n bias resistor pairs are applicable to the case where no termination resistor is set at the end of the bus; Calculate the bias resistor value R;

[0016] Adjusting the resistance value of the corresponding bias resistor pair according to the calculated bias resistor value;

[0017] Among them, V A 、V Bare the potentials of buses A and B, V A -V B and V T are the bias differential voltages, VCC is the bias power supply, and R IN is the input impedance of the transceiver; R T is the termination resistor; M is the total number of nodes, and its value is taken from the elements in the sequence {Mmax, Mmax / 2, …, Mmax / 2^(x - 1)}, where x ranges from 1 to n / 2.

[0018] The present invention divides the bias resistor pairs into two groups. One group is applicable to the case where a termination resistor is provided at the end, and the other group is applicable to the case where no termination resistor is provided at the end, and can calculate the resistance value of the bias resistor according to the actual situation; it is beneficial to set bias resistors with different resistance values for different bus situations.

[0019] Preferably, the resistance values of the bias resistor pairs are Ru1 < Ru2 < … < Run; Rux = Rdx; [Ru1, Rd1] is the bias resistor pair with the minimum resistance value, and [Run, Rdn] is the bias resistor pair with the maximum resistance value; the bias differential threshold voltage VT is set to be greater than 200 mV.

[0020] The present invention sets the preset bias differential threshold voltage to be greater than 200 mV, which can ensure that there is enough margin for the bus idle voltage and improve the stability and anti-interference ability of the system.

[0021] The second aspect of the present invention provides an adjustment method for adaptively adjusting the RS485 bus drive, including:

[0022] Step S1: During initialization, the control unit controls the switch S1 of the first pair of bias resistor pairs Ru1 and Rd1 to close and records cur as 1, and the remaining switches are opened; where cur is the switch number corresponding to the bias resistor pair and is used to record the switch.

[0023] Step S2: When the host does not send a signal and the bus is idle, the acquisition unit acquires the differential bias voltage VS of the bus.

[0024] Step S3: The control unit determines whether the differential bias voltage VS is greater than the preset bias differential threshold voltage VT and whether the current switch record cur is less than n; if yes, the currently closed switch is opened, the switch of the next pair of bias resistor pairs is closed, and cur = cur + 1 is updated; repeat Step S2; if not, execute Step S4.

[0025] Step S4: Determine whether the differential bias voltage VS is less than or equal to the preset bias differential threshold voltage VT; if yes, the control unit controls the currently closed switch to open, closes the switch of the previous pair of bias resistor pairs, and transfers to the normal communication process; if not, the bias resistor adjustment ends and transfers to the normal communication process.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] 1. The RS485 bus driver of the present invention comprises a host and several slaves, wherein the host head end is provided with a termination resistor, and the slave ends are provided with termination resistors according to actual conditions; by setting the total number of bias resistor pairs to an even number, and each group of bias resistor pairs corresponds to a two-way switch, synchronous control of pull-up resistors and pull-down resistors can be achieved; the bias resistor pairs are divided into two groups, one group is suitable for the case where the end is provided with a termination resistor, and the other group is suitable for the case where the end is not provided with a termination resistor, and the bias resistor value can be calculated according to actual conditions; it is beneficial to set bias resistors with different resistance values ​​for different bus conditions.

[0028] 2. The present invention adjusts and controls the bias resistor pairs in sequence, collects the differential bias voltage when the bus is idle, and analyzes whether to switch to the normal communication process based on the differential control voltage, the preset bias differential threshold voltage and the switch record; it can realize adaptive adjustment of the bus according to the number of bus slaves and the setting of the end termination resistor, without the need for technical personnel to adjust the bus, thus reducing labor costs; and setting the preset bias differential threshold voltage to greater than 200mV can ensure that the bus idle voltage has sufficient margin, thereby improving the stability and anti-interference ability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 A schematic diagram of the overall connection of the system of the present invention;

[0031] Figure 2 is a schematic diagram of the internal structure of the regulating unit of the present invention;

[0032] Figure 3 Schematic diagram of adjusting specific steps of the present invention. DETAILED DESCRIPTION

[0033] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] See also Figure 1-Figure 2 , a first aspect of the present invention provides a system for adaptively adjusting RS485 bus drive, comprising: a host and a plurality of slaves;

[0035] The host includes a control unit, an adjustment unit, an RS485 interface unit and a collection unit; the slave includes a control unit and an RS485 interface unit;

[0036] The control unit is used to adjust and control the bias resistor; the adjustment unit includes n bias resistor pairs and n selection switches, which are used to adjust the resistance values ​​of the n bias resistor pairs; the collection unit is used to collect the bus differential bias voltage when the bus is idle;

[0037] The host is located at the head end of the total network and is externally provided with a termination resistor; the end of the end slave can select and set the termination resistor according to the signal wavelength and the length of the transmission line; wherein, the end slave refers to the slave set at the end of the total network;

[0038] The system includes a host and M-1 slaves, where the maximum value Mmax of M is determined by the input impedance of the RS485 transceiver;

[0039] The total number of bias resistor pairs is n, n is an even number, and the value range of n is 4≤n≤Mmax; each bias resistor pair x includes a pull-up resistor Rux and a pull-down resistor Rdx; the pull-up resistor Rux and the pull-down resistor Rdx can be selected and switched by selecting a dual-way switch Sx, and the n bias resistor pairs are divided into two groups.

[0040] Figure 1 The middle end slave is slave M-1. You can choose to set a termination resistor at the end slave. Generally, when high-frequency signals are transmitted, the signal wavelength is shorter than the transmission line. The signal will form a reflected wave at the end of the transmission line, interfering with the original signal. Therefore, a termination resistor needs to be added at the end of the transmission line to prevent the signal from being reflected after reaching the end of the transmission line. This is not necessary for low-frequency signals.

[0041] In long-distance signal transmission, in order to avoid signal reflection and echo, it is generally necessary to connect a termination resistor at the receiving end. In the case of low communication speed or short communication distance, termination resistor is generally not set. On the contrary, when the communication distance is long and the communication speed is fast, and the signal quality requirement is high, termination resistor is generally set at the end of the end slave.

[0042] For example, the input impedance of the RS485 transceivers selected for all nodes of the system is 12 kΩ, so the maximum number of nodes is 32, including 1 master node and 31 slave nodes; the master node is set at the head end, and there is 1 termination resistor RT outside the RS485 interface unit of the master node, and RT is 120 Ω. The termination resistor of the slave node at the end can be selected and configured or not configured according to the actual situation on site.

[0043] The adjustment unit includes 8 bias resistor pairs and 8 selection switches S. Rux and Rdx can be selected and switched by selecting the dual-path switch Sx, where x ranges from 1 to 8, and the bias power supply VCC is set to 5 V.

[0044] The resistance values of the bias resistor pairs are Ru1 < Ru2 < … < Run; Rux = Rdx; [Ru1, Rd1] is the bias resistor pair with the minimum resistance value, and [Run, Rdn] is the bias resistor pair with the maximum resistance value; the bias differential threshold voltage VT is set to be greater than 200 mV.

[0045] The n bias resistor pairs are divided into two groups, including:

[0046] The 1st to n / 2th bias resistor pairs are applicable to the case where a termination resistor is set at the end of the bus; the resistance value R of the bias resistor is calculated through the formula to obtain the resistance value R of the bias resistor;

[0047] The (n / 2 + 1)th to nth bias resistor pairs are applicable to the case where no termination resistor is set at the end of the bus; the resistance value R of the bias resistor is calculated through the formula to obtain the resistance value R of the bias resistor;

[0048] Adjust the resistance values of the corresponding bias resistor pairs according to the calculated resistance values of the bias resistors; where, where, V A and V B are the potentials of buses A and B, V A - V B and V T are the bias differential voltages, VCC is the bias power supply, R IN is the input impedance of the transceiver; R T is the termination resistor; M is the total number of nodes, and the value is taken from the elements in the sequence {Mmax, Mmax / 2, …, Mmax / 2^(x - 1)}, where x ranges from 1 to n / 2.

[0049] For example: Divide 8 bias resistor pairs into two groups. The 1st to 4th bias resistor pairs are applicable to the case where a termination resistor is set at the end of the bus; the bias resistor is calculated through the formula

[0050] The 5th to 8th bias resistor pairs are applicable to the case where no termination resistor is set at the end of the bus, and the bias resistor is calculated through the formula

[0051] Wherein, the value of M is taken according to the elements in {32, 16, 8, 4} and the bias differential threshold voltage VT is taken as 250 mV;

[0052] [Ru1, Rd1], [Ru2, Rd2], [Ru3, Rd3], [Ru4, Rd4] are the first group of bias resistor pairs, corresponding to the case where there is a termination resistor at the end, [Ru5, Rd5], [Ru6, Rd6], [Ru7, Rd7], [Ru8, Rd8] are the second group of bias resistor pairs, corresponding to the case where there is no termination resistor at the end. Thus, the bias resistors Ru1~Ru8 or Rd1~Rd8 are calculated to be 528Ω, 548Ω, 559Ω, 564Ω, 983Ω, 1056Ω, 1096Ω, 1118Ω respectively.

[0053] See also Figure 3 A second aspect of the present invention provides a method for adaptively adjusting an RS485 bus driver, comprising:

[0054] Step S1: During initialization, the control unit controls the switch S1 of the first bias resistor pair Ru1 and Rd1 to be closed and records cur as 1, and the remaining switches are opened; wherein cur is the switch number corresponding to the bias resistor pair, which is used to record the switch;

[0055] Step S2: When the host does not send a signal and the bus is free, the acquisition unit acquires the differential bias voltage VS of the bus;

[0056] Step S3: The control unit determines whether the differential bias voltage VS is greater than the preset bias differential threshold voltage VT, and whether the current switch record cur is less than n; if yes, the current closed switch is opened, the switch of the next pair of bias resistors is closed, and cur=cur+1 is updated; step S2 is repeated; if no, step S4 is executed;

[0057] Step S4: Determine whether the differential bias voltage VS is less than or equal to the preset bias differential threshold voltage VT; if yes, the control unit controls to open the currently closed switch, close the switch of the previous pair of bias resistors, and enter the normal communication process; if no, the bias resistor adjustment is completed and the normal communication process is entered.

[0058] For example: during initialization, the control unit controls the switch S1 of the first bias resistor pair Ru1 and Rd1 to be closed and cur is recorded as 1, and S2 to S8 are disconnected;

[0059] The acquisition unit acquires the bias differential voltage VS; determines whether VS is greater than VT and cur is less than 8. If yes, S1 is disconnected and S2 is closed; and cur=cur+1=2, and the above steps are repeated; if no, proceed to the next step;

[0060] Determine whether VS is less than or equal to VT; if yes, disconnect Scur, close Scur-1, and the bias resistance adjustment is completed and the normal communication process is entered; if no, the bias resistance adjustment is completed and the normal communication process is entered.

[0061] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.

[0062] The working principle of the present invention: The present invention performs adaptive adjustment on the RS485 bus drive, and the specific steps are: Step S1: During initialization, the control unit controls the switch S1 of the first pair of bias resistors Ru1 and Rd1 to be closed and records cur as 1, and the remaining switches are disconnected; wherein, the switch number corresponding to the cur bias resistor pair is used to record the switch; Step S2: When the host does not send a signal and the bus is free, the acquisition unit acquires the differential bias voltage VS of the bus; Step S3: The control unit determines whether the differential bias voltage VS is greater than a preset bias differential threshold voltage VT, and whether the current switch record cur is less than n; if yes, the current closed switch is disconnected, the switch of the next pair of bias resistors is closed, and cur=cur+1 is updated; Step S2 is repeated; if no, step S4 is executed; Step S4: Determine whether the differential bias voltage VS is less than or equal to the preset bias differential threshold voltage VT; if yes, the control unit controls the disconnection of the current closed switch, the switch of the previous pair of bias resistors is closed, and the normal communication process is entered; if no, the bias resistor adjustment is ended and the normal communication process is entered.

[0063] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A system for adaptively adjusting RS485 bus drive, characterized in that: Including: A host and several slave devices; The host includes a control unit, an adjustment unit, an RS485 interface unit, and a collection unit; the slave devices include a control unit and an RS485 interface unit; The control unit is used to adjust and control the bias resistors; The adjustment unit includes n pairs of bias resistors and n selection switches, and is used to adjust the resistance values of the n pairs of bias resistors; The collection unit is used to collect the bus differential bias voltage when the bus is idle; The host is located at the head of the total network, and a termination resistor is externally provided; the end of the end slave device can be selectively provided with a termination resistor according to the signal wavelength and the length of the transmission line; among them, the end slave device refers to the slave device provided at the end of the total network.

2. A system for adaptively adjusting RS485 bus drive according to claim 1, characterized in that: The system includes one host and M - 1 slave devices, where the maximum value Mmax of M is determined by the input impedance of the RS485 transceiver.

3. A system for adaptively adjusting RS485 bus drive according to claim 1, characterized in that: The total number of the pairs of bias resistors is n, n is an even number, and the value range of n is 4 ≤ n ≤ Mmax; each pair of bias resistors x includes a pull-up resistor Rux and a pull-down resistor Rdx; the pull-up resistor Rux and the pull-down resistor Rdx can be selectively switched through a dual-path switch Sx; and the n pairs of bias resistors are divided into two groups.

4. A system for adaptively adjusting RS485 bus drive according to claim 3, characterized in that: The dividing the n pairs of bias resistors into two groups includes: The 1st to n / 2nd bias resistor pairs are applicable when there is a terminating resistor at the end of the bus; Calculate the bias resistor value R; The n / 2+1 to n bias resistor pairs are applicable to the case where no termination resistor is set at the end of the bus; Calculate the bias resistor value R; Adjusting the resistance value of the corresponding pair of bias resistors according to the calculated bias resistor resistance value; Among them, V A 、V B is the potential of bus A and B, V A -V B and V T is the bias differential voltage, VCC is the bias power supply, R IN is the input impedance of the transceiver; R T is the termination resistor; M is the total number of nodes, and its value is taken from the elements in the sequence {Mmax, Mmax / 2, …, Mmax / 2^(x-1)}, where x ranges from 1 to n / 2.

5. A system for adaptively adjusting RS485 bus drive according to claim 4, characterized in that: The resistance values of the pairs of bias resistors are Ru1 < Ru2 < … < Run; Rux = Rdx; [Ru1, Rd1] is the pair of bias resistors with the minimum resistance value, and [Run, Rdn] is the pair of bias resistors with the maximum resistance value; The bias differential threshold voltage VT is set to be greater than 200 mV.

6. A method for adaptively adjusting RS485 bus driver, applied to a system for adaptively adjusting RS485 bus driver according to any one of claims 1 to 5, characterized in that: Including: Step S1: During initialization, the control unit controls the switch S1 of the first pair of bias resistors Ru1 and Rd1 to close and records cur as 1, and the remaining switches are opened; where cur is the switch number corresponding to the pair of bias resistors and is used to record the switches; Step S2: When the host does not send a signal and the bus is idle, the collection unit collects the bus differential bias voltage VS; Step S3: The control unit determines whether the differential bias voltage VS is greater than a preset bias differential threshold voltage VT and whether the current switch record cur is less than n; if yes, disconnect the currently closed switch, close the switch of the next pair of bias resistors, and update cur = cur + 1; repeat Step S2; if not, execute Step S4; Step S4: Determine whether the differential bias voltage VS is less than or equal to the preset bias differential threshold voltage VT; if yes, the control unit controls to disconnect the currently closed switch, close the switch of the previous pair of bias resistors, and transfer to the normal communication process; if not, the bias resistor adjustment ends and transfers to the normal communication process.

Citation Information

Patent Citations

  • Bias voltage adaptation module and method and LCD (Liquid Crystal Display) driving chip

    CN116994533A

  • Nonpolar RS-485 interface chip with pull-up and pull-down resistors inside

    CN204256735U

  • Communication circuit of RS485 module

    CN218181353U

  • Pull-up and pull-down resistance value adjusting circuit and electronic equipment

    CN220087271U

  • Transmitter circuit

    US20240120956A1

Cited By

  • Dynamic adjusting circuit, system and method for 485 bus pull-up and pull-down bias resistor

    CN121283798A