Automatic identification and expansion communication method based on RS485 interface

By dynamically adjusting the terminal matching resistance and bias current of the RS485 interface, combined with the charge leakage mechanism and the Kalman filtering algorithm, the signal delay and false triggering of the RS485 interface in complex industrial environments is solved, achieving high accuracy and stable communication.

CN120371755APending Publication Date: 2025-07-25PINGDINGSHAN PINGGAO-YASKAWA SWITCH APP CO LTD

Patent Information

Application Number
CN202510372025.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing RS485 interfaces automatically identify driver switching delay and bus high capacitance effects in the communication, which affects communication accuracy and stability, and are particularly obvious in complex industrial environments.

Method used

By dynamically measuring the equivalent distribution capacitance value of the bus, adjusting the terminal matching resistance and bias current in real time, using the thyristor trigger charge leakage mechanism to force the bus residual charge to zero, and accurately determine the idle state with a hysteresis comparator, predicting the signal propagation delay and dynamically adjusting the sampling window, using the differential voltage amplitude comparison method to detect the bus occupation state, dynamically set the idle state determination threshold, and arbitration was performed in combination with the Poisson retreat model.

Benefits of technology

Effectively eliminate signal attenuation and edge distortion caused by capacitance effect, improve the accuracy and stability of signal transmission, reduce the probability of communication conflicts, adapt to dynamic changes in complex industrial scenarios, and reduce equipment failure and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371755A_ABST
    Figure CN120371755A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic identification and expansion communication method based on an RS485 interface, and relates to the technical field of industrial automation communication. The problems that an existing RS485 interface is complex in configuration, poor in protocol compatibility and high in data transmission delay are solved. According to the scheme, the terminal matched resistance and the bias current are adjusted in real time by dynamically measuring the bus equivalent distributed capacitance value, and signal attenuation caused by the capacitance effect is inhibited; a silicon controlled rectifier trigger type charge discharge mechanism is adopted to force bus residual charge to return to zero quickly, and an idle state is accurately judged in combination with a hysteresis comparator; dynamically compensating signal edge distortion and calibrating a sampling window time sequence based on a pre-emphasis filtering and Kalman filtering algorithm; multi-node stable communication is realized through capacitance value driven conflict detection threshold adaptive adjustment and a Poisson back-off model; according to the invention, the real-time performance, the anti-interference capability and the multi-node expansion reliability of RS485 communication in a complex industrial scene are obviously improved, and the debugging and maintenance cost of the system is reduced at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial automation communication technology, and more particularly to an automatic recognition and extended communication method based on the RS485 interface. Background Art

[0002] RS485 is a serial communication interface standard based on differential signal transmission, with characteristics such as strong anti-interference ability, support for multi-point communication (up to 32 nodes), and long-distance transmission (1200 meters), and is widely used in fields such as industrial control and intelligent instruments. However, traditional RS485 systems rely on manual configuration of node addresses and communication modes, and it is difficult to adapt to complex scenarios with dynamic device access and coexistence of multiple protocols. In recent years, RS485 communication methods based on automatic recognition and intelligent extension have become a research hotspot, aiming to reduce the system deployment complexity and improve communication efficiency and reliability through hardware adaptive switching and software protocol optimization.

[0003] The current automatic recognition and extended communication method for RS485 interfaces is mainly achieved through hardware circuit reconstruction and protocol optimization. For example, Chinese Patent CN117271416B proposes an adaptive RS232 / RS485 interface circuit, which uses analog switches (such as CD4066) and logic control circuits (such as 74HC08 AND gate chips) to realize the automatic recognition and switching of interface types. The core lies in detecting the electrical characteristics (such as signal level range) of the external device interface through the recognition module, and driving the analog switch to select the RS232 or RS485 channel, so as to be compatible with the access requirements of different devices. Similarly, in the field of extended communication, CN117806291B discloses a self-checking method for standby RS485 interfaces based on a single-chip microcontroller controller. By paralleling the A / B signal lines of multiple interfaces and using the control program to simulate the bus load, the closed-loop detection of the interface function is realized, avoiding relying on external devices to verify the communication link. However, there are still obvious deficiencies in the existing RS485 interfaces in terms of automatic recognition and extended communication technology, mainly reflected in the driver switching delay and the bus high-capacitance effect. Since RS485 communication adopts a half-duplex mode, when the driver switches from the transmit state to the receive state, the capacitance effect existing in its internal circuit, external bias, and terminal matching network will cause a certain delay, making the data edge transmission on the bus not fast enough, and then resulting in inaccurate judgment of the bus idle state by the recognition module. At the same time, in the actual industrial environment, long-distance shielded twisted pairs and multi-node parallel connections greatly increase the distributed capacitance of the bus, further exacerbating the delay of the signal rising edge and falling edge, making the level conversion in the automatic recognition process blurred. This timing uncertainty and edge delay are prone to cause false triggering or multiple responses, seriously affecting the accuracy and stability of the RS485 interface in automatic recognition and extended communication. Practical application cases show that this defect may lead to misidentification of devices, misalignment of data frames, and even communication conflicts, ultimately reducing the real-time performance and reliability of the entire system, and at the same time increasing the risk of system failures and maintenance costs. Therefore, an automatic recognition and extended communication method based on the RS485 interface is needed. Summary of the Invention

[0004] Aiming at the deficiencies of the prior art, the present invention discloses an automatic recognition and extended communication method based on the RS485 interface, aiming to solve the problems raised in the background technology.

[0005] To achieve the above technical effects, the present invention adopts the following technical solutions:

[0006] An automatic recognition and extended communication method based on the RS485 interface, comprising the following steps:

[0007] Step 1: Send a test signal with a preset frequency to the RS485 bus through the main controller. The receiving end collects the signal edge time parameters and amplitude-frequency attenuation characteristics, and uses the least squares parameter estimation algorithm to calculate the equivalent distributed capacitance value in real time. The equivalent distributed capacitance value is the superposition value of the parasitic capacitance of the bus transmission line and the node-to-ground capacitance, and is used to characterize the bus signal attenuation characteristics;

[0008] Step 2: According to the equivalent distributed capacitance value, dynamically adjust the resistance value of the terminal matching resistor through the proportional-integral-derivative control algorithm, and adjust the bias current of the driver according to the exponential law based on the charge conservation model;

[0009] Step 3: During the driver mode switching interval, adopt a charge discharge mechanism, generate a discharge current pulse based on the equivalent distributed capacitance value through a thyristor-triggered transient discharge circuit, force the residual charge on the bus to zero within the time window, and verify the bus idle state through a hysteresis comparator;

[0010] Step 4: According to the signal edge time parameters, construct a high-frequency gain compensation model using a finite impulse response digital filter, dynamically configure the filter coefficients according to the fundamental frequency and harmonic attenuation characteristics of the bus signal, perform pre-emphasis processing on the received signal, and output the conditioned signal after high-frequency compensation;

[0011] Step 5: According to the conditioned signal, extract the signal zero-crossing sequence through the preamble synchronization mechanism, and combine the equivalent distributed capacitance value, use the Kalman filter algorithm to predict the signal propagation delay, and dynamically adjust the start position and width of the sampling window;

[0012] Step 6: Before the node initiates communication, dynamically set the idle state determination threshold according to the equivalent distributed capacitance value, and use the differential voltage amplitude comparison method to detect the bus occupancy state; if a conflict is detected, generate a preemption delay time based on the preset node priority weight and Poisson backoff model, and output a bus access permission instruction;

[0013] Step 7: When it is detected that the bit error rate exceeds the preset threshold or the timing calibration deviation in Step 5 exceeds the limit, trigger the bus parameter re-measurement process, combine the historical topology feature matrix and the current error data, and update the impedance matching model and pre-emphasis filter coefficients through the least squares regression algorithm.

[0014] As a further technical solution of the present invention, the working principle of the least squares parameter estimation algorithm is as follows: The main controller constructs a linear regression equation of the distributed capacitance and the observed parameters in the transmission line model based on the measured signal rising edge time and amplitude decay data, and generates an initial capacitance estimate value and a residual vector; then, analyzes the sensitivity gradient of the capacitance change to the rising edge time and amplitude decay through the sensitivity gradient analysis method, and adjusts the initial capacitance estimate value along the reverse direction of the gradient to reduce the sum of squared residuals. In each iteration, the parameter step size is updated according to the partial derivative direction of the Jacobian matrix until the residual falls within a preset convergence threshold interval; during the adjustment process, if it is detected that the root mean square error of the residual exceeds the convergence threshold, the main controller adopts an adaptive step size contraction mechanism, reduces the parameter adjustment amplitude according to the exponential decay rule, and recalculates the sensitivity gradient to output the optimal estimate value of the equivalent distributed capacitance.

[0015] As a further technical solution of the present invention, in step 2, the differential term of the proportional-integral-derivative controller calculates the instantaneous deviation amount between the capacitance value and the reference impedance, the integral term accumulates the historical deviation to suppress the steady-state error, the proportional term generates a real-time adjustment coefficient, and outputs a dynamic matching resistance value to the adjustable resistor array; the charge conservation model constructs an exponential function I through an exponential bias compensation mechanism according to the capacitance value change rate and the bus voltage decay slope bias =I0e kΔC to calculate the compensation current; where ΔC is the difference between the current capacitance value and the initial calibration value, and k is the gain coefficient; if it is detected that the bus voltage overshoot exceeds the preset threshold, the integral separation strategy is triggered to disable the PID integral term to suppress oscillation; when the capacitance value volatility is higher than the preset threshold, the real-time capacitance value is filtered by the exponentially weighted moving average method to generate a smoothed capacitance sequence and input it into the PID controller; finally, a dynamically optimized terminal resistance value and bias current command are output to the driver to make the bus impedance and the distributed capacitance form a critically damped match.

[0016] As a further technical solution of the present invention, in step 5, the Kalman filter algorithm calculates the deviation amount between the predicted value and the actual value through the observation residual detection module. If the residual exceeds the statistical confidence interval, the covariance matrix reset mechanism is triggered, and a dynamic gain adjustment strategy is adopted to update the Kalman gain coefficient according to the residual change rate according to the exponential law to suppress the prediction oscillation caused by the capacitance mutation.

[0017] As a further technical solution of the present invention, the working principle of step 6 is as follows: Based on the equivalent distributed capacitance value, the static impedance characteristic parameters of the bus are calculated. Before a node initiates communication, the differential voltage amplitude comparison method is used to compare the current bus voltage change rate with the historical steady-state level reference, and the idle state determination threshold is dynamically adjusted through an adaptive threshold calculation model; during the occupancy detection process, the short-term noise interference is eliminated by the high-speed sampling window sliding mean filtering algorithm, and the weak conflict signal is analyzed by applying the symbol flip error correction method; if a voltage jump that conforms to the conflict characteristic is detected, the Poisson distribution time parameter is calculated through an exponential backoff random process, and the node priority weight is analyzed according to the distributed arbitration protocol. The backoff time is generated by the competitive window dynamic allocation algorithm, and the bus arbitration state transition is executed in the conflict arbitration control unit, and the bus access permission instruction is output in combination with the time-division multiplexing channel scheduling model.

[0018] Based on the above technical solutions, the positive and beneficial effects of the present invention are as follows:

[0019] 1. Through the verification of the dynamic charge discharge mechanism and the adaptive hysteresis comparator, the charge interference remaining due to the capacitance effect during the driver switching process is effectively eliminated, the bus voltage is quickly reset to zero, and the idle state is accurately determined, avoiding mis-triggering or delayed response problems caused by signal tails, and reducing the communication conflict probability from the root cause.

[0020] 2. Based on the dynamic impedance matching and high-frequency pre-emphasis compensation technology based on the distributed capacitance value, the signal attenuation and edge distortion caused by the high capacitance effect of the bus in the long-distance multi-node scenario are suppressed, the steepness of the signal rise / fall edge is significantly improved, and the accurate recognition of the level conversion by the logic decision module is ensured, thereby reducing the risk of data frame misalignment and error codes.

[0021] 3. By predicting the signal propagation delay through the Kalman filter algorithm and dynamically calibrating the sampling window, combined with the adaptive adjustment of the conflict detection threshold driven by the capacitance value, the timing drift problem caused by the bus distributed capacitance is effectively overcome, the signal overlap and communication conflict caused by multi-node competition are avoided, and the integrity and timing controllability of data transmission under complex topologies are guaranteed.

[0022] 4. Relying on the parameter re-measurement mechanism triggered by the bit error rate and the iterative update of the historical topology feature matrix, the impedance matching model and the pre-emphasis parameters are dynamically corrected, continuously offsetting the bus characteristic offset caused by environmental changes or node addition and deletion, thereby reducing the system performance degradation caused by hardware aging or operating conditions fluctuations, and significantly improving the long-term operation stability.

[0023] 5. Through a fully automatic capacitance measurement, dynamic matching, and conflict arbitration mechanism, it can adapt to dynamic changes in different cable lengths, the number of nodes, and load conditions without manual intervention, reducing the debugging rework caused by impedance mismatch or timing calibration deviation in traditional solutions. At the same time, it reduces the equipment failure rate and maintenance frequency caused by communication anomalies. Description of the Drawings

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings, where:

[0025] Figure 1 is the architecture diagram of an automatic recognition and extended communication method based on the RS485 interface of the present invention;

[0026] Figure 2 is the working principle architecture diagram of the least squares parameter estimation algorithm of the present invention;

[0027] Figure 3 is the working principle architecture diagram of the charge discharge mechanism of the present invention. Detailed Embodiments

[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0029] In an embodiment, an automatic recognition and extended communication method based on the RS485 interface, as Figure 1 shown, includes: Step 1. Send a test signal with a preset frequency to the RS485 bus through the master controller. The receiving end collects the signal edge time parameter and amplitude-frequency attenuation characteristic, and uses the least squares parameter estimation algorithm to calculate the equivalent distributed capacitance value in real time. The equivalent distributed capacitance value is the superposition value of the parasitic capacitance of the bus transmission line and the node-to-ground capacitance, and is used to characterize the bus signal attenuation characteristic; as Figure 2As shown, the working principle of the least squares parameter estimation algorithm is as follows: Based on the measured signal rising edge time and amplitude decay data, the main controller constructs a linear regression equation for the distributed capacitance and observed parameters in the transmission line model, generating an initial capacitance estimate value and a residual vector; then, through the sensitivity gradient analysis method, it analyzes the sensitivity gradient of capacitance change to the rising edge time and amplitude decay, and adjusts the initial capacitance estimate value in the opposite direction of the gradient to reduce the sum of squared residuals. In each iteration, the parameter step size is updated according to the partial derivative direction of the Jacobian matrix until the residual falls within a preset convergence threshold interval; during the adjustment process, if it is detected that the root mean square error of the residual exceeds the convergence threshold, the main controller, through the adaptive step size contraction mechanism, reduces the parameter adjustment amplitude according to the exponential decay rule and recalculates the sensitivity gradient to output the optimal estimate value of the equivalent distributed capacitance.

[0030] Step 2: According to the equivalent distributed capacitance value, dynamically adjust the resistance value of the terminal matching resistor through the proportional-integral-derivative control algorithm, and adjust the bias current of the driver according to the exponential law based on the charge conservation model; the differential term of the proportional-integral-derivative controller calculates the instantaneous deviation between the capacitance value and the reference impedance, the integral term accumulates historical deviations to suppress the steady-state error, and the proportional term generates a real-time adjustment coefficient, outputting the dynamic matching resistor value to the adjustable resistor array; the charge conservation model, through the exponential bias compensation mechanism, constructs an exponential function I bias = I0e kΔC to calculate the compensation current; where ΔC is the difference between the current capacitance value and the initial calibration value, and k is the gain coefficient; if it is detected that the bus voltage overshoot exceeds the preset threshold, the integral separation strategy is triggered to disable the PID integral term to suppress oscillations; when the capacitance value volatility is higher than the preset threshold, the real-time capacitance value is filtered through the exponentially weighted moving average method to generate a smoothed capacitance sequence and input it into the PID controller; finally, the dynamically optimized terminal resistor value and bias current command are output to the driver to make the bus impedance and the distributed capacitance form a critically damped match.

[0031] Step 3: During the gap of driver mode switching, adopt the charge discharge mechanism, generate a discharge current pulse based on the equivalent distributed capacitance value through the thyristor-triggered transient discharge loop, force the residual charge on the bus to zero within the time window, and verify the bus idle state through the hysteresis comparator; such as Figure 3As shown, the working principle of the charge discharge mechanism is as follows: At the moment of the driver mode switching, based on the equivalent distributed capacitance value output in step 1, the target value of the discharge current is determined through the dynamic charge quantity calculation model; and the thyristor-triggered pulse modulation method is adopted to generate a discharge current pulse inversely related to the capacitance value, and the discharge intensity is controlled by adjusting the pulse duty cycle; if it is detected that the voltage drop rate after discharge does not reach the preset threshold, the secondary discharge circuit is triggered to superimpose a stepwise increasing current until the bus voltage drops to the lower limit of the hysteresis comparator; finally, the discharge parameters are recorded through closed-loop feedback, and the amplitude and width of subsequent pulses are dynamically corrected. The hysteresis comparator dynamically adjusts the upper threshold and the lower threshold of the hysteresis window based on the equivalent distributed capacitance value. The upper threshold is lifted in proportion to the capacitance value, and the lower threshold is reduced in proportion to the capacitance value; the hysteresis comparator real-time monitors the bus voltage drop slope through the voltage change rate detection module. If the slope is lower than the preset value, the window width adaptive expansion mechanism is triggered to expand the hysteresis window to 1.5 times the original width; when the bus voltage is stable below the lower threshold, the idle flag signal is locked through the status latch.

[0032] Step 4: According to the signal edge time parameter, a high-frequency gain compensation model is constructed by using a finite impulse response digital filter, and the filter coefficients are dynamically configured according to the fundamental frequency and harmonic attenuation characteristics of the bus signal, and the received signal is pre-emphasized to output a conditioned signal after high-frequency compensation. The working principle of this step is as follows: The received signal is subjected to a fast Fourier transform (FFT) through the real-time spectrum analysis module to extract the amplitude of the fundamental frequency component and its harmonic attenuation slope; based on the equivalent distributed capacitance value measured in step 1, the least mean square error (LMS) algorithm is used to construct a target gain compensation curve, and the coefficient matrix of the finite impulse response (FIR) digital filter is dynamically generated; if it is detected that the harmonic attenuation rate exceeds the preset threshold, the coefficient recalculation mechanism is triggered, and the passband gain and stopband attenuation parameters of the filter are iteratively optimized through the gradient descent method; at the hardware level, the received signal is convolved through the parallel multiplier-accumulator (MAC) unit of the FPGA to perform the pre-emphasis process in real time; at the same time, combined with the real-time signal-to-noise ratio (SNR) monitoring result, if the SNR is lower than the set threshold, the adaptive noise reduction strategy is activated, and the Hamming window function is embedded in the filter coefficients to suppress the high-frequency noise amplification; finally, a conditioned signal after dynamic spectrum shaping is output to eliminate the edge distortion caused by the bus capacitance effect.

[0033] Step 5: According to the conditioning signal, extract the signal zero-crossing sequence through the preamble synchronization mechanism, and combine the equivalent distributed capacitance value. Use the Kalman filtering algorithm to predict the signal propagation delay, and dynamically adjust the start position and width of the sampling window. The preamble synchronization mechanism extracts the zero-crossing sequence of the preamble signal through the zero-crossing detection circuit at the receiving end, and constructs a propagation delay model based on the sequence time interval. The propagation delay model uses a Kalman filter to predict the current signal propagation delay and dynamically adjusts the start position and width of the sampling window. When the deviation between the actual sampling point and the prediction window exceeds the threshold, the preamble synchronization mechanism updates the noise parameters of the Kalman filter to adapt to environmental changes. The Kalman filtering algorithm calculates the deviation between the predicted value and the actual value through the observation residual detection module. If the residual exceeds the statistical confidence interval, it triggers the covariance matrix reset mechanism, adopts a dynamic gain adjustment strategy, and updates the Kalman gain coefficient exponentially according to the residual change rate to suppress the prediction oscillation caused by capacitance mutation.

[0034] Step 6: Before the node initiates communication, dynamically set the idle state determination threshold according to the equivalent distributed capacitance value, and use the differential voltage amplitude comparison method to detect the bus occupancy status. If a conflict is detected, generate a preemption delay time based on the preset node priority weight and the Poisson backoff model, and output a bus access permission instruction. Specifically, calculate the bus static impedance characteristic parameters based on the equivalent distributed capacitance value. Before the node initiates communication, use the differential voltage amplitude comparison method to compare the current bus voltage change rate with the historical steady-state level reference, and dynamically adjust the idle state determination threshold through the adaptive threshold calculation model. During the occupancy detection process, eliminate short-term noise interference through the high-speed sampling window sliding mean filtering algorithm, and apply the symbol flip error correction method to analyze weak conflict signals. If a voltage jump that conforms to the conflict characteristics is detected, calculate the Poisson distribution time parameter through the exponential backoff random process, analyze the node priority weight according to the distributed arbitration protocol, generate a backoff time using the competition window dynamic allocation algorithm, perform bus arbitration state transfer in the conflict arbitration control unit, and output a bus access permission instruction in combination with the time-division multiplexing channel scheduling model.

[0035] Step 7: When the bit error rate is detected to exceed the preset threshold or the timing calibration deviation in Step 5 exceeds the limit, trigger the bus parameter re-measurement process. Combine the historical topology feature matrix with the current error data, and update the impedance matching model and pre-emphasis filter coefficients through the least squares regression algorithm. The bus parameter re-measurement process is based on the historical topology feature matrix and real-time error data, applies the generalized least squares regression algorithm to calculate the global impedance fitting parameters, combines the time domain reflectometry to analyze the transient impedance change trend, and constructs a distributed bus load model; during the impedance fitting process, update the matching resistor compensation coefficient through the recursive least squares filtering algorithm, and dynamically adjust the pre-emphasis compensation weight matrix through the adaptive finite impulse response filter; the adaptive finite impulse response filter calculates the harmonic attenuation characteristic parameters through the spectrum analysis method, and optimizes the high-frequency gain compensation model based on the linear predictive coding algorithm to make the updated filter parameters match the load characteristic matrix synergistically.

[0036] In Step 1 of the above embodiment, the master controller sends a test pulse encoded by Manchester at 1 MHz through the RS485 bus driver. The receiving end uses a high-speed ADC (sampling rate ≥ 100 MSPS) to synchronously collect the signal waveform and extract the rising edge time and the steady-state amplitude attenuation rate. The software layer constructs an equivalent model of the transmission line, initializes the capacitance estimation value based on the measured data, and executes the least squares iterative algorithm: calculate the sum of squared residuals, analyze the sensitivity gradient direction, update the partial derivative of the Jacobian matrix, and adjust the capacitance estimation step size. When the root mean square error of the residuals exceeds the threshold, trigger the adaptive step size contraction, reduce the step size according to the exponential rule and recalculate the gradient. The hardware layer is linked with the programmable logic device through the SPI interface to update the capacitance value to the dynamic impedance matching module in real time. The convergence threshold is set to the sum of squared residuals less than 1e-6 to ensure that the capacitance estimation error is less than 5%.

[0037] Compared with the traditional fixed capacitance calibration method, Step 1 significantly improves the accuracy of distributed capacitance measurement through dynamic parameter estimation and adaptive iteration mechanism, and effectively responds to the dynamic changes of the bus topology in complex industrial environments (such as node addition and deletion, cable length fluctuation). The combination of gradient sensitivity analysis and step size contraction mechanism avoids the problems that the traditional least squares method is prone to falling into local optimum or divergence, and ensures the robustness of parameter estimation. The accurate equivalent distributed capacitance value provides a reliable basis for subsequent impedance matching and signal conditioning, and suppresses the signal attenuation and timing drift caused by the high capacitance effect from the root.

[0038] In step 2 of the above embodiment, the adjustable resistor array uses a digital potentiometer (such as AD5292) to receive the PWM resistor adjustment instruction from the PID controller. The reference impedance is set to 120Ω, and the dynamic adjustment range is ±30%. The charge conservation model calculates the capacitance change rate in real time through the FPGA, and drives the DAC module to output an exponential bias current to the RS485 driver (such as SN65HVD3082). The PID parameters are initialized as Kp = 0.8, Ki = 0.2, Kd = 0.1, and the integral separation threshold is set to disable the integral term when the bus voltage overshoot exceeds 200mV. The EWMA filtering weight coefficient α = 0.3 is used to perform a moving average process on the real-time capacitance value. The hardware layer synchronously updates the resistor value and the bias current instruction through the I2C bus, and the critical damping matching target is the signal reflection coefficient Γ ≤ 0.1. Compared with the traditional fixed terminal resistor scheme, step 2 significantly reduces the signal reflection and ringing effects caused by bus impedance mismatch through the collaborative optimization of PID dynamic control and the charge conservation model. The exponential bias current compensation effectively cancels the charge residue caused by the capacitance effect and shortens the driver switching delay. The combination of the integral separation strategy and the EWMA filtering mechanism suppresses the controller oscillation caused by parameter fluctuations and improves the stability of impedance matching. The critical damping matching ensures the rapid dissipation of signal energy, improves the signal edge quality, and lays a highly reliable physical layer foundation for subsequent automatic identification and communication expansion.

[0039] In step 3 of the above embodiment, the charge discharge mechanism determines the target value of the discharge current through a dynamic charge quantity calculation model based on the bus equivalent distributed capacitance value obtained in real time in step 1. This model correlates the equivalent distributed capacitance value with the bus voltage attenuation characteristic, establishing an inverse proportional relationship between the discharge current amplitude and the capacitance value to ensure the consistency of the discharge efficiency under different capacitive loads. The thyristor-triggered transient discharge circuit adopts a pulse modulation method to control the discharge intensity by adjusting the pulse duty cycle. When the residual charge quantity on the bus is large, the duty cycle is increased to enhance the instantaneous discharge power, and vice versa, the duty cycle is decreased to reduce energy loss. If the bus voltage drop rate after discharge does not reach the preset threshold (for example, the voltage does not drop below the threshold within 50 ns), the system triggers the secondary discharge circuit, and enhances the discharge intensity in stages through the stepwise increasing current superposition method until the bus voltage is forced to be pulled down to the lower threshold of the hysteresis comparator. The closed-loop feedback mechanism records the key parameters (such as the number of discharges, current peak value, and voltage attenuation time) during the discharge process in real time, and dynamically corrects the amplitude and width of the subsequent discharge pulses to form an adaptive charge management strategy. The hysteresis comparator dynamically adjusts the double-threshold window according to the equivalent distributed capacitance value. The upper threshold rises with the capacitance value ratio to suppress false triggering in a high-capacitance environment, and the lower threshold decreases proportionally to accelerate the determination of the idle state. The voltage change rate detection module monitors the bus voltage drop slope in real time. When the slope is lower than the preset value (such as 0.5 V / μs), it triggers the window width adaptive expansion mechanism to expand the hysteresis window to 1.5 times the original width, extending the determination time window to cope with the interference of slow-changing signals. Finally, the idle flag signal is locked through the status latch to ensure the uniqueness and stability of the bus state determination.

[0040] During implementation, in the hardware realization, the thyristor-triggered transient discharge circuit uses the STTH3080 thyristor device. Its trigger signal is generated by the STM32H7 microcontroller through the PWM module. The initial discharge pulse amplitude is set to 5A, the duty cycle range is 10%-90%, and the pulse frequency is 1MHz. The bus voltage is real-time sampled by the AD7606 high-speed ADC at a sampling rate of 10MSPS, and the voltage drop rate threshold is set to 1V / μs. When it is detected that the voltage after discharge does not reach the expected attenuation rate, the microcontroller issues an instruction to the LTC7001 driver chip through the SPI bus to start the secondary discharge circuit. The stepped increasing current step is 2A, and the maximum superposition times is 3 times. The closed-loop feedback parameter correction algorithm constructs an empirical model based on historical discharge data (such as the number of discharges, voltage attenuation time), and dynamically adjusts the pulse parameters through the exponential weighted average method. The hysteresis comparator uses the LMV7219 high-speed comparator. The initial value of the upper threshold is +200mV, the lower threshold is -200mV, and the threshold adjustment coefficient is set to adjust the threshold by ±10mV corresponding to every 100pF capacitance change. The voltage change rate detection module extracts the first derivative of the voltage signal through a differential circuit. When it is detected that the slope is lower than 0.5V / μs, the FPGA logic unit expands the hysteresis window to 300mV and controls the window maintenance time to be 200ns through a state machine. The status latch uses the 74HC574 chip to lock the idle flag signal after the bus voltage is stably lower than the lower threshold, and drives the LED indicator to display the port status through the GPIO.

[0041] Through the collaborative design of the charge discharge mechanism and the dynamic hysteresis comparator, the present invention effectively eliminates the level ambiguity problem caused by residual charge during the driver switching process, and significantly improves the accuracy and response speed of the bus idle state determination. Compared with the traditional fixed threshold comparison and passive discharge scheme, this technology can adapt to different bus capacitance loads, suppress signal reflection and delay in a high-capacitance environment, and reduce the probability of communication conflicts and data retransmission. At the same time, the closed-loop feedback mechanism and the window adaptive expansion function enhance the anti-interference ability of the system, ensure long-term stable operation in complex industrial scenarios, and provide reliable physical layer support for multi-node RS485 communication.

[0042] In step 4 of the above embodiment, the finite impulse response (FIR) digital filter is selected as the core processing unit for high-frequency compensation due to its inherent linear phase characteristics and stability advantages. Its technical principle is first reflected in the construction of a programmable filter coefficient matrix to dynamically adapt to the fundamental frequency and harmonic attenuation characteristics of the bus signal. Specifically, based on the equivalent distributed capacitance value measured in step 1 and the signal edge time parameter conditioned in step 3, the system extracts the fundamental frequency component of the signal and its harmonic attenuation slope through spectrum analysis, and establishes a frequency response model. This model abstracts the bus transmission characteristics into a frequency-domain transfer function, where the high-frequency attenuation is mainly caused by the capacitive load effect of the distributed capacitance and the line impedance. The design of the FIR filter is based on the inverse transfer function theory, and the signal is pre-emphasized by constructing a gain curve complementary to the attenuation characteristics in the frequency domain. In specific implementation, the filter coefficients are dynamically updated according to the real-time spectrum characteristics: when a fundamental frequency offset of the signal or an increase in harmonic attenuation is detected (for example, due to an increase in bus capacitance caused by node addition), the system iteratively optimizes the filter coefficients through the least mean square (LMS) algorithm, so that the compensated signal presents a steep edge in the time domain and restores the high-frequency energy ratio in the frequency domain. The dynamic configuration mechanism further combines the real-time signal-to-noise ratio (SNR) parameter of the bus signal, and introduces an adaptive noise reduction weight in the low SNR scenario to suppress the amplification effect of high-frequency noise during the compensation process. The core of the pre-emphasis process is to pre-cancel the attenuation of the high-frequency components of the signal by increasing the energy density of the high-frequency components of the signal, so as to reconstruct a signal shape close to the original transmitted waveform at the receiving end, reducing the inter-symbol interference (ISI) and the bit error rate (BER). In addition, the order selection of the FIR filter is based on the Nyquist sampling theorem and the bus bandwidth requirement, ensuring that the main harmonic components are covered under the premise of meeting the real-time performance. A typical configuration is a 64th-order filter to support harmonic compensation up to 4 times the fundamental frequency.

[0043] During implementation, at the hardware implementation level, step 4 relies on the programmable logic resources of an FPGA (such as the Xilinx Kintex-7 series) to construct a real-time FIR filter processing pipeline. The signal conditioning module receives the pre-emphasis requirement instructions and real-time spectrum parameters from step 3 and performs convolution operations through a high-speed parallel multiplier-accumulator (MAC) unit. The filter coefficients are stored in dual-port RAM and are updated by the dynamic configuration engine according to the following process: First, the spectrum analysis module performs a 1024-point FFT operation on the received signal to extract the amplitude attenuation rates of the fundamental frequency component (such as 1 MHz) and its third harmonic (3 MHz); Second, based on the attenuation rates and the equivalent distributed capacitance value in step 1, the target gain curve is calculated through the LMS algorithm to generate a 64th-order FIR coefficient matrix; Finally, after the coefficient matrix is normalized, it is written into the RAM, and a filter reload instruction is synchronously triggered. The software layer communicates with the main control MCU (such as STM32H743) through the UART interface, monitors the signal-to-noise ratio parameter in real time, activates the noise reduction weight when the SNR is lower than 20 dB, and introduces a Hamming window function in the coefficient calculation to suppress out-of-band noise. Parameter configuration examples include: when the fundamental frequency is 1 MHz, the cut-off frequency of the filter passband is set to 2 MHz, the cut-off frequency of the stopband is 4 MHz, and the passband ripple is limited within ±0.1 dB; the dynamic update period is set to perform FFT and coefficient recalculation every 10 ms to ensure a rapid response to changes in the bus topology. The preprocessed signal is converted into a digital level by a hysteresis comparator (such as TI TL331) and output to the subsequent timing calibration module. In terms of hardware resource occupancy, the FIR filter consumes approximately 15% of the FPGA logic units and 8 blocks of 18Kb BRAM, meeting the real-time processing requirements of 100 Mbps.

[0044] Compared with traditional fixed-parameter pre-emphasis circuits, this step significantly improves the compensation accuracy of signal high-frequency attenuation in complex industrial environments by dynamically configuring FIR filter coefficients. Its adaptive spectrum reconstruction ability effectively overcomes the problem of signal edge blurring caused by fluctuations in cable length and changes in the number of nodes, ensuring accurate decision-making on logic levels at the receiving end and reducing the error code risk caused by insufficient high-frequency energy. At the same time, combined with the adaptive noise reduction mechanism of real-time signal-to-noise ratio, it suppresses noise amplification while maintaining signal integrity, further enhancing the anti-interference ability and long-term stability of the communication system.

[0045] In step 5 of the above embodiment, the preamble synchronization mechanism captures the edge zero-crossing timestamps of the preamble (such as the 0x55 sequence) through a zero-crossing detection circuit, generates a zero-crossing sequence, and constructs a discrete model of signal propagation delay. This model is based on the non-linear relationship between the equivalent distributed capacitance value and the signal transmission rate, quantifies the delay increment caused by the capacitance effect as a phase offset on the time axis, and establishes a state prediction equation through the Kalman filtering algorithm. The state vector of the Kalman filter includes the current signal propagation delay and its change rate, the observation vector is the actual time interval of the zero-crossing sequence, and the process noise covariance matrix is dynamically adjusted according to the fluctuation of the equivalent distributed capacitance value to reflect the randomness of the bus topology change. When the deviation between the actual sampling point and the prediction window exceeds the preset threshold, the covariance matrix reset mechanism is triggered to force the process noise parameters to be restored to the initial calibration value, avoiding filter divergence caused by capacitance mutation. The observation residual detection module calculates the difference between the predicted delay and the actual delay in real time. If the residual exceeds the statistical confidence interval (such as the 3σ principle), the dynamic gain adjustment strategy is started, and the Kalman gain coefficient is updated according to an exponential law to suppress prediction oscillation. The dynamic gain adjustment smooths the impact of burst noise on the prediction model by weighting the historical residual change rate, ensuring the stability of timing calibration. Finally, the starting position and width of the dynamically adjusted sampling window cover the stable interval of the effective edge of the signal, avoiding symbol overlap or decision ambiguity caused by the capacitance accumulation effect.

[0046] In implementation, the zero-crossing detection circuit in this step works in cooperation with a high-speed comparator (such as TI LMV7219) and FPGA logic. The comparator outputs the zero-crossing pulses of the preamble signal, and the FPGA records the pulse time intervals through a counter and generates a zero-crossing point sequence. The Kalman filtering algorithm runs in the DSP module (such as ADI ADSP-SC589). The initial state vector is set to [delay = 0, rate of change = 0], the process noise covariance matrix Q is initialized as a diagonal matrix [1e-6, 1e-6], and the observation noise covariance matrix R is set to 1e-5. The equivalent distributed capacitance value is input into the DSP in real time through the SPI interface, and the off-diagonal elements of the Q matrix are dynamically adjusted to 0.1 times the capacitance value. When it is detected that the sampling point deviation exceeds 10% of the bit period (such as 1 μs @ 1 Mbps), the covariance matrix reset is triggered, and Q is restored to the initial value. The observation residual detection module calculates the absolute value of the residual. If it exceeds 3 times the standard deviation (calculated based on the historical residual sequence), the dynamic gain adjustment is activated, and the Kalman gain coefficient is updated according to the exponential function, with the attenuation factor α = 0.8. The starting position of the dynamically adjusted sampling window is fine-tuned through the programmable delay line (such as Xilinx IDELAYE2) of the FPGA, and the window width is dynamically set according to the product formula of the current bit rate and the capacitance value. For example, when the bit rate is 1 Mbps and the capacitance value is 200 pF, the window width is set to 900 ns. In terms of hardware resource occupancy, the Kalman filtering calculation of the DSP module consumes approximately 15% of the processor load, and the occupancy rate of the FPGA logic units is less than 8%, meeting the real-time requirements.

[0047] Compared with the traditional fixed sampling window scheme, this step significantly improves the sampling accuracy in multi-node and long-distance RS485 communication through the dynamic timing calibration of preamble synchronization and Kalman filtering, effectively suppressing the timing drift and inter-symbol interference caused by the accumulation of distributed capacitance. The adaptive covariance reset and dynamic gain adjustment mechanism enhance the robustness to topological mutations, ensure the stability of signal decision in complex industrial environments, and reduce the bit error rate and the risk of communication conflicts.

[0048] In step 6 of the above embodiment, based on the equivalent distributed capacitance value, the static impedance characteristic parameters of the bus are calculated, an association model between the bus voltage change rate and the steady-state level reference is established, and the idle state determination threshold is dynamically adjusted through the adaptive threshold calculation model. According to the real-time change of the bus impedance (such as distributed capacitance fluctuation or cable length difference), the model sets the determination threshold to a dynamic range (such as 0.5V to 1.5V) to avoid misjudgment caused by impedance mismatch of the fixed threshold in a complex environment. The differential voltage amplitude comparison method extracts the instantaneous change rate of the voltage amplitude by high-speed sampling the bus differential signal, and combines the sliding mean filtering algorithm to eliminate short-term noise interference (such as electromagnetic pulses or transient glitches). The length of the sliding mean filtering window is positively correlated with the equivalent capacitance value of the bus, ensuring that the filtering depth in a high-capacitance environment is sufficient to suppress low-frequency noise. The symbol flip error correction method identifies the characteristics of weak collision signals (such as voltage superposition distortion caused by simultaneous transmission of multiple nodes) by detecting the regularity of the polarity jump of the differential signal (such as the number of consecutive symbol flips), improving the collision detection sensitivity. When the collision characteristics are detected, the preemption delay time is generated based on the preset node priority weight (such as the master node weight is 0.8 and the slave node is 0.2) and the Poisson backoff model. The Poisson backoff model calculates the random backoff time window through the exponential distribution function. Nodes with higher priority are assigned shorter backoff times, and nodes with the same priority disperse the retry opportunities through the competition window dynamic allocation algorithm (such as the time slot length is 10ms). Finally, the collision arbitration control unit outputs the bus access permission instruction in combination with the time division multiplexing channel scheduling model (such as TDMA time slot allocation), ensuring that high-priority nodes quickly preempt the bus, and low-priority nodes wait in order, realizing the rapid resolution of collisions and the efficient utilization of channel resources.

[0049] During implementation, this step uses the STM32H743 microcontroller as the main control unit, and the AD7606 high-speed ADC is used to collect the bus differential voltage signal in real time at a sampling rate of 1MSPS. The bus static impedance parameter calculation module dynamically sets the impedance matching range (such as 80Ω to 200Ω) based on the equivalent distributed capacitance value (output of step 1) and the transmission line model formula. The adaptive threshold calculation model takes the impedance value as the input, and maps the idle determination threshold to 0.5V to 1.5V through linear interpolation, and the threshold update period is 1ms. The length of the sliding mean filter window is dynamically adjusted according to the capacitance value (such as when the capacitance value increases by 100pF, the window length increases by 5 sampling points). The filtered voltage signal is sent to the symbol flip detection circuit (such as the SN74LVC1G14 Schmitt trigger), and the number of consecutive symbol flips is counted (the threshold is set to 3 times). The conflict arbitration logic is implemented by an FPGA (such as Xilinx Artix-7), the priority weight table is stored in the EEPROM, and the λ parameter of the Poisson backoff model is set to 0.1 (corresponding to an average backoff time of 10ms). The dynamic allocation algorithm for the contention window divides the time slot into 10ms intervals, and the node generates a random backoff time slot according to the weight (for example, the backoff time range of a node with a weight of 0.8 is 0-2ms, and that of a node with a weight of 0.2 is 8-10ms). The time-division multiplexing channel scheduling model allocates communication time slots through a hardware timer (such as TIM2). When the conflict arbitration is successful, it triggers the GPIO to output a bus enable signal to the RS485 driver (such as MAX13487E), and at the same time drives the LED indicator to display the bus status. Through the dynamic threshold determination and intelligent conflict arbitration mechanism, the present invention significantly improves the conflict detection accuracy and arbitration efficiency of the multi-node RS485 bus. Compared with the traditional fixed threshold and polling arbitration scheme, this technology can adapt to the change of bus impedance, suppress misjudgment caused by noise interference, and quickly identify and resolve conflicts. The combination of the priority weight and the Poisson backoff model optimizes the allocation of bus access rights, reduces the waiting time of high-priority nodes, enhances the real-time performance and stability of the system in high-load scenarios, and provides a reliable multi-node communication solution for industrial automation scenarios.

[0050] In step 7 of the above embodiments, when the system detects that the bit error rate exceeds the limit or the timing calibration deviation accumulates to a preset threshold, a bus parameter re-measurement process is triggered. The core innovation lies in the multi-dimensional regression analysis that integrates the historical topology feature matrix and real-time error data. The generalized least squares regression algorithm constructs a global impedance fitting model to associate the historical topology feature matrix (such as the number of nodes, cable length, capacitance value sequence) with the current error vector (such as bit error rate, timing deviation), and solves the optimal increment of the impedance matching parameters. The time domain reflectometry (TDR) injects high-frequency test pulses and analyzes the reflected waveforms to resolve local mutation points of the bus transient impedance (such as poor connector contact or impedance mismatch of branch cables), and constructs a distributed load model. The recursive least squares filtering algorithm iteratively updates the matching resistor compensation coefficient based on the real-time error data within a sliding window, and optimizes the parameter convergence speed through covariance matrix recursion to suppress measurement noise interference. The adaptive finite impulse response (FIR) filter uses the spectral analysis method to extract the harmonic attenuation characteristics of the current signal, combines with the linear predictive coding (LPC) algorithm to predict the attenuation trend of high-frequency components, and dynamically adjusts the pre-emphasis compensation weight matrix. The LPC algorithm constructs an autoregressive model to associate the historical harmonic attenuation parameters with the current spectral characteristics, and generates predicted values of future compensation weights, so that the pre-emphasis coefficient can adapt to load changes prospectively. Finally, the updated impedance matching model and pre-emphasis parameters are jointly verified through a collaborative optimization engine to ensure the global optimality of impedance matching and signal compensation.

[0051] During implementation, the bus parameter re-measurement process is executed collaboratively by the master DSP (such as TI TMS320C6748) and the FPGA. The historical topology feature matrix is stored in the external Flash, recording the equivalent capacitance, the number of nodes, and the bit error rate data of the most recent 100 measurements. The generalized least squares regression algorithm runs on the DSP, with the initial convergence threshold set to the sum of squared residuals less than 1e-5 and the maximum number of iterations 50 times. The time-domain reflectometry measurement module consists of a high-speed ADC (ADS4129, sampling rate 250MSPS) and a pulse generator (ADPULSE-PG2), injecting a 2MHz test pulse and collecting the reflected waveform. The positions and amplitudes of the transient impedance mutation points are extracted through the FFT module of the FPGA. The recursive least squares filter uses a sliding window length N = 10, and the covariance matrix is initialized with diagonal elements of 1e-4, updating the weight coefficients at each iteration. The pre-emphasis weight matrix of the adaptive FIR filter is generated through the LPC prediction module of the FPGA, with the LPC order set to 8th order, the prediction window length 5ms, and the weight update period 1ms. The collaborative optimization engine receives the impedance matching parameters and the pre-emphasis weights through the UART interface. The verification logic determines whether the impedance reflection coefficient Γ is lower than 0.1 and the signal-to-noise ratio SNR is higher than 20dB. If the verification fails, the parameter rollback mechanism is triggered to restore to the previous stable version. After the parameter update is completed, the master MCU configures the digital potentiometer (AD5280) and the DAC module (AD5627) through the I2C bus, adjusting the terminal resistance value and the bias current respectively.

[0052] Compared with the traditional static parameter configuration scheme, this step significantly improves the system's adaptability to dynamic topology and load fluctuations through a closed-loop self-optimization mechanism driven by historical data, effectively suppressing the performance degradation caused by hardware aging or environmental interference. The collaborative optimization of global impedance fitting and forward-looking pre-emphasis compensation ensures the long-term stability of signal integrity and timing consistency in complex industrial scenarios, significantly reducing the maintenance cost and the risk of failures.

[0053] Although the specific implementation manners of the present invention have been described above, those skilled in the art should understand that these specific implementation manners are only illustrative. Without departing from the principles and essence of the present invention, those skilled in the art can make various omissions, substitutions, and changes to the details of the above methods and systems. For example, combining the above method steps so as to perform substantially the same function in a substantially the same manner to achieve substantially the same result falls within the scope of the present invention. Therefore, the scope of the present invention is only defined by the appended claims.

Claims

1. An automatic recognition and extended communication method based on the RS485 interface; characterized in that: The method includes the following steps: Step 1: Send a test signal with a preset frequency to the RS485 bus through the master controller. The receiving end collects the signal edge time parameter and the amplitude-frequency attenuation characteristic, and uses the least square parameter estimation algorithm to calculate the equivalent distributed capacitance value in real time. The equivalent distributed capacitance value is the superposition value of the parasitic capacitance of the bus transmission line and the capacitance to ground of the node, and is used to characterize the bus signal attenuation characteristic; Step 2: According to the equivalent distributed capacitance value, dynamically adjust the resistance value of the terminal matching resistor through the proportional integral differential control algorithm, and adjust the bias current of the driver according to the exponential law based on the charge conservation model; Step 3: During the gap of the driver mode switch, adopt the charge discharge mechanism, and generate a discharge current pulse based on the equivalent distributed capacitance value through the thyristor-triggered transient discharge loop, force the residual charge of the bus to zero within the time window, and verify the bus idle state through the hysteresis comparator; Step 4: According to the signal edge time parameter, construct a high-frequency gain compensation model using the finite impulse response digital filter, dynamically configure the filter coefficient according to the fundamental frequency and harmonic attenuation characteristics of the bus signal, perform pre-emphasis processing on the received signal, and output the conditioned signal after high-frequency compensation; Step 5: According to the conditioned signal, extract the signal zero-crossing sequence through the preamble synchronization mechanism, and combine the equivalent distributed capacitance value, use the Kalman filter algorithm to predict the signal propagation delay, and dynamically adjust the start position and width of the sampling window; Step 6: Before the node initiates communication, dynamically set the idle state determination threshold according to the equivalent distributed capacitance value, and use the differential voltage amplitude comparison method to detect the bus occupancy state; if a conflict is detected, generate a preemption delay time based on the preset node priority weight and the Poisson backoff model, and output a bus access permission instruction; Step 7: When it is detected that the bit error rate exceeds the preset threshold or the timing calibration deviation in Step 5 exceeds the limit, trigger the bus parameter re-measurement process, combine the historical topology feature matrix and the current error data, and update the impedance matching model and the pre-emphasis filter coefficient through the least square regression algorithm.

2. The automatic recognition and extended communication method based on RS485 interface according to claim 1, characterized in that: The working principle of the least square parameter estimation algorithm is as follows: The master controller constructs a linear regression equation of the distributed capacitance and the observed parameters in the transmission line model based on the measured signal rising edge time and amplitude attenuation data, generates an initial capacitance estimate value and a residual vector; then, analyzes the sensitivity gradient of the capacitance change to the rising edge time and amplitude attenuation through the sensitivity gradient analysis method, and adjusts the initial capacitance estimate value in the opposite direction of the gradient to reduce the sum of squared residuals. In each iteration, update the parameter step size according to the partial derivative direction of the Jacobian matrix until the residual falls into the preset convergence threshold interval; During the adjustment process, if it is detected that the root mean square error of the residual exceeds the convergence threshold, the master controller uses the adaptive step size contraction mechanism to reduce the parameter adjustment amplitude according to the exponential decay rule and recalculate the sensitivity gradient to output the optimal estimate value of the equivalent distributed capacitance.

3. The automatic recognition and extended communication method based on RS485 interface according to claim 1, characterized in that: In step 2, the derivative term of the proportional-integral-derivative controller calculates the instantaneous deviation between the capacitance value and the reference impedance, the integral term accumulates the historical deviation to suppress the steady-state error, the proportional term generates a real-time adjustment coefficient, and outputs a dynamically matched resistance value to the adjustable resistor array; the charge conservation model constructs an exponential function I through an exponential bias compensation mechanism according to the capacitance value change rate and the bus voltage decay slope bias = I0e kΔC to calculate the compensation current; where ΔC is the difference between the current capacitance value and the initial calibration value, and k is the gain coefficient; if it is detected that the bus voltage overshoot exceeds the preset threshold, the integral separation strategy is triggered to disable the PID integral term to suppress oscillation; When the capacitance value volatility is higher than the preset threshold, the real-time capacitance value is filtered by the exponentially weighted moving average method to generate a smoothed capacitance sequence and input it into the PID controller; finally, the dynamically optimized terminal resistance value and bias current command are output to the driver to make the bus impedance and distributed capacitance form a critically damped match.

4. An automatic recognition and extended communication method based on the RS485 interface according to claim 1, characterized in that: The working principle of the charge discharge mechanism is as follows: at the moment of driver mode switching, based on the equivalent distributed capacitance value output in step 1, the target value of the discharge current is determined through the dynamic charge quantity calculation model; and the thyristor-triggered pulse modulation method is used to generate a discharge current pulse inversely related to the capacitance value, and the discharge intensity is controlled by adjusting the pulse duty cycle; if it is detected that the voltage drop rate after discharge does not reach the preset threshold, the secondary discharge circuit is triggered to superimpose a stepwise increasing current until the bus voltage drops to the lower limit of the hysteresis comparator; finally, the discharge parameters are recorded through closed-loop feedback to dynamically correct the amplitude and width of subsequent pulses.

5. The automatic recognition and extended communication method based on RS485 interface according to claim 1, wherein: The hysteresis comparator dynamically adjusts the upper threshold and lower threshold of the hysteresis window based on the equivalent distributed capacitance value. The upper threshold is raised in proportion to the capacitance value, and the lower threshold is lowered in proportion to the capacitance value. The hysteresis comparator real-time monitors the bus voltage drop slope through the voltage change rate detection module. If the slope is lower than the preset value, the window width adaptive expansion mechanism is triggered to expand the hysteresis window to 1.5 times the original width; when the bus voltage is stable below the lower threshold, the idle flag signal is locked through the status latch.

6. The automatic recognition and extended communication method based on the RS485 interface according to claim 1, characterized in that: The preamble synchronization mechanism extracts the zero-crossing point sequence of the preamble signal through the zero-crossing detection circuit at the receiving end and constructs a propagation delay model based on the sequence time interval; the propagation delay model uses the Kalman filter to predict the current signal propagation delay and dynamically adjusts the start position and width of the sampling window; when the deviation between the actual sampling point and the predicted window exceeds the threshold, the noise parameters of the Kalman filter are updated to adapt to the environmental changes.

7. A method for automatic recognition and extended communication based on RS485 interface according to claim 1, characterized in that: In step 5, the Kalman filter algorithm calculates the deviation between the predicted value and the actual value through the observation residual detection module. If the residual exceeds the statistical confidence interval, the covariance matrix reset mechanism is triggered, and the dynamic gain adjustment strategy is adopted to update the Kalman gain coefficient exponentially according to the residual change rate to suppress the prediction oscillation caused by capacitance mutation.

8. An automatic recognition and extended communication method based on RS485 interface according to claim 1, characterized in that: The working principle of step 6 is as follows: based on the equivalent distributed capacitance value, the bus static impedance characteristic parameters are calculated. Before the node initiates communication, the differential voltage amplitude comparison method is used to compare the current bus voltage change rate with the historical steady-state level reference, and the idle state determination threshold is dynamically adjusted through the adaptive threshold calculation model. During the occupancy detection process, the short-time noise interference is eliminated through the high-speed sampling window sliding mean filtering algorithm, and the symbol flip error correction method is applied to analyze the weak conflict signal. If it is detected that the voltage jump conforms to the conflict characteristics, the Poisson distribution time parameter is calculated through the exponential backoff random process, and the node priority weight is analyzed according to the distributed arbitration protocol. The backoff time is generated by the competitive window dynamic allocation algorithm, and the bus arbitration state transition is executed in the conflict arbitration control unit, and the bus access permission instruction is output in combination with the time division multiplexing channel scheduling model.

9. A method for automatic identification and extended communication based on RS485 interface according to claim 1, characterized in that: The bus parameter re-measurement process is based on the historical topology feature matrix and real-time error data. It applies the generalized least squares regression algorithm to calculate the global impedance fitting parameters, combines the time-domain reflectometry to analyze the transient impedance change trend, and constructs a distributed bus load model. During the impedance fitting process, the recursive least squares filtering algorithm is used to update the matching resistor compensation coefficient, and the adaptive finite impulse response filter is used to dynamically adjust the pre-emphasis compensation weight matrix. The adaptive finite impulse response filter calculates the harmonic attenuation characteristic parameters through the spectrum analysis method, and optimizes the high-frequency gain compensation model based on the linear predictive coding algorithm to make the updated filtering parameters match the load characteristic matrix synergistically.

Citation Information

Patent Citations

  • An adaptive RS232 and RS485 interface circuit

    CN117271416B

Cited By

  • Half-duplex bus communication ad hoc network method and system based on Poisson backoff model

    CN121262097A

  • A method and system for half-duplex bus communication ad hoc networking based on the Poisson backoff model

    CN121262097B

  • Sensor signal active fault-tolerant control system for strong electromagnetic pulse environment

    CN121432994A

  • Extensible server architecture system suitable for various processors

    CN121478090A

  • Control system real-time monitoring method based on multi-unit cooperation

    CN121857532A