A design method for simplifying IO implementation system master-slave switching
By sending periodically serial data and CRC checks between the primary and backup systems, the error problem during primary-backup switching is solved, the system stability and communication reliability are achieved, and the error switching and dual-master state during hot-swapping are avoided.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BANGYAN TECH
- Filing Date
- 2023-10-09
- Publication Date
- 2026-06-26
AI Technical Summary
Existing primary/standby systems are prone to switching errors when hot-swapping devices, including brief dual-primary detection, incorrect switching caused by power pins contacting first, and incorrect switching when the device is forcibly switched to the primary system.
The serial data sent between the primary and backup systems is scheduled to be transmitted at a timer interval. This includes the primary/backup status, manual backup command, primary system time, and backup system time. The initial status is backup system. The primary/backup switching status is determined based on the user command and the timer data. The data is transmitted through the FPGA-simulated serial interface protocol, and CRC check is used to ensure data integrity.
This effectively avoids master-slave switching errors during hot-swapping, improves system stability, prevents erroneous data output and dual-master states, and ensures communication reliability and data transmission integrity.
Smart Images

Figure CN117370230B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information and communication, and in particular to a design method for implementing system master-slave switching with simplified I / O. Background Technology
[0002] Currently, the interfaces of common primary and backup systems have power pins and I / O pins for transmitting signals. Generally, the power pins are longer than the I / O pins to ensure that the power is contacted first and the signal is contacted later. This method of I / O interlocking to achieve primary and backup switching can lead to the following three situations causing primary and backup switching errors when hot-swapping devices.
[0003] One scenario is that when the primary and backup systems are working normally, if the backup device is unplugged, the jitter of the I / O port may cause the current primary device to erroneously detect that another device is also a primary device, and perform a brief dual-primary judgment, resulting in an incorrect primary / backup system switchover.
[0004] The second scenario is when only the primary device is working, and a backup device is inserted. Since the power pins are contacted first and the I / O pins are contacted later, a dual-primary situation will occur after the power pins are contacted and before the I / O pins are contacted. Then, after the I / O pins are contacted, a dual-primary judgment is performed, resulting in an incorrect primary / backup switchover.
[0005] The third scenario occurs when the primary and backup devices are working simultaneously. When a manual primary command is given to the backup device, the backup device is forcibly switched to the primary device, resulting in a brief dual-primary situation and thus an incorrect primary / backup switchover.
[0006] To address the above technical issues, this invention provides a simplified I / O implementation method for system master / slave failover, which simplifies hardware design and effectively improves system stability. Summary of the Invention
[0007] This invention addresses the technical problem of errors that easily occur during hot-swapping of system devices for primary / standby switching by providing a simplified I / O design method for achieving system primary / standby switching.
[0008] This invention provides a simplified I / O implementation method for system master / slave failover, comprising the following steps:
[0009] S01: Set the same timing period to send serial data on the primary and backup systems with IO ports respectively. The serial data includes primary / backup status, manual backup command, primary system time, and backup system time.
[0010] Among them, the primary / backup status is used to transmit the primary / backup status of this system to the peer system;
[0011] Manual backup command is used to convert the user's manual master command received by this system into a manual backup command and transmit it to the peer system.
[0012] The master system time is used to transmit the time when this system becomes the master system to the peer system. This parameter is invalid when this system is the backup system.
[0013] Backup system time is used to transmit the time when this system becomes a backup system to the other system. This parameter is invalid when this system is the master system.
[0014] S02: Each system in the primary and backup systems is initially set to the backup system upon power-up.
[0015] S03: After initialization, the device will set the current device to either primary or backup status according to its slot number.
[0016] S04: Each system in the primary and backup systems determines whether to switch the primary / backup status based on the received user manual primary command or user manual backup command and timed serial data.
[0017] S05: Complete the switching of primary and backup system status and / or the time-based accumulation of backup system time and / or the time-based accumulation of primary system time;
[0018] S06: Transmit the serial data sent periodically to the other end and cycle to step S04.
[0019] As a further improvement of the present invention, step S04 further includes the following steps:
[0020] S041: The main and backup systems include the backup system status and the main system status;
[0021] When the device is in standby mode, determine whether a manual master command has been received from the local user;
[0022] If a manual master command is received from the local user, the manual backup command bit in the serial data will be set to 1; the backup time will be incremented periodically.
[0023] If no manual master command is received from the user on this end, then determine whether data has been received from the peer end within a time period.
[0024] If the determination is negative, the peer device has been unplugged or damaged. The device will then switch to the primary system, and the primary system time will be reset to zero. The manual backup command will also be reset to zero.
[0025] If the determination is yes, then receive the serial data sent by the peer system;
[0026] Then determine whether the other end is a backup system and whether the backup system time of the other end is less than the backup system time of this system;
[0027] If the result is negative, the backup time will be accumulated periodically.
[0028] If the determination is yes, then switch the device to the primary system state, clear the primary system time to zero, and clear the manual backup command.
[0029] As a further improvement of the present invention, step S04 further includes the following steps:
[0030] S041: The main and backup systems include the backup system status and the main system status;
[0031] When the device is in master status, determine whether a manual standby command has been received from the local user;
[0032] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0033] If the determination is negative, then receive the serial data sent by the peer system and further determine whether there is a manual backup command from the peer system.
[0034] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0035] If the determination is no, then further determine whether the other end is the main system and whether the time of the other end's main system is greater than the time of this system's main system;
[0036] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0037] If the determination is negative, the current device master time will be accumulated periodically.
[0038] As a further improvement of the present invention, the serial data also includes CRC check, which is used to ensure the integrity of the transmitted data and prevent the failure of master / slave switching due to incomplete or incorrect transmitted data during hot-plugging.
[0039] The beneficial effects of this invention are as follows: It solves the problem of incorrect identification of unplugged devices due to I / O port jitter by transmitting the master / standby status via an FPGA-simulated serial interface protocol; it avoids erroneous master / standby switching before I / O pin contact by transmitting the master time via an FPGA-simulated serial interface protocol; and it converts the manual master command of the local system into a manual standby command of the remote system, which is then sent to the remote system via the I / O port, preventing dual master states. Furthermore, it uses a serial communication interface protocol and CRC check on the I / O interface between the master and standby systems. The receiving end performs CRC check on the received serial data, and only processes the data if the check matches, ensuring the integrity and correctness of serial data transmission and preventing unstable data transmission during hot-plugging of I / O, which could output erroneous data to the other end and cause master / standby switching errors. This invention accurately identifies hot-plugged devices between the master and standby systems using master identifier, master time, standby identifier, and standby time, preventing erroneous data output to the other end and causing master / standby switching errors. Simultaneously, it converts the manual master command of the local system into a manual standby command of the remote system, which is then sent to the remote system via the I / O port, avoiding dual master states and effectively improving system stability. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other solutions can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a schematic diagram illustrating the timed data transmission format between the primary and backup systems in a simplified I / O implementation design method for system primary / backup switching according to the present invention.
[0042] Figure 2 This is a flowchart of a design method for a simplified I / O implementation of system master / slave switching according to the present invention;
[0043] Figure 3 This is a manual main control flowchart of a design method for a simplified I / O implementation of system master / slave switching according to the present invention;
[0044] Figure 4 This is a schematic diagram illustrating the primary / backup switching mechanism of a simplified I / O implementation method for system primary / backup switching according to the present invention. Detailed Implementation
[0045] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0046] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0047] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0048] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0049] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0050] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings.
[0051] This invention provides a simplified I / O implementation method for system master / slave failover, such as... Figure 1-2 As shown, it includes the following steps:
[0052] S01: Set the same timing period to send serial data on the primary and backup systems with IO ports respectively. The serial data includes primary / backup status, manual backup command, primary system time, and backup system time.
[0053] Among them, the primary / backup status is used to transmit the primary / backup status of this system to the peer system;
[0054] Manual backup command is used to convert the user's manual master command received by this system into a manual backup command and transmit it to the peer system.
[0055] The master system time is used to transmit the time when this system becomes the master system to the peer system. This parameter is invalid when this system is the backup system.
[0056] Backup system time is used to transmit the time when this system becomes a backup system to the other system. This parameter is invalid when this system is the master system.
[0057] S02: Each system in the primary and backup systems is initially set to the backup system upon power-up.
[0058] S03: After initialization, the device will set the current device to either primary or backup status according to its slot number.
[0059] S04: Each system in the primary and backup systems determines whether to switch the primary / backup status based on the received user manual primary command or manual backup command and timed serial data.
[0060] S05: Complete the switching of primary and backup system status and / or the time-based accumulation of backup system time and / or the time-based accumulation of primary system time;
[0061] S06: Transmit the serial data sent periodically to the other end and cycle to step S04.
[0062] In this embodiment, serial data is continuously transmitted between the primary and backup devices. The preferred timing period is 10ms. The specific timing period is determined according to the minimum time required for primary / backup switching by different users. For example, if a user requires that the backup device should switch within 50ms when the primary device fails to ensure communication recovery, then the set period should be less than 50ms.
[0063] In this embodiment, the source of the manual backup command in the timing serial data and the user manual backup command received by the system are different. The user manual backup command is issued by the user. If the user wants the current system device to become a backup device, they send the user manual backup command, and the device immediately switches to backup status upon receiving it. The user manual master command is issued by the user. The user wants the current system device to become a master device. However, if the switch were to be performed directly like the user manual backup command, a brief dual-master situation would occur. Therefore, the system device converts the user manual master command into a manual backup command in the serial data and transmits it to the peer. The peer switches to backup status. After the backup time is reset to zero, a brief dual-backup situation occurs. Since the backup time of the system at the local end is greater than that of the peer, the goal of switching to master status is achieved. Therefore, the manual backup command in the timing serial data is an intermediate state of the user manual master command in the process of switching to master status, and its source is different from the user manual backup command sent by the user.
[0064] This invention addresses the issue of incorrect identification of device primary / backup status due to I / O port jitter by using an FPGA to simulate a serial interface protocol for transmitting primary / backup status. It also uses an FPGA to simulate a serial interface protocol for transmitting primary system time, preventing erroneous primary / backup switching before I / O pin contact based on the primary system time value. Furthermore, it converts manual primary commands of the local system into manual backup commands of the other system, and then sends them to the other system via the I / O port, thus avoiding dual-primary status.
[0065] As a further improvement to this embodiment, such as Figure 2 As shown, step S04 further includes the following steps:
[0066] S041: The main and backup systems include the backup system status and the main system status;
[0067] When the device is in standby mode, determine whether a manual master command has been received from the local user;
[0068] If a manual master command is received from the local user, the manual backup command bit in the serial data will be set to 1; the backup time will be incremented periodically.
[0069] If no manual master command is received from the user on this end, then determine whether data has been received from the peer end within a time period.
[0070] If the determination is negative, the peer device has been unplugged or damaged. The device will then switch to the primary system, and the primary system time will be reset to zero. The manual backup command will also be reset to zero.
[0071] If the determination is yes, then receive the serial data sent by the peer system;
[0072] Then determine whether the other end is a backup system and whether the backup system time of the other end is less than the backup system time of this system;
[0073] If the result is negative, the backup time will be accumulated periodically.
[0074] If the determination is yes, then switch the device to the primary system state, clear the primary system time to zero, and clear the manual backup command.
[0075] In other embodiments, further, such as Figure 2 As shown, step S04 further includes the following steps:
[0076] S041: The main and backup systems include the backup system status and the main system status;
[0077] When the device is in master status, determine whether a manual standby command has been received from the local user;
[0078] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0079] If the determination is negative, then receive the serial data sent by the peer system and further determine whether there is a manual backup command from the peer system.
[0080] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0081] If the determination is no, then further determine whether the other end is the main system and whether the time of the other end's main system is greater than the time of this system's main system;
[0082] If the determination is yes, the current device switches to standby mode and the standby time is reset to zero;
[0083] If the determination is negative, the current device master time will be accumulated periodically.
[0084] In other embodiments, preferably, such as Figure 3As shown, the primary and backup systems include systems A and B, both of which are set to backup status. During initialization, based on the slot number or other identifier, the current devices are set as follows: system A devices are in backup status, and system B devices are in primary status. After receiving a manual primary switchover command, system A sets the manual backup command in the primary / backup transmission data to 1 and transmits the serial data periodically to system B devices, accumulating the backup time of system A devices. System B receives the serial data sent by system A and determines whether there is a manual backup command from the peer system. If system B determines that there is no manual backup command from the peer system, it continues to receive the serial data periodically sent by system A and then makes a determination. If system B determines that the received serial data contains a manual backup command from the peer system, system B switches to backup status, clears its backup time data to zero, and periodically transmits its backup status and backup time to system A. After receiving the serial data sent by system B, system A determines whether system B is a backup system and whether system B's backup time is less than system A's backup time.
[0085] If the judgment result is yes, then system A switches to the primary system, the primary system time data is cleared to zero, and the manual backup command in the primary / backup transmission data is cleared to zero; if the judgment result is no, then the process loops back to system A, setting the manual backup command in the primary / backup transmission serial data to 1 to continue data transmission and judgment. Figure 4 As shown, where T BS Indicates the preparation time for the B series; T BM Indicates the main time of the B series; T AS Indicates the preparation time for series A; T AM This indicates the primary system time for system A. For system A or system B to switch to primary, either system A or B must meet one of the following two conditions: a. The system is in normal working condition, and the other system is not inserted; b. The other system is a backup system, and the backup system time is less than the primary system time. For system A or system B to switch to backup, either system A or B must meet one of the following three conditions: a. A manual backup system switch command is received from the system A; b. A manual backup system switch command is received from the other system; c. The other system is in primary status, and the primary system time is greater than the primary system time. This invention accurately identifies hot-swappable devices between primary and backup systems using primary system identifier, primary system time, backup system identifier, and backup system time, preventing erroneous data output to the other end, causing primary / backup switch errors, avoiding dual-primary status during hot-swapping, and effectively improving system stability.
[0086] As a further improvement to this embodiment, such as Figure 1As shown, the serial data also includes CRC checksum. The CRC checksum is used to ensure the integrity of the transmitted data and prevent incomplete or erroneous data transmission during hot-swapping, which could lead to master / slave switching errors. Through a serial communication interface protocol and CRC checksum at the I / O interface between the master and slave systems, the receiving end performs CRC checksum on the received serial data. Only if the checksum matches is the data processed, ensuring the integrity and correctness of serial data transmission. This prevents unstable data transmission during I / O hot-swapping, which could output erroneous data to the other end and cause master / slave switching errors, further improving system stability.
[0087] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "one example," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0088] The above description, in conjunction with specific embodiments, provides a further detailed explanation of the present invention, but it should not be construed as limiting the specific implementation of the invention to these descriptions. For those skilled in the art, several simple deductions or substitutions can be made without departing from the concept of the present invention.
Claims
1. A design method for implementing system master-slave failover with simplified I / O, characterized in that, Includes the following steps: S01: Set the same timing period to send serial data on the primary and backup systems with IO ports respectively. The serial data includes primary / backup status, manual backup command, primary system time, and backup system time. Among them, the primary / backup status is used to transmit the primary / backup status of this system to the peer system; Manual backup command is used to convert the user's manual master command received by this system into a manual backup command and transmit it to the peer system. The master system time is used to transmit the time when this system becomes the master system to the other system. When this system is the backup system, this master system time is invalid. Backup system time is used to transmit the time when this system becomes a backup system to the other system. When this system is the master system, this backup system time is invalid. S02: Each system in the primary and backup systems is initially set to the backup system upon power-up. S03: After initialization, set the current device to either primary or backup status according to the slot number where the device is located; S04: Each system in the primary and backup systems determines whether to switch the primary / backup status based on the received user manual master command or user manual backup command and timed serial data; the primary / backup system includes the backup status and the primary status. When the device is in standby mode, determine whether a manual master command has been received from the local user; If a manual master command is received from the local user, the manual backup command in the serial data is set to 1, and the backup time is incremented periodically; or if no manual master command is received from the local user, it is determined whether serial data from the peer is received within a timing period. If the determination is negative, the peer device has been unplugged or damaged, and the current device switches to the master system, clears the master system time to zero, and clears the manual backup command; if the determination is positive, the device receives serial data sent by the peer system. Then determine whether the other end is a backup system and whether the backup time of the other end is less than the backup time of this system; if the determination is no, the backup time is accumulated periodically; if the determination is yes, the current device is switched to the primary system state, the primary system time is cleared to zero, and the manual backup command is cleared to zero. When the device is in master status, determine whether a manual standby command has been received from the local user; If the determination is yes, the current device switches to standby mode and the standby time is reset to zero; if the determination is no, the serial data sent by the peer system is received and it is further determined whether there is a manual standby command from the peer. If the determination is yes, the current device switches to standby mode and the standby time is reset to zero; if the determination is no, it further determines whether the peer is the primary system and whether the peer's primary system time is greater than the current system's primary system time. If the determination is yes, the current device switches to standby mode and the standby time is reset to zero; if the determination is no, the current device's primary time is incremented periodically. S05: Complete the switching of primary and backup system status and / or the time-based accumulation of backup system time and / or the time-based accumulation of primary system time; S06: Transmit the serial data sent periodically to the other end and cycle to step S04.
2. The design method for implementing system master / slave switching with simplified I / O as described in claim 1, characterized in that, The serial data also includes CRC checksum, which is used to ensure the integrity of the transmitted data and prevent the failure of master / slave switching due to incomplete or incorrect transmitted data during hot-plugging.