Dual-bus Communication Method, Device, System, and Storage Medium
By adjusting the reference voltage and bus voltage threshold in the dual bus communication system, the instability of dual bus communication in the long distance is solved, and the longer communication distance and lower cost are achieved.
Patent Information
- Application Number
- CN202210936786.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-05
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-08-05
AI Technical Summary
Dual bus communication is unstable under long distances, resulting in the node device being unable to receive commands issued by the host device, and the control is invalid.
By obtaining the sampling signal of the bus voltage threshold, the frame reception status of the node device is determined, and whether it is a patrol frame drop status is determined. If the inspection frame drop state occurs, adjust the reference voltage and update the bus voltage threshold to improve communication stability.
It improves the stability of dual-bus communication, extends the installation distance of node equipment, reduces cable costs, and ensures communication reliability.
Smart Images

Figure CN115460033B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of dual-bus communication, and particularly to a dual-bus communication method, device, system, and storage medium. Background Art
[0002] To save on-site wiring and costs, dual-bus communication technology has been widely applied. Multiple node devices are mounted on two buses, and the host device powers and communicates with each node device through the dual buses without an external 24V power supply.
[0003] Cables naturally have impedance. For high-quality cables, the impedance is about 20 ohms per 1000 meters, but the price is relatively high; for ordinary cables, the impedance is about 60 ohms per 1000 meters; for inferior cables, the impedance is even greater, but the price is cheaper.
[0004] As the distance of the communication cable increases, it will cause the bus voltage of the node device to drop sharply relative to the bus voltage of the host device. When the position where the node device is connected is far away and a fire alarm occurs and the node device needs to be controlled for linkage, if the communication is abnormal, the node device will not receive the command issued by the host device, resulting in control failure. In the case of long-distance communication, the communication stability will limit the installation distance of the node device. In related technologies, to expand the installation distance of the node device and ensure communication stability at the same time, low-impedance cables will be used, but this will increase costs.
[0005] Regarding the problem of unstable dual-bus communication in related technologies, no effective solution has been proposed yet. Summary of the Invention
[0006] In this embodiment, a dual-bus communication method, device, system, and storage medium are provided to solve the problem of unstable dual-bus communication in related technologies.
[0007] In a first aspect, in this embodiment, a dual-bus communication method is provided, which is applied to a host device. The host device powers and communicates with a node device through a dual bus. The method includes:
[0008] Obtain a first signal, where the first signal is obtained by demodulating a sampling signal of the dual bus according to a bus voltage threshold;
[0009] Determine the frame reception situation of the corresponding node device according to the first signal, and determine whether the frame reception situation is a patrol frame loss state;
[0010] In the case where it is determined that the frame reception situation is the patrol frame loss state, adjust the reference voltage, and update the bus voltage threshold according to the adjusted reference voltage.
[0011] In some of these embodiments, adjusting the reference voltage includes: repeatedly performing the following steps until the inspection frame loss state is eliminated:
[0012] Adding the current reference voltage R to a preset value X to obtain an adjusted reference voltage, where X = i × k, i is a positive integer, k is a real number, and the unit of k includes volts;
[0013] Determining whether an inspection frame loss state occurs within a preset time period;
[0014] When it is determined that an inspection frame loss occurs within the preset time period, taking the opposite of i and adding the current reference voltage R to the preset value X;
[0015] Determining whether an inspection frame loss state occurs within a preset time period;
[0016] When it is determined that an inspection frame loss occurs within the preset time period, taking the opposite of i and then adding 1 numerical unit.
[0017] In some of these embodiments, the inspection frame loss state includes:
[0018] After sending an inspection frame to the corresponding node device, there are N consecutive inspection frame loss states; or,
[0019] When batch-inspecting all node devices, after completing one inspection task for all node devices, there are M consecutive N inspection frame loss states;
[0020] Both M and N are positive integers.
[0021] In some of these embodiments, before demodulating the sampling signal of the dual bus according to the bus voltage threshold, the method further includes:
[0022] Determining a corresponding target interval among multiple voltage intervals according to the voltage of the sampling signal;
[0023] Obtaining the reference voltage corresponding to the target interval, and determining the bus voltage threshold according to the reference voltage corresponding to the target interval.
[0024] In some of these embodiments, the method further includes:
[0025] If the voltage of the sampling signal is not within any of the multiple voltage intervals, taking one of the voltage intervals as the target interval corresponding to the sampling signal.
[0026] Second, in this embodiment, a dual-bus communication device is provided, including: a communication module, a signal processing module, and a control module, where the communication module and the signal processing module are respectively connected to the control module; among them,
[0027] The communication module is used to receive signals generated by node devices from the dual buses, and send signals generated by the host device to the dual buses;
[0028] The signal processing module is used to sample the signals of the dual buses, and demodulate the sampled signals according to the bus voltage threshold to obtain a first signal;
[0029] The control module can determine the frame reception situation of the corresponding node device according to the first signal, judge whether the frame reception situation is the patrol frame loss state, and when it is judged that the frame reception situation is the patrol frame loss state, adjust the reference voltage of the signal processing module, and update the bus voltage threshold according to the adjusted reference voltage.
[0030] In some of these embodiments, the communication module includes: a first bus port, a second bus port, a rectification unit, and a level adjustment unit; where
[0031] The first end of the rectification unit is connected to the first bus port, the second end of the rectification unit is connected to the second bus port, and the third end of the rectification unit is connected to the level adjustment unit.
[0032] In some of these embodiments, the signal processing module includes: a sampling unit, a voltage dividing unit, and a comparator connected in sequence; where the first input terminal of the comparator is connected to the voltage dividing unit, and the second input terminal of the comparator is used to be connected to the control module.
[0033] In some of these embodiments, the control module and the comparator are integrated in an integrated circuit chip, and the sampling unit and the voltage dividing unit are respectively connected to the pins of the integrated circuit chip.
[0034] In a third aspect, a dual-bus communication system is provided in this embodiment, including a first bus, a second bus, a host device, and multiple node devices. The host device supplies power to and communicates with each node device through the first bus and the second bus. The host device includes the dual-bus communication device described in the second aspect above.
[0035] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored. When the program is executed by a processor, it implements the dual-bus communication method described in the first aspect above.
[0036] Compared with the related art, in the dual-bus communication method, device, system, and storage medium provided in this embodiment, by obtaining a first signal, where the first signal is obtained by demodulating the sampling signal of the dual bus according to a bus voltage threshold; determining the frame reception situation of the corresponding node device according to the first signal, and judging whether the frame reception situation is a patrol frame loss state; in the case where it is determined that the frame reception situation is a patrol frame loss state, adjusting the reference voltage, and updating the bus voltage threshold according to the adjusted reference voltage, the problem of unstable dual-bus communication in the related art is solved, and the stability of dual-bus communication is improved.
[0037] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments and descriptions thereof of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0039] Figure 1 is a schematic structural diagram of a dual-bus communication system in an embodiment;
[0040] Figure 2 is a schematic structural diagram of a host device in an embodiment;
[0041] Figure 3 is a schematic waveform diagram of a sampling signal in an embodiment;
[0042] Figure 4 is a schematic structural diagram of a communication module in an embodiment;
[0043] Figure 5 is a hardware circuit diagram of a communication module in an embodiment;
[0044] Figure 6 is a schematic structural diagram of a signal processing module in an embodiment;
[0045] Figure 7 is a hardware circuit diagram of a signal processing module in an embodiment;
[0046] Figure 8 is a hardware circuit diagram of a host device in an embodiment;
[0047] Figure 9 is a schematic waveform diagram of the sampling signal after demodulation in an embodiment;
[0048] Figure 10 is a flowchart of a dual-bus communication method in an embodiment;
[0049] Figure 11 Schematic diagram of the process for adjusting the reference voltage in an embodiment;
[0050] Figure 12 Workflow diagram of the host device in an embodiment. Detailed implementation manners
[0051] For a clearer understanding of the purpose, technical solution, and advantages of this application, the following describes and explains this application in combination with the accompanying drawings and embodiments.
[0052] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by those with ordinary skills in the technical field to which this application belongs. In this application, words such as "a", "one", "a kind of", "the", "these", etc. do not indicate a limitation in quantity, and they can be singular or plural. The terms "including", "comprising", "having" and any variants thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device including a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connected", "coupled", etc. involved in this application do not limit to physical or mechanical connections, but may include electrical connections, whether directly or indirectly connected. The "plurality" involved in this application means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application only distinguish similar objects and do not represent a specific order for the objects.
[0053] In an embodiment, a dual-bus communication system is provided. Please refer to Figure 1 , Figure 1 which is the schematic diagram of the structure of the dual-bus communication system in this embodiment, including a first bus, a second bus, a host device, and multiple node devices. The host device supplies power to and communicates with each node device through the first bus and the second bus.
[0054] In this embodiment, the host device and each node device follow a master-slave response communication mechanism. The host device periodically inspects the node devices, and each node device makes a response once per inspection cycle. After an event occurs in a node device, the event will not be reported actively. Only when the host device inspects a certain node device, the node event will be reported. Whether the node device successfully receives the host command determines the communication success rate of the node device.
[0055] The node devices include, but are not limited to, point-type photoelectric smoke detectors, point-type photothermal detectors, sound and light alarms, manual alarm buttons, fire hydrant buttons, fire display panels, gas release alarms, and emergency start / stop buttons.
[0056] The host device is responsible for demodulating and parsing the signals directly collected on the dual buses, thereby controlling the communication with the node devices. The host device can adaptively adjust the reference voltage according to the frame reception situation of the node devices, thereby changing the bus voltage threshold to solve the problem of unstable dual-bus communication in the related art and improve the stability of the dual-bus communication.
[0057] Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of the host device in an embodiment. The host device includes: a communication module, a signal processing module, and a control module. The communication module and the signal processing module are respectively connected to the control module; among them, the communication module is used to receive the signals generated by the node devices from the dual buses and send the signals generated by the host device to the dual buses; the signal processing module is used to sample the signals on the dual buses and demodulate the sampled signals according to the bus voltage threshold to obtain the first signal; the control module can determine the frame reception situation of the corresponding node device according to the first signal, judge whether the frame reception situation is the state of missing frames during inspection, and adjust the reference voltage of the signal processing module and update the bus voltage threshold according to the adjusted reference voltage when it is determined that the frame reception situation is the state of missing frames during inspection.
[0058] Please refer to Figure 3 , Figure 3 which is a waveform schematic diagram of the sampled signal in this embodiment. Due to the influence of the cable impedance, waveforms such as those in the elliptical dashed box will be generated in the sampled signal. For the time being, this section of the waveform is called an abnormal waveform. The node devices mounted on the dual buses are at different distances from the host device. Especially for the remote node devices, the influence of the cable impedance is greater, because these node devices may not be able to receive the commands sent by the host device.
[0059] In this embodiment, the relationship between the reference voltage and the bus voltage threshold is: the greater the reference voltage, the greater the bus voltage threshold.
[0060] When there is Figure 3In the case of the abnormal waveform shown: For the proximal node device, the bus voltage is relatively high. If the reference voltage is set relatively small at this time, resulting in a relatively small bus voltage threshold, the low level of the abnormal waveform is easily misinterpreted as a high level, leading to communication failure. For the distal node device, the bus voltage is relatively low. If the reference voltage is set relatively large at this time, resulting in a relatively large bus voltage threshold, there may be a situation where the bus voltage threshold is greater than the highest voltage of the dual buses, then all high levels are misinterpreted as low voltages, leading to communication failure.
[0061] The related art has the following problems in demodulating the sampled signal: A voltage comparator is used to demodulate the sampled signal. However, the reference voltage of the voltage comparator is set fixedly, which makes the bus voltage threshold also fixed.
[0062] If the reference voltage remains unchanged: In the case where it is applicable to proximal communication, once the installation distance of the node device is extended, the bus voltage will be greatly reduced, resulting in communication failure of the node device; similarly, in the case where it is applicable to distal communication, once the installation distance of the node device is reduced, communication will also have problems.
[0063] The host device provided in this embodiment can adaptively adjust communication parameters according to the frame receiving state of the node device, and avoid hardware defects through software settings to solve the problem of unstable dual-bus communication in the related art and improve the stability of dual-bus communication. Moreover, the circuit for implementing the dual-bus communication method is simple, the hardware cost is low, with the same material cable, the communication distance is farther, the communication is more stable, and low-cost cables can be used at the same installation distance, reducing the cable cost.
[0064] Regarding the communication distance, assuming the initial value of the bus voltage is 28V and the bus voltage of the end node device is 12V, then the communication distance is (28 - 12) / (bus current × cable impedance). For example, if the cable impedance per 500m is 10 ohms and the current in the line is 100 mA, then the communication distance is 8000m. If the cable impedance per 500m is 40 ohms, then the communication distance is 2000m. And node devices such as smoke sensors, temperature sensors, manual alarms, and fire hydrants have relatively low power consumption, and about 400 can be loaded with 100 mA.
[0065] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a communication module in an embodiment. The communication module includes: a first bus port, a second bus port, a rectification unit, and a level adjustment unit; wherein, the first end of the rectification unit is connected to the first bus port, the second end of the rectification unit is connected to the second bus port, and the third end of the rectification unit is connected to the level adjustment unit.
[0066] Please refer to Figure 5 , Figure 5It is the hardware circuit diagram of the communication module in an embodiment. B1 and B2 are the first bus port and the second bus port respectively, and D1 is the rectifying unit, which enables B1 and B2 to be connected without polarity.
[0067] The level adjustment unit includes a pull-up resistor R3, a pull-down resistor R9, a PMOS transistor M2, a triode Q1, and a resistor R5. Among them, R5 plays a current-limiting role, and BUS_RXD is connected to one of the input terminals of the comparator. The control module analyzes data by parsing the high and low levels of the sampling signal voltage returned by the dual bus to parse the data sent by the node device. During the process of the control module sending a signal, if the level of the signal is high level 1, then M2 and Q1 are cut off, and R3 pulls up the bus level to high level; if the level of the signal is low level 0, then M2 and Q1 are turned on, and R9 pulls down the bus voltage to low level. Optionally, the model of M2 is PM505BA, and the model of Q1 is LMBTA06LT1G.
[0068] The communication module further includes a fuse F1, a TVS tube D3, a capacitor C1, and a capacitor C2. Among them, the fuse F1 plays a current-limiting role, the TVS tube D3 plays a surge protection role, and the capacitors C1 and C2 play a filtering role.
[0069] Please refer to Figure 6 , Figure 6 It is the structural schematic diagram of the signal processing module in an embodiment. The signal processing module includes: a sampling unit, a voltage dividing unit, and a comparator connected in sequence; among them, the first input terminal of the comparator is connected to the voltage dividing unit, and the second input terminal of the comparator is used to connect to the control module. Optionally, the comparator can be an analog comparator.
[0070] Please refer to Figure 7 , Figure 7 It is the hardware circuit diagram of the signal processing module in an embodiment. The sampling unit includes a resistor R12, a resistor R16, and a capacitor C12. Among them, the resistors R12 and R16 play a voltage dividing role, the capacitor C12 plays a sampling and filtering role, and AD_24V is connected to the control module for A / D conversion. If R12 / R16 = 10 and the voltage of the sampling signal is V AD_24V , then the bus voltage VBUS = 11V AD_24V .
[0071] The voltage dividing unit includes a resistor R6, a resistor R11, and a diode D4. Among them, R6 and R11 play a voltage dividing role, and D4 plays an anti-reverse connection role.
[0072] In one embodiment, the control module and the comparator are integrated in an integrated circuit chip, and the sampling unit and the voltage dividing unit are respectively connected to the pins of the integrated circuit chip. Compared with discrete devices, the integrated control module and comparator can reduce electronic interference. Optionally, the integrated circuit chip can be a single-chip microcomputer integrated with an analog comparator, where the analog comparator is used to compare an analog quantity with a standard value. When the analog quantity is higher than the value, a high (or low) level is output; otherwise, a low (or high) level is output.
[0073] Please refer to Figure 8 , Figure 8 FIG. is the hardware circuit diagram of the host device in one embodiment. The host device includes a communication module, a signal processing module, and a control module. Among them, the structures and functions of the communication module and the signal processing module have been introduced in the above embodiments and will not be elaborated here. In this embodiment, the comparator and the control module in the signal processing module are integrated in an integrated circuit chip, and the integrated circuit chip can be implemented by the Huada single-chip microcomputer HC32F003. The single-chip microcomputer realizes the dual-bus voltage sampling function through the P35 port, realizes the sending and receiving of dual-bus communication data through the P14 port and the P15 port, and realizes the function of the analog comparator through the P33 port and the P03 port.
[0074] In the related art, the BUS_RXD signal is directly connected to the RXD port of the single-chip microcomputer, and the single-chip microcomputer analyzes the BUS_RXD signal through a preset high and low level determination rule. However, when the communication distance is relatively long, or when the sampling signal on the bus is interfered, it is very easy to cause an error in parsing the BUS_RXD signal. As Figure 3 shown in the abnormal waveform, if the BUS_RXD signal is directly judged, it is very easy to parse the partial waveform that is not really pulled to the low level as a high level, resulting in a parsing error.
[0075] To solve this problem, in this embodiment, after the sampling signal is divided by R6 and R11, the sampling signal is converted into the BUS_RXD signal of the single-chip microcomputer. The BUS_RXD signal is connected to the input end P33 port of the analog comparator of the single-chip microcomputer. The BUS_RXD signal is used as the input signal of the analog comparator and compared with the reference voltage parameter set in the software of the single-chip microcomputer to integrate the BUS_RXD signal. The data waveform integrated by the analog comparator is output through the output end P03 port of the comparator and connected to the P15 port of the single-chip microcomputer. The P15 port then analyzes the received data. Please refer to Figure 9 , Figure 9 FIG. is the waveform after being processed by the analog comparator, and the abnormal waveforms are all correctly integrated.
[0076] To further ensure the accuracy of data parsing, in this embodiment, the reference voltage of the analog comparator will be adaptively adjusted through software settings. Assuming the reference voltage is a, the bus voltage threshold is:
[0077] Vth = ((R6 + R11) / R11)×a + Δv
[0078] Where Δv is the voltage drop across the diode and triode in the circuit.
[0079] If there appears Figure 3 the abnormal waveform shown, when R6 / R11 = 4 and Δv = 1, the low level of the bus voltage can only be pulled down to half of the high level. Then when the bus voltage is 28V, Vth = 5a + 1 must be greater than 28 / 2, that is, a > 2.6 to correctly resolve this abnormal waveform into a low level. When the bus voltage is 12V, Vth = 5a + 1 must be greater than 12 / 2, that is, a > 1 to correctly resolve this abnormal waveform into a low level. However, if a = 2.6 at this time, then Vth = 5a + 1 = 14V, and at this time Vth = 14 is greater than the highest bus voltage 12V, misinterpreting all high levels as low levels. Similarly, when a = 1 and the bus voltage is 28V, Vth = 5a + 1 = 6V, and at this time the low level will be misinterpreted as a high level.
[0080] Therefore, the host device provided in this embodiment can adaptively adjust the reference voltage a according to the frame reception situation of the node device, thereby adaptively adjusting the bus voltage threshold to improve the communication success rate of the dual bus. The method embodiments running on the host device will be introduced below.
[0081] Please refer to Figure 10 , Figure 10 which is a flowchart of the dual bus communication method in an embodiment. Taking the method applied to the host device in any of the above embodiments as an example, the process includes the following steps:
[0082] Step S101, obtain a first signal, where the first signal is obtained by demodulating the sampling signal of the dual bus according to the bus voltage threshold.
[0083] The bus voltage threshold is used to define whether the voltage of the signal transmitted on the bus is high level or low level. The host device collects the signal transmitted on the bus at a preset frequency to obtain a sampling signal, and the host device determines the level of the sampling signal according to the bus voltage threshold to obtain the demodulated first signal.
[0084] Step S102, determine the frame reception situation of the corresponding node device according to the first signal, and determine whether the frame reception situation is the state of missing frames during patrol inspection.
[0085] The frame reception situation refers to two situations: after the host device sends a patrol frame to the corresponding node device, the corresponding node device receives the patrol frame and does not receive the patrol frame.
[0086] The inspection frame loss state means that after the host device sends an inspection frame to the corresponding node device, at least some of the node devices do not receive the inspection frame.
[0087] The host device analyzes the first signal to determine which node devices have returned response frames and which node devices have not returned response frames, so as to determine the frame reception situation of the corresponding node devices. Exemplarily, if the identity identifier or communication address of a certain node device is carried in the first signal, it means that the response frame of the node device has been received, and the node device has received the inspection frame; otherwise, it means that the response frame of the node device has not been received, and the node device has not received the inspection frame either. The host device will determine the inspection frame loss state according to the frame reception situation of the corresponding node devices.
[0088] Step S103, when it is determined that the frame reception situation is the inspection frame loss state, adjust the reference voltage, and update the bus voltage threshold according to the adjusted reference voltage.
[0089] The frame reception situation being the inspection frame loss state means that at least some of the node devices have not received the inspection frame. In this case, the host device adjusts the reference voltage to update the bus voltage threshold.
[0090] Through the above steps S101 to S103, considering the defects in the bus output waveform of the host device, adaptively adjust the communication parameters according to the frame reception state of the node device, and avoid hardware defects through software settings, so as to solve the problem of unstable dual-bus communication in the related technology and improve the stability of dual-bus communication.
[0091] Moreover, the circuit for implementing the dual-bus communication method of this embodiment is simple, the hardware cost is low, for the same material cable, the communication distance is farther, the communication is more stable, and low-cost cables can be used for the same installation distance, reducing the cable cost.
[0092] Please refer to Figure 11 , Figure 11 which is a schematic flowchart of adjusting the reference voltage in an embodiment. This process includes the following steps:
[0093] Step S201, add the current reference voltage R to the preset value X to obtain the adjusted reference voltage, where X = i × k (V), i is a positive integer, k is a real number, and V represents the unit of volts;
[0094] Step S202, determine whether the inspection frame loss state occurs within the preset time; if so, exit this process; if not, execute step S203;
[0095] Step S203, take the opposite of i, and add the current reference voltage R to the preset value X;
[0096] Step S204: Determine whether the patrol frame loss state occurs within a preset duration. If so, exit this process; if not, execute Step S205.
[0097] Step S205: Take the opposite of i and accumulate 1 numerical unit, then return to Step S201.
[0098] Through the above Steps S201 to S205, the adaptive adjustment of the reference voltage is achieved.
[0099] In one embodiment, the patrol frame loss state includes: after sending a patrol frame to the corresponding node device, there are N consecutive patrol frame loss states; or, when batch-inspecting all node devices, after completing one patrol task for all node devices, there are M consecutive N-time patrol frame loss states. Here, both M and N are positive integers.
[0100] In one embodiment, before demodulating the sampling signal of the dual bus according to the bus voltage threshold, the method further includes:
[0101] Determine the corresponding target interval among multiple voltage intervals according to the voltage of the sampling signal; obtain the reference voltage corresponding to the target interval, and determine the bus voltage threshold according to the reference voltage corresponding to the target interval.
[0102] In one embodiment, the method further includes: if the voltage of the sampling signal is not within any of the voltage intervals of the multiple voltage intervals, then take one of the voltage intervals as the target interval corresponding to the sampling signal.
[0103] Please refer to Figure 12 , Figure 12 For the working flowchart of the host device in one embodiment, this process includes the following steps:
[0104] Step S301: Start the bus signal sampling task.
[0105] Step S302: Filter the sampling signal.
[0106] Step S303: Determine whether there are 3 consecutive patrol frame loss states. If so, execute Step S304; if not, execute Step S306.
[0107] Step S304: Determine whether there are 5 abnormal situations within 1 minute. The abnormal situation refers to the occurrence of 3 consecutive patrol frame loss states. If so, execute Step S305; if not, end the process.
[0108] Step S305: Adaptively adjust the reference voltage a of the analog comparator.
[0109] Step S306: Determine the reference voltage a of the analog comparator.
[0110] In this embodiment, the host device performs a bus signal sampling task every 2 s. If the bus signals are continuously sampled 8 times, two maximum values are removed, two minimum values are removed, and the average of the remaining 4 voltage values is calculated to obtain the bus voltage of this sampling.
[0111] The host device issues an inspection frame every 100 ms and issues 600 frames within 1 minute. When determining whether the inspection frame loss state occurs, it is first determined whether the host device sends other instructions. If there are other instructions, this inspection frame loss does not count. When the communication detects that the inspection frame loss continuously occurs 3 times and this situation occurs 5 times within one minute, the reference voltage a of the analog comparator is adjusted according to the voltage adaptive adjustment algorithm.
[0112] Exemplarily, assuming that the bus voltage range is 12 V - 28 V, the voltage adaptive adjustment algorithm of this embodiment can achieve long-distance communication with the bus voltage dropping to 12 V. The specific description is as follows:
[0113] In the voltage adaptive adjustment algorithm, the range of 12 V - 28 V is divided into several intervals, such as 12 - 15 V, 15 - 18 V, 18 - 21 V, 21 - 25 V, 25 - 28 V. The identification of each interval is V_level0, V_level1, V_level2, V_level3, V_level4 respectively. Each interval corresponds to a reference voltage, which are a_level0, a_level1, a_level2, a_level3, a_level4 respectively. The initial values of the reference voltages are stored in a constant array.
[0114] When it is determined that the sampled value of the bus voltage is within a certain interval V_levelx, the reference voltage is changed to the corresponding a_levelx. The determination of the reference voltage is based on the hardware waveform. Under different interval voltages, abnormal waveforms similar to Figure 3 will appear in the bus data. The degree of abnormality of this abnormal waveform is determined by the output waveform of the host device and external influences. Therefore, in this embodiment, the hardware waveforms in various situations are collected, and the initial values of the reference voltages for each voltage interval in the algorithm are determined according to these waveforms.
[0115] Since inaccurate acquisition may also occur due to interference during the sampling process, when the sampled value of the bus voltage is not within any voltage interval, the reference voltage a_level3 corresponding to 21 - 25 V is used by default. After the corresponding reference voltage a_levelx is selected according to the collected bus voltage, the frame reception situation of the node device is judged. If the inspection frame loss state still occurs, the reference voltage is not adjusted according to the bus voltage, but the selected a_levelx value is automatically adjusted.
[0116] First, increase the value of a_levelx by m, and then determine the frame loss situation within 1 minute. If there is still a communication problem, decrease the value of a_levelx by m, and then determine the frame loss situation within 1 minute again. If there is still a communication problem, increase the value of a_levelx by 2m. If there is still a problem, decrease the value of a_levelx by 2m until the communication meets the conditions.
[0117] Then observe the communication for 3 minutes. If there is no communication anomaly within 3 minutes, then the next time the inspection frame loss state occurs, it is necessary to first determine the reference voltage according to the range of the bus voltage, and then adaptively adjust the reference voltage.
[0118] In addition, in combination with the dual-bus communication method provided in the above embodiments, a storage medium can also be provided in this embodiment to implement it. A computer program is stored on the storage medium; when the computer program is executed by a processor, any one of the dual-bus communication methods in the above embodiments is implemented.
[0119] It should be understood that the specific embodiments described here are only used to explain this application, rather than to limit it. According to the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the protection scope of this application.
[0120] Obviously, the drawings are only some examples or embodiments of this application. For those of ordinary skill in the art, this application can also be applied to other similar situations based on these drawings without creative work. In addition, it can be understood that although the work done during this development process may be complex and time-consuming, for those of ordinary skill in the art, certain design, manufacturing, or production changes based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient disclosure of this application.
[0121] The term "embodiment" in this application means that the specific features, structures, or characteristics described in combination with the embodiments can be included in at least one embodiment of this application. The phrase appears in various positions in the specification does not necessarily mean the same embodiment, nor does it mean being independent or alternative to other embodiments and mutually exclusive. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in this application can be combined with other embodiments without conflict.
[0122] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of patent protection. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A dual - bus communication method is applied to a host device. The host device powers and communicates with node devices through a dual - bus. Characterized in that, The method includes: Obtain a first signal, wherein the first signal is obtained by demodulating a sampling signal of the dual - bus according to a bus voltage threshold, and the bus voltage threshold is used to define the voltage level of the signal transmitted on the dual - bus; Determine the frame - receiving situation of the corresponding node device according to the first signal, and judge whether the frame - receiving situation is a state of missing frames during patrol inspection; In the case where it is judged that the frame - receiving situation is the state of missing frames during patrol inspection, adjust the reference voltage, and update the bus voltage threshold according to the adjusted reference voltage. The bus voltage threshold has a linear relationship of the first order with respect to the reference voltage.
2. The dual - bus communication method according to claim 1, Characterized in that, Adjusting the reference voltage includes: repeatedly executing the following steps until the state of missing frames during patrol inspection is eliminated: Add the current reference voltage R to a preset value X to obtain the adjusted reference voltage, where X = i×k, i is a positive integer, k is a real number, and the unit of k includes volts; Judge whether the state of missing frames during patrol inspection occurs within a preset time duration; In the case where it is judged that the state of missing frames during patrol inspection occurs within the preset time duration, take the opposite of i, and add the current reference voltage R to the preset value X; Judge whether the state of missing frames during patrol inspection occurs within a preset time duration; In the case where it is judged that the state of missing frames during patrol inspection occurs within the preset time duration, take the opposite of i and then accumulate 1 numerical unit.
3. The dual - bus communication method according to claim 1, Characterized in that, The state of missing frames during patrol inspection includes: After sending a patrol inspection frame to the corresponding node device, there are N consecutive states of missing frames during patrol inspection; or, When conducting batch patrol inspections on all node devices, after completing one patrol inspection task for all node devices, there are M consecutive N - times states of missing frames during patrol inspection; Both M and N are positive integers.
4. The dual - bus communication method according to claim 1, Characterized in that, Before demodulating the sampling signal of the dual - bus according to the bus voltage threshold, the method further includes: Determine the corresponding target interval among multiple voltage intervals according to the voltage of the sampling signal; Obtain the reference voltage corresponding to the target interval, and determine the bus voltage threshold according to the reference voltage corresponding to the target interval.
5. The dual - bus communication method according to claim 4, Characterized in that, The method further includes: If the voltage of the sampling signal is not within any of the voltage intervals of the multiple voltage intervals, then take one of the voltage intervals as the target interval corresponding to the sampling signal.
6. A dual - bus communication device, Characterized in that, Includes: A communication module, a signal processing module, and a control module. The communication module and the signal processing module are respectively connected to the control module; wherein, The communication module is used to receive signals generated by node devices from the dual - bus, and send signals generated by the host device to the dual - bus; The signal processing module is used to sample the signals on the dual buses and demodulate the sampled signals according to the bus voltage threshold to obtain a first signal, where the bus voltage threshold is used to define the voltage level of the signals transmitted on the dual buses; The control module can determine the frame reception situation of the corresponding node device according to the first signal, judge whether the frame reception situation is a patrol frame loss state, and when it is determined that the frame reception situation is the patrol frame loss state, adjust the reference voltage of the signal processing module, update the bus voltage threshold according to the adjusted reference voltage, and the bus voltage threshold has a linear relationship of the first order with respect to the reference voltage.
7. The dual-bus communication device according to claim 6, wherein, the communication module includes: a first bus port, a second bus port, a rectification unit and a level adjustment unit; wherein, the first end of the rectification unit is connected to the first bus port, the second end of the rectification unit is connected to the second bus port, and the third end of the rectification unit is connected to the level adjustment unit.
8. The dual-bus communication device according to claim 6, wherein, the signal processing module includes: a sampling unit, a voltage dividing unit and a comparator connected in sequence; wherein, the first input terminal of the comparator is connected to the voltage dividing unit, and the second input terminal of the comparator is used to be connected to the control module.
9. The dual-bus communication device according to claim 8, wherein, the control module and the comparator are integrated in an integrated circuit chip, and the sampling unit and the voltage dividing unit are respectively connected to the pins of the integrated circuit chip.
10. A dual-bus communication system, wherein, it includes a first bus, a second bus, a host device and a plurality of node devices, the host device supplies power to and communicates with each node device through the first bus and the second bus, and the host device includes the dual-bus communication device according to any one of claims 6 to 9.
11. A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the dual-bus communication method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Two-bus communication method and system
CN105049311A
Bus test system and method
CN107491055A