Serial bus redundant communication diagnosis method and system and electronic equipment
By obtaining the self-diagnosis information of the standby station and sending communication diagnostic instructions in abnormal situations in the serial bus communication system, the problem of how to confirm the communication connection between the standby station and the downstream equipment without the confusion of link data is solved, and the accurate confirmation of communication status and guarantee of link stability is achieved.
Patent Information
- Application Number
- CN202411395055.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-25
AI Technical Summary
In a serial bus communication system using a redundant solution, how to confirm the communication connection between the standby station and the downstream equipment without the confusion of link data.
The self-diagnosis information of the backup station is obtained through the main station. When the self-diagnosis information is abnormal, the main station sends communication diagnostic instructions to the backup station and enters the backup station waiting state. The backup station sends diagnostic information to the downstream equipment through the serial bus, generating and returning the diagnostic results.
Without affecting the serial bus data transmission, accurately confirm the communication between the backup station and the downstream equipment to avoid link data confusion and ensure that the backup station can timely understand the communication status between itself and the downstream equipment.
Smart Images

Figure CN119520358A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a serial bus redundant communication diagnosis method, system and electronic equipment. Background Art
[0002] In order to ensure the stability of data transmission, the current serial bus communication system often uses a redundant solution, that is, more than one control center is set up upstream, and only one control center is used as the master station to communicate with the downstream equipment at the same time, and the remaining control centers are on standby as backup stations. When switching is required, a backup station is selected to replace the original master station as the new master station.
[0003] For the backup station, it is necessary to be prepared to become the master station at any time. Therefore, the backup station also needs to confirm whether it can communicate with the downstream device. However, in serial communication, if two control centers use the serial link to communicate with the downstream device at the same time, the data in the link will be confused, and the normal operation of the master station will frequently use the serial bus for communication.
[0004] Therefore, how to confirm the communication connection between the backup station and the downstream equipment in a serial bus communication system using a redundant solution while ensuring that link data is not confused is an urgent problem to be solved. Summary of the invention
[0005] In view of this, the present invention is committed to providing a serial bus redundant communication diagnostic method, system and electronic device to confirm the communication connection status between the backup station and the downstream device in a serial bus communication system using a redundant scheme while ensuring that there is no link data confusion.
[0006] In a first aspect, an embodiment of the present application provides a serial bus redundant communication diagnostic method, which is applied to a master station in a serial bus redundant communication system, wherein the serial bus redundant communication system further includes a standby station and a downstream device, wherein the master station is connected to the standby station via a heartbeat line, and the master station and the standby station are both connected to the downstream device via a serial bus, wherein the method includes:
[0007] Acquiring self-diagnosis information, the self-diagnosis information including a detection record of the standby station detecting whether the standby station can communicate with the downstream device through self-diagnosis;
[0008] When the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and a standby station waiting state is entered, so as to wait for the standby station to return a diagnosis result in the standby station waiting state;
[0009] The communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate the diagnostic result based on feedback information of the diagnostic information.
[0010] Optionally, the obtaining of self-diagnosis information includes:
[0011] The self-diagnosis information transmission instruction is periodically sent to the standby station via the heartbeat line with a first preset time period as a period, and the self-diagnosis information returned by the standby station according to the self-diagnosis information transmission instruction is received via the heartbeat line; or, the self-diagnosis information periodically sent by the standby station with a second preset time period as a period is received via the heartbeat line.
[0012] Optionally, when the self-diagnosis information is abnormal, sending a communication diagnosis instruction to the standby station through the heartbeat line and entering a standby station waiting state includes:
[0013] When the master station is communicating online with the downstream device and the standby station is communicating online with the downstream device, but the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state;
[0014] or,
[0015] When the master station communicates with the downstream device online and the standby station communicates with the downstream device offline, and the self-diagnosis information indicates that the standby station's most recent self-diagnosis was unsuccessful, after a preset waiting time, a communication diagnosis instruction is sent to the standby station via the heartbeat line, and the standby station enters a waiting state.
[0016] Optionally, when the self-diagnosis information is abnormal, sending a communication diagnosis instruction to the standby station through the heartbeat line and entering a standby station waiting state includes:
[0017] When the communication between the master station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, the following steps are periodically performed with a preset polling diagnosis duration as a period until at least one of the master station and the standby station is online in communication with the downstream device:
[0018] sending diagnostic information to the downstream device via the serial bus to attempt to establish communication with the downstream device;
[0019] After failing to establish communication with the downstream device, sending a communication diagnosis instruction to the standby station through the heartbeat line and entering a standby station waiting state;
[0020] The diagnostic result returned by the standby station is received, and when the diagnostic result shows that the standby station fails to establish communication with the downstream device, the standby station waiting state is exited.
[0021] In a second aspect, an embodiment of the present application provides a serial bus redundant communication diagnostic method, which is applied to a standby station in a serial bus redundant communication system, wherein the serial bus redundant communication system further includes a master station and a downstream device, wherein the master station is connected to the standby station via a heartbeat line, and the master station and the standby station are both connected to the downstream device via a serial bus, wherein the method includes:
[0022] Perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis;
[0023] receiving, via the heartbeat line, a communication diagnostic instruction returned by the master station according to the self-diagnostic information, and sending diagnostic information to the downstream device via the serial bus according to the communication diagnostic instruction;
[0024] The diagnostic result is generated based on the feedback information of the diagnostic information and is returned to the master station.
[0025] Optionally, performing self-diagnosis acquisition and sending self-diagnosis information to the master station includes:
[0026] Performing the self-diagnosis periodically to obtain the self-diagnosis information with a third preset time period as a period;
[0027] Receive a self-diagnosis information transmission instruction periodically sent by the main station through the heartbeat line with a first preset time period as a period, and send the self-diagnosis information to the main station through the heartbeat line according to the self-diagnosis information transmission instruction; or, periodically send the self-diagnosis information to the main station through the heartbeat line with a second preset time period as a period.
[0028] Optionally, receiving, through the heartbeat line, a communication diagnostic instruction returned by the master station according to the self-diagnostic information, and sending diagnostic information to the downstream device through the serial bus according to the communication diagnostic instruction; generating and returning the diagnostic result to the master station based on feedback information of the diagnostic information, comprises:
[0029] When the communication between the master station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, the following steps are periodically performed with a preset polling diagnosis duration as a period until at least one of the master station and the standby station is online in communication with the downstream device:
[0030] receiving a communication diagnostic instruction sent by the master station through the heartbeat line, and sending diagnostic information to the downstream device through the serial bus according to the communication instruction, so as to try to establish communication with the downstream device;
[0031] After the communication connection with the downstream device fails to be established, the diagnosis result is returned to the master station, and the diagnosis result shows that the standby station fails to establish the communication connection with the downstream device.
[0032] Optionally, the performing self-diagnosis acquisition and sending self-diagnosis information to the master station includes:
[0033] Monitoring the serial bus to obtain first data and second data transmitted by the serial bus, wherein the first data is a communication request sent by the master station to the downstream device, and the second data is a response message sent by the downstream device to the master station according to the communication request;
[0034] According to the first data and the second data, self-diagnosis information is acquired and sent to the master station.
[0035] In a third aspect, an embodiment of the present application provides a serial bus redundant communication system, including:
[0036] A master station, at least one standby station and a downstream device, wherein the master station and the standby station are both connected to the downstream device via a serial bus, and the master station and the standby station are connected via a heartbeat line;
[0037] The standby station is used to perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis; receiving the communication diagnosis instruction returned by the master station according to the self-diagnosis information through the heartbeat line, and sending the diagnosis information to the downstream device through the serial bus according to the communication diagnosis instruction; generating and returning the diagnosis result to the master station based on the feedback information of the diagnosis information;
[0038] The master station is used to obtain self-diagnosis information, and the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis; when the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a standby station waiting state, so as to wait for the standby station to return a diagnosis result in the standby station waiting state; the communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate the diagnostic result based on feedback information of the diagnostic information.
[0039] Optionally, the master station and the backup station are connected via a heartbeat line, including:
[0040] The master station and any of the backup stations are directly connected via a heartbeat line, and any two of the backup stations are directly connected via a heartbeat line;
[0041] or,
[0042] The master station is directly connected to a first preset number of the standby stations through a heartbeat line, and a second preset number of the standby stations are directly connected to each other through a heartbeat line, so that the master station and any one of the standby stations, or any two of the standby stations, communicate through a preset routing protocol.
[0043] In a fourth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor;
[0044] The memory is connected to the processor and is used to store programs;
[0045] The electronic device implements the serial bus redundant communication diagnosis method as described in the first aspect or the second aspect by running the program in the memory through the processor.
[0046] The present application provides a serial bus redundant communication diagnosis method. The master station sends a communication diagnosis instruction to the standby station according to the self-diagnosis information of the standby station and enters the standby station waiting state, so that the standby station can diagnose its communication with the downstream device through the serial bus. The present application timely grants the standby station the right to occupy the serial bus for communication diagnosis at the appropriate time by the master station, so that the standby station can accurately know the communication status between itself and the downstream device. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0048] Figure 1 A schematic diagram of the structure of a serial bus redundant communication system provided in an embodiment of the present application.
[0049] Figure 2 A flowchart of a serial bus redundant communication diagnostic method provided in an embodiment of the present application.
[0050] Figure 3 A flowchart of another serial bus redundant communication diagnostic method provided in an embodiment of the present application.
[0051] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] This application is applied to serial bus redundant communication systems, such as Figure 1 As shown in the figure, it is a serial bus redundant communication system with one master station and one redundant standby station, and multiple downstream devices. The master station is named FEP-A, the standby station is named FEP-B, the master station and the standby station are connected to the downstream devices through the COMA serial port, and the master station and the standby station are connected through the dual-machine heartbeat line.
[0054] It should be noted that the master station and the backup station in the serial bus redundant communication system can be converted into each other. When switching is required, for example, when the master station fails, the serial bus redundant communication system will select a backup station to replace the original master station as the new master station and take over the work of the original master station. Therefore, the "master station" and "backup station" in this application are only the names given to the devices at the time of executing the method in this application according to the functions implemented by the devices at that time. If the switching of the master and backup stations occurs later, the master station and the backup station need to be re-determined when the method is executed again later.
[0055] The first embodiment of the present application provides a serial bus redundant communication diagnostic method, which is applied to a master station in a serial bus redundant communication system. The serial bus redundant communication system also includes a standby station and a downstream device. The master station and the standby station are connected via a heartbeat line. The master station and the standby station are both connected to the downstream device via a serial bus, such as Figure 2 As shown, the method may include the following steps:
[0056] Step 201 : Obtain self-diagnosis information, where the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis.
[0057] In order to avoid link data confusion, the prior art generally stipulates that when the master station is working, other standby stations in the serial bus redundant communication system are in a silent state and cannot use the serial bus for activities. Although it is impossible to use the serial bus to communicate directly with downstream devices, the standby station can still use some indirect diagnostic means to indirectly detect the communication status between the standby station and the downstream device, that is, self-diagnosis. However, the above-mentioned indirect diagnostic means are less accurate than direct communication diagnosis using the serial bus. For example, the two parties who directly use the serial bus to communicate can use encryption check bits to check each other and other means to ensure the integrity and accuracy of information transmission, but the self-diagnosis of the standby station cannot use the above-mentioned technical means.
[0058] In this embodiment, self-diagnosis information including a detection record of whether the standby station can communicate with the downstream device through self-diagnosis is obtained from the standby station for further analysis.
[0059] Step 202: When the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state, so as to wait for the standby station to return the diagnosis result in the standby station waiting state; the communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate a diagnostic result based on the feedback information of the diagnostic information.
[0060] The master station and the standby station are connected via a heartbeat line to achieve communication between the master station and the standby station without affecting the data transmission in the serial bus. The heartbeat line can work in full-duplex mode to further avoid conflicts in the communication between the master station and the standby station via the heartbeat line.
[0061] When the acquired self-diagnosis information indicates that the standby station detects an abnormality in the communication between itself and the downstream device, the master station will send a communication diagnosis instruction to the standby station through the heartbeat line and enter the standby station waiting state. In the standby station waiting state, the master station will remain silent and will not occupy the serial bus until the state ends. The release method of the standby station waiting state can be set to release after receiving the diagnostic result returned by the standby station, or release it automatically after a period of time.
[0062] The communication diagnostic instruction instructs the standby station to send diagnostic information to the downstream device via the serial bus. Since the master station is in the standby station waiting state at this time, only the standby station uses the serial bus for communication, avoiding the situation of link data confusion.
[0063] When the standby station completes the diagnosis of using the serial bus to communicate with the downstream device, it will return the diagnosis result to the master station. The way to return the diagnosis result can be that when the standby station completes the diagnosis, the diagnosis result is immediately sent to the master station through the heartbeat line, or, if the standby station is set to communicate with the master station periodically, the diagnosis result is sent with the communication message in the next communication cycle. The diagnosis result will indicate that the communication between the standby station and the downstream device through the serial bus is normal, or indicate that the standby station and the downstream device cannot communicate through the serial bus.
[0064] This embodiment stipulates the rules for the standby station to use the serial bus, so that at the appropriate time, the master station can promptly grant the standby station the right to occupy the serial bus for communication diagnosis and enter the standby station waiting state according to the rules to avoid affecting the standby station's use of the serial bus, so that the standby station can accurately understand the communication status between itself and the downstream equipment.
[0065] The second embodiment of the present application further defines the serial bus redundant communication diagnostic method in the first embodiment in more detail and specificity. Some or all of the technical features in the second embodiment can be combined with or replaced with the first embodiment alone or in combination, so as to obtain more feasible serial bus redundant communication diagnostic methods.
[0066] The following is a detailed description of the serial bus redundant communication diagnostic method in the second embodiment of the present application:
[0067] Optionally, obtaining self-diagnostic information includes: periodically sending self-diagnostic information transmission instructions to the standby station via a heartbeat line with a first preset time period as a period, and receiving self-diagnostic information returned by the standby station according to the self-diagnostic information transmission instructions via the heartbeat line; or, receiving self-diagnostic information periodically sent by the standby station with a second preset time period as a period via the heartbeat line.
[0068] Since in actual applications, the serial bus redundant communication system is generally in a long-term working state, this embodiment provides the above method to periodically obtain self-diagnosis information when the serial bus redundant communication system is running for a long time.
[0069] The method of periodically obtaining self-diagnosis information can be that the main station periodically sends a self-diagnosis information transmission instruction to the standby station with a first preset time period as a period, and then receives the self-diagnosis information returned by the standby machine. Alternatively, a reporting timing thread can be established in the standby station, with a second preset time period as a period, and the standby station periodically reports the self-diagnosis information by itself, and the main station is only responsible for receiving it. The specific values of the first preset time period and the second preset time period can be set according to actual needs.
[0070] Optionally, when the self-diagnosis information is abnormal, a communication diagnostic instruction is sent to the standby station via the heartbeat line, and the standby station enters a waiting state, including: when the main station communicates with the downstream device online and the standby station communicates with the downstream device online, but the self-diagnosis information indicates that the standby station's most recent self-diagnosis was unsuccessful, a communication diagnostic instruction is sent to the standby station via the heartbeat line, and the standby station enters a waiting state; or, when the main station communicates with the downstream device online and the standby station communicates with the downstream device offline, and the self-diagnosis information indicates that the standby station's most recent self-diagnosis was unsuccessful, after a preset waiting time, a communication diagnostic instruction is sent to the standby station via the heartbeat line, and the standby station enters a waiting state.
[0071] In order to characterize the communication status between devices, "offline" and "online" can be used for description. Considering that during data transmission, there may be temporary packet loss due to accidental reasons such as signal interference. But in fact, the communication connection between devices is not completely disconnected, and the device should be considered to be still online at this time. Therefore, if only one diagnosis or self-diagnosis is performed, the results obtained may not be absolutely accurate. In summary, for the operation of switching between the offline and online states of the device, considering the existence of packet loss and other situations, it can be set as needed to perform multiple diagnoses or self-diagnoses and obtain the same results before switching the offline and online states of the device, so as to ensure the reliability of the parameters of the device status this time.
[0072] In this embodiment, a set of rules is provided to specify how to switch the offline and online states of a device. Specifically, the following rules are included: when the device is downgraded from a master station to a backup station due to disconnection with the device, the device is in an offline state; when the device cannot obtain any data from the heartbeat line and the serial bus for a period of time, the device automatically enters an offline state; when the device fails to self-diagnose for multiple times (at least twice) in a row, the device is in an offline state; when the device fails to diagnose the downstream device through the serial bus, the device is in an offline state; when the device successfully performs a self-diagnosis or diagnoses the downstream device through the serial bus, the device is in an online state.
[0073] In the above rules, except for the special case of obtaining any data from the heartbeat line and serial bus (in this case, the device is disconnected from other devices and can only perform operations on its own), the switching method of the device status in other cases can be set as needed. For example, the backup station can enter the offline state or online state by itself when it meets the rules; or it needs to contact the master station and enter the offline state or online state only after receiving the instruction of the master station.
[0074] In this embodiment, the specific way for the master station to obtain the status of the standby station can be set to obtain it from the self-diagnosis information sent by the standby station, or it can be set that the master station has a dedicated standby station status acquisition process and the status of the standby station is obtained by the process.
[0075] This embodiment provides the following two processing methods for the offline and online states of the standby station:
[0076] If the master station is communicating with the downstream device online, and the master station analyzes the self-diagnosis information and finds that the standby station has failed to perform self-diagnosis successfully within the most recent continuous time (the length of the continuous time can be set as needed), and the standby station is still communicating with the downstream device online, then a communication diagnosis instruction is sent to the standby station and the standby station enters the standby station waiting state. The specific sending time can be immediate sending, or, when a general periodic communication rule is set between the master station and the standby station, according to the communication rule, a communication diagnosis instruction is sent to the standby station at the next general periodic communication.
[0077] If the master station is communicating with the downstream device online, and the master station analyzes the self-diagnosis information and finds that the standby station has failed to perform self-diagnosis successfully within the most recent continuous time (the length of the continuous time can be set as needed), and the standby station is communicating with the downstream device offline, then after the preset waiting time, a communication diagnosis instruction is sent to the standby station, and the standby station enters the waiting state. The preset waiting time is generally much longer than the communication cycle length in the general periodic communication rules mentioned above.
[0078] In the case where the standby station is offline, in order to avoid frequent diagnosis of the standby station occupying communication bandwidth and affecting the normal operation of the host, a longer preset waiting time will be set to reduce the diagnosis frequency of the standby station in the offline state.
[0079] This embodiment also specifically provides a description method for representing the most recent self-diagnosis situation of the standby station in the self-diagnosis information. The standby station can maintain a self-diagnosis number variable Dn. Whenever the standby station successfully performs a self-diagnosis, the value of Dn is increased by one. When the master station finds that the value of Dn in the self-diagnosis information has not increased, it is considered that the most recent self-diagnosis of the standby station has not been successful.
[0080] Optionally, when the self-diagnosis information is abnormal, a communication diagnostic instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state, including: when the communication between the main station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the standby station's most recent self-diagnosis is unsuccessful, with a preset polling diagnosis duration as a period, periodically execute the following steps until at least one device in the main station and the standby station is online in communication with the downstream device: send diagnostic information to the downstream device through the serial bus to try to establish communication with the downstream device; after failing to establish communication with the downstream device, send a communication diagnostic instruction to the standby station through the heartbeat line, and enter the standby station waiting state; receive the diagnostic result returned by the standby station, and when the diagnostic result shows that the standby station has failed to establish communication with the downstream device, exit the standby station waiting state.
[0081] When both the master station and the backup station are in an offline state, the core task of the serial bus redundant communication system is to select a device that can establish communication with the downstream device as soon as possible to continue working. Therefore, this embodiment provides the above method to find a device that can establish communication with the downstream device in the master station and the backup station as soon as possible.
[0082] Specifically, the master station and the standby station periodically perform polling diagnosis together with a preset polling diagnosis duration. In one cycle, each device will occupy the serial bus to perform communication diagnosis once. In the above polling diagnosis, as long as any device successfully establishes communication with the downstream device, the device can start working as a new master station.
[0083] It should be understood that when both the master station and the backup station are offline, the "master station" is actually unable to work normally through the serial bus. Therefore, in the above polling diagnosis, the master station and the backup station have the same control opportunity over the downstream devices. At this time, the master station and the backup station are only different in name, and their control status over the downstream devices is actually equal.
[0084] The above polling diagnosis requires a device to act as a coordinator to lead the entire process to avoid multiple devices using the serial bus for diagnosis at the same time, which may cause confusion in link data. In this embodiment, the master station is used as the coordinator. As has been discussed above, at this time, the master station and the standby station actually have the same control status over the downstream device in the system, so the standby station can also replace the master station as the coordinator to execute the method in this embodiment.
[0085] The third embodiment of the present application provides a serial bus redundant communication diagnostic method, which is applied to a standby station in a serial bus redundant communication system. The serial bus redundant communication system also includes a master station and a downstream device. The master station and the standby station are connected via a heartbeat line. The master station and the standby station are both connected to the downstream device via a serial bus, such as Figure 3 As shown, the method may include the following steps:
[0086] Step 301: Perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis.
[0087] When the master station is working, the standby station is usually in a silent state. In the silent state, the standby station cannot use the serial bus for activities, but it can still perform self-diagnosis through some indirect technical means to detect the communication between the standby station and the downstream equipment. For example, the voltage waveform of the serial port can be detected and analyzed to determine whether the serial port can receive data in the serial bus.
[0088] After completing the self-diagnosis, the self-diagnosis information including the self-diagnosis test record is sent to the main station through the heartbeat line.
[0089] Step 302: Receive the communication diagnosis instruction returned by the master station according to the self-diagnosis information through the heartbeat line, and send the diagnosis information to the downstream device through the serial bus according to the communication diagnosis instruction.
[0090] When receiving the communication diagnostic command sent by the master station, the standby station will exit the silent state and send diagnostic information to the downstream device through the serial bus to verify the communication status between the standby station and the downstream device.
[0091] Step 303: Generate feedback information based on the diagnostic information and return the diagnostic result to the master station.
[0092] After the standby station sends diagnostic information to the downstream device, it will receive feedback information (even the situation of "no feedback information received from the downstream device" is a type of feedback information, corresponding to the situation where the standby station and the downstream device cannot communicate through the serial bus), and return the diagnostic results including the feedback information to the master station.
[0093] The diagnostic result can be returned by sending the diagnostic result to the master station via the heartbeat line immediately after the standby station completes the diagnosis, or, if the standby station is set to communicate with the master station periodically, sending the diagnostic result along with the communication message in the next communication cycle. The diagnostic result will indicate that the communication between the standby station and the downstream device via the serial bus is normal, or indicate that the standby station and the downstream device cannot communicate via the serial bus.
[0094] The fourth embodiment of the present application further defines the serial bus redundant communication diagnostic method in the third embodiment in more detail and specificity. Some or all of the technical features in the fourth embodiment can be combined with or replaced with the third embodiment alone or in combination, so as to obtain more feasible serial bus redundant communication diagnostic methods.
[0095] The following is a detailed description of the serial bus redundant communication diagnostic method in the fourth embodiment of the present application:
[0096] Optionally, performing self-diagnosis to obtain and sending self-diagnosis information to the main station includes: periodically performing self-diagnosis to obtain self-diagnosis information with a third preset time period as a period; receiving self-diagnosis information transmission instructions periodically sent by the main station through a heartbeat line with a first preset time period as a period, and sending self-diagnosis information to the main station through the heartbeat line according to the self-diagnosis information transmission instructions; or, periodically sending self-diagnosis information to the main station through the heartbeat line with a second preset time period as a period.
[0097] Since in actual applications, the serial bus redundant communication system is generally in a long-term working state, this embodiment provides the above method to periodically obtain self-diagnosis information when the serial bus redundant communication system is running for a long time.
[0098] First, the standby station periodically performs self-diagnosis with the third preset time length as a period to obtain self-diagnosis information, and then periodically transmits the self-diagnosis information to the master station.
[0099] The method of periodically transmitting self-diagnosis information to the master station can be that the master station periodically sends a self-diagnosis information transmission instruction to the standby station with a first preset time period as a period, and then receives the self-diagnosis information returned by the standby machine. Alternatively, a reporting timing thread can be established in the standby station, with a second preset time period as a period, and the standby station periodically reports the self-diagnosis information by itself, and the master station is only responsible for receiving it. The specific values of the first preset time period and the second preset time period can be set according to actual needs.
[0100] Optionally, a communication diagnostic instruction returned by the master station based on the self-diagnosis information is received through a heartbeat line, and diagnostic information is sent to the downstream device through a serial bus according to the communication diagnostic instruction; a diagnostic result is generated based on the feedback information of the diagnostic information and returned to the master station, including: when the communication between the master station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the standby station’s most recent self-diagnosis is unsuccessful, the following steps are periodically performed with a preset polling diagnosis duration as a period until at least one device in the master station and the standby station is online in communication with the downstream device: a communication diagnostic instruction sent by the master station is received through a heartbeat line, and diagnostic information is sent to the downstream device through a serial bus according to the communication instruction to try to establish communication with the downstream device; after failing to establish communication with the downstream device, a diagnostic result is returned to the master station, and the diagnostic result shows that the standby station failed to establish communication with the downstream device.
[0101] When both the master station and the backup station are in an offline state, the core task of the serial bus redundant communication system is to select a device that can establish communication with the downstream device as soon as possible to continue working. Therefore, this embodiment provides the above method to find a device that can establish communication with the downstream device in the master station and the backup station as soon as possible.
[0102] Specifically, the master station and the standby station periodically perform polling diagnosis together with a preset polling diagnosis duration. In one cycle, each device will occupy the serial bus to perform communication diagnosis once. In the above polling diagnosis, as long as any device successfully establishes communication with the downstream device, the device can start working as a new master station.
[0103] It should be understood that when both the master station and the backup station are offline, the "master station" is actually unable to work normally through the serial bus. Therefore, in the above polling diagnosis, the master station and the backup station have the same control opportunity over the downstream devices. At this time, the master station and the backup station are only different in name, and their control status over the downstream devices is actually equal.
[0104] The above polling diagnosis requires a device to act as a coordinator to lead the entire process to avoid multiple devices using the serial bus for diagnosis at the same time, which may cause confusion in link data. In this embodiment, the master station is used as the coordinator, and the standby station receives the leadership of the coordinator. As has been discussed above, at this time, the control status of the master station and the standby station over the downstream device in the system is actually the same, so the master station can also be used instead of the standby station to receive the leadership of the coordinator to execute the method in this embodiment.
[0105] Optionally, performing self-diagnosis to obtain and send self-diagnosis information to the main station includes: monitoring the serial bus, obtaining first data and second data transmitted by the serial bus, the first data being a communication request sent by the main station to a downstream device, and the second data being a response message sent by the downstream device to the main station based on the communication request; based on the first data and the second data, obtaining and sending self-diagnosis information to the main station.
[0106] This embodiment provides a specific self-diagnosis method, which is used for the standby station to self-diagnose the communication status with the downstream device without occupying the serial bus.
[0107] In this embodiment, the standby station monitors the data transmitted in the serial bus and identifies the data. If it can identify the communication request sent by the master station to the downstream device and the response message sent by the downstream device to the master station based on the communication request, it can be roughly considered that the standby station can establish communication with the downstream device and can send self-diagnosis information including successful self-diagnosis to the master station.
[0108] A fifth embodiment of the present application provides a serial bus redundant communication system, including:
[0109] A master station, at least one backup station and downstream equipment, the master station and the backup station are connected to the downstream equipment via a serial bus, and the master station and the backup station are connected via a heartbeat line;
[0110] The standby station is used to perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes the detection record of whether the standby station can communicate with the downstream device through self-diagnosis; receiving the communication diagnosis instruction returned by the master station according to the self-diagnosis information through the heartbeat line, and sending the diagnosis information to the downstream device through the serial bus according to the communication diagnosis instruction; generating and returning the diagnosis result based on the feedback information of the diagnosis information to the master station;
[0111] The master station is used to obtain self-diagnosis information, which includes the detection record of whether the standby station can communicate with the downstream device through self-diagnosis. When the self-diagnosis information is abnormal, the master station sends a communication diagnosis instruction to the standby station through the heartbeat line, and enters the standby station waiting state, so as to wait for the standby station to return the diagnosis result in the standby station waiting state. The communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate a diagnostic result based on the feedback information of the diagnostic information.
[0112] The serial bus redundant communication system provided in this embodiment belongs to the same application concept as the serial bus redundant communication diagnostic method provided in the above embodiments of this application, and can execute the serial bus redundant communication diagnostic method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. For the technical details not fully described in this embodiment, please refer to the specific processing content of the serial bus redundant communication diagnostic method provided in the above embodiments of this application, and will not be repeated here.
[0113] Optionally, the master station and the standby station are connected via a heartbeat line, including: the master station and any standby station are directly connected via a heartbeat line, and any two standby stations are directly connected via a heartbeat line; or, the master station and a first preset number of standby stations in the standby station are directly connected via a heartbeat line, and a second preset number of standby stations in the standby station are directly connected via a heartbeat line, and the master station and any one of the standby stations, or any two of the standby stations communicate via a preset routing protocol.
[0114] This embodiment specifically provides a logic of connecting the master station and the backup station through a heartbeat line. One logic is to use a heartbeat line to connect each master station and the backup station and every two backup stations, that is, any two control centers in any system are directly connected by a heartbeat line. This connection method is often used in the case of a small number of redundant backup stations, such as one master station and one or two backup stations.
[0115] Another logic is to directly connect the master station to a first preset number of standby stations among the standby stations through a heartbeat line, and directly connect the second preset number of standby stations among the standby stations through a heartbeat line, and the heartbeat line connection between each control center forms a mesh structure. Since in this connection logic, there may be a situation where two control centers are not directly connected through a heartbeat line, a forwarding routing protocol can be preset, and it is agreed that other control centers will forward on their behalf to ensure that any two control centers in the system can communicate directly or indirectly through a heartbeat line.
[0116] The sixth embodiment of the present application further provides an electronic device, see Figure 4 As shown, the device includes:
[0117] Memory 400 and processor 410;
[0118] The memory 400 is connected to the processor 410 and is used to store programs;
[0119] The processor 410 is used to implement the serial bus redundant communication diagnosis method disclosed in any of the above method embodiments by running the program stored in the memory 400.
[0120] Specifically, the computing device may further include: a bus, a communication interface 420 , an input device 430 and an output device 440 .
[0121] The processor 410, the memory 400, the communication interface 420, the input device 430 and the output device 440 are connected to each other via a bus.
[0122] A bus may include a pathway that transfers information between components of a computer system.
[0123] Processor 410 may be a general purpose processor, such as a general purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the scheme of the present invention. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0124] The processor 410 may include a main processor, and may also include a baseband chip, a modem, and the like.
[0125] The memory 400 stores a program for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 400 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.
[0126] The input device 430 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.
[0127] Output device 440 may include a device that allows information to be output to a user, such as a display screen, a printer, a speaker, etc.
[0128] The communication interface 420 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc.
[0129] The processor 410 executes the program stored in the memory 400 and calls other devices, which can be used to implement the various steps of the distributed service load distribution method provided in the above embodiment of the present application.
[0130] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0131] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0132] The steps in the methods of each embodiment of the present application can be adjusted in sequence, combined and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.
[0133] The modules and sub-modules in the devices and terminals of the various embodiments of the present application can be combined, divided and deleted according to actual needs.
[0134] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0135] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.
[0137] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0138] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software units executed by a processor, or a combination of the two. The software units may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0139] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0140] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A serial bus redundant communication diagnostic method, characterized in that: A method for applying to a master station in a serial bus redundant communication system, wherein the serial bus redundant communication system further comprises a standby station and a downstream device, wherein the master station is connected to the standby station via a heartbeat line, and both the master station and the standby station are connected to the downstream device via a serial bus, and the method comprises: Acquiring self-diagnosis information, the self-diagnosis information including a detection record of the standby station detecting whether the standby station can communicate with the downstream device through self-diagnosis; When the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and a standby station waiting state is entered, so as to wait for the standby station to return a diagnosis result in the standby station waiting state; The communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate the diagnostic result based on feedback information of the diagnostic information.
2. The method according to claim 1, characterized in that The obtaining of self-diagnosis information includes: The self-diagnosis information transmission instruction is periodically sent to the standby station via the heartbeat line with a first preset time period as a period, and the self-diagnosis information returned by the standby station according to the self-diagnosis information transmission instruction is received via the heartbeat line; or, the self-diagnosis information periodically sent by the standby station with a second preset time period as a period is received via the heartbeat line.
3. The method according to claim 1, characterized in that When the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state, including: When the master station is communicating online with the downstream device and the standby station is communicating online with the downstream device, but the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state; or, When the master station communicates with the downstream device online and the standby station communicates with the downstream device offline, and the self-diagnosis information indicates that the standby station's most recent self-diagnosis was unsuccessful, after a preset waiting time, a communication diagnosis instruction is sent to the standby station via the heartbeat line, and the standby station enters a waiting state.
4. The method according to claim 1, characterized in that: When the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a waiting state, including: When the communication between the master station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, the following steps are periodically performed with a preset polling diagnosis duration as a period until at least one of the master station and the standby station is online in communication with the downstream device: sending diagnostic information to the downstream device via the serial bus to attempt to establish communication with the downstream device; After failing to establish communication with the downstream device, sending a communication diagnosis instruction to the standby station through the heartbeat line and entering a standby station waiting state; The diagnostic result returned by the standby station is received, and when the diagnostic result shows that the standby station fails to establish communication with the downstream device, the standby station waiting state is exited.
5. A serial bus redundant communication diagnostic method, characterized in that: Applied to a standby station in a serial bus redundant communication system, the serial bus redundant communication system further includes a master station and a downstream device, the master station is connected to the standby station via a heartbeat line, and the master station and the standby station are both connected to the downstream device via a serial bus, the method comprising: Perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis; receiving, via the heartbeat line, a communication diagnostic instruction returned by the master station according to the self-diagnostic information, and sending diagnostic information to the downstream device via the serial bus according to the communication diagnostic instruction; The diagnostic result is generated based on the feedback information of the diagnostic information and is returned to the master station.
6. The method according to claim 5, characterized in that Performing self-diagnosis acquisition and sending self-diagnosis information to the master station includes: Performing the self-diagnosis periodically to obtain the self-diagnosis information with a third preset time period as a period; Receive a self-diagnosis information transmission instruction periodically sent by the main station through the heartbeat line with a first preset time period as a period, and send the self-diagnosis information to the main station through the heartbeat line according to the self-diagnosis information transmission instruction; or, periodically send the self-diagnosis information to the main station through the heartbeat line with a second preset time period as a period.
7. The method according to claim 5, characterized in that receiving, via the heartbeat line, a communication diagnostic instruction returned by the master station according to the self-diagnostic information, and sending diagnostic information to the downstream device via the serial bus according to the communication diagnostic instruction; Generating the diagnostic result based on the feedback information of the diagnostic information and returning it to the master station includes: When the communication between the master station and the downstream device is offline and the communication between the standby station and the downstream device is offline, and the self-diagnosis information indicates that the most recent self-diagnosis of the standby station is unsuccessful, the following steps are periodically performed with a preset polling diagnosis duration as a period until at least one of the master station and the standby station is online in communication with the downstream device: receiving a communication diagnostic instruction sent by the master station through the heartbeat line, and sending diagnostic information to the downstream device through the serial bus according to the communication instruction, so as to try to establish communication with the downstream device; After the communication connection with the downstream device fails to be established, the diagnosis result is returned to the master station, and the diagnosis result shows that the standby station fails to establish the communication connection with the downstream device.
8. The method according to claim 5, characterized in that The self-diagnosis acquisition and sending of self-diagnosis information to the master station include: Monitoring the serial bus to obtain first data and second data transmitted by the serial bus, wherein the first data is a communication request sent by the master station to the downstream device, and the second data is a response message sent by the downstream device to the master station according to the communication request; According to the first data and the second data, self-diagnosis information is acquired and sent to the master station.
9. A serial bus redundant communication system, characterized in that: include: A master station, at least one standby station and a downstream device, wherein the master station and the standby station are both connected to the downstream device via a serial bus, and the master station and the standby station are connected via a heartbeat line; The standby station is used to perform self-diagnosis acquisition and send self-diagnosis information to the master station; the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis; receive the communication diagnosis instruction returned by the master station according to the self-diagnosis information through the heartbeat line, and send the diagnosis information to the downstream device through the serial bus according to the communication diagnosis instruction; generating, based on feedback information of the diagnostic information, and returning the diagnostic result to the master station; The master station is used to obtain self-diagnosis information, and the self-diagnosis information includes a detection record of whether the standby station can communicate with the downstream device through self-diagnosis; when the self-diagnosis information is abnormal, a communication diagnosis instruction is sent to the standby station through the heartbeat line, and the standby station enters a standby station waiting state, so as to wait for the standby station to return a diagnosis result in the standby station waiting state; the communication diagnosis instruction is used to instruct the standby station to send diagnostic information to the downstream device through the serial bus, and generate the diagnostic result based on feedback information of the diagnostic information.
10. The system according to claim 9, characterized in that The master station and the backup station are connected via a heartbeat line, including: The master station and any of the backup stations are directly connected via a heartbeat line, and any two of the backup stations are directly connected via a heartbeat line; or, The master station is directly connected to a first preset number of the standby stations through a heartbeat line, and a second preset number of the standby stations are directly connected to each other through a heartbeat line, so that the master station and any one of the standby stations, or any two of the standby stations, communicate through a preset routing protocol.
11. An electronic device, characterized in that: including memory and processor; The memory is connected to the processor and is used to store programs; The electronic device implements the serial bus redundant communication diagnostic method as described in any one of claims 1 to 4 or any one of claims 5 to 8 by running the program in the memory through the processor.