MCU network port backup method and device, electronic equipment and readable storage medium

By configuring dual network ports in the MCU hardware design and monitoring and switching network status, the network interruption problem caused by single network port failure is solved, and the stability and data integrity of the MCU device system are achieved, and it is suitable for industrial control and Internet of Things applications.

CN120281633APending Publication Date: 2025-07-08镁佳(北京)科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In MCU equipment system, a single network port failure causes network communication interruption, affecting the stability and security of industrial control and IoT devices. The existing network redundancy technology cannot meet cost, power consumption and space requirements, and the data synchronization and recovery mechanism is imperfect, which poses data loss and security threats.

Method used

In the MCU hardware design, two network ports are configured to connect different Ethernet controllers to form two physical network links, and quickly switch to another normal network port when one network port fails through network status monitoring. The network buffer is used to store unsent data, and data transmission is optimized using link aggregation and congestion control algorithms.

Benefits of technology

It improves the reliability and security of MCU network connections, avoids network interruptions, ensures data integrity and continuity, and is suitable for application scenarios with high requirements for data accuracy, such as industrial production and medical data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281633A_ABST
    Figure CN120281633A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of embedded systems, and provides an MCU network port backup method and device, electronic equipment and a readable storage medium, and the method comprises the steps: initializing a first network port of an MCU, and setting a working mode and a first network buffer area of the first network port; initializing a second network port of the MCU, and setting a working mode and a second network buffer area of the second network port; monitoring network states of the first network port and the second network port; and when the first network port or the second network port has a network fault, switching a network communication task of a fault network port in the first network port and the second network port to a non-fault network port, and controlling target buffer data of the fault network port to be transmitted at the non-fault network port. According to the technical scheme provided by one or more embodiments of the invention, the security and reliability of MCU network communication and the data transmission efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of embedded systems, and particularly to an MCU network port backup method, device, electronic device and readable storage medium. Background Art

[0002] In modern industrial control, Internet of Things and other fields, the microcontroller unit (MCU) is the core control component of many device systems, and the stability and reliability of its network communication are crucial. With the continuous improvement of industrial automation and the wide deployment of Internet of Things devices, the MCU usually needs to continuously and stably interact with the external network for data.

[0003] However, traditional MCU hardware often only has a single network port. Once this network port fails, such as physical link damage, network interface chip failure, etc., the entire device system controlled by the MCU will be unable to communicate with the external network normally, which may lead to serious consequences such as production interruption, data loss, and device out of control.

[0004] In some application scenarios with extremely high requirements for network reliability, such as device monitoring and control in intelligent factories, data transmission of remote medical devices, information interaction in intelligent transportation systems, etc., any interruption of network connection may bring huge economic losses and potential safety hazards. Summary of the Invention

[0005] In view of this, one or more embodiments of the present disclosure provide an MCU network port backup method, device, electronic device and readable storage medium, which can improve the security and reliability of MCU network communication and data transmission efficiency.

[0006] On the one hand, the present disclosure provides an MCU network port backup method, the method includes: initializing a first network port of the MCU, setting a working mode and a first network buffer of the first network port; wherein, the first network port is connected to a first Ethernet controller of the MCU to form a first physical network link; initializing a second network port of the MCU, setting a working mode and a second network buffer of the second network port; wherein, the second network port is connected to a second Ethernet controller of the MCU to form a second physical network link; monitoring network states of the first network port and the second network port; when a network failure occurs in the first network port or the second network port, switching network communication tasks of the faulty network port among the first network port and the second network port to the non-faulty network port, and controlling target buffer data of the faulty network port to be transmitted in the non-faulty network port.

[0007] On the other hand, the present disclosure also provides an MCU network port backup device, which includes: a first configuration unit for initializing a first network port of the MCU and setting a working mode and a first network buffer of the first network port; wherein the first network port is connected to a first Ethernet controller of the MCU to form a first physical network link; a second configuration unit for initializing a second network port of the MCU and setting a working mode and a second network buffer of the second network port; wherein the second network port is connected to a second Ethernet controller of the MCU to form a second physical network link; a network port monitoring unit for monitoring network states of the first network port and the second network port; and a network port switching unit for switching a network communication task of a faulty network port among the first network port and the second network port to a non-faulty network port and controlling transmission of target buffered data of the faulty network port on the non-faulty network port when a network fault occurs in the first network port or the second network port.

[0008] On the other hand, the present disclosure also provides an electronic device, which includes a memory and a processor. The memory is used for storing a computer program, and when the computer program is executed by the processor, the above-mentioned MCU network port backup method is implemented.

[0009] On the other hand, the present disclosure also provides a computer-readable storage medium, which is used for storing a computer program, and when the computer program is executed by a processor, the above-mentioned MCU network port backup method is implemented.

[0010] The technical solutions provided by one or more embodiments of the present disclosure can configure two network ports in the MCU hardware design, connect the two network ports to different Ethernet controllers to form two physical network links. By monitoring the network states of the two network ports, when a fault occurs in one of the network ports, the communication task of the faulty network port can be quickly switched to the other normal network port. In this way, the reliability of the MCU network connection is greatly improved, and the MCU network communication interruption caused by a single network port fault is effectively avoided, ensuring the continuous and stable operation of the MCU device system in application scenarios such as industrial control and the Internet of Things.

[0011] The technical solution provided by one or more embodiments of the present disclosure can store the data that has not been successfully sent on the faulty network interface by using a network buffer. When the network communication task of the faulty network interface is switched to another normal network interface with a backup function, the buffered data of the faulty network interface can be resent on the normal network interface. In this way, the MCU not only properly processes the target buffered data that has been received but not processed by the faulty network interface, but also ensures the integrity and continuity of the target buffered data during the network switching process, avoiding data loss or transmission errors. The technical solution provided by one or more embodiments of the present disclosure is of great significance for application scenarios with extremely high requirements for data accuracy, such as industrial production data recording, medical data transmission, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The features and advantages of the embodiments of the present disclosure will be more clearly understood by referring to the accompanying drawings. The drawings are schematic and should not be construed as limiting the present disclosure in any way. In the drawings:

[0013] Figure 1 FIG. shows a schematic diagram of the steps of a method for backing up an MCU network interface in one embodiment of the present disclosure;

[0014] Figure 2 FIG. shows a schematic diagram of the functional modules of a device for backing up an MCU network interface in one embodiment of the present disclosure;

[0015] Figure 3 FIG. shows a schematic diagram of the functional modules of another device for backing up an MCU network interface in one embodiment of the present disclosure;

[0016] Figure 4 FIG. shows a schematic diagram of the structure of an electronic device in one embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present disclosure.

[0018] In the related art, the MCU device system can use the MCU as the core control component and cooperate with other functional components (such as input modules, audio modules, display modules, sensor modules, drive modules, etc.) to jointly implement the device functions. Although there are already some network redundancy technologies in other fields, for the MCU device system, the existing network redundancy technologies may have compatibility problems and cannot fully meet the strict requirements of the MCU device system for cost, power consumption, and space. For example, some complex network redundancy solutions may require the support of additional hardware devices, increasing the cost and hardware complexity of the MCU device system. Also, for some network redundancy solutions, when dealing with network switching, the data synchronization and recovery mechanisms are not perfect enough, easily leading to data loss or transmission errors, and it is difficult to ensure the data reliability of the MCU device system. In addition, with the increasing network security threats, the MCU device system also faces challenges in terms of the security of network communication. The traditional network configuration makes it difficult for the MCU device system to effectively resist the risks of network attacks and data leakage.

[0019] In the related art, for different network environments, the requirements for network bandwidth and the distribution of data traffic are different. Therefore, how to achieve efficient data transmission and reasonable traffic allocation under limited hardware resources to meet the needs of different application scenarios is also one of the issues that need to be considered in the current MCU network communication.

[0020] Please refer to Figure 1 , a method for backing up the MCU network interface provided by an embodiment of the present disclosure may include the following multiple steps.

[0021] S1: Initialize the first network interface of the MCU, and set the working mode and the first network buffer of the first network interface; wherein, the first network interface is connected to the first Ethernet controller of the MCU to form a first physical network link.

[0022] In this embodiment, the first network interface is connected to the first Ethernet controller of the MCU. Using the first Ethernet controller, the MCU can initialize the first network interface. For example, the working mode of the first network interface can be set, including but not limited to full-duplex and half-duplex modes; the baud rate of the first network interface can be set, and a media access control (MAC) address can be assigned to the first network interface. During the initialization stage of the first network interface, an independent network buffer can also be created for the first network interface to store the data received and sent by the first network interface.

[0023] S2: Initialize the second network interface of the MCU, and set the working mode and the second network buffer of the second network interface; wherein, the second network interface is connected to the second Ethernet controller of the MCU to form a second physical network link.

[0024] In this embodiment, the second network interface is connected to the second Ethernet controller of the MCU. Using the second Ethernet controller, the MCU can initialize the second network interface. For example, the working mode of the second network interface can be set, including but not limited to full-duplex and half-duplex modes; the baud rate of the second network interface can be set, and a Media Access Control (MAC) address can be assigned to the second network interface. During the initialization phase of the second network interface, an independent network buffer can also be created for the second network interface to store the data received and sent by the first network interface.

[0025] In this embodiment, two network interfaces can be configured in the MCU hardware design, and the two network interfaces are connected to different Ethernet controllers to form two physical network links. For the first network interface and the second network interface, a network switching circuit can be designed. For example, using a multiplexer logic device, according to the control signal of the software, the signals of the two network interfaces are switched.

[0026] S3: Monitor the network status of the first network interface and the second network interface.

[0027] In this embodiment, since two network interfaces are configured in the MCU hardware design, the two network interfaces are connected into different physical network links, and a network switching circuit is designed. When it is detected that the network status of one of the network interfaces fails, the communication task of the faulty network interface can be quickly switched to another normal network interface through software control. In this way, the reliability of the MCU network connection is greatly improved, effectively avoiding the interruption of MCU network communication caused by a single network interface failure, and ensuring the continuous and stable operation of the MCU device system in application scenarios such as industrial control and the Internet of Things.

[0028] In some embodiments, Internet Control Message Protocol (ICMP) heartbeat packets can be periodically sent to the first network interface and the second network interface. According to whether a response to the ICMP heartbeat packet is received, the network connection status of the first network interface and the second network interface can be monitored.

[0029] In some embodiments, using the Link Layer Discovery Protocol (LLDP), the link information of the first physical network link and the second physical network link can be obtained. According to the link information, it can assist in diagnosing whether the first physical network link or the second physical network link is faulty.

[0030] In some embodiments, after checking the error counters of the first physical network link and the second physical network link, according to the error counters, it can be determined whether there are physical layer or link layer problems with the first network interface and the second network interface.

[0031] In a practical application example, by writing a network status monitoring function, heartbeat packets of the ICMP protocol can be sent to a specific target address regularly. According to whether a response to the heartbeat packet is received, the network connection status of the first network interface and the second network interface can be monitored. Meanwhile, by using LLDP that complies with industry standards (such as IEEE802.3ah) to send LLDP frames, detailed information about the first physical network link and the second physical network link can be obtained, including port identification, device identification, system name, and system description. According to the link information, link layer faults of the first network interface and the second network interface can be assisted in diagnosis. In addition, for the error counters of the first physical network link and the second physical network link, the identifiable errors include but are not limited to Cyclic Redundancy Check (CRC) errors and frame alignment errors.

[0032] In some embodiments, before monitoring the network status of the first network interface and the second network interface, the MCU network interface backup method may further perform at least one of the following steps: setting different Virtual Local Area Networks (VLANs) for the first network interface and the second network interface; configuring respective Access Control Lists (ACLs) for the first network interface and the second network interface; setting a data encryption protocol for the first network interface and the second network interface.

[0033] Specifically, setting different Virtual Local Area Networks for the first network interface and the second network interface can isolate different network traffic. Configuring the Access Control List can only allow authorized devices and services to communicate through the network interface. Encrypting the data transmitted by the network interface using the SSL / TLS protocol or other encryption protocols can ensure the security of the data.

[0034] For the first network interface and the second network interface, by means of setting different Virtual Local Area Networks to isolate network traffic, configuring the Access Control List to restrict communication of authorized devices and services, and encrypting the data transmitted by the network interface using an encryption protocol, the network security of the MCU is effectively enhanced, enabling the MCU network communication to resist network attacks, prevent data leakage, and improving the device security and data security of the MCU device system.

[0035] S4: When a network fault occurs in the first network interface or the second network interface, switch the network communication task of the faulty network interface among the first network interface and the second network interface to the non-faulty network interface, and control the target buffer data of the faulty network interface to be transmitted at the non-faulty network interface.

[0036] In this embodiment, combined with the network status monitoring of step S3, it can be determined whether the first network port or the second network port has a fault. For example, the fault judgment condition may be: no response to the ICMP protocol heartbeat packet is received within the specified time. For another example, the fault judgment condition may be: an abnormality is detected in the link layer of the first network port or the second network port. When a network fault occurs in the first network port or the second network port, the network switching circuit can be controlled by software to switch the network communication of the faulty network port to another normal network port.

[0037] In this embodiment, after switching the network port, the IP address can be re-allocated and the TCP connection can be re-established according to the different network configurations to ensure the normal operation of the network application. By re-allocating the IP address and establishing the TCP connection according to the network configuration after the network port is switched, it can be ensured that the network application can quickly resume normal operation, reducing the application interruption time caused by network switching, improving the availability and user experience of the MCU device system, and being suitable for real-time application scenarios with high requirements for network response speed.

[0038] In this embodiment, the network buffer can be used to store data that has not been successfully sent on the faulty network port. While waiting for the network communication task of the faulty network port to switch to another normal network port that serves as a backup, the buffered data of the faulty network port can be resent on the normal network port. In this way, the MCU not only properly handles the target buffered data that has been received but not processed by the faulty network port, but also ensures the integrity and continuity of the target buffered data during the network switching process, avoiding data loss or transmission errors. For application scenarios with extremely high requirements for data accuracy, such as industrial production data recording, medical data transmission, etc., the technical solution provided by this embodiment is of great significance.

[0039] In some implementations, in order to switch the network communication task of the faulty network port to the healthy network port, the first network port and the second network port may be bound into a logical link. If there is a faulty physical network link in the first physical network link and the second physical network link, the data traffic of the faulty physical network link is transferred to the healthy physical network link according to the control signal of the MCU.

[0040] In some implementations, in a network environment supporting the Link Aggregation Control Protocol (LACP), the Link Aggregation Control Protocol can be used to bind the first network port and the second network port into a logical link, and dynamically allocate data traffic between different physical network links through the Link Aggregation Control Protocol. In a network environment that does not support the Link Aggregation Control Protocol, the link aggregation function can be simulated at the software level of the MCU to plan and allocate data transmission tasks between the first network port and the second network port.

[0041] When hardware support is available, two network interfaces can be bound into a logical link using Link Aggregation Control Protocol (LACP), which can dynamically allocate data traffic among multiple physical links, improving network transmission efficiency. In a network environment that does not support LACP, the link aggregation function can be simulated at the software level, which can reasonably allocate the data transmission tasks of network interfaces and monitor the status of network interfaces, ensuring that the MCU can achieve efficient data transmission and flexible traffic management under different network conditions, and improving the utilization rate of network resources of the MCU.

[0042] In a practical application example, when hardware support is available, the first network interface and the second network interface can be bound into a logical link using LACP, and LACP can dynamically allocate data traffic among multiple physical links. When one of the physical links fails, LACP can automatically transfer the data traffic of the failed physical link to other normal links. In a network environment that does not support LACP, the MCU can simulate the link aggregation function at the software level, reasonably allocate the data transmission tasks of the first network interface and the second network interface, and at the same time monitor the status of each network interface for quick switching in case of a failure.

[0043] In some embodiments, controlling the transmission of the target buffered data of the failed network interface on the non-failed network interface includes: classifying and prioritizing the target buffered data using Quality of Service (QoS) technology; adjusting the data sending rate of the target buffered data through a congestion control algorithm.

[0044] Specifically, by using Quality of Service (QoS) technology, different types of network traffic can be classified and prioritized to ensure the priority transmission of important data. At the software level, a congestion control algorithm can be used to adjust the data sending rate according to the network conditions to avoid network congestion. The congestion control algorithm can dynamically adjust the size of the congestion window and control the data sending rate according to the congestion status of the network to avoid network congestion and improve the overall performance of the network.

[0045] In some embodiments, adjusting the data sending rate of the target buffered data through a congestion control algorithm includes: setting initial values of a congestion window and a slow start threshold, where the congestion window is used to control the data sending rate of the MCU before receiving an acknowledgment signal, the acknowledgment signal being for the target buffered data, and the slow start threshold being used to determine when to switch from the slow start phase to the congestion avoidance phase; during the data transmission of the target buffered data, if the congestion window is less than the slow start threshold, enter the slow start phase; in the slow start phase, whenever the MCU receives an acknowledgment signal, exponentially increase the congestion window and correspondingly increase the data sending rate of the target buffered data so that the data sending rate matches the exponentially increased congestion window; if the congestion window reaches or exceeds the slow start threshold, enter the congestion avoidance phase; in the congestion avoidance phase, whenever the MCU receives an acknowledgment signal, linearly increase the congestion window and correspondingly increase the data sending rate of the target buffered data so that the data sending rate matches the linearly increased congestion window; if a timeout packet loss occurs during the data transmission of the target buffered data, halve the slow start threshold and reset the congestion window to the initial value or a preset reset value, where the timeout packet loss indicates that the MCU has not received the acknowledgment signal within a preset time; if, during the data transmission of the target buffered data, the number of repetitions of the acknowledgment signal received by the MCU reaches a preset repetition upper limit, enter the fast recovery phase; in the fast recovery phase, reduce the slow start threshold according to a preset rule and reduce the congestion window to the adjusted slow start threshold, and re-enter the congestion avoidance phase.

[0046] Specifically, in the slow start phase, the congestion window grows exponentially, which can quickly detect the available bandwidth of the network. In the congestion avoidance phase, the congestion window grows linearly, which can avoid network congestion. When a timeout packet loss occurs, by adjusting the sizes of the congestion window and the slow start threshold, data transmission can be quickly restored according to different packet loss situations, and the data sending rate can be readjusted.

[0047] The congestion control algorithm provided in this embodiment can dynamically adjust the data sending rate according to the network conditions, avoid network congestion, improve the overall performance of the network and the data transmission efficiency, can better adapt to traffic changes in different network environments, and ensure the stability and smoothness of the MCU network communication.

[0048] It should be noted that, in some embodiments, the MCU network interface backup method may also set two MCU devices, one as the primary device and the other as the backup device. The backup device can synchronize the data and status of the primary device in real time. When a failure occurs in the network interface or other key components of the primary device, the backup device can take over the network communication in a timely manner, further improving the fault tolerance and stability of the MUC device system, and providing a more reliable guarantee for application scenarios with extremely high reliability requirements. In this solution, during the network interface initialization phase of steps S1 and S2, the dual-machine hot standby startup step can be interspersed. After that, when the primary device is working normally, the backup device is in the hot standby state, synchronizing the data and status of the primary device in real time. When a failure occurs in the network interface or other key components of the primary device and it cannot work normally, the backup device can take over the network communication of the primary device.

[0049] The technical solution provided by one or more embodiments of the present disclosure can configure two network interfaces in the MCU hardware design, connect the two network interfaces to different Ethernet controllers, and form two physical network links. By monitoring the network status of the two network interfaces, when a failure occurs in one of the network interfaces, the communication task of the failed network interface can be quickly switched to the other normal network interface. In this way, the reliability of the MCU network connection is greatly improved, effectively avoiding the interruption of MCU network communication caused by a single network interface failure, and ensuring the continuous and stable operation of the MCU device system in application scenarios such as industrial control and the Internet of Things.

[0050] The technical solution provided by one or more embodiments of the present disclosure can use a network buffer to store the data that has not been successfully sent on the failed network interface. When the network communication task of the failed network interface is switched to another normal network interface with a backup function, the buffered data of the failed network interface can be resent on the normal network interface. In this way, the MCU not only properly processes the target buffered data that has been received but not processed on the failed network interface, but also ensures the integrity and continuity of the target buffered data during the network switching process, avoiding data loss or transmission errors. The technical solution provided by one or more embodiments of the present disclosure is of great significance for application scenarios with extremely high requirements for data accuracy, such as industrial production data recording and medical data transmission.

[0051] Please refer to Figure 2 , the present disclosure also provides an MCU network interface backup device, and the device includes:

[0052] A first configuration unit 100, configured to initialize the first network interface of the MCU, set the working mode and the first network buffer of the first network interface; wherein, the first network interface is connected to the first Ethernet controller of the MCU to form a first physical network link;

[0053] A second configuration unit 200, configured to initialize a second network interface of the MCU, and set a working mode and a second network buffer of the second network interface; wherein, the second network interface is connected to a second Ethernet controller of the MCU to form a second physical network link;

[0054] A network interface monitoring unit 300, configured to monitor network states of the first network interface and the second network interface;

[0055] A network interface switching unit 400, configured to, when a network fault occurs in the first network interface or the second network interface, switch a network communication task of a faulty network interface among the first network interface and the second network interface to a non-faulty network interface, and control target buffered data of the faulty network interface to be transmitted at the non-faulty network interface.

[0056] In one embodiment, the network interface monitoring unit 300 is specifically configured to periodically send Internet Control Message Protocol heartbeat packets to the first network interface and the second network interface, and monitor network connection conditions of the first network interface and the second network interface according to whether responses to the heartbeat packets are received.

[0057] In one embodiment, the network interface monitoring unit 300 is specifically configured to use a Link Layer Discovery Protocol to obtain link information of the first physical network link and the second physical network link, and assist in diagnosing whether the first physical network link or the second physical network link is faulty according to the link information.

[0058] In one embodiment, the network interface monitoring unit 300 is specifically configured to check error counters of the first physical network link and the second physical network link, and judge whether there are physical layer or link layer problems in the first network interface and the second network interface according to the error counters.

[0059] In one embodiment, the network interface switching unit 400 includes a switching control sub-unit 401. The switching control sub-unit 401 is configured to bind the first network interface and the second network interface into a logical link; if there is a faulty physical network link among the first physical network link and the second physical network link, transfer data traffic of the faulty physical network link to the non-faulty physical network link according to a control signal of the MCU.

[0060] In one embodiment, the switching control subunit 401 is specifically configured to, in a network environment that supports the Link Aggregation Control Protocol (LACP), use the LACP to bind the first network interface and the second network interface into one logical link, and dynamically allocate data traffic between different physical network links through the LACP; in a network environment that does not support the LACP, simulate the link aggregation function at the software level to plan and allocate the data transmission tasks of the first network interface and the second network interface.

[0061] In one embodiment, the network interface switching unit 400 includes a transmission control subunit 402. The transmission control subunit 402 is configured to classify and prioritize the target buffered data by using Quality of Service (QoS) technology; adjust the data transmission rate of the target buffered data through a congestion control algorithm.

[0062] In one embodiment, the transmission control subunit 402 is specifically configured to set initial values of a congestion window and a slow start threshold. The congestion window is used to control the data transmission rate of the MCU before receiving an acknowledgment signal that is for the target buffered data. The slow start threshold is used to determine when to switch from the slow start phase to the congestion avoidance phase. During the data transmission process of the target buffered data, if the congestion window is smaller than the slow start threshold, enter the slow start phase. In the slow start phase, whenever the MCU receives an acknowledgment signal, exponentially increase the congestion window and correspondingly increase the data transmission rate of the target buffered data so that the data transmission rate matches the exponentially increased congestion window. If the congestion window reaches or exceeds the slow start threshold, enter the congestion avoidance phase. In the congestion avoidance phase, whenever the MCU receives an acknowledgment signal, linearly increase the congestion window and correspondingly increase the data transmission rate of the target buffered data so that the data transmission rate matches the linearly increased congestion window. If a timeout packet loss occurs during the data transmission process of the target buffered data, halve the slow start threshold and reset the congestion window to the initial value or a preset reset value. The timeout packet loss indicates that the MCU does not receive the acknowledgment signal within a preset time. If the number of repetitions of the acknowledgment signal received by the MCU reaches a preset repetition upper limit during the data transmission process of the target buffered data, enter the fast recovery phase. In the fast recovery phase, reduce the slow start threshold according to a preset rule, reduce the congestion window to the adjusted slow start threshold, and re-enter the congestion avoidance phase.

[0063] In one embodiment, please refer to Figure 3, the MCU network port backup device further includes a security management unit 500. The security management unit 500 is used to perform at least one of the following functions: setting different virtual local area networks for the first network port and the second network port; configuring respective access control lists for the first network port and the second network port; setting data encryption protocols for the first network port and the second network port.

[0064] Each unit illustrated in the above embodiments may be specifically implemented by a computer chip or by a product with a certain function. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0065] For convenience of description, the above devices are described by function as various units separately. Of course, when implementing the present application, the functions of each unit may be implemented in the same or multiple software and / or hardware.

[0066] Please refer to Figure 4 , the present disclosure also provides an electronic device, which includes a memory and a processor. The memory is used to store a computer program. When the computer program is executed by the processor, the above-mentioned MCU network port backup method is implemented.

[0067] The present disclosure also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned MCU network port backup method is implemented.

[0068] Among them, the processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or a combination of the above types of chips.

[0069] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of the present disclosure. By running the non-transitory software programs, instructions, and modules stored in the memory, the processor can execute various functional applications and data processing of the processor, that is, implement the methods in the above method embodiments.

[0070] The memory may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor and the like. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0071] Those skilled in the art can understand that to implement all or part of the processes in the methods of the above embodiments, it can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (abbreviation: HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.

[0072] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, equipment, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0073] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

[0074] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations fall within the scope defined by the appended claims.

Claims

1. A method for backing up the MCU network port, characterized in that, The method includes: Initializing a first network interface of the MCU, and setting a working mode and a first network buffer of the first network interface; wherein, the first network interface is connected to a first Ethernet controller of the MCU to form a first physical network link; Initializing a second network interface of the MCU, and setting a working mode and a second network buffer of the second network interface; wherein, the second network interface is connected to a second Ethernet controller of the MCU to form a second physical network link; Monitoring network states of the first network interface and the second network interface; When a network fault occurs in the first network interface or the second network interface, switching network communication tasks of the faulty network interface among the first network interface and the second network interface to the non-faulty network interface, and controlling target buffer data of the faulty network interface to be transmitted at the non-faulty network interface.

2. The method according to claim 1, wherein The monitoring of the network states of the first network interface and the second network interface includes at least one of the following: Regularly sending Internet Control Message Protocol (ICMP) heartbeat packets to the first network interface and the second network interface, and monitoring network connection conditions of the first network interface and the second network interface according to whether responses to the heartbeat packets are received; Using the Link Layer Discovery Protocol (LLDP) to obtain link information of the first physical network link and the second physical network link, and assisting in diagnosing whether the first physical network link or the second physical network link is faulty according to the link information; Checking error counters of the first physical network link and the second physical network link, and judging whether there are physical layer or link layer problems in the first network interface and the second network interface according to the error counters.

3. The method according to claim 1, wherein The switching of network communication tasks of the faulty network interface among the first network interface and the second network interface to the non-faulty network interface includes: Binding the first network interface and the second network interface into a logical link; If there is a faulty physical network link among the first physical network link and the second physical network link, transferring data traffic of the faulty physical network link to the non-faulty physical network link according to a control signal of the MCU.

4. The method according to claim 3, characterized in that The binding of the first network interface and the second network interface into a logical link includes: In a network environment supporting the Link Aggregation Control Protocol (LACP), using the LACP to bind the first network interface and the second network interface into the logical link, and dynamically allocating data traffic among different physical network links through the LACP; In a network environment not supporting the LACP, simulating link aggregation functions at the software level to plan and allocate data transmission tasks of the first network interface and the second network interface.

5. The method according to claim 1, wherein Before the monitoring of the network states of the first network interface and the second network interface, the method further includes at least one of the following: Setting different Virtual Local Area Networks (VLANs) for the first network interface and the second network interface; Configuring respective Access Control Lists (ACLs) for the first network interface and the second network interface; Setting data encryption protocols for the first network interface and the second network interface.

6. The method according to claim 1, wherein Controlling target buffer data of the faulty network interface to be transmitted at the non-faulty network interface includes: Using quality of service technology, classify and prioritize the target buffered data; Adjust the data transmission rate of the target buffered data through a congestion control algorithm.

7. The method according to claim 6, wherein The adjusting the data transmission rate of the target buffered data through a congestion control algorithm includes: Set initial values for the congestion window and the slow start threshold. The congestion window is used to control the data transmission rate of the MCU before receiving an acknowledgment signal, which is for the target buffered data. The slow start threshold is used to determine when to switch from the slow start phase to the congestion avoidance phase; During the data transmission of the target buffered data, if the congestion window is less than the slow start threshold, enter the slow start phase; During the slow start phase, whenever the MCU receives an acknowledgment signal, exponentially increase the congestion window and correspondingly increase the data transmission rate of the target buffered data so that the data transmission rate matches the exponentially increased congestion window; If the congestion window reaches or exceeds the slow start threshold, enter the congestion avoidance phase; During the congestion avoidance phase, whenever the MCU receives an acknowledgment signal, linearly increase the congestion window and correspondingly increase the data transmission rate of the target buffered data so that the data transmission rate matches the linearly increased congestion window; If a timeout packet loss occurs during the data transmission of the target buffered data, halve the slow start threshold and reset the congestion window to the initial value or a preset reset value. The current timeout packet loss indicates that the MCU has not received the acknowledgment signal within a preset time; If, during the data transmission of the target buffered data, the number of repetitions of the acknowledgment signal received by the MCU reaches a preset repetition upper limit, enter the fast recovery phase; During the fast recovery phase, reduce the slow start threshold according to a preset rule, reduce the congestion window to the adjusted slow start threshold, and re-enter the congestion avoidance phase.

8. An MCU network port backup device, characterized in that, The device includes: A first configuration unit for initializing the first network interface of the MCU and setting the working mode and the first network buffer of the first network interface; wherein, the first network interface is connected to the first Ethernet controller of the MCU to form a first physical network link; A second configuration unit for initializing the second network interface of the MCU and setting the working mode and the second network buffer of the second network interface; wherein, the second network interface is connected to the second Ethernet controller of the MCU to form a second physical network link; A network interface monitoring unit for monitoring the network status of the first network interface and the second network interface; A network interface switching unit for, when a network failure occurs in the first network interface or the second network interface, switching the network communication task of the failed network interface among the first network interface and the second network interface to the non-failed network interface, and controlling the target buffered data of the failed network interface to be transmitted on the non-failed network interface.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory is used to store a computer program. When the computer program is executed by the processor, the method described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program. When the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.