A multi-protocol heterogeneous device real-time collaborative control system based on STM32

CN123010517APending Publication Date: 2026-10-30KUNMING NORTH INFRARED TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610920302.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0008]传统PLC扩展模块,标准化、可靠性高,成本高、周期长、灵活性差、难以支持新协议

Benefits of technology

[0029]本发明的上述技术方案具有如下有益的技术效果:本发明通过"协议融合 + 实时协同 + 智能仲裁 + 故障自愈 + 参数管理 + 数据融合"的六维协同体系,相比现有技术实现以下突破。通过单STM32与协议融合,提高系统集成度,降低硬件成本;通过协议抽象与自动转换,提高开发效率,降低代码冗余;降低实时响应时间,提升响应速度;通过多源协同能力,原子性同步执行,可靠性提升;通过优先级仲裁与预警,实现冲突处理,失控风险降低;通过自动隔离与降级,实现故障恢复,MTTR降低;通过统一、冗余与自动发现的参数管理,降低配置成本;映射表增删即可提高扩展性,降低接入新设备时间;通过集中式、标准化的维护性,减少维护成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123010517A_ABST
    Figure CN123010517A_ABST
Patent Text Reader

Abstract

The application discloses a multi-protocol heterogeneous device real-time collaborative control system based on an STM32, which is composed of a multi-protocol heterogeneous device, a master microcontroller and a local control device; an input end of the master microcontroller is connected with the multi-protocol heterogeneous device, and a control end of the master microcontroller is connected with the local control device. Through single STM32 and protocol fusion, the system integration is improved, and the hardware cost is reduced; through protocol abstraction and automatic conversion, the development efficiency is improved, and the code redundancy is reduced; the real-time response time is reduced, and the response speed is improved; through multi-source collaborative capability, atomic synchronous execution and reliability improvement; through priority arbitration and early warning, conflict processing is realized, and the risk of out-of-control is reduced; through automatic isolation and degradation, fault recovery is realized, and the MTTR is reduced; the mapping table can be added or deleted to improve the expansibility and reduce the time of accessing new devices; through centralized and standardized maintainability, the maintenance cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of industrial automation, embedded system multi-protocol fusion, and distributed device collaborative control, specifically to a real-time collaborative control system for heterogeneous devices based on STM32. This system achieves transparent fusion and collaborative conversion of multiple protocols, such as MODBUS RTU / TCP, custom TTL protocol, and RS232 / RS485, within a single STM32 microcontroller. It supports unified management, real-time collaboration, atomic control, and multi-dimensional fault self-healing from heterogeneous devices such as touchscreens, host computers, local motors, multi-channel data acquisition units, and relay control boards.

[0002] The system is suitable for high-end application scenarios such as multi-motor collaborative control of industrial production lines, distributed PLC gateways, industrial data acquisition and control (SCADA) systems, edge nodes of intelligent manufacturing execution systems (MES), management of new energy inverter groups, and remote control of industrial machinery and equipment. Background Technology

[0003] With the acceleration of trends such as intelligent manufacturing, the demand for multi-protocol, multi-level, and distributed control of field devices has surged. However, existing solutions generally suffer from the following core bottlenecks in five dimensions: protocol silos, multi-source collaboration, cross-protocol conversion, real-time performance assurance, and intelligent fault tolerance. These bottlenecks include: protocol silos and redundant development, resulting in low system integration; inconsistent timing of multi-device collaborative control, leading to a lack of real-time performance assurance; complexity and error-proneness of cross-protocol command mapping; control source conflicts and disordered priorities, posing security risks; fault propagation during communication anomalies, resulting in weak fault tolerance; and scattered and inconsistent parameters and configurations.

[0004] Analysis of existing related technical solutions: Industrial PC + SCADA software, with complete functions and rich protocols, but high cost, high power consumption, difficulty in embedding in the field, and response time >200ms;

[0005] Distributed multi-MCU architecture, with each UART operating independently on a separate MCU, results in high costs, high complexity, difficulty in controlling cross-MCU communication latency, and no guarantee of real-time performance.

[0006] Single MCU with multiple UARTs + polling: simple and low cost, but suffers from redundant protocol stacks, no priority scheduling, uncertain response time, and poor real-time performance.

[0007] A simple gateway that only performs protocol conversion, supports MODBUS / Ethernet conversion, but lacks local control, fault tolerance, multi-source fusion, and parameter management.

[0008] Traditional PLC expansion modules are standardized and highly reliable, but also costly, have long development cycles, poor flexibility, and are difficult to support new protocols.

[0009] There is an urgent need for a systematic and innovative system that integrates "protocol fusion, real-time collaboration, intelligent arbitration, fault tolerance, and parameter management" to break through the bottlenecks of traditional multi-device integration. Summary of the Invention

[0010] This invention aims to overcome the five core bottlenecks in the integration of traditional multi-protocol heterogeneous devices, namely "protocol silos, multi-source conflicts, lack of real-time guarantee, fault propagation, and parameter dispersion," and proposes a highly integrated, efficient, and reliable multi-protocol industrial control gateway and local intelligent controller fusion system that integrates the following innovative elements.

[0011] To address the aforementioned problems, a first aspect of the present invention provides a real-time collaborative control system for multi-protocol heterogeneous devices based on STM32, comprising multi-protocol heterogeneous devices, a master microcontroller, and a local control device; the input terminal of the master microcontroller is connected to the multi-protocol heterogeneous devices, and the control terminal of the master microcontroller is connected to the local control device. The multi-protocol heterogeneous devices consist of devices with various different protocols; the master microcontroller receives control commands from different devices and then controls the local control device.

[0012] Furthermore, the multi-protocol heterogeneous device includes a relay board, a touch screen, a host computer, a data acquisition unit, a debugging port, and a motor; the relay board is connected to the main control microcontroller via an RS232 interface; the touch screen is connected to the main control microcontroller via a TTL interface; the host computer, data acquisition unit, and debugging port are connected to the main control microcontroller via an RS485 interface; and the motor is connected to the main control microcontroller via a GPIO / PWM interface.

[0013] Furthermore, the main control microcontroller uses the STM32F103RCT6 chip.

[0014] According to another aspect of the present invention, a real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 is provided, comprising the following steps:

[0015] Step 1: Power-on initialization; parameter management and power-down protection; initialization of all UARTs;

[0016] Step 2: Enter the main loop; refresh the watchdog heartbeat flag to prevent freezing; fuse the received data protocol; execute instructions with priority; perform fault detection every 10-100ms; fuse multi-source data; report status; perform watchdog detection;

[0017] Step 3, fault recovery.

[0018] Furthermore, the fusion of received data protocols includes: protocol identification and parsing, identifying MODBUS, TTL, and RS232 protocols based on data characteristics, and extracting device addresses, registers, and parameters from each protocol's independent parser;

[0019] Command mapping and conversion: mapping to the target device and converting parameters;

[0020] Instruction distribution and execution, conflict detection before instruction enqueueing, conflicting instructions from the same device through priority arbitration, simultaneous issuance of instructions to multiple targets, disabling interrupts to prevent contention, and DMA and priority interrupts to ensure real-time performance;

[0021] The system aggregates data from multiple sources, aligns data returned by the collector, relay status, and local motor feedback with timestamps, scores data consistency to reflect the quality of data fusion, and supports multi-dimensional queries. The same set of aggregated data can be queried from touch screens, host computers, and cloud platforms.

[0022] Furthermore, the multi-source data is fused into aggregated local, collector, and relay data, and the fused data is cached after timestamp alignment and consistency scoring.

[0023] Furthermore, fault recovery includes three-level fault recovery and automatic recovery scanning;

[0024] Level 1, Automatic Retry for Communication Abnormalities: When UART receive times out, CRC error occurs, or frame length is abnormal, it will retry a maximum of 3 times with an interval of 100ms. If it recovers, the device will continue to be used. If it continues to fail, it will enter Level 2.

[0025] Level 2, device offline, fault isolation: When Level 1 fails continuously or heartbeat is lost, the device status is changed to OFFLINE, and subsequent commands of the device are automatically redirected to the backup device. Related commands are executed in a downgraded manner. Automatic detection is performed every 10 seconds. If the detection is successful, automatic reconnection and recovery are performed to prevent single point of failure from spreading and the system continues to run.

[0026] Level 3, Data Abnormality, Data Discard: When the return value exceeds the range, has an incorrect format, or has an abnormal timestamp, the current data is discarded, the previous valid data is used, the quality score of the fused data is marked, and an alarm is sent to the touch screen or host computer, so that data abnormality does not affect the execution of subsequent control commands.

[0027] Automatic recovery scan: Periodically checks offline devices every 10 seconds and attempts to reconnect. If the device returns to online, the device list is automatically updated and it is restored to use. If it remains offline, it continues to wait for the next cycle.

[0028] Furthermore, parameter management and power-loss protection include a Flash parameter storage scheme with redundancy verification and primary / backup partitioning. After power-on, the primary parameter area is read and verified using magic words and CRC32. If valid, the parameters are loaded and the system starts. If invalid, it attempts to restore from the backup area. If the backup is also invalid, the built-in safe default value is loaded. When parameters are changed online, they are immediately written to Flash, and the backup area is updated to ensure recovery after power failure.

[0029] The technical solution of this invention has the following beneficial technical effects: This invention, through a six-dimensional collaborative system of "protocol fusion + real-time collaboration + intelligent arbitration + fault self-healing + parameter management + data fusion," achieves the following breakthroughs compared to existing technologies: By integrating a single STM32 microcontroller with protocols, system integration is improved and hardware costs are reduced; through protocol abstraction and automatic conversion, development efficiency is improved and code redundancy is reduced; real-time response time is reduced and response speed is increased; through multi-source collaborative capabilities, atomic synchronous execution is achieved, improving reliability; through priority arbitration and early warning, conflict handling is achieved, reducing the risk of loss of control; through automatic isolation and degradation, fault recovery is achieved, reducing MTTR; through unified, redundant, and automatically discovered parameter management, configuration costs are reduced; scalability is improved by adding or deleting mapping tables, reducing the time to connect new devices; through centralized and standardized maintainability, maintenance costs are reduced. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of a real-time collaborative control system for multi-protocol heterogeneous devices based on STM32.

[0031] Figure 2 This is a schematic diagram of the structure of a multi-protocol heterogeneous device in a real-time collaborative control system for multi-protocol heterogeneous devices based on STM32.

[0032] Figure 3 Flowchart of a real-time collaborative control method for multi-protocol heterogeneous devices based on STM32. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments and the accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0034] like Figure 1 As shown, a real-time collaborative control system for multi-protocol heterogeneous devices based on STM32 is provided, which consists of multi-protocol heterogeneous devices, a main control microcontroller, and a local control device; the input terminal of the main control microcontroller is connected to the multi-protocol heterogeneous devices, and the control terminal of the main control microcontroller is connected to the local control device.

[0035] like Figure 2As shown, the multi-protocol heterogeneous device includes a relay board, a touch screen, a host computer, a data acquisition unit, a debugging port, and a motor. The relay board is connected to the main control microcontroller via an RS232 interface. The touch screen is connected to the main control microcontroller via a TTL interface. The host computer, data acquisition unit, and debugging port are connected to the main control microcontroller via an RS485 interface. The motor is connected to the main control microcontroller via a GPIO / PWM interface.

[0036] The main control microcontroller uses the STM32F103RCT6 chip.

[0037] like Figure 3 As shown, according to another aspect of the present invention, a real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 is provided, comprising the following steps:

[0038] Step 1: Power-on initialization; parameter management and power-down protection; initialization of all UARTs;

[0039] Step 2: Enter the main loop; refresh the watchdog heartbeat flag to prevent freezing; fuse the received data protocol; execute instructions with priority; perform fault detection every 10-100ms; fuse multi-source data; report status; perform watchdog detection;

[0040] Step 3, fault recovery.

[0041] The fusion of received data protocols includes: protocol identification and parsing, identifying MODBUS, TTL, and RS232 protocols based on data characteristics, and extracting device addresses, registers, and parameters from each protocol's independent parser;

[0042] Command mapping and conversion: mapping to the target device and converting parameters;

[0043] Instruction distribution and execution, conflict detection before instruction enqueueing, conflicting instructions from the same device through priority arbitration, simultaneous issuance of instructions to multiple targets, disabling interrupts to prevent contention, and DMA and priority interrupts to ensure real-time performance;

[0044] The system aggregates data from multiple sources, aligns data returned by the collector, relay status, and local motor feedback with timestamps, scores data consistency to reflect the quality of data fusion, and supports multi-dimensional queries. The same set of aggregated data can be queried from touch screens, host computers, and cloud platforms.

[0045] Multi-source data fusion involves aggregating local, collector, and relay data, performing timestamp alignment and consistency scoring, and then caching the fused data.

[0046] Fault recovery includes three levels of fault recovery and automatic recovery scan;

[0047] Level 1, Automatic Retry for Communication Abnormalities: When UART receive times out, CRC error occurs, or frame length is abnormal, it will retry a maximum of 3 times with an interval of 100ms. If it recovers, the device will continue to be used. If it continues to fail, it will enter Level 2.

[0048] Level 2, device offline, fault isolation: When Level 1 fails continuously or heartbeat is lost, the device status is changed to OFFLINE, and subsequent commands of the device are automatically redirected to the backup device. Related commands are executed in a downgraded manner. Automatic detection is performed every 10 seconds. If the detection is successful, automatic reconnection and recovery are performed to prevent single point of failure from spreading and the system continues to run.

[0049] Level 3, Data Abnormality, Data Discard: When the return value exceeds the range, has an incorrect format, or has an abnormal timestamp, the current data is discarded, the previous valid data is used, the quality score of the fused data is marked, and an alarm is sent to the touch screen or host computer, so that data abnormality does not affect the execution of subsequent control commands.

[0050] Automatic recovery scan: Periodically checks offline devices every 10 seconds and attempts to reconnect. If the device returns to online, the device list is automatically updated and it is restored to use. If it remains offline, it continues to wait for the next cycle.

[0051] Parameter management and power failure protection include a Flash parameter storage scheme with redundancy verification and primary / backup partitioning. After power-on, the primary parameter area is read and verified by magic words and CRC32. If valid, the parameters are loaded and the system starts. If invalid, it attempts to restore from the backup area. If the backup is also invalid, the built-in safe default value is loaded. When parameters are changed online, they are immediately written to Flash, and the backup area is updated to ensure recovery after power failure. Specific Implementation

[0052] This STM32-based real-time collaborative control system for multi-protocol heterogeneous devices consists of multi-protocol heterogeneous devices, a main microcontroller, and local control devices. The input terminals of the main microcontroller are connected to the multi-protocol heterogeneous devices, and its control terminals are connected to the local control devices. The multi-protocol heterogeneous devices include a relay board, a touchscreen, a host computer, a data acquisition unit, a debugging port, and a motor. The relay board is connected to the main microcontroller via an RS232 interface; the touchscreen is connected to the main microcontroller via a TTL interface; the host computer, data acquisition unit, and debugging port are connected to the main microcontroller via an RS485 interface; and the motor is connected to the main microcontroller via a GPIO / PWM interface. The main microcontroller uses the STM32F103RCT6 chip. The local control device, taking motor PWM as an example, includes 5 independent UART channels (1-5), 4 PWM motor local control channels, and 8 limit switch inputs.

[0053] A real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 includes the following steps.

[0054] Step 1: Power-on initialization; parameter management and power-down protection; initialization of all UARTs;

[0055] Step 2: Enter the main loop; refresh the watchdog heartbeat flag to prevent freezing; fuse the received data protocol; execute instructions with priority; perform fault detection every 10-100ms; fuse multi-source data; report status; perform watchdog detection;

[0056] Step 3, fault recovery.

[0057] The data reception protocol fusion includes: protocol identification and parsing, identifying MODBUS, TTL, and RS232 protocols based on data characteristics, and extracting device addresses, registers, and parameters from each protocol's independent parser;

[0058] Command mapping and conversion: mapping to the target device and converting parameters;

[0059] Command distribution and execution include conflict detection before command queuing, priority arbitration for conflicting commands from the same device, simultaneous issuance of multiple target commands, disabling interrupts to prevent contention, and using DMA and priority interrupts to ensure real-time performance. DMA is used to independently process UART data without CPU overhead. Fine-grained interrupt priority settings are set to Local > Acquisition > Remote > Debugging: Priority 0 ensures uninterrupted touchscreen input, guaranteeing immediate local control; priorities 1-3 prevent touchscreen interruption of data acquisition and critical responses; priorities 4-7 prevent remote computer interruption of local operations; and priority 15 allows debugging information to be interrupted by any operation, with all operations timestamped. Post-event alignment and analysis are supported, reducing system response time from >200ms to <50ms, achieving 99.5% stability, and supporting a hybrid mode of touchscreen, computer, and local control.

[0060] The system aggregates data from multiple sources, aligns data returned by the collector, relay status, and local motor feedback with timestamps, scores data consistency to reflect the quality of data fusion, and supports multi-dimensional queries. The same set of aggregated data can be queried from touch screens, host computers, and cloud platforms.

[0061] Consistency score (0-100): 100 points for all valid data; -25 points for offline data acquisition; -15 points for limit switch triggering; -10 points for time dispersion > 200ms. Data is automatically aggregated every 100ms and sent to the touchscreen / host computer every 500ms.

[0062] Typical scenario: The touchscreen issues a command to "motor speed 50%" and the host computer issues a command to "motor speed 80%"; Process: The touchscreen command (priority 200) and the host computer command (priority 100) are arbitrated, and the touchscreen takes priority (local priority principle), executing the motor speed of 50%, immediately updating the local PWM, and synchronously sending a MODBUS query to the data acquisition unit. The limit switch can be interrupted when triggered, and the result is displayed on the touchscreen within 20ms; Limit switch interrupt handling (priority 255): At any time, the limit switch trigger immediately generates an "emergency stop" command, inserts it at the top of the priority queue (level 255), interrupts all current operations, the motor stops immediately, the LED flashes quickly as an alarm, and the "emergency stop" event is logged.

[0063] Multi-source data fusion involves aggregating local, collector, and relay data, performing timestamp alignment and consistency scoring, and then caching the fused data.

[0064] Fault recovery includes three levels of fault recovery and automatic recovery scan;

[0065] Level 1, Automatic Retry for Communication Abnormalities: When UART receive times out, CRC error occurs, or frame length is abnormal, it will retry a maximum of 3 times with an interval of 100ms. If it recovers, the device will continue to be used. If it continues to fail, it will enter Level 2.

[0066] Level 2, device offline, fault isolation: When Level 1 fails consecutively or heartbeat is lost, the device status is changed to OFFLINE, and subsequent instructions of the device are automatically redirected to the backup device. Related commands are executed in a downgraded manner. Automatic detection is performed every 10 seconds, and a Hello frame is sent. After successful detection, automatic reconnection and recovery are performed to prevent single point of failure from spreading and the system continues to run.

[0067] Level 3, Data Abnormality, Data Discard: When the return value exceeds the range, has an incorrect format, or has an abnormal timestamp, the current data is discarded, the previous valid data is used, the quality score of the fused data is marked, and an alarm is sent to the touch screen or host computer, so that data abnormality does not affect the execution of subsequent control commands.

[0068] Automatic recovery scan: Periodically checks offline devices every 10 seconds and attempts to reconnect. If the device returns to online, the device list is automatically updated and it is restored to use. If it remains offline, it continues to wait for the next cycle.

[0069] For parameter management and power failure protection, the system adopts a redundant verification + primary / backup partitioning Flash parameter storage scheme: Flash parameter distribution (built-in 256KB):

[0070] 0x00000-0x31FFF: Application code area (200KB);

[0071] 0x32000-0x3DFFF: Parameter area main body (48KB), including magic word (0xA5A5) + version number, UART baud rate configuration (5 channels), device table (address / type / protocol, etc.), protocol mapping table, CRC32 checksum (sub-area + all);

[0072] 0x3E000-0x3FFFF: Parameter area backup (8KB).

[0073] Power-on self-test and recovery process: Read the main parameter area and verify the magic word + CRC32; if the main area is valid, load the parameters and start the system; if the main area is invalid, try to restore from the backup area; if the backup is also invalid, load the built-in security default value; when parameters are changed online, write them to Flash immediately and update the backup area to ensure recovery after power failure / power outage.

[0074] The software layered architecture consists of 5 layers:

[0075] Layer 5: Application and Collaborative Control Layer: Touchscreen instruction processing, host computer instruction processing, multi-source collaborative decision-making and execution, display and feedback management; Layer 4: Control Strategy and Intelligent Decision-Making Layer: Priority arbitration engine, fault detection and self-healing strategy, real-time scheduler, data fusion and consistency verification.

[0076] Layer 3: Protocol Fusion and Conversion Layer: Protocol abstraction layer, protocol parsing (MODBUS / TTL / RS232), dynamic mapping table management, automatic instruction conversion engine, multi-source data aggregation;

[0077] Layer 2: Communication and Parameter Service Layer: UART driver (USART1 / 2 / 3 / UART4 / 5), DMA + interrupt management, CRC check and error handling, parameter storage and recovery, watchdog and heartbeat monitoring;

[0078] Layer 1: Hardware Abstraction and Driver Layer: GPIO / PWM driver, timer and interrupt management, Flash read / write, peripheral initialization.

[0079] Comparison with existing technologies:

[0080]

[0081] It should be understood that the specific embodiments described above are merely illustrative or explanatory of the principles of the invention and do not constitute a limitation thereof. Therefore, any modifications, equivalent substitutions, improvements, etc., made without departing from the spirit and scope of the invention should be included within the protection scope of the invention. Furthermore, the appended claims are intended to cover all variations and modifications falling within the scope and boundaries of the appended claims, or equivalent forms of such scope and boundaries.

Claims

1. A real-time collaborative control system for multi-protocol heterogeneous devices based on STM32, characterized in that, It consists of a multi-protocol heterogeneous device, a main control microcontroller, and a local control device; the input terminal of the main control microcontroller is connected to the multi-protocol heterogeneous device, and the control terminal of the main control microcontroller is connected to the local control device.

2. The STM32-based multi-protocol heterogeneous device real-time collaborative control system according to claim 1, characterized in that, The multi-protocol heterogeneous device includes a relay board, a touch screen, a host computer, a data acquisition unit, a debugging port, and a motor; the relay board is connected to the main control microcontroller via an RS232 interface; the touch screen is connected to the main control microcontroller via a TTL interface; the host computer, data acquisition unit, and debugging port are connected to the main control microcontroller via an RS485 interface; and the motor is connected to the main control microcontroller via a GPIO / PWM interface.

3. The STM32-based multi-protocol heterogeneous device real-time collaborative control system according to claim 1, characterized in that, The main control microcontroller uses the STM32F103RCT6 chip.

4. A real-time collaborative control method for multi-protocol heterogeneous devices based on STM32, characterized in that, Includes the following steps, Step 1: Power-on initialization; parameter management and power-down protection; initialization of all UARTs; Step 2: Enter the main loop; refresh the watchdog heartbeat flag to prevent freezing; fuse the received data protocol; execute instructions with priority; perform fault detection every 10-100ms; fuse multi-source data; report status; Watchdog detection; Step 3, fault recovery.

5. The real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 according to claim 4, characterized in that, The protocol fusion of received data includes: protocol identification and parsing, identifying MODBUS, TTL and RS232 protocols based on data characteristics, and extracting device address, register and parameters by an independent parser for each protocol; Command mapping and conversion: mapping to the target device and converting parameters; Instruction distribution and execution, conflict detection before instruction enqueueing, conflicting instructions from the same device through priority arbitration, simultaneous issuance of instructions to multiple targets, disabling interrupts to prevent contention, and DMA and priority interrupts to ensure real-time performance; The system aggregates data from multiple sources, aligns data returned by the collector, relay status, and local motor feedback with timestamps, scores data consistency to reflect the quality of data fusion, and supports multi-dimensional queries. The same set of aggregated data can be queried from touch screens, host computers, and cloud platforms.

6. The real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 according to claim 4, characterized in that, The multi-source data fusion involves aggregating local, collector, and relay data, performing timestamp alignment and consistency scoring, and then caching the fused data.

7. The real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 according to claim 4, characterized in that, The fault recovery includes three-level fault recovery and automatic recovery scanning; Level 1, Automatic Retry for Communication Abnormalities: When UART receive times out, CRC error occurs, or frame length is abnormal, it will retry a maximum of 3 times with an interval of 100ms. If it recovers, the device will continue to be used. If it continues to fail, it will enter Level 2. Level 2, device offline, fault isolation: When Level 1 fails continuously or heartbeat is lost, the device status is changed to OFFLINE, and subsequent commands of the device are automatically redirected to the backup device. Related commands are executed in a downgraded manner. Automatic detection is performed every 10 seconds. If the detection is successful, automatic reconnection and recovery are performed to prevent single point of failure from spreading and the system continues to run. Level 3, Data Abnormality, Data Discard: When the return value exceeds the range, has an incorrect format, or has an abnormal timestamp, the current data is discarded, the previous valid data is used, the quality score of the fused data is marked, and an alarm is sent to the touch screen or host computer, so that data abnormality does not affect the execution of subsequent control commands. Automatic recovery scan: Periodically checks offline devices every 10 seconds and attempts to reconnect. If the device returns to online, the device list is automatically updated and it is restored to use. If it remains offline, it continues to wait for the next cycle.

8. The real-time collaborative control method for multi-protocol heterogeneous devices based on STM32 according to claim 4, characterized in that, The parameter management and power failure protection includes a Flash parameter storage scheme with redundancy verification and primary / backup partitioning. After power-on, the primary parameter area is read and verified by magic words and CRC32. If valid, the parameters are loaded and the system starts. If invalid, an attempt is made to restore from the backup area. If the backup is also invalid, the built-in safe default value is loaded. When parameters are changed online, they are immediately written to Flash, and the backup area is updated to ensure recovery after power failure.