Node equipment state determination method and device, storage medium and electronic equipment
By adding oversampling and weighted analysis methods to the soft serial port, the error in node device status identification caused by interference in the fire protection two-wire bus wiring was solved, accurate identification was achieved in the interference environment, and the reliability of data parsing was improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG HUAXIAO TECH CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-04-24
AI Technical Summary
When the fire alarm controller communicates with the node devices through the fire protection bus, the electrical signal interference caused by the multi-core cable wiring makes it impossible for the hardware serial port to effectively parse the communication data and accurately identify the status of the node devices.
By adding oversampling, two-bus timing reference, and weighting analysis methods to the soft serial port, the falling edge of the target signal is detected and sampled N times to determine the parsed data. The sampling continues M times to identify the start bit and data bit data. In-depth analysis is used to filter interference, thereby achieving accurate parsing of the target signal.
It can still accurately identify the status of node devices even under signal interference, avoiding the problem that the hardware serial port cannot correctly parse data under interference, thus improving the accuracy and robustness of identification.
Smart Images

Figure CN121924031A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for determining the state of a node device. Background Technology
[0002] In related technologies, fire alarm controllers typically monitor the status of connected node devices via a fire alarm bus. However, since most fire alarm buses use multi-core cables for wiring, the electrical signals in the parallel cables interfere with each other. As a result, during the bus code reception phase (i.e., when the host receives the data transmitted by the node device regarding status information), the bus waveform is often abnormally pulled low or high. This will cause the hardware serial port to be unable to effectively parse the communication data and thus be unable to accurately identify the status of the node device.
[0003] This indicates that there is a technical problem in the relevant technologies that makes it impossible to accurately identify the status of node devices.
[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] This application provides a method, apparatus, storage medium, and electronic device for determining the state of a node device, so as to at least solve the technical problem in the related art that the state of a node device cannot be accurately identified.
[0006] According to one aspect of the embodiments of this application, a method for determining the state of a node device is provided, comprising: detecting a target signal transmitted in real time in a target bus, and sampling the target signal N times upon detecting a falling edge to obtain N first sampled signals, wherein the target signal is a signal sent by the node device through the target bus upon receiving a query command; determining parsed data based on the N first sampled signals; if the parsed data is start bit data, continuing to sample the target signal transmitted in real time in the target bus M times to obtain a second sampled signal; determining data bit data based on the second sampled signals; and determining the state of the node device based on the data bit data.
[0007] In one exemplary embodiment, determining parsed data based on N first sampled signals includes: determining a first number of first sub-signals and a second number of second sub-signals included in the N first sampled signals, wherein the voltage value of the first sub-signals is less than a predetermined threshold and the voltage value of the second sub-signals is greater than the predetermined threshold; and determining the parsed data based on the first number and the second number.
[0008] In one exemplary embodiment, determining the parsed data based on the first quantity and the second quantity includes: determining the parsed data as a first value when the first quantity is N; and determining the parsed data as a second value when the second quantity is N.
[0009] In one exemplary embodiment, determining the parsed data based on the first quantity and the second quantity includes: when neither the first quantity nor the second quantity is 0, determining a first proportion of the first sub-signal based on the first quantity, determining a second proportion of the second sub-signal based on the second quantity, and determining the parsed data based on the first proportion and the second proportion.
[0010] In one exemplary embodiment, determining the parsed data based on the first proportion and the second proportion includes: determining the parsed data as a first value when the first proportion is greater than or equal to a first preset threshold; and determining the parsed data as a second value when the second proportion is greater than or equal to the first preset threshold.
[0011] In an exemplary embodiment, determining the parsed data based on the first proportion and the second proportion includes: determining a first weight for each of the first sampled signals when the first difference between the first proportion and the second proportion is less than or equal to a second preset threshold; determining a first sum and a second sum based on the first weight, wherein the first sum is the sum of the first weights of the first sub-signals, and the second sum is the sum of the first weights of the second sub-signals; determining the parsed data as a first value when the first sum is greater than or equal to the second sum; and determining the parsed data as a second value when the first sum is less than the second sum.
[0012] In one exemplary embodiment, determining a first weight for each of the first sampled signals includes: determining an intermediate signal included in N first sampled signals, a first signal preceding the intermediate signal, and a second signal following the intermediate signal, wherein the number of intermediate signals is odd when N is odd and even when N is even; setting the first weight of the intermediate signal to a target weight value; setting the first weight of the first signal to decrease according to a target gradient based on the target weight value; and setting the first weight of the second signal to decrease according to the target gradient based on the target weight value.
[0013] In an exemplary embodiment, the target signal transmitted in real time on the target bus is sampled M times to obtain a second sampled signal, which includes: when the number of data bits included in the target signal is Y bits, the target signal transmitted on the target bus is sampled M times in Y target periods to obtain Y sampled signal groups, wherein one sampled signal group includes M sampled signals; and the Y sampled signal groups are determined as the second sampled signal.
[0014] In an exemplary embodiment, determining data bit data based on the second sampling signal includes: performing the following operations for each sampling signal group included in the second sampling signal to determine the data bit data corresponding to the sampling signal group: determining a third number of first sub-signals and a fourth number of second sub-signals included in the sampling signal group, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; and determining the data bit data based on the third number and the fourth number.
[0015] In one exemplary embodiment, determining the data bit data based on the third quantity and the fourth quantity includes: when the third quantity is M, determining the data bit data as a first value; and when the fourth quantity is M, determining the data bit data as a second value.
[0016] In one exemplary embodiment, determining the data bit data based on the third quantity and the fourth quantity includes: when both the third quantity and the fourth quantity are not 0, determining a third proportion of the first sub-signal based on the third quantity, determining a fourth proportion of the second sub-signal based on the fourth quantity, and determining the data bit data based on the third proportion and the fourth proportion.
[0017] In an exemplary embodiment, determining the data bit data based on the third proportion and the fourth proportion includes: determining the data bit data as a first value when the third proportion is greater than or equal to a first preset threshold; and determining the data bit data as a second value when the fourth proportion is greater than or equal to the first preset threshold.
[0018] In an exemplary embodiment, determining the data bit data based on the third proportion and the fourth proportion includes: determining a second weight for each sampled signal included in the sampled signal group when the second difference between the third proportion and the fourth proportion is less than or equal to a third preset threshold; determining a third sum and a fourth sum based on the second weight, wherein the third sum is the sum of the second weights of the first sub-signal, and the fourth sum is the sum of the second weights of the second sub-signal; determining the data bit data as a first value when the third sum is greater than or equal to the fourth sum; and determining the data bit data as a second value when the third sum is less than the fourth sum.
[0019] According to another aspect of the embodiments of this application, a device for determining the state of a node device is also provided, comprising: a detection module, configured to detect a target signal transmitted in real time in a target bus, and, upon detecting a falling edge, sample the target signal N times to obtain N first sampled signals, wherein the target signal is a signal sent by the node device through the target bus upon receiving a query command; a first determination module, configured to determine parsed data based on the N first sampled signals; a sampling module, configured to, if the parsed data is start bit data, continue to sample the target signal transmitted in real time in the target bus M times to obtain a second sampled signal; a second determination module, configured to determine data bit data based on the second sampled signals; and a third determination module, configured to determine the state of the node device based on the data bit data.
[0020] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed by a processor.
[0021] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in any of the method embodiments described above.
[0022] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to perform the steps of any of the above method embodiments through the computer program.
[0023] This application allows for the following method: When a falling edge is detected during the real-time transmission of a target signal on the target bus, the target signal can be sampled N times to obtain N first sampled signals. The target signal is the signal sent by the node device via the target bus upon receiving a query command. After acquiring N first sampled signals, they can be analyzed to determine the parsed data, which in turn determines the start bit data. If the parsed data is the start bit data, the target signal can be sampled M times to obtain second sampled signals. These second sampled signals determine the data bits, which in turn determine the node device's state. Even under interference, the start bit data and data bits of the target signal can still be analyzed through deep oversampling analysis. In contrast, related technologies cannot analyze the target signal normally under interference. Therefore, oversampling avoids the problem of incorrect data parsing and subsequent inaccurate node device state identification under interference, as is common in related technologies. Thus, this method solves the problem of inaccurate node device state identification, achieving accurate node device state recognition. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of an application scenario for determining the state of a node device according to an embodiment of this application;
[0025] Figure 2 This is a schematic diagram of an optional node device state determination process according to an embodiment of this application;
[0026] Figure 3 This is a schematic diagram of the target signal structure according to an embodiment of this application;
[0027] Figure 4 This is a flowchart illustrating the process of determining the state of a node device in this optional example;
[0028] Figure 5 This is a structural block diagram of an optional node device status determination device according to an embodiment of this application;
[0029] Figure 6 This is a computer system architecture block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] According to one aspect of the embodiments of this application, a method for determining the state of a node device is provided. Optionally, in this embodiment, the above-described method for determining the state of a node device may be applied, but is not limited to, to applications such as... Figure 1 The hardware environment shown includes terminal device 102 and server 104. Server 104 can be connected to terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) to terminal device 102 or clients installed on terminal device 102. A database can be set up on server 104 or independently of server 104 to provide data storage services for server 104.
[0033] The aforementioned network may include, but is not limited to, at least one of the following: wired network and wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), and local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wireless Fidelity (WIFI) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), mobile phone, tablet computer, etc. Server 104 may be, but is not limited to, a cloud server, server cluster, or other server types.
[0034] The method for determining the node device status in this embodiment can be executed by server 104, terminal device 102, or jointly by server 104 and terminal device 102. Alternatively, the method for determining the node device status in this embodiment can be executed by a client installed on terminal device 102.
[0035] Figure 2 This is a flowchart illustrating an optional method for determining the state of a node device according to an embodiment of this application, as shown below. Figure 2 As shown, the process of this method may include the following steps:
[0036] Step S202: Detect the target signal transmitted in real time in the target bus, and when a falling edge is detected, sample the target signal N times to obtain N first sampled signals, wherein the target signal is the signal sent by the node device through the target bus when it receives a query command;
[0037] The method for determining the status of node devices in this embodiment can be applied to fields such as fire alarm linkage systems, building automation systems, industrial control systems, security monitoring systems, and Internet of Things (IoT) systems. It can be specifically applied to scenarios where parallel line interference exists in fire alarm wiring. In fire alarm systems of large buildings, shopping malls, or factories, the fire alarm controller communicates and exchanges data with various node devices (e.g., smoke detectors, heat detectors, manual alarm buttons, fire control units, etc.) connected to the fire alarm bus via a fire alarm secondary bus. The fire alarm secondary bus can be understood as the mainstream communication solution used in the fire alarm control panel within the fire protection industry. It provides power to all node devices connected to the bus using a DC voltage (24V) and transmits and receives data via a chip serial port. The control panel (i.e., the fire alarm controller) can monitor the status of the node devices connected to it. When a node malfunctions, it can report data to the control panel via the fire alarm secondary bus, and the control panel will display the abnormal point. If the control panel wants to query the status information of each node, it can reduce the voltage on the fire alarm secondary bus. In other words, the control panel sends commands to the nodes by high-frequency modulation of the bus voltage. For example, when the bus sends a command, 24V can represent logic 1 and 0V can represent logic 0. When a node device replies with a code, the hardware circuit will switch to receive mode and reduce the bus voltage to 5V so that the node device can pull the code to reply with data. For example, 5V can represent logic 1 and 4V can represent logic 0. When the fire alarm bus voltage is maintained at 24V, it can power or charge the node device. When the bus voltage is pulled down to 5V, the node device can maintain its own operation using its own capacitor. After replying with data, the fire alarm bus voltage is restored to 24V. In this way, the node device connected to the fire alarm control panel can be powered or communicated with via a two-wire wiring method.
[0038] Fire alarm bus 2 typically requires dedicated shielded twisted-pair cabling to avoid sharing with other signal lines. However, during project construction, construction teams often opt for multi-core cables instead of shielded twisted-pair cabling for cost savings and ease of installation. Multi-core cabling leads to interference between electrical signals within the same multi-core cable. While this interference is negligible if the cable only supplies power and doesn't transmit data, fire alarm systems typically transmit data via the fire alarm bus 2. Because the fire alarm bus 2's transmitting node (i.e., the host) uses a high voltage drop for output, this interference is negligible during the transmitting phase. However, during the receiving phase, the voltage on the fire alarm bus 2 is only 5V, and the voltage difference between logic 1 and logic 0 is small. When the fire alarm bus 2 is interfered with by other electromagnetic signals in parallel cables, the bus waveform may be abnormally pulled low or high. In this situation, the host's decoding of the transmitted data via the chip's hardware serial port fails because the hardware serial port has strict timing requirements; if the timing is not correct, decoding is impossible.
[0039] To at least partially solve the aforementioned technical problems, in this embodiment, for the issues of "crosstalk and noise interference," the infected data can be filtered by adding oversampling, two-bus timing reference, and weighting analysis methods to the soft serial port. This can solve specific problems caused by the uneven skill levels of on-site installers and messy wiring (such as long-distance parallel laying of power and low-voltage cables). The soft serial port can be understood as a software program that samples and parses serial port data on the bus. The functions beyond the chip's own hardware serial port can be simulated through the effects of oversampling and weighting analysis.
[0040] In the above embodiment, when there is no interference on the waveform of the fire alarm bus, the initial waveform on the bus is a standard falling edge plus a duration of 52 seconds. If abnormal interference occurs, a low level of s (19200 baud rate) will cause irregular noise in the waveform on the two buses, which will seriously affect the detection of the start bit data. In this case, the start bit data can be detected by using the software serial port parsing method – combined with the agreed timing of communication between the host and the node device. That is, after the host sends the query command for the power-saving device to the node device and enters the receive state by pulling the bus low, the node device will detect the start bit data after a fixed time (e.g., 312) after detecting the host's low level. s) will then begin sending data (i.e., the aforementioned target signal). The host can detect the target signal transmitted by the node device in real time, and when at a fixed time (e.g., 312) If a falling edge is detected near s), sampling can continue. Sampling N times after the falling edge can yield N first sample data. Then, the signal at this time can be determined as the start bit data through the N first sample data.
[0041] In the above embodiments, if a traditional hardware serial port is used to detect the target signal, a fixed-time timing cannot be utilized because the hardware serial port cannot set the delay duration. If no signal is received within 2 seconds, the data frame may be determined to be invalid, thus missing step 312. The actual data after 's'. However, it can be flexibly detected via a software serial port, for example: in 312... If the start bit data is mistakenly detected within s, it can be assumed that the start bit is caused by interference. When in 312... A continuous falling edge is generated after s, but the falling edge may not be sufficient due to interference. In the case of s (transmission time of one bit of data), the soft serial port can determine whether it is the start bit data by obtaining the first sampled data obtained by N samples after the falling edge, rather than because there is not enough 52 s is directly judged as an incorrect starting bit data.
[0042] Step S204: Determine the parsed data based on N of the first sampled signals;
[0043] In the above embodiments, the N first sampled signals can be of various forms. For example, if the number of samples N is 10, the acquired first sampled signals can be 1111110111, 0000110100, 1111111111, 0000000000, 0000000100, etc., where N is a positive integer, which can be 10, 15, 20, etc., and this invention does not limit this. Since the N first sampled signals can be diverse, each arrangement of the first sampled signals needs to be further analyzed to determine which of the included first sampled signals is the interfered signal, and whether the start bit data is 0 or 1, so as to determine whether it is the start bit through the analyzed data.
[0044] Step S206: If the parsed data is start bit data, continue to sample the target signal transmitted in real time in the target bus M times to obtain the second sampled signal;
[0045] In the above embodiments, the first key point of serial port parsing is the detection of the start bit data. Figure 3 This is a schematic diagram of the target signal structure according to an embodiment of this application, such as... Figure 3As shown, the target signal includes 1 start bit, 8 data bits, and 1 stop bit. The timing of serial communication is the core of asynchronous serial data transmission. Its key point lies in encoding data through level changes on the time axis. The level states of the start bit, data bits, and stop bit on the time axis are shown in Table 1. If the start bit detection is incorrect, all subsequent data sampling will be incorrect. The sampling of the start bit data involves a high-level transition to a low-level (i.e., the falling edge mentioned above) and a low level lasting 52 seconds. The baud rate is 19200. However, if interference occurs, such as an abnormal falling edge or a shortened low-level duration of the start bit data, the hardware serial port will parse incorrectly, delaying data parsing. In such cases, the start bit can be determined using a software serial port with oversampling analysis. If the parsed data obtained from parsing N first sampled signals is a first value of 0, then the parsed data can be determined as start bit data. The next step is to sample the data bits, i.e., continue sampling the target signal transmitted in real-time on the target bus M times to obtain the second sampled signal. The data bits can then be determined using the second sampled signal. If the parsed data obtained from parsing N first sampled signals is a second value of 1, then this parsed data is not start bit data. The next falling edge can then be detected, and the data after the next falling edge can be sampled N times to determine again whether it is start bit data.
[0046] Table 1
[0047]
[0048] Step S208: Determine the data bits based on the second sampling signal;
[0049] In the above embodiments, see again Figure 2 Data bit resolution and start bit resolution are different. Data bit resolution does not require detecting the start signal, but only needs to detect whether the waveform of the bit is high or low. Since the data bit is 8 bits, the data bit is either high level (1) or low level (0). Therefore, the second sampling signal can be used to determine whether each data bit is 1 or 0.
[0050] Step S210: Determine the state of the node device based on the data bit data.
[0051] In the above embodiments, the data bits can carry information such as the device type, ID, operating status, alarm status, and fault status of the node device. By parsing these data bits, the host (such as a fire alarm controller) can obtain the real-time status information of the node device. When the node device sends data through the fire alarm bus, its data bits can be encoded according to a specific format and protocol. For example, the first few data bits may represent the device ID, the following data bits may represent the device type, and the subsequent groups of data bits may represent the fire alarm status, fault status, self-test status, etc. Each combination of high and low levels (i.e., a sequence of logic "1" and logic "0") represents a different status code. After receiving these data bits, the host will convert the level signals into meaningful information according to the preset communication protocol and status encoding rules. This may include data bit identification, check bit verification, and parsing and updating the status of the node device based on the content of the data bits.
[0052] This application allows for the following method: When a falling edge is detected during the real-time transmission of a target signal on the target bus, the target signal can be sampled N times to obtain N first sampled signals. The target signal is the signal sent by the node device via the target bus upon receiving a query command. After acquiring N first sampled signals, they can be analyzed to determine the parsed data, which in turn determines the start bit data. If the parsed data is the start bit data, the target signal can be sampled M times to obtain second sampled signals. These second sampled signals determine the data bits, which in turn determine the node device's state. Even under interference, the start bit data and data bits of the target signal can still be analyzed through deep oversampling analysis. In contrast, related technologies cannot analyze the target signal normally under interference. Therefore, oversampling avoids the problem of incorrect data parsing and subsequent inaccurate node device state identification under interference, as is common in related technologies. Thus, this method solves the problem of inaccurate node device state identification, achieving accurate node device state recognition.
[0053] Optionally, the entity performing the above steps may be a host or other device with similar processing capabilities, but is not limited thereto.
[0054] In one exemplary embodiment, determining parsed data based on N first sampled signals includes: determining a first number of first sub-signals and a second number of second sub-signals included in the N first sampled signals, wherein the voltage value of the first sub-signals is less than a predetermined threshold and the voltage value of the second sub-signals is greater than the predetermined threshold; and determining the parsed data based on the first number and the second number.
[0055] In the above embodiments, under normal circumstances, when there is no interference on the target bus, the waveform of the start bit data is a standard falling edge plus 52. The start bit data transmission time (s) is low, but when interference is present, irregular noise will appear on the waveform of the bus, which will seriously affect the detection of the start bit data, such as the disordered distribution of high and low levels. In this case, it is necessary to analyze the N first sampled signals to determine whether each of the N first sampled signals contains a low level (i.e., the aforementioned first sub-signal) or a high level (i.e., the aforementioned second sub-signal). If so, the number of times the low level occurs (i.e., the aforementioned first quantity) and the number of times the high level occurs (i.e., the aforementioned second quantity) are respectively. The determination of high and low levels can be made by a predetermined threshold, which can be 3.3V, 4.5V, etc., and is not limited to this. When the voltage value is greater than the predetermined threshold, it can be determined as the second sub-signal; when the voltage value is less than the predetermined threshold, it can be determined as the first sub-signal.
[0056] By counting the number of the first and second sub-signals, irregular changes in the signal waveform can be handled, such as signal narrowing or the presence of glitches. Under interference, the hardware serial port may misjudge the data bit state due to brief signal changes, leading to data parsing errors. However, by statistically analyzing oversampled data points, even if the signal waveform is interfered with, the true state of the data bits can still be determined based on the numerical advantage, thus ensuring correct data parsing.
[0057] In one exemplary embodiment, determining the parsed data based on the first quantity and the second quantity includes: determining the parsed data as a first value when the first quantity is N; and determining the parsed data as a second value when the second quantity is N.
[0058] In the above embodiments, when the interference is particularly weak and does not affect the waveform, all N first sampling signals acquired are first sub-signals (low level 0), i.e., the first quantity is N, and the second quantity of the second sub-signals is 0. Therefore, the parsed data can be logic 0 (i.e., the aforementioned first value). However, when the interference is particularly strong, there may be a situation where all N first sampling signals acquired are high level 1, i.e., the second quantity of the second sub-signals is N, and the first quantity of the first sub-signals is 0. In this case, the parsed result is logic 1 (i.e., the aforementioned second value). When the parsed result is the first value 0, it can be determined that this is the correct start bit data, and further sampling can be performed to determine the data bits after the start bit data. When the parsed result is the second value 1, it can be considered that this start bit data is generated by interference and is not the true start bit data. Therefore, upon detecting the next falling edge, N more real-time transmitted target signals can be acquired to obtain the next first acquisition signal. The next first acquisition signal is then used to determine whether it is the true start bit data.
[0059] In this embodiment, when the signal quality is poor or there is interference, the hardware serial port may misjudge the start bit data due to the instability of single-point sampling. However, by sampling N times continuously and counting the number of occurrences of high and low levels, the logic value of the start bit data can be determined more accurately.
[0060] In one exemplary embodiment, determining the parsed data based on the first quantity and the second quantity includes: when neither the first quantity nor the second quantity is 0, determining a first proportion of the first sub-signal based on the first quantity, determining a second proportion of the second sub-signal based on the second quantity, and determining the parsed data based on the first proportion and the second proportion.
[0061] In the above embodiment, when both high and low levels exist in the first sampling signal and their respective quantities are not zero, it is not possible to accurately determine whether it is start bit data by simply using the quantity of high and low levels. The first proportion of the first sub-signal in the N first sampling signals can be determined by the first quantity, and the second proportion of the second sub-signal in the N second sampling signals can be determined by the second quantity. Then, the parsed data is determined by the first proportion and the second proportion.
[0062] By determining the parsed data based on the first and second proportions, the true state of the start position can be identified more accurately. This is because when the signal is interfered with, the hardware serial port may misjudge the start position due to inaccurate single-point sampling. However, this embodiment, by analyzing the signal proportions, can accurately identify the mainstream state of the signal even if there is a small amount of interference, thereby improving the accuracy of data parsing.
[0063] In one exemplary embodiment, determining the parsed data based on the first proportion and the second proportion includes: determining the parsed data as a first value when the first proportion is greater than or equal to a first preset threshold; and determining the parsed data as a second value when the second proportion is greater than or equal to the first preset threshold.
[0064] In the above embodiments, when both high and low levels exist in the first sampled signal and their distribution is relatively uniform, the value of the first proportion and the second proportion can be determined. For example, if the number of samples N is 10 and the first preset threshold is 80%, one possibility is that one or two interference spikes may appear in the continuous waveform, meaning the N first sampled signals could be 0000010000. In this case, the first proportion is 0.9 and the second proportion is 0.1. In this situation, the first proportion is greater than the first preset threshold of 80%, so the parsed data can be determined to be the first value 0. Another possibility is that the interference is particularly strong, resulting in the N first sampled signals being 1111011110. In this case, the first proportion is 0.2 and the second proportion is 0.8. In this situation, the second proportion is equal to the first preset threshold of 0.8, so the parsed data can be determined to be the second value 1.
[0065] In this embodiment, when the signal is interfered with, the hardware serial port may misjudge the data bit status due to abnormal level changes at individual points, leading to parsing errors. However, by comparing the first and second proportions with the threshold, the true state of the data can be determined more robustly, avoiding parsing failures caused by small-scale noise or glitches, thereby improving the reliability of data parsing.
[0066] In an exemplary embodiment, determining the parsed data based on the first proportion and the second proportion includes: determining a first weight for each of the first sampled signals when the first difference between the first proportion and the second proportion is less than or equal to a second preset threshold; determining a first sum and a second sum based on the first weight, wherein the first sum is the sum of the first weights of the first sub-signals, and the second sum is the sum of the first weights of the second sub-signals; determining the parsed data as a first value when the first sum is greater than or equal to the second sum; and determining the parsed data as a second value when the first sum is less than the second sum.
[0067] In the above embodiments, when the high and low level distributions in the N first sampled signals are relatively disordered, and the first proportion and the second proportion are very close or equal (i.e., the first difference between the first proportion and the second proportion is less than or equal to a second preset value), and cannot be distinguished by simple comparison, a first weight can be assigned to each first sampled signal. The first sum of the first weights of the first sub-signals and the second sum of the second weights of the second sub-signals are then calculated. The second preset threshold can be 0.2, etc., and this invention does not limit this. Then, the magnitudes of the first sum and the second sum can be compared. If the first sum is greater than or equal to the second sum, the parsed data is determined to be the first value 0; if the first sum is less than the second sum, the parsed data is determined to be the second value 1.
[0068] In this embodiment, when the signal is subjected to multi-source interference or uneven intensity, traditional hardware serial ports or single threshold judgments often lose accuracy. However, this embodiment, by comparing the first weight and value of the first sub-signal and the second sub-signal, can make correct analytical decisions based on the overall trend of the signal even when the signal waveform is contaminated or distorted to a certain extent, greatly improving the robustness of the communication link.
[0069] In one exemplary embodiment, determining a first weight for each of the first sampled signals includes: determining an intermediate signal included in N first sampled signals, a first signal preceding the intermediate signal, and a second signal following the intermediate signal, wherein the number of intermediate signals is odd when N is odd and even when N is even; setting the first weight of the intermediate signal to a target weight value; setting the first weight of the first signal to decrease according to a target gradient based on the target weight value; and setting the first weight of the second signal to decrease according to the target gradient based on the target weight value.
[0070] In the above embodiments, a method of centering with high weights can be used to determine the first weight of each first sampled signal, that is, the closer the data is to the center, the higher the weight. First, the intermediate signals included in the N first sampled signals can be identified. The first sampled signals between the intermediate signals can be divided into first signals, and the first sampled signals after the intermediate signals can be divided into second signals. When N is odd, the number of intermediate signals is odd, which can be 1 bit; when N is even, the number of intermediate signals is even, which can be 2 bits. The first weight of the intermediate signal is the highest (in the case of an even number, the first weights of the intermediate signals are the same). The first weight of the first signal decreases from the target weight value of the intermediate signal according to the target gradient. The first weight of the second signal also decreases from the target weight value of the intermediate signal according to the target gradient. The target gradient can be 0.1, 0.2, etc., and this invention is not limited thereto. For example, if the number of samplings N is 5 and the target gradient is 0.1, then the first weights are 0.1, 0.2, 0.3, 0.2, and 0.1, which can be understood as a symmetrical distribution with the intermediate signal as the axis of symmetry; if the number of samplings is 6 and the target gradient is 0 or 1, then the first weights are 1, 2, 3, 3, 2, and 1.
[0071] This embodiment takes into account that in a communication environment with noise or interference, the level state of the signal edge is easily affected by transient noise. Therefore, a higher target weight value is assigned to the middle signal, while the weight values of the first and second signals on both sides are assigned in a weighting method that decreases according to the target gradient to emphasize the decisive role of the center level of the signal waveform. This reflects the true signal state, improves the robustness of data parsing, and reduces parsing errors.
[0072] In an exemplary embodiment, the target signal transmitted in real time on the target bus is sampled M times to obtain a second sampled signal, which includes: when the number of data bits included in the target signal is Y bits, the target signal transmitted on the target bus is sampled M times in Y target periods to obtain Y sampled signal groups, wherein one sampled signal group includes M sampled signals; and the Y sampled signal groups are determined as the second sampled signal.
[0073] In the above embodiments, see again Figure 3 The target signal may include Y data bits. After the start bit data is determined, the target data transmitted in the target bus can be sampled M times in each of the Y target cycles to obtain Y groups of sampled signals. Each group of sampled signals includes M sampled signals. The Y groups of sampled signals are the second sampled signal. Y can be 5-9.
[0074] In the above embodiment, taking a baud rate of 19200 and a data bit width Y of 8 as an example, when the baud rate is 19200, the output time for each data bit is 52 seconds. s (i.e., the target period mentioned above), therefore, after determining the starting bit data, we can continue sampling M times to obtain the first set of sampled signals. The first data bit can then be determined using the first set of sampled signals. If the sampling time is less than 52... If s, then wait for the first target cycle to arrive, and at the start of the second target cycle, continue to collect M times, repeating the above operation until the last data bit is determined.
[0075] In this embodiment, M consecutive samples can effectively filter out instantaneous noise in complex environments with signal interference. By comparing and comprehensively analyzing the results of each sample, abnormal signals caused by interference can be identified and eliminated, thereby improving the purity of the analyzed data and enhancing the system's anti-interference capability.
[0076] In an exemplary embodiment, determining data bit data based on the second sampling signal includes: performing the following operations for each sampling signal group included in the second sampling signal to determine the data bit data corresponding to the sampling signal group: determining a third number of first sub-signals and a fourth number of second sub-signals included in the sampling signal group, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; and determining the data bit data based on the third number and the fourth number.
[0077] In the above embodiment, when the waveform on the two buses is a continuous 52 If the s signal is low, the logic value of this data bit is considered to be 0; if it is a continuous 52... A high level in 's' indicates that the logic of this data bit is 1. For the hardware serial port of a chip, if there are spikes in the data bit waveform, the waveform will not maintain continuity, leading to parsing failure. Therefore, a software serial port oversampling method can be used to continuously sample each data bit waveform M times. Each sampled signal group is then analyzed. The analysis of each sampled signal group determines whether it contains a low level (i.e., the first sub-signal mentioned above) or a high level (i.e., the second sub-signal mentioned above). If so, the number of times the low level occurs (i.e., the third quantity mentioned above) and the number of times the high level occurs (i.e., the fourth quantity mentioned above) are determined. The high and low levels can be distinguished by a predetermined threshold, which can be 3.3V, 4.5V, etc., and is not limited to these. A voltage value greater than the predetermined threshold is identified as the second sub-signal, and a voltage value less than the predetermined threshold is identified as the first sub-signal.
[0078] In this embodiment, in complex communication environments, signals may be subject to various interferences, leading to fluctuations in signal level. By statistically analyzing the number of the first and second sub-signals in the sampled signal group, level anomalies caused by noise or interference can be filtered out, ensuring that data parsing is not affected by interference and improving the system's anti-interference capability.
[0079] In one exemplary embodiment, determining the data bit data based on the third quantity and the fourth quantity includes: when the fourth quantity is M, determining the data bit data as a first value; and when the third quantity is M, determining the data bit data as a second value.
[0080] In the above embodiments, under normal waveform conditions, the M signals in the sampled signal group obtained by continuous sampling M times are all either high level 1 or low level 0. That is, there are two possibilities: one is that all are low level 0, i.e., the fourth quantity of the first sub-signal is 0, and the third quantity of the second sub-signal is M, in which case the data bit is logic 0 (i.e., the first value mentioned above); the other is that all are high level 1, i.e., the third quantity of the first sub-signal is 0, and the fourth quantity of the second sub-signal is M, in which case the data bit is logic 1 (i.e., the second value mentioned above). For example, when the number of samplings M is 15 times, the sampled signal group obtained in the first case is 000000000000000, and the sampled signal group obtained in the second case is 111111111111111, where M is an integer greater than 0, and can be 15, 25, 30, etc., which is not limited in this invention.
[0081] In this embodiment, in a communication environment with noise or interference, the result of a single sampling may produce errors. By sampling M times, even if an incorrect level identification occurs occasionally, as long as the majority of the M samples meet the expected level state, the data bits can be correctly parsed, which can significantly improve the fault tolerance of the system and enhance its anti-interference capability.
[0082] In one exemplary embodiment, determining the data bit data based on the third quantity and the fourth quantity includes: when both the third quantity and the fourth quantity are not 0, determining a third proportion of the first sub-signal based on the third quantity, determining a fourth proportion of the second sub-signal based on the fourth quantity, and determining the data bit data based on the third proportion and the fourth proportion.
[0083] In the above embodiments, when both high and low levels exist in the sampling signal group and their respective quantities are not zero, the data bits cannot be accurately determined solely by the quantity of high and low levels. The third proportion of the first sub-signal in the sampling signal group can be determined by the third quantity, and the fourth proportion of the second sub-signal in the sampling signal group can be determined by the fourth quantity. Then, the data bits are determined by the third and fourth proportions.
[0084] When a signal is affected by interference, noise, or unstable factors, traditional threshold comparison may misjudge the level state. However, in this embodiment, by calculating the third and fourth proportions, the true level distribution of the signal can be reflected more objectively. Even if the signal fluctuates within a certain proportion, the accuracy and stability of data parsing can be ensured.
[0085] In one exemplary embodiment, determining the data bit data based on the third proportion and the fourth proportion includes: determining the data bit data as a first value when the third proportion is greater than or equal to a first preset threshold; and determining the data bit data as a second value when the fourth proportion is greater than or equal to the first preset threshold.
[0086] In the above embodiments, when the sampled data cannot maintain a stable continuous waveform, an interference spike (whether upward or downward) may appear in the continuous waveform, as shown in Table 2. When the number of samples M is 15, the signal of the sampled signal group may be 111101111111111111111 or 000000000110000. In both cases, the proportion of low level 0 and high level 1 in the 15 signals can be directly compared. If the third proportion is greater than or equal to the first preset threshold, 1 can be considered as an interference waveform, and the first value 0 is taken as the logical data of this data bit. If the fourth proportion is greater than or equal to the first preset threshold, 0 can be considered as an interference waveform, and the second value 1 is taken as the logical data of this data bit. The first preset threshold can be 80%, 60%, etc., and the present invention does not limit it.
[0087] Table 2
[0088]
[0089] In environments with signal interference, even high-quality samples may contain some noise. By introducing the concepts of a third and fourth proportion and comparing them with a first preset threshold, the system can effectively distinguish between real and interfering signals, greatly enhancing its anti-interference capability and ensuring data transmission quality in complex communication environments.
[0090] In an exemplary embodiment, determining the data bit data based on the third proportion and the fourth proportion includes: determining a second weight for each sampled signal included in the sampled signal group when the second difference between the third proportion and the fourth proportion is less than or equal to a third preset threshold; determining a third sum and a fourth sum based on the second weight, wherein the third sum is the sum of the second weights of the first sub-signal, and the fourth sum is the sum of the second weights of the second sub-signal; determining the data bit data as a first value when the third sum is greater than or equal to the fourth sum; and determining the data bit data as a second value when the third sum is less than the fourth sum.
[0091] In the above embodiments, when the second difference between the third proportion of the first sub-signal and the fourth proportion of the second sub-signal is close (i.e., the second difference is less than or equal to the third preset threshold), the following waveforms may appear: one is that the waveform bit width narrows, and the other is that multiple interference spikes appear (randomly upward and downward). The third preset threshold can be 0.2, 0.3, etc., and this invention does not limit this. The normal transmission time for one bit of data is 52 seconds. After interference, the actual data bits may only be 30. The sampled waveform with a narrower bit width is shown in Table 3. As shown in Table 3, the data will shrink towards the center, and the waveform near the outer edges will not match the actual waveform. Simply judging the proportion of high and low levels is no longer effective. Therefore, a method of assigning a high weight to the center can be used. A second weight is assigned to each sampled signal in the sampled signal group (i.e., the closer the signal is to the center, the higher the weight), giving each bit a different weight score. For example, the first sampled data has a weight score of only 1, and the third sampled data has a weight score of 2. If the third sampled data is inconsistent with the first sampled data, the weight scores are compared, and the sampled result with the larger weight score is adopted. Expanding the sampling to M times, the second weights of all first sub-signals are summed to obtain the third sum, and the second weights of all second sub-signals are summed to obtain the fourth sum. Finally, the first and second sums can be compared. The method of assigning the second weight is similar to the method of assigning the first weight, and will not be elaborated further here. When the first sum is greater than or equal to the second sum, this data bit can be set to the first value 0; when the first sum is less than the second sum, this data bit can be set to the second value 1.
[0092] Table 3
[0093]
[0094] In the above embodiments, when the sampling signal results appear under particularly strong voltage interference (e.g., two buses and 220V power supply are on the same line), they are relatively messy (i.e., multiple upward and downward random signals appear), as shown in Table 4. In this case, the method of centering high weight and 0 weight being greater than 1 weight can be used for judgment. If the data results of the first sum and the second sum are found to be very close after calculating the center weight, then the first value of 0 is taken as the data of this bit. This is because the noise margin of high level (e.g., 2.4V to 5V in TTL circuits) is usually larger than that of low level (e.g., 0V to 0.8V). Even with a small amount of noise superimposed, the high level may still remain within the effective range, while the small interference of low level (e.g., tens of millivolts) may cause it to be misjudged as a high level.
[0095] Table 4
[0096]
[0097] The determination of the node device status in this application will be explained below with reference to specific embodiments.
[0098] Figure 4 This is a flowchart illustrating the process of determining the node device status in this optional example, such as... Figure 4 As shown, the process for determining the status of this node device may include the following steps:
[0099] Step S402, host sampling start bit;
[0100] Step S404: The host configures the sampling pin to trigger an interrupt on the falling edge.
[0101] Step S406, a falling edge is detected;
[0102] Step S408: Configure the sampling pin to input state;
[0103] Step S410: Start 1us timer 1 (counts only, no interruption);
[0104] Step S412: Continuously read the timer 1 count value within the interrupt;
[0105] Step S414: Determine if the count value is ≥5us. If yes, proceed to step S416; otherwise, proceed to step S412.
[0106] Step S416: Clear the timer 1 count value;
[0107] Step S418: Record the sampling level;
[0108] Step S420: Determine whether the number of samples is ≥10. If yes, proceed to step S422; otherwise, proceed to step S412.
[0109] Step S422, process the data;
[0110] Step S424: Determine if there is a continuous low level. If yes, proceed to step S426; otherwise, proceed to step S404.
[0111] Step S426, sample the start bit;
[0112] Step S428: Calculate the remaining time for the start bit;
[0113] Step S430: Start 1us timer 2 and set the remaining time of the start bit to the interrupt time;
[0114] Step S432, begin data sampling;
[0115] Step S434, host sample data bits;
[0116] Step S436, Timer 2 generates an interrupt;
[0117] Step S438: Stop timer 2 counting;
[0118] Step S440: Clear the timer 1 count value;
[0119] Step S442: Continuously read the timer 1 count value within the interrupt;
[0120] Step S444: Determine if the count value is ≥3us. If yes, proceed to step S446; otherwise, proceed to step S442.
[0121] Step S446: Clear the timer 1 count value;
[0122] Step S448: Record the sampling level;
[0123] Step S450: Determine whether the number of samples is ≥15. If yes, proceed to step S452; otherwise, proceed to step S442.
[0124] Step S452, process the data;
[0125] Step S454: Level 1 has a greater weight than Level 0, and the weight of the sampled intermediate data is greater than the weight of the sampled first and last data.
[0126] Step S456: Record this bit data;
[0127] Step S458: Determine whether sampling is complete. If yes, proceed to step S460; otherwise, proceed to step S462.
[0128] Step S460: Determine whether all bytes have been sampled. If yes, proceed to step S464; otherwise, proceed to step S402.
[0129] Step S462, calculate the remaining time for this bit;
[0130] Step S464: Frame processing data;
[0131] Step S466: Start 1us timer 2, set the remaining time of the data bits to the interrupt time, and execute step S434 after waiting for the remaining time.
[0132] In the above embodiments, the entire system includes a timer, I / O (Input / Output) port sampling, sampling level processing, abnormal waveform filtering methods, and data analysis. It can filter abnormal waveforms in the serial port timing waveform on the two-bus receiving stage and parse the data on the bus according to preset serial port parameters. When the two-bus encounters parallel-line routing projects, interference will occur during the two-bus receiving stage. If the chip's hardware serial port is used to parse the waveform, the timing of the hardware serial port is relatively strict, and it is highly likely that the data cannot be parsed. Therefore, oversampling, two-bus timing reference, and weighted analysis methods can be added to the software serial port to filter the interference data. Moreover, software improvements can solve the two-bus interference problem when the hardware solution is finalized (without modifying the hardware), and can solve the communication failure problem caused by abnormal interference during the use of the two-bus at a low cost.
[0133] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0135] According to another aspect of the embodiments of this application, a device for determining the state of a node device is also provided. This device can be used to implement the method for determining the state of a node device provided in the above embodiments, and will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0136] Figure 5 This is a structural block diagram of an optional node device state determination device according to an embodiment of this application, such as... Figure 5 As shown, the device for determining the status of the node device includes:
[0137] The detection module 502 is used to detect the target signal transmitted in real time in the target bus, and when a falling edge is detected, to sample the target signal N times to obtain N first sampled signals, wherein the target signal is the signal sent by the node device through the target bus when it receives a query command;
[0138] The first determining module 504 is used to determine analytical data based on N of the first sampled signals;
[0139] Sampling module 506 is used to continue sampling the target signal transmitted in real time in the target bus M times when the parsed data is the start bit data, so as to obtain the second sampled signal;
[0140] The second determining module 508 is used to determine data bit data based on the second sampling signal;
[0141] The third determining module 510 is used to determine the state of the node device based on the data bit data.
[0142] In an exemplary embodiment, the first determining module 504 may determine the parsed data based on N first sampled signals in the following manner: determining a first number of first sub-signals and a second number of second sub-signals included in the N first sampled signals, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; and determining the parsed data based on the first number and the second number.
[0143] In an exemplary embodiment, the first determining module 504 may determine the parsed data based on the first quantity and the second quantity in the following manner: when the first quantity is N, the parsed data is determined to be a first value; when the second quantity is N, the parsed data is determined to be a second value.
[0144] In an exemplary embodiment, the first determining module 504 may determine the parsed data based on the first quantity and the second quantity in the following manner: when neither the first quantity nor the second quantity is 0, determine the first proportion of the first sub-signal based on the first quantity, determine the second proportion of the second sub-signal based on the second quantity, and determine the parsed data based on the first proportion and the second proportion.
[0145] In an exemplary embodiment, the first determining module 504 may determine the parsed data based on the first proportion and the second proportion in the following manner: when the first proportion is greater than or equal to a first preset threshold, the parsed data is determined to be a first value; when the second proportion is greater than or equal to the first preset threshold, the parsed data is determined to be a second value.
[0146] In an exemplary embodiment, the first determining module 504 may determine the parsed data based on the first proportion and the second proportion in the following manner: when the first difference between the first proportion and the second proportion is less than or equal to a second preset threshold, a first weight of each of the first sampled signals is determined; a first sum and a second sum are determined based on the first weight, wherein the first sum is the sum of the first weights of the first sub-signals, and the second sum is the sum of the first weights of the second sub-signals; when the first sum is greater than or equal to the second sum, the parsed data is determined to be a first value; when the first sum is less than the second sum, the parsed data is determined to be a second value.
[0147] In an exemplary embodiment, the first determining module 504 may determine the first weight of each first sampled signal in the following manner: determining an intermediate signal, a first signal preceding the intermediate signal, and a second signal following the intermediate signal among N first sampled signals, wherein the number of intermediate signals is odd when N is odd and even when N is even; setting the first weight of the intermediate signal to a target weight value; setting the first weight of the first signal to decrease according to a target gradient based on the target weight value; setting the first weight of the second signal to decrease according to the target gradient based on the target weight value.
[0148] In an exemplary embodiment, the sampling module 506 may continue to sample the target signal transmitted in real time on the target bus M times to obtain a second sampling signal in the following manner: when the number of data bits included in the target signal is Y bits, the target signal transmitted on the target bus is sampled M times in Y target periods to obtain Y sampling signal groups, wherein one sampling signal group includes M sampling signals; the Y sampling signal groups are determined as the second sampling signal.
[0149] In an exemplary embodiment, the second determining module 508 may determine data bits based on the second sampling signal in the following manner: for each sampling signal group included in the second sampling signal, perform the following operations to determine the data bits corresponding to the sampling signal group: determine a third number of first sub-signals and a fourth number of second sub-signals included in the sampling signal group, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; determine the data bits based on the third number and the fourth number.
[0150] In an exemplary embodiment, the second determining module 508 may determine the data bit data based on the third quantity and the fourth quantity in the following manner: when the third quantity is M, the data bit data is determined to be a first value; when the fourth quantity is M, the data bit data is determined to be a second value.
[0151] In an exemplary embodiment, the second determining module 508 may determine the data bit data based on the third quantity and the fourth quantity in the following manner: when both the third quantity and the fourth quantity are not 0, determine the third proportion of the first sub-signal based on the third quantity, determine the fourth proportion of the second sub-signal based on the fourth quantity, and determine the data bit data based on the third proportion and the fourth proportion.
[0152] In an exemplary embodiment, the second determining module 508 may determine the data bit data based on the third proportion and the fourth proportion in the following manner: when the third proportion is greater than or equal to a first preset threshold, the data bit data is determined to be a first value; when the fourth proportion is greater than or equal to the first preset threshold, the data bit data is determined to be a second value.
[0153] In an exemplary embodiment, the second determining module 508 may determine the data bit data based on the third proportion and the fourth proportion in the following manner: when the second difference between the third proportion and the fourth proportion is less than or equal to a third preset threshold, determining a second weight for each sampled signal included in the sampled signal group; determining a third sum and a fourth sum based on the second weight, wherein the third sum is the sum of the second weights of the first sub-signal, and the fourth sum is the sum of the second weights of the second sub-signal; when the third sum is greater than or equal to the fourth sum, determining the data bit data as a first value; and when the third sum is less than the fourth sum, determining the data bit data as a second value.
[0154] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0155] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes the steps in any of the above method embodiments when it is run.
[0156] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.
[0157] According to another aspect of the embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is configured to perform the steps of any of the method embodiments described above via the computer program. In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0158] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0159] According to another aspect of the embodiments of this application, a computer program product is also provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit 601, it performs various functions provided in the embodiments of this application. The sequence numbers of the embodiments of this application above are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0160] Figure 6 A schematic block diagram of a computer system architecture for implementing embodiments of the present application is shown. Figure 6 As shown, the computer system 600 includes a Central Processing Unit (CPU) 601, which performs various appropriate actions and processes based on programs stored in ROM 602 or loaded into RAM 603 from storage section 608. Random Access Memory 603 also stores various programs and data required for system operation. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An Input / Output (I / O) interface 605 is also connected to the bus 604.
[0161] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card, such as a local area network card or modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0162] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit 601, it performs various functions defined in the system of this application.
[0163] It should be noted that, Figure 6 The computer system 600 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0164] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0165] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining the state of a node device, characterized in that, include: The target signal transmitted in real time in the target bus is detected, and when a falling edge is detected, the target signal is sampled N times to obtain N first sampled signals, wherein the target signal is the signal sent by the node device through the target bus when it receives a query command; Determine analytical data based on N of the first sampled signals; If the parsed data is start bit data, the target signal transmitted in real time in the target bus is sampled M times to obtain the second sampled signal; The data bits are determined based on the second sampled signal; The state of the node device is determined based on the data bit data.
2. The method according to claim 1, characterized in that, Based on N of the first sampled signals, the analytical data is determined, including: Determine a first number of first sub-signals and a second number of second sub-signals included in N first sampled signals, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; The parsed data is determined based on the first quantity and the second quantity.
3. The method according to claim 2, characterized in that, Determining the parsed data based on the first quantity and the second quantity includes: When the first quantity is N, the parsed data is determined to be the first value; When the second quantity is N, the parsed data is determined to be the second value.
4. The method according to claim 2, characterized in that, Determining the parsed data based on the first quantity and the second quantity includes: When both the first quantity and the second quantity are not 0, the first proportion of the first sub-signal is determined based on the first quantity, and the second proportion of the second sub-signal is determined based on the second quantity; The parsed data is determined based on the first proportion and the second proportion.
5. The method according to claim 4, characterized in that, The parsed data is determined based on the first proportion and the second proportion, including: If the first proportion is greater than or equal to the first preset threshold, the parsed data is determined to be the first value; If the second proportion is greater than or equal to the first preset threshold, the parsed data is determined to be the second value.
6. The method according to claim 4, characterized in that, The parsed data is determined based on the first proportion and the second proportion, including: If the first difference between the first proportion and the second proportion is less than or equal to the second preset threshold, a first weight is determined for each of the first sampled signals; A first sum and a second sum are determined based on the first weight, wherein the first sum is the sum of the first weights of the first sub-signal, and the second sum is the sum of the first weights of the second sub-signal; If the first sum is greater than or equal to the second sum, the parsed data is determined to be the first value; If the first sum is less than the second sum, the parsed data is determined to be the second value.
7. The method according to claim 6, characterized in that, Determining a first weight for each of the first sampled signals includes: Determine the intermediate signal, the first signal preceding the intermediate signal, and the second signal following the intermediate signal among the N first sampled signals, wherein the number of intermediate signals is odd when N is odd and even when N is even; Set the first weight of the intermediate signal to the target weight value; The first weight of the first signal is set to decrease according to the target gradient based on the target weight value; The first weight of the second signal is set to decrease according to the target gradient based on the target weight value.
8. The method according to claim 1, characterized in that, The target signal transmitted in real time on the target bus is sampled M times to obtain a second sampled signal, including: When the number of data bits included in the target signal is Y bits, the target signal transmitted in the target bus is sampled M times in Y target cycles to obtain Y sample signal groups, wherein one sample signal group includes M sample signals; The Y groups of the sampled signals are determined as the second sampled signal.
9. The method according to claim 1, characterized in that, Determining data bits based on the second sampled signal includes: For each sample signal group included in the second sample signal, the following operations are performed to determine the data bit data corresponding to the sample signal group: Determine the third number of the first sub-signal and the fourth number of the second sub-signal included in the sampled signal group, wherein the voltage value of the first sub-signal is less than a predetermined threshold and the voltage value of the second sub-signal is greater than the predetermined threshold; The data bits are determined based on the third quantity and the fourth quantity.
10. The method according to claim 9, characterized in that, Determining the data bit data based on the third quantity and the fourth quantity includes: When the third quantity is M, the data bit is determined to be the first value; When the fourth quantity is M, the data bit is determined to be the second value.
11. The method according to claim 9, characterized in that, Determining the data bit data based on the third quantity and the fourth quantity includes: When both the third quantity and the fourth quantity are not 0, the third proportion of the first sub-signal is determined based on the third quantity, and the fourth proportion of the second sub-signal is determined based on the fourth quantity. The data bit data is determined based on the third proportion and the fourth proportion.
12. The method according to claim 11, characterized in that, Determining the data bit data based on the third proportion and the fourth proportion includes: If the third proportion is greater than or equal to the first preset threshold, the data bit is determined to be the first value; If the fourth proportion is greater than or equal to the first preset threshold, the data bit is determined to be the second value.
13. The method according to claim 11, characterized in that, Determining the data bit data based on the third proportion and the fourth proportion includes: If the second difference between the third proportion and the fourth proportion is less than or equal to a third preset threshold, a second weight is determined for each sampled signal included in the sampled signal group; A third sum and a fourth sum are determined based on the second weight, wherein the third sum is the sum of the second weights of the first sub-signal, and the fourth sum is the sum of the second weights of the second sub-signal; If the third sum is greater than or equal to the fourth sum, the data bit is determined to be the first value; If the third sum is less than the fourth sum, the data bit is determined to be the second value.
14. A device for determining the state of a node device, characterized in that, include: The detection module is used to detect the target signal transmitted in real time in the target bus, and when a falling edge is detected, the target signal is sampled N times to obtain N first sampled signals, wherein the target signal is the signal sent by the node device through the target bus when it receives a query command; The first determining module is used to determine analytical data based on N of the first sampled signals; The sampling module is used to continue sampling the target signal transmitted in real time in the target bus M times when the parsed data is the start bit data, so as to obtain the second sampled signal; The second determining module is used to determine the data bits based on the second sampled signal; The third determining module is used to determine the state of the node device based on the data bit data.
15. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 13.
17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.