Embedded device communication scheduling method and system based on multi-serial port cooperation

CN122195621BActive Publication Date: 2026-10-16TIANJIN ZHONGDA ZHITENG TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202610659781.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-14
Publication Date
2026-10-16
Estimated Expiration
2046-05-14

AI Technical Summary

Technical Problem

[0008]针对现有技术的不足,本发明提供了基于多串口协同的嵌入式设备通信调度方法及系统,解决了多串口协同场景下回流报文被误判为真实响应并持续触发重发与级联发送,进而引发队列堆积、中断挤压与资源耗尽的问题

Benefits of technology

[0021] (1) This invention introduces the number of byte parity matches, the length of consecutive byte segments, the CRC match flag, the number of byte misses, the sending and receiving interval value and the port offset value to perform frame-level backflow identification on the received frame and the candidate sending frame. It can distinguish between real peripheral responses and cross-serial port backflow messages, thereby achieving the effect of backflow message source discrimination and pseudo response identification. It effectively solves the problem that the received is regarded as a real response and lacks frame-level source discrimination capability in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122195621B_ABST
    Figure CN122195621B_ABST
Patent Text Reader

Abstract

The application discloses a multi-serial-port cooperative embedded device communication scheduling method and system, and relates to the technical field of digital data processing.The multi-serial-port cooperative embedded device communication scheduling method comprises the following steps: S1, collecting multi-serial-port communication scheduling data, pre-processing the multi-serial-port communication scheduling data, storing the pre-processed data and constructing a serial-port scheduling database; S2, carrying out frame-level backflow identification based on transceiving frame homologous matching, CRC consistent marking and port offset value; S3, carrying out storm diffusion calculation through queue occupation, interruption load and resource utilization rate data; and S4, executing normal scheduling recovery, isolation time length extension and serial-port loopback alarm operation according to scheduling convergence analysis results.The method solves the problem that backflow messages are misjudged as real responses and continuously trigger retransmission and cascade sending in the multi-serial-port cooperative scenario, thereby causing queue accumulation, interruption extrusion and resource exhaustion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital data processing technology, specifically to an embedded device communication scheduling method and system based on multi-serial port collaboration. Background Technology

[0002] Embedded devices in industrial control, edge acquisition, communication gateways, and instrumentation scenarios often require simultaneous access to multiple serial port channels for command issuance, status readback, data acquisition, fault diagnosis, and link maintenance between the main control unit and multiple peripherals. Existing multi-serial port collaborative communication scheduling methods mostly employ port isolation combined with event-triggered processing paths, configuring send buffers, receive buffers, interrupt handling procedures, and send / receive timing control logic for each serial port. Upon receiving a message that meets the frame header, length, device address, function code, and CRC rules, the receiving end typically treats the received message directly as a peripheral response, releasing the waiting link, advancing subsequent transmission tasks, ending the retransmission process, and updating the communication status accordingly. This processing path has a relatively low implementation threshold and is easy to deploy in resource-constrained embedded devices, thus it is widely used in multi-serial port collaborative communication scenarios.

[0003] For example, invention patent CN110401670B discloses an optimized Ethernet transparent transmission method for industrial serial port protocols. For an industrial serial port protocol transmission control system, the method includes: state machines are set in both the first and second protocol converters, acting as slave / master stations respectively; a protocol stack for the serial port slave and master stations is established between the first and second protocol converters; a sequence number is added to the data frames transmitted and received between the first and second protocol converters; the sequence number is added when a data frame is sent from the serial port, and the sequence number increments sequentially according to the number of times it is sent; Ethernet communication between the first and second protocol converters uses the User Datagram Protocol (UDP), and a multi-send mechanism is added to the UDP protocol. This solves the problem of poor transmission performance of industrial serial port protocols caused by delays and frame drops during transmission in poor network conditions or in interconnected networks, making the entire transmission process efficient and accurate.

[0004] For example, invention patent CN107707447B discloses an EtherCAT-based slave system and control method. This system includes: a slave data exchange module for exchanging data with a slave controller; a slave controller for parsing and communicating with the master controller; an encoder data acquisition module for expanding multi-channel encoder protocol conversion; a digital input / output module for acquiring digital input signals and outputting digital level control signals; an analog data input / output module for level conversion and isolation of input analog voltage signals, and for reading analog data and outputting analog control signals; and a bus protocol conversion module for coupling different industrial bus protocols into the EtherCAT protocol. This solves the problems of control system complexity and large installation space requirements, and improves compatibility and versatility in supporting different communication protocols.

[0005] However, existing multi-serial port schedulers generally lack fine-grained discrimination capabilities regarding the source relationship of transmitted and received frames. They lack effective means to distinguish between false responses caused by cross-port backflow, physical connection loopback, abnormal device forwarding, and mirrored pass-through. When a message sent from serial port A returns from serial port B via an external loopback path, the backflow message often retains the original frame header content, function code, device address, and CRC check result. Simply relying on traditional processing methods such as receive triggering, CRC check, address matching, function code matching, and timeout retransmission makes it difficult to accurately determine whether the currently received message belongs to a genuine peripheral device response. As a result, the backflow message is easily misjudged as a normal response, continuing to drive subsequent transmissions, abnormal retransmissions, and cross-port cascading scheduling. As the number of misjudgments accumulates, the transmission and reception requests in the scheduling chain amplify each other, easily forming a continuously spreading positive feedback communication storm. Once the return packets continue to enter the scheduling chain, the sending queue and receiving queue are prone to rapid accumulation in a short period of time, the number of interrupt triggers continues to increase, processor usage, DMA transfer resources and cache resources are greatly squeezed, which in turn leads to a decrease in communication throughput, real-time task overdue, increased service response delay, and long-term instability of serial port links. In severe cases, it may also trigger soft reset and watchdog protection.

[0006] Therefore, in order to address the above problems, there is an urgent need for an embedded device communication scheduling method and system based on multi-serial port collaboration. Summary of the Invention

[0007] Technical problems to be solved

[0008] To address the shortcomings of existing technologies, this invention provides an embedded device communication scheduling method and system based on multi-serial port collaboration. This solves the problem that in multi-serial port collaboration scenarios, return messages are misjudged as genuine responses and continuously trigger retransmission and cascading, leading to queue accumulation, interruption squeezing, and resource exhaustion.

[0009] Technical solution

[0010] To achieve the above objectives, the present invention provides the following technical solution: an embedded device communication scheduling method based on multi-serial port collaboration, comprising: S1, collecting multi-serial port communication scheduling data, preprocessing the multi-serial port communication scheduling data, storing it, and constructing a serial port scheduling database; S2, performing frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency marking, and port offset values, and performing real response release and backflow frame isolation operations according to the backflow identification results; S3, performing storm diffusion calculations based on queue occupancy, interrupt load, and resource utilization data, and performing one-way release, cascade transmission blocking, and DMA block reception switching operations according to the diffusion calculation results; S4, performing scheduling convergence analysis around the number of isolated backflow frames, the number of suspected backflow frames, the number of real response frames, the number of successfully transmitted frames, and the number of retransmitted frames, and performing normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations according to the scheduling convergence analysis results.

[0011] Further, the specific steps for collecting multi-serial port communication scheduling data are as follows: Collect multi-serial port communication scheduling data: Obtain the sending serial port number, sending start time, sending completion time, frame length in bytes, frame header byte value, function code, device address, CRC check value, sending frame byte sequence, sending queue depth, sending queue capacity, number of successfully sent frames, and number of retransmitted frames through the sending record link; obtain the receiving serial port number, receiving start time, receiving completion time, receiving frame byte sequence, receiving queue depth, receiving queue capacity, number of real response frames, number of suspected backflow frames, and number of isolated backflow frames through the receiving record link; obtain the interrupt trigger count, interrupt safety limit, CPU utilization rate, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of busy DMA channels, and total number of DMA channels through the resource monitoring link.

[0012] Further, the specific steps for preprocessing and storing multi-serial port communication scheduling data and constructing a serial port scheduling database are as follows: Timestamp alignment, incomplete frame removal, abnormal frame removal, duplicate frame merging, and unification of frame header fields, function code fields, device address fields, and CRC checksum fields are performed on the transmitted and received message data; within the same backflow retrieval duration, each received frame is paired with the most recently transmitted image from each serial port to obtain the candidate transmitting serial port number and the expected response serial port number; the number of byte-to-byte matches is obtained based on the positional comparison results of the transmitted and received frame byte sequences; the length of the continuous byte segment is obtained based on the longest consecutive consistent byte interval; and the length of the byte segment is determined based on the frame length. The number of byte misses is obtained by calculating the difference between the number of bytes that have a corresponding position. The transmission and reception interval is obtained by calculating the difference between the transmission completion time and the reception completion time. The CRC consistency flag is obtained by comparing the CRC checksums. The port offset is obtained by calculating the difference between the expected response serial port position and the actual receiving serial port position in the scheduling mapping table. The numerical data in the multi-serial port communication scheduling data is Z-score standardized and then range normalized to map each feature to a unified numerical range. The port status data and resource usage data are processed by scheduling window merging and port status association. The standardized and normalized multi-serial port communication scheduling data is stored to construct a serial port scheduling database.

[0013] Furthermore, the specific steps for frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency flags, and port offset values ​​are as follows: Obtain the number of byte-to-byte coincidences, the length of consecutive byte segments, the number of bytes in the frame length, the CRC consistency flag, the transmit / receive interval value, and the port offset value; obtain the number of byte misses based on the difference between the number of bytes in the frame length and the number of byte-to-byte coincidences; sum the number of byte-to-byte coincidences, the length of consecutive byte segments, and the CRC consistency flags to obtain the content matching input; sum the number of byte misses, the port offset value, and one to obtain the difference reduction input; divide the content matching input by the difference reduction input and perform an arctangent operation to obtain the matching compression input; add one to the transmit / receive interval value, perform a square root operation, and then take the reciprocal to obtain the delay proximity input; sum the matching compression input and the delay proximity input to obtain the frame backflow identification value.

[0014] Furthermore, the specific steps for performing real response release and backflow frame isolation operations based on the backflow identification results are as follows: By comparing the frame backflow identification value and the backflow identification threshold in real time, the currently received frame is first written into the real response candidate queue, and source verification measures are performed: the current received frame is compared with the device address and function code of the most recently issued command, the actual receiving serial port is verified with the expected response serial port, and it is determined whether the sending and receiving interval is less than the interval threshold, and whether the current device address already has a real response frame that has passed protocol verification within this scheduling window; when the source verification is passed, the normal response release path of the current received frame is retained and written into the real response queue; when the source verification is failed, the current received frame is determined to be a backflow frame to be isolated and written into the isolation queue. The system identifies the current received frame as a return frame and writes it into the isolation queue. It then cancels the retransmission and cascading actions triggered by the current received event. When the frame return identification value is greater than or equal to the return identification threshold, the system determines the current received frame as a return frame and writes it into the isolation queue. It cancels the retransmission and cascading actions triggered by the current received event, pairs the candidate sending serial port with the actual receiving serial port to form a hit serial port pair and switches it to a one-way release state, retaining only the sending direction. Simultaneously, it extends the holding time of the hit serial port pair's transmission mirror, shortens the holding time of the irrelevant serial port's transmission mirror, narrows the range of candidate response serial ports, freezes the cross-port linkage trigger flag of the hit serial port pair, and remaps the expected response serial port number according to the device address and function code, updating the positional correspondence of the hit serial port pair, thereby blocking the return frame from entering the scheduling chain.

[0015] Furthermore, the specific steps for storm propagation calculation using queue occupancy, interrupt load, and resource utilization data are as follows: Obtain the send queue depth, send queue capacity, receive queue depth, receive queue capacity, interrupt trigger count, interrupt safety limit, CPU utilization, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of suspected backflow frames, number of busy DMA channels, and total number of DMA channels; divide the send queue depth by the send queue capacity to obtain the send queue occupancy value; divide the receive queue depth by the receive queue capacity to obtain the receive queue occupancy value; divide the interrupt trigger count by... Interrupt safety limit is used to obtain interrupt occupancy value; CPU utilization is divided by CPU occupancy safety limit to obtain processing occupancy value; the squares of transmit queue occupancy value, receive queue occupancy value, interrupt occupancy value, and processing occupancy value are squared and summed, then the square root is taken to obtain resource squeeze term; the number of remaining cache blocks is divided by the total number of cache blocks plus one to obtain cache buffer term; the sum of the number of suspected backflow frames and the number of busy DMA channels is divided by the total number of DMA channels plus one to obtain injection diffusion term; the resource squeeze term is divided by cache buffer term and then summed with injection diffusion term to obtain storm diffusion value.

[0016] Furthermore, the specific steps for performing one-way release, cascaded transmission blocking, and DMA block receive switching operations based on the diffusion calculation results are as follows: By comparing the storm diffusion value and the diffusion threshold in real time, when the storm diffusion value is less than the diffusion threshold, the current multi-serial port collaborative scheduling strategy is maintained, only the received frames that have hit the return flow are isolated, and the normal transmission and reception order of the missed serial ports is not changed; when the storm diffusion value is greater than or equal to the diffusion threshold, storm suppression measures are implemented: the hit serial port pair is switched to a one-way release state, the enqueueing of new service frames on the hit serial port pair is suspended, only heartbeat frames, status query frames, and recovery control frames are retained, and cross-port connections are frozen. The system implements cascading transmission and abnormal retransmission triggering to reduce the depth of the transmission queue; it merges and clears duplicate return frames in the isolation queue that have the same function code, device address, and CRC check value, reducing the depth of the receive queue and decreasing the number of suspected return frames; it changes the receive processing from frame-by-frame triggering to DMA block reception, reducing the number of interrupt triggers and CPU utilization; it releases the DMA transfer channel and buffer block occupied by isolated return frames on the hit serial port pair, increases the number of remaining buffer blocks, and sends the number of isolated return frames, suspected return frames, actual response frames, successful transmission frames, and retransmission frames to the scheduling convergence verification module.

[0017] Furthermore, the specific steps for scheduling convergence analysis based on the number of isolated return frames, suspected return frames, actual response frames, successfully transmitted frames, and retransmission frames are as follows: Obtain the number of isolated return frames, suspected return frames, actual response frames, successfully transmitted frames, retransmission frames, and storm spread value; divide the number of isolated return frames by the number of suspected return frames plus one to obtain the isolation efficiency; multiply the number of actual response frames plus one by the number of successfully transmitted frames plus one, and then perform a square root operation to obtain the effective communication term; square the number of suspected return frames, the number of retransmission frames, and the storm spread value respectively, sum them, and then perform a square root operation to obtain the instability residual term; divide the instability residual term by the isolation efficiency plus one to obtain the suppression correction term; divide the effective communication term by the sum of the suppression correction term and one to obtain the scheduling convergence value.

[0018] Furthermore, based on the scheduling convergence analysis results, the specific steps for performing normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations are as follows: By comparing the scheduling convergence value and the convergence threshold in real time, when the scheduling convergence value is greater than or equal to the convergence threshold, the one-way release restriction on the hit serial port is lifted, the service frame is enqueued, the receiving and processing retains the DMA block for one observation cycle and then switches back to frame-by-frame reception, shortens the holding time of the hit serial port for the transmitted image, clears the backflow frame records that have been verified in the isolation queue, restores the cross-port linkage trigger flag, and prioritizes the release of real response candidate frames corresponding to the same device address and the same function code; when the scheduling convergence value is less than the convergence threshold, the direct verification path is retained for the real response candidate frames, and after verification, they are prioritized to be written into the real response queue to increase the number of real response frames; service frames that have been sent but have not hit the backflow identification path are prioritized to be kept To improve isolation efficiency, the system retains sending eligibility, reduces the number of cancelled transmissions, and increases the number of successfully transmitted frames. It re-verifies suspected backflow frames in the isolation queue by device address, function code, and frame sequence number, merging and clearing duplicate backflow frames. It freezes the abnormal retransmission trigger chain for hit serial ports, retaining only one retransmission task for the same device address, thus reducing the number of retransmitted frames. It maintains the one-way release state for hit serial ports, maintains DMA block reception for hit serial port pairs, and limits the number of newly added service frames enqueued in each scheduling window to k, reducing interrupt trigger counts, CPU utilization, and the depth of the sending and receiving queues, thereby mitigating storm propagation. When the scheduling convergence value for n consecutive scheduling windows is still less than the convergence threshold, a serial port loopback alarm record is generated, and the transmission of non-core service frames on the hit serial port pair is disabled, retaining only heartbeat frames, status query frames, and recovery control frames.

[0019] Furthermore, the second aspect of the present invention provides an embedded device communication scheduling system based on multi-serial port collaboration, applying an embedded device communication scheduling method based on multi-serial port collaboration, comprising: a multi-serial port message acquisition and preprocessing module, used to acquire multi-serial port communication scheduling data, preprocess the multi-serial port communication scheduling data, store it, and construct a serial port scheduling database; a frame-level backflow identification module, used to perform frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency marking, and port offset values, and perform real response release and backflow frame isolation operations according to the backflow identification results; a storm diffusion suppression scheduling module, used to perform storm diffusion calculations based on queue occupancy, interrupt load, and resource utilization data, and perform one-way release, cascade transmission blocking, and DMA block receive switching operations according to the diffusion calculation results; and a scheduling convergence verification module, used to perform scheduling convergence analysis around the number of isolated backflow frames, the number of suspected backflow frames, the number of real response frames, the number of successfully transmitted frames, and the number of retransmitted frames, and perform normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations according to the scheduling convergence analysis results.

[0020] The present invention has the following beneficial effects:

[0021] (1) This invention introduces the number of byte parity matches, the length of consecutive byte segments, the CRC match flag, the number of byte misses, the sending and receiving interval value and the port offset value to perform frame-level backflow identification on the received frame and the candidate sending frame. It can distinguish between real peripheral responses and cross-serial port backflow messages, thereby achieving the effect of backflow message source discrimination and pseudo response identification. It effectively solves the problem that the received is regarded as a real response and lacks frame-level source discrimination capability in the prior art.

[0022] (2) Based on frame backflow identification, this invention adds device address, function code, expected response serial port, send and receive interval value and source verification processing of unique response within the window to the real response candidate frame, and performs isolation and trigger cancellation on the received frame that fails the verification, thereby achieving the effect of misjudgment protection and fine release of real response in boundary scenarios, effectively solving the problem in the prior art that abnormal backflow is easily misjudged as normal response when the backflow value is in the critical area.

[0023] (3) This invention constructs storm diffusion values ​​based on the depth of the sending queue, the depth of the receiving queue, the number of interrupt triggers, the CPU utilization rate, the number of remaining buffer blocks, the number of suspected backflow frames, and the number of busy DMA channels. When diffusion is enhanced, it performs one-way release, service frame restriction, cascade transmission blocking, duplicate backflow frame merging and clearing, and DMA block reception switching processing, thereby achieving the effect of rapid suppression of backflow diffusion links and synchronous relief of resource squeezing. It effectively solves the problem in the prior art of continuous retransmission and cascade transmission after backflow misjudgment, leading to queue accumulation and resource exhaustion.

[0024] (4) This invention constructs a scheduling convergence value based on the number of isolated return frames, the number of suspected return frames, the number of real response frames, the number of successfully sent frames, the number of retransmission frames, and the storm diffusion value. Based on the convergence result, it performs normal scheduling recovery, isolation duration extension, transmission qualification retention, and retransmission reduction processing, thereby achieving the effect of adaptive recovery and continuous suppression of the multi-serial port scheduling state according to the degree of convergence. This effectively solves the problem of unclear abnormal handling termination conditions, premature recovery, or insufficient suppression leading to repeated link instability in the prior art.

[0025] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0026] Figure 1 This is a flowchart of the embedded device communication scheduling method based on multi-serial port collaboration of the present invention;

[0027] Figure 2 This is a structural diagram of the embedded device communication scheduling system based on multi-serial port collaboration of the present invention;

[0028] Figure 3This invention provides the timing sequence for the collaborative scheduling interaction between RTOS tasks and interrupt DMA in a multi-serial-port communication scenario.

[0029] Figure 4 This is a convergence trend diagram of the multi-serial port collaborative embedded device communication scheduling of the present invention. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] Please see Figures 1-4 This invention provides a technical solution: an embedded device communication scheduling method based on multi-serial port collaboration, comprising: S1, collecting multi-serial port communication scheduling data, preprocessing the multi-serial port communication scheduling data, storing it, and constructing a serial port scheduling database; S2, performing frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency marking, and port offset values, and performing real response release and backflow frame isolation operations according to the backflow identification results; S3, performing storm diffusion calculation through queue occupancy, interrupt load, and resource utilization data, and performing one-way release, cascade transmission blocking, and DMA block reception switching operations according to the diffusion calculation results; S4, performing scheduling convergence analysis around the number of isolated backflow frames, the number of suspected backflow frames, the number of real response frames, the number of successfully transmitted frames, and the number of retransmitted frames, and performing normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations according to the scheduling convergence analysis results.

[0032] Specifically, the steps for collecting multi-serial port communication scheduling data are as follows: Obtain the sending serial port number, sending start time, sending completion time, frame length in bytes, frame header byte value, function code, device address, CRC check value, sending frame byte sequence, sending queue depth, sending queue capacity, number of successfully sent frames, and number of retransmitted frames through the sending record link. The sending record link can consist of a serial port driver sending interface, a sending completion interrupt recording unit, and a sending queue management unit. It records the sending start time when the sending message is loaded into the serial port sending buffer, and records the sending completion time when the serial port sending completion flag is set or a sending completion interrupt is triggered. It also records the frame length in bytes and frame header byte value for the corresponding message. The function code, device address, CRC check value, and transmitted frame byte sequence are extracted synchronously. The frame header byte value, function code, device address, and CRC check value are applicable to serial communication protocols that include frame header fields, function code fields, address fields, and CRC check fields. They can correspond to Modbus-type messages or custom serial protocols with the same field organization. The number of successfully transmitted frames and the number of retransmitted frames are both based on the current scheduling window as a unified statistical standard. The number of successfully transmitted frames represents the total number of transmitted frames that have been sent and have not been canceled within the current scheduling window. The number of retransmitted frames represents the total number of transmitted frames that have re-entered the transmission process within the current scheduling window due to timeout, failure to receive a valid response, or hitting an abnormal trigger chain.

[0033] The receiving serial port number, receiving start time, receiving completion time, receiving frame byte sequence, receiving queue depth, receiving queue capacity, number of real response frames, number of suspected backflow frames, and number of isolated backflow frames are obtained through the receiving record link. The receiving record link can be composed of a serial port receiving interrupt recording unit, a receiving buffer extraction unit, and a receiving queue management unit. It records the receiving start time when the first byte of the received data enters the receiving buffer, records the receiving completion time after the entire frame is received and passes the frame boundary judgment, and writes the receiving frame byte sequence into the receiving queue. The number of real response frames, the number of suspected backflow frames, and the number of isolated backflow frames are all based on the current scheduling window as a unified statistical standard. The number of real response frames represents the total number of received frames that have entered the real response queue after source verification and protocol verification in the current scheduling window. The number of suspected backflow frames represents the total number of received frames that have entered the backflow identification and judgment path and been marked as suspected backflow in the current scheduling window. The number of isolated backflow frames represents the total number of backflow frames that have been written into the isolation queue and blocked from subsequent triggering chains in the current scheduling window.

[0034] The resource monitoring link acquires the following data: interrupt trigger count, interrupt safety limit, CPU utilization, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of busy DMA channels, and total number of DMA channels. The resource monitoring link consists of an interrupt counting unit, a processing occupancy sampling unit, a cache block status scanning unit, and a DMA channel status sampling unit. The interrupt trigger count is obtained by accumulating the number of serial port transmit interrupts, serial port receive interrupts, and related scheduling interrupts within the current scheduling window. The CPU utilization is obtained as the ratio of the processing time occupied by communication scheduling tasks within the current scheduling window to the total duration of the scheduling window. The number of remaining cache blocks and the total number of cache blocks are obtained through a cache block allocation table. The number of busy DMA channels and the total number of DMA channels are obtained through DMA channel status register information. The current scheduling window is a unified statistical time window for the number of successfully transmitted frames, retransmitted frames, actual response frames, suspected return frames, isolated return frames, and interrupt trigger count. The return search duration is used to limit the candidate pairing search range between received frames and the most recently transmitted image, ensuring that multi-serial port communication scheduling data is recorded, compared, and subsequently processed under the same statistical caliber.

[0035] In this implementation scheme, by collecting and recording multi-serial communication scheduling data on a link-by-link basis with a unified standard, it is possible to completely obtain key status information of the sending side, receiving side, and resource side within the same scheduling window. It also clarifies the data sources and statistical ranges of frame header byte values, function codes, device addresses, CRC check values, sent frame byte sequences, received frame byte sequences, interrupt trigger counts, CPU utilization, number of remaining cache blocks, and number of busy DMA channels. This ensures that the number of successfully sent frames, retransmitted frames, actual response frames, suspected backflow frames, and isolated backflow frames have consistent time standards and comparability, thereby providing a complete, stable, and traceable data foundation for subsequent candidate pairing of transmitted and received frames, source verification, backflow identification, storm diffusion calculation, and scheduling convergence analysis.

[0036] Specifically, the steps for preprocessing and storing multi-serial port communication scheduling data and constructing a serial port scheduling database are as follows: Timestamp alignment, incomplete frame removal, abnormal frame removal, duplicate frame merging, and unification of frame header fields, function code fields, device address fields, and CRC checksum fields are performed on the transmitted and received message data. Timestamp alignment is performed by sorting the data according to the unified time base of the transmission start time, transmission completion time, and reception start and completion times. Incomplete frame removal is used to remove messages with missing start identifiers, insufficient frame length bytes, or missing CRC checksums. Abnormal frame removal is used to remove messages with frame length bytes exceeding the current protocol registration range. For messages whose function codes or device addresses exceed the current protocol registration range, duplicate frame merging is used to retain a valid record for messages whose received frame byte sequences are completely identical and fall within the same short time window at the time of reception completion. The frame header field is uniformly represented by a uniform byte width after being truncated according to the protocol registration length, and is stored using the same byte order and the same hexadecimal encoding. The function code field is uniformly represented by a uniform unsigned value extracted according to the function code registration length. The device address field is uniformly represented by a uniform unsigned value extracted according to the device address registration length. The CRC check value field is uniformly represented by a uniform byte order extracted according to the protocol registration check width.

[0037] Within the same backflow retrieval duration, each received frame is candidate-paired with the most recently transmitted image of each serial port. The backflow retrieval duration is determined based on the current serial port baud rate, the maximum frame length in bytes, the protocol-specified response waiting time, and the statistical results of the transmission and reception interval values ​​within the most recent scheduling windows. This ensures that the backflow retrieval duration covers the retrieval interval from the completion of a transmitted message to the end of the valid response period, obtaining the candidate transmitting serial port number and the expected response serial port number. The scheduling mapping table is generated based on the port initialization configuration record, the device address and function code binding record, and the polling distribution order record. The expected response serial port position represents the logical sorting position of the target response serial port corresponding to the current device address and function code in the scheduling mapping table within the enabled serial port sequence. The actual receiving serial port position represents the logical sorting position of the current receiving serial port in the enabled serial port sequence, based on the transmitted frame byte sequence and the received... The system obtains the number of byte matches by comparing the byte sequence at the same position. It then obtains the length of the longest consecutive matching byte interval, the number of byte misses by comparing the frame length (byte count) with the number of byte matches, the transmit / receive interval by comparing the transmit completion time with the receive completion time, the CRC match flag by comparing the CRC checksums, and the port offset by comparing the expected response serial port position with the actual receive serial port position in the scheduling mapping table. The system performs Z-score standardization on the numerical data in the multi-serial-port communication scheduling data, followed by range normalization to map each feature to a unified numerical range. It then performs scheduling window merging and port status association processing on the port status data and resource usage data. Finally, it stores the standardized and normalized multi-serial-port communication scheduling data to construct a serial port scheduling database.

[0038] This implementation scheme unifies the processing, candidate pairing, and feature extraction of transmitted and received message data. This enables messages from different serial port sources and arriving at different times to form a comparable data set under the same time base. Furthermore, it obtains candidate transmitting serial port numbers, expected response serial port numbers, number of byte-matched pairs, length of consecutive byte segments, number of byte misses, transmit / receive interval values, CRC consistency flags, and port offset values. Simultaneously, it completes the scaling of numerical data, scheduling window merging, and port status association. This provides a consistent, structurally complete, and directly callable data foundation for subsequent frame-level backflow identification, storm propagation calculation, and scheduling convergence analysis. Ultimately, it achieves the effects of clarifying the source relationships of multi-serial port messages, quantifying backflow features, and centrally storing scheduling status, effectively supporting subsequent continuous analysis of backflow misjudgment, propagation compression, and link instability issues.

[0039] Specifically, the steps for frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency flag, and port offset value are as follows: obtain the number of byte-to-byte matching, the length of consecutive byte segments, the number of bytes in the frame length, the CRC consistency flag, the transmit / receive interval value, and the port offset value. Among these, the number of byte-to-byte matching, the length of consecutive byte segments, the number of byte misses, and the number of bytes in the frame length all use the same frame length caliber, and their values ​​are all limited to zero to the number of bytes in the frame length. The port offset value is the absolute value of the difference between the expected response serial port position and the actual receiving serial port position in the scheduling mapping table, and the value is a non-negative integer. The transmit / receive interval value is converted to a non-negative value using a unified time unit. The CRC consistency flag is uniformly defined as a numerical type, taking one when the CRC checksum is consistent and zero when the CRC checksum is inconsistent, to ensure that the CRC consistency flag has the same caliber in the summation operation and subsequent numerical operations.

[0040] To ensure the comparability of all inputs, the number of byte coincidences, the length of consecutive byte segments, the number of bytes in the frame length, the transmit / receive interval, and the port offset have been standardized and normalized during the preprocessing stage. All parameters involved in the calculation are dimensionless. The number of byte misses is obtained based on the difference between the number of bytes in the frame length and the number of byte coincidences. The number of byte misses characterizes the degree of difference between the received frame and the candidate transmit frame that did not form byte coincidences within the same frame length. The number of byte coincidences, the length of consecutive byte segments, and C... The RC consistency flag is summed to obtain the content fit input, which characterizes the overall fit between the received frame and the candidate transmitted frame in terms of byte content, consecutive byte segments, and check results. The number of byte misses, the port offset, and 1 are summed to obtain the difference reduction input, where 1 is defined as a zero-prevention term to prevent the denominator from being zero when both the number of byte misses and the port offset are zero. If a positive constant with the same zero-prevention effect as 1 and without changing the monotonic relationship is used, it is considered an equivalent zero-prevention term corresponding to 1. The content fit input is divided by the difference reduction input. After inputting the terms, an arctangent operation is performed to obtain a matching compression term. This term compresses the ratio between the content-fitting input term and the difference-reducing input term to a stable range, preventing sudden output changes caused by local abnormal matching. The transmit / receive interval value is incremented by one, and then the square root operation is performed, followed by taking the reciprocal to obtain a delay proximity term. The increment also serves as a zero-prevention term, preventing denominator instability when the transmit / receive interval value is zero, and maintaining the relationship that a smaller transmit / receive interval value corresponds to a larger delay proximity term. The matching compression term and the delay proximity term are summed to obtain the frame reflow identification value, which is used for... This comprehensively characterizes the possibility that the currently received frame is formed by the return flow of messages sent from other serial ports. The return flow identification threshold can be determined through the offline calibration path, which can collect historical normal response frame samples and historical cross-port return flow frame samples. The target return flow identification threshold is selected based on the inflection point position in the receiver's working characteristic curve. In the online adaptive update path, the return flow identification threshold can be rolled over by combining the number of real response frames, the number of suspected return flow frames, and the false isolation records in the most recent scheduling windows, thereby ensuring that the frame return flow identification value maintains a stable discrimination capability under different link load conditions.

[0041] The specific formula for the frame reflow identification value is as follows:

[0042] ;

[0043] In the formula, This indicates the frame return identification value, reflecting the possibility that the currently received frame was formed by the return of a message sent from another serial port; This indicates the number of byte-level coincidences, reflecting the number of consistent bytes between the received frame and the candidate transmitted frame at the same byte position. It indicates the length of a consecutive identical byte segment, reflecting the length of the longest consecutive identical byte segment in the received frame and the candidate transmitted frame; This indicates a CRC match flag; the value is 1 when the CRC matches and 0 when the CRC does not match. This indicates the number of byte misses, reflecting the number of bytes that the received frame and the candidate transmitted frame did not form a consistent sequence within the same frame length. This represents the port offset value, reflecting the degree of deviation between the expected response serial port position and the actual receiving serial port position in the scheduling mapping table; This represents the transmission and reception interval, reflecting the time difference between the completion time of the candidate transmission frame and the completion time of the current reception frame.

[0044] In this implementation scheme, by acquiring the number of byte co-occurrences, the length of consecutive byte segments, the number of bytes in the frame length, the CRC consistency flag, the transmit / receive interval value, and the port offset value, and further obtaining the number of byte misses, content matching input items, difference reduction input items, matching compression items, and latency proximity items, a frame return flow identification value is finally formed. This unifies the content consistency, timing proximity, and response position deviation between the received frame and the candidate transmitted frame into the same discrimination process, enabling the difference between cross-serial port return flow frames and real response frames to be quantitatively expressed. This avoids making release judgments based solely on the matching results of a single field, improves the ability to identify return flow risks, and provides a stable judgment basis for subsequent real response release, return flow frame isolation, and storm propagation suppression.

[0045] Specifically, the steps for performing real response release and reflow frame isolation operations based on the reflow identification results are as follows:

[0046] By comparing the frame return identification value and the return identification threshold in real time, the currently received frame is first written into the real response candidate queue, and source verification measures are performed: the current received frame is compared with the most recently issued command according to the device address and function code to confirm whether the current received frame belongs to the same response object and the same instruction category as the most recently issued command; the actual receiving serial port and the expected response serial port are verified to determine whether the current received frame returns along the response path set in the scheduling mapping table; the sending and receiving interval value is determined to be less than the interval threshold to limit the current received frame to be within the effective response timing range corresponding to the most recently issued command; wherein, this scheduling window represents a unified time window used to count the number of real response frames, the number of suspected return frames, the number of isolated return frames, the number of successfully sent frames, and the number of retransmitted frames. Whether the current device address already has a real response frame that has passed protocol verification within this scheduling window is used to determine the same The system checks whether a device address has completed a valid response write within the same statistical time window to prevent return frames from repeatedly occupying the real response channel in subsequent moments. The protocol verification indicates that the current received frame simultaneously passes frame-level CRC verification and application-layer response validity verification. Frame-level CRC verification confirms that no verification errors occurred in the transmission link, while application-layer response validity verification confirms that the function code, response content, and response status in the current received frame match the protocol definition of the most recently issued command. When the source verification passes, the normal response release path for the current received frame is retained and written into the real response queue, allowing the current received frame to enter the subsequent scheduling and advancement process. When the source verification fails, the current received frame is determined to be a return frame awaiting isolation and written into the isolation queue. The retransmission and cascading transmission actions triggered by the current received event are revoked to prevent unidentified received frames from continuing to drive subsequent transmission chains.

[0047] When the frame return identification value is greater than or equal to the return identification threshold, the current received frame is determined to be a return frame and written into the isolation queue. The retransmission action and cascading transmission action triggered by the current receiving event are canceled. The candidate sending serial port and the actual receiving serial port are combined into a hit serial port pair and switched to a one-way release state, retaining only the down-direction transmission. At the same time, the holding time of the transmission mirror of the hit serial port pair is extended, the holding time of the transmission mirror of the irrelevant serial port is shortened, the range of candidate response serial ports is narrowed, the cross-port linkage trigger flag of the hit serial port pair is frozen, and the expected response serial port number is remapped according to the device address and function code. The position correspondence of the hit serial port pair is updated, so that the current received frame cannot enter the scheduling chain again through the response release path, thereby blocking the return frame from continuously triggering retransmission action and cascading transmission action.

[0048] like Figure 3The diagram shows the timing sequence of the collaborative scheduling interaction between RTOS tasks and interrupt DMA in a multi-serial-port communication scenario provided in this application embodiment. The horizontal axis represents the interaction modules of each function, and the vertical axis represents the execution sequence. As can be seen from the timing flow, the serial port interrupt ISR first starts DMA reception and clears the interrupt flag. After triggering the DMA to complete the interrupt, the DMA callback wakes up the RTOS task by sending a semaphore. After reading the received frame data, the RTOS task initiates a frame return flow identification request to the scheduler. The scheduler calculates the frame return flow identification value and compares the return flow identification threshold, and then returns the result. The system performs traffic splitting based on the identification result. Normal response frames are written to the real response queue, while return flow frames are identified, written to the isolation queue, and the cascaded transmission is canceled. Subsequently, the scheduler releases the DMA channel and buffer, and the DMA callback re-enables the serial port reception interrupt. This timing diagram fully presents the collaborative interaction process of task scheduling, interrupt response, DMA transmission, and return flow identification and control in a multi-serial-port communication scenario. It clearly reflects the execution logic and dependencies between modules, and intuitively verifies that the interaction mechanism of this application can effectively realize the isolation of abnormal frames in serial port communication and the orderly scheduling of resources, providing visual support for the stable operation of the system.

[0049] In this implementation scheme, by comparing the frame return flow identification value with the return flow identification threshold in real time, and combining the device address, function code, expected response serial port, transmit / receive interval value, real response record in this scheduling window, and protocol verification results to conduct source verification, it is possible to distinguish between real response frames and return flow frames in the receiving link. Received frames that meet the source consistency and protocol legality requirements enter the real response queue, while received frames with abnormal sources, path deviations, timing abnormalities, or duplicate responses enter the isolation queue. Simultaneously, retransmission actions and cascaded transmission actions triggered by abnormal reception events are revoked. Furthermore, for the hit serial port pair, one-way release, transmission mirror hold duration adjustment, candidate response serial port range shrinking, cross-port linkage trigger flag freezing, and expected response serial port number remapping and position correspondence update processing are performed. This effectively blocks return flow frames from entering the scheduling chain, reduces false release phenomena, and provides accurate isolation results and hit serial port pair information for subsequent storm propagation suppression and scheduling convergence analysis.

[0050] Specifically, the steps for storm propagation calculation using queue occupancy, interrupt load, and resource utilization data are as follows: Obtain the following parameters: send queue depth, send queue capacity, receive queue depth, receive queue capacity, interrupt trigger count, interrupt safety limit, CPU utilization, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of suspected backflow frames, number of busy DMA channels, and total number of DMA channels. These parameters have already undergone standardization and normalization during the preprocessing stage, and all parameters involved in the calculation are dimensionless. The interrupt safety limit is determined based on the communication task cycle, serial port receive service duration, send service duration, real-time task reserve, and the statistical results of interrupt trigger counts in multiple consecutive stable scheduling windows. It is used to characterize the current communication link's ability to avoid task backlog. The interrupt triggering boundary that can be tolerated under the condition, the CPU occupancy safety limit is determined based on the processor's allocable processing budget during communication scheduling, protocol verification, cache moving and parallel service execution, and is used to characterize the processor load boundary that the communication scheduling link can occupy. The total number of DMA channels is obtained based on the chip resource table, the currently enabled DMA mapping relationship and the serial port moving link allocation result, and represents the number of effective DMA channels that can be used for multi-serial port communication moving within the current scheduling window. The total number of cache blocks represents the total number of fixed-length buffer units used to store sent message data, received message data and isolated return frame data. The number of remaining cache blocks represents the number of fixed-length buffer units that have not been occupied at the end of the current scheduling window, thereby ensuring that the number of cache blocks adopts a uniform counting caliber throughout the entire scheduling link.

[0051] Dividing the transmit queue depth by the transmit queue capacity yields the transmit queue occupancy value, converting transmit queuing pressure into a dimensionless occupancy ratio. Dividing the receive queue depth by the receive queue capacity yields the receive queue occupancy value, converting receive queuing pressure into a dimensionless occupancy ratio. Dividing the number of interrupt triggers by the interrupt safety limit yields the interrupt occupancy value, converting interrupt load intensity into a dimensionless occupancy ratio. Dividing the CPU utilization rate by the CPU utilization safety limit yields the processing occupancy value, converting processor load intensity into a dimensionless occupancy ratio. The transmit queue occupancy value, receive queue occupancy value, interrupt occupancy value, and processing occupancy value are squared and then summed. Then, the square root operation is performed to obtain the resource squeeze term. By amplifying the superposition effect of the synchronous increase in multi-source pressure through squaring, it avoids the dilution of a sudden increase in one term by other terms due to simple averaging. This allows for a centralized representation of the simultaneous increase in transmit queuing, receive queuing, interrupt load, and processor load within the same scheduling window, thus more sensitively reflecting the sudden resource contraction process caused by backflow misjudgment. The number of remaining buffer blocks is divided by the total number of buffer blocks plus one to obtain the buffer buffer term. The proportion of available buffer units represents the current link's carrying capacity for new packets and isolated backflow frames. The smaller the buffer buffer term, the weaker the buffer capacity. The resource squeeze term is buffered by the buffer. After correction, the injection diffusion term can more accurately reflect the different diffusion consequences of the same queue pressure under different buffer availability conditions. The injection diffusion term is obtained by summing the number of suspected backflow frames and the number of busy DMA channels, then dividing by the total number of DMA channels plus one. Both the number of suspected backflow frames and the number of busy DMA channels are counted using discrete counting methods within the same scheduling window. The former reflects the backflow workload to be processed, while the latter reflects the number of already occupied transport execution bits. Both are dimensionless quantities within the same time window. Further normalization is achieved by adding one to the total number of DMA channels, making the injection diffusion term a representation of the impact of backflow injection pressure on the DMA transport link. The degree of resource crowding is determined by dividing the resource crowding item by the cache buffer item and then summing it with the injected diffusion item to obtain the storm diffusion value. Since the storm diffusion value simultaneously covers the pressure relationship corresponding to the send queue depth, receive queue depth, interrupt trigger count, CPU utilization, number of remaining cache blocks, number of suspected backflow frames, number of busy DMA channels, and total number of DMA channels, it can raise the value in advance when backflow misjudgment begins to push queue accumulation, interrupt increase, processor load increase, cache balance reduction, and DMA transfer bits being continuously occupied. This provides a directional quantitative basis for subsequent one-way release, cascaded send blocking, and DMA block receive switching.

[0052] The specific formula for storm diffusion value is as follows:

[0053] ;

[0054] In the formula, This represents the storm diffusion value, reflecting the degree of diffusion and compression of queue, interrupt, processing, and DMA resources caused by misjudgment of return frames; This represents the send queue occupancy value, reflecting the current send queue depth relative to the send queue capacity. This indicates the receive queue occupancy value, reflecting the current receive queue depth relative to the receive queue capacity. This represents the interrupt occupancy value, reflecting the degree of occupancy of the number of interrupt triggers within the current scheduling window relative to the interrupt safety limit; This indicates the processing occupancy value, reflecting the current CPU utilization rate relative to the safe upper limit of CPU utilization; Indicates the number of remaining cache blocks; Indicates the total number of cache blocks; Indicates the number of suspected reflow frames; Indicates the number of busy DMA channels; This indicates the total number of DMA channels.

[0055] This implementation plan achieves unified normalization and correlation calculation of transmit queue depth, receive queue depth, interrupt trigger count, CPU utilization, number of remaining cache blocks, number of suspected backflow frames, number of busy DMA channels, and total number of DMA channels. This compresses the queuing pressure, interrupt load, processing load, cache capacity, and DMA transport occupancy relationship in multi-serial-port communication links into directly comparable storm diffusion values. This allows for timely characterization of diffusion intensity when a linkage trend emerges, such as increased transmit queue, increased receive queue, increased interrupt trigger, increased processor load, reduced cache capacity, and continuous DMA channel occupancy caused by backflow misjudgment. This provides a unified quantitative basis for subsequent execution of one-way release, cascaded transmit blocking, and DMA block receive switching, achieving the effect of centralized assessment of multi-source resource squeezing status and early identification of communication storm diffusion trends.

[0056] Specifically, the specific steps for performing one-way release, cascaded transmission blocking, and DMA block reception switching operations based on the diffusion calculation results are as follows: By comparing the storm diffusion value and the diffusion threshold in real time, when the storm diffusion value is less than the diffusion threshold, the current multi-serial port collaborative scheduling strategy is maintained, only the received frames that have hit the return flow are isolated, and the normal transmission and reception order of the missed serial ports is not changed, so that the missed serial ports can continue to complete the service interaction along the original transmission and reception link, and the number of real response frames and the number of successfully sent frames are continuously accumulated, thereby avoiding excessive suppression of the normal communication link before the storm diffusion value reaches the diffusion range;

[0057] When the storm spread value is greater than or equal to the spread threshold, storm suppression measures are implemented: the hit serial port pair is switched to one-way release state, new service frames are suspended from being enqueued on the hit serial port pair, only heartbeat frames, status query frames, and recovery control frames are retained, and cross-port cascade transmission and abnormal retransmission triggering are frozen, reducing the depth of the transmission queue. Among them, heartbeat frames, status query frames, and recovery control frames are identified based on the joint matching result of function code, frame header byte value, and protocol control field. Messages whose function code matches the heartbeat hold instruction set are identified as heartbeat frames; messages whose function code matches the status readback instruction set and whose protocol control field is marked as query type are identified as status query frames; messages whose function code matches the link recovery instruction set and whose protocol control field is marked as recovery type are identified as recovery control frames. Duplicate return frames with the same function code, device address, and CRC check value in the isolation queue are merged and cleared, reducing the depth of the receive queue and reducing the number of suspected return frames, so that the same return messages that repeatedly enter the isolation path no longer continuously occupy the receive queue position. The receive processing is changed from frame-by-frame triggering to... DMA block reception reduces the number of interrupt triggers and CPU utilization. The block size of DMA block reception is determined jointly by the length of the receive buffer of the hit serial port pair and the average frame length in the current scheduling window. The triggering conditions include at least two situations: the DMA receive buffer reaches half full and the receive idle time reaches timeout. When the storm diffusion value is greater than or equal to the diffusion threshold, the frame-by-frame triggering path is switched to the DMA block reception path. After the storm diffusion value falls back and remains below the diffusion threshold in several consecutive scheduling windows, the receive processing of the hit serial port pair is switched back to the frame-by-frame triggering path. The DMA transfer channel and buffer block occupied by the isolated return frames on the hit serial port pair are released, the number of remaining buffer blocks is increased, and the number of isolated return frames, suspected return frames, real response frames, successful transmission frames, and retransmission frames are sent to the scheduling convergence verification module. Thus, the storm suppression measures reduce the send queue depth, receive queue depth, interrupt trigger count, CPU utilization, and suspected return frame count, while forming a continuous state input for subsequent scheduling convergence analysis.

[0058] In this implementation plan, by comparing the storm diffusion value with the diffusion threshold in real time, and maintaining the current multi-serial port collaborative scheduling strategy or implementing storm suppression measures under different results, the communication links of the scheduled return path and the missed links are separated and handled. When the storm diffusion value is in the diffusion range, by restricting the enqueueing of new service frames, retaining necessary maintenance frames, freezing cross-port cascaded transmission and abnormal retransmission triggers, merging and clearing duplicate return frames, switching to DMA block reception, and releasing occupied DMA transfer channels and buffer blocks, the depth of the transmission queue, the depth of the reception queue, the number of interrupt triggers, the CPU utilization rate, and the number of suspected return frames are reduced, and the number of remaining buffer blocks is increased, thereby suppressing the continuous amplification of the diffusion chain caused by the return misjudgment and providing continuous and effective status input for subsequent scheduling convergence verification.

[0059] Specifically, the steps for scheduling convergence analysis focusing on the number of isolated return frames, suspected return frames, actual response frames, successful transmission frames, and retransmission frames are as follows: Obtain the number of isolated return frames, suspected return frames, actual response frames, successful transmission frames, retransmission frames, and storm propagation value. These values ​​have already undergone standardization and normalization during the preprocessing stage, and all parameters involved in the calculation are dimensionless. The number of isolated return frames represents the total number of return frames that have entered the isolation queue and completed trigger chain blocking processing within the current scheduling window. The number of suspected return frames represents the total number of return frames that have entered the isolation queue and completed trigger chain blocking processing within the current scheduling window. The total number of received frames that enter the backflow identification path and are marked as suspected backflows is: the number of actual response frames represents the total number of received frames that have been written into the actual response queue after source verification and protocol verification in the current scheduling window; the number of successfully sent frames represents the total number of sent frames that have been sent and have not been revoked in the current scheduling window; the number of retransmitted frames represents the total number of sent frames that have re-entered the sending process in the current scheduling window due to missing responses, abnormal sources, or link conflicts; and the storm diffusion value represents the diffusion pressure formed by queue congestion, interrupt load, processing occupancy, buffer consumption, and DMA channel occupancy caused by backflow misjudgment in the current scheduling window.

[0060] The isolation effectiveness rate is obtained by dividing the number of isolated return frames by the number of suspected return frames plus one. This rate characterizes the coverage of suspected return paths by the isolation action; an increased effectiveness rate indicates that more suspected return frames are blocked outside the scheduling chain. The effective communication term is obtained by multiplying the number of actual response frames plus one by the number of successfully transmitted frames plus one, and then taking the square root. This term synchronously characterizes the recovery degree of effective responses on the receiving side and the recovery degree of stable transmission on the sending side, avoiding judgments of link recovery based solely on unilateral statistical results. Finally, the squares of the number of suspected return frames, the number of retransmitted frames, and the storm spread value are summed, and then the square root is taken. The instability residual term is obtained, which characterizes the remaining degree of backflow disturbance, repeated transmission pressure, and resource squeezing pressure within the current scheduling window. Dividing the instability residual term by the isolation efficiency plus one yields the suppression correction term, which reflects the reduction effect of isolation actions on the instability residual term. As the isolation efficiency increases, the boosting effect of the instability residual term on subsequent convergence judgment is compressed. Dividing the effective communication term by the sum of the suppression correction term and one yields the scheduling convergence value, which comprehensively characterizes the degree of recovery of the multi-serial port communication link within the current scheduling window from an abnormal backflow state to a stable transmission and reception state. When the scheduling convergence value reaches the convergence threshold, it indicates the number of actual response frames. With the number of successfully transmitted frames providing sustained support, and the number of suspected backflow frames, retransmission frames, and storm spread values ​​compressed to a controllable range, normal scheduling recovery can be performed to gradually lift the restrictions on the hit serial port pairs and resume service frame queuing. When the scheduling convergence value fails to reach the convergence threshold, it indicates that the instability residue is still having a continuous impact on the link. In this case, the isolation duration needs to be extended to continue maintaining the restrictions on one-way passage of the hit serial port pairs, DMA block reception, and queuing of new service frames to prevent the backflow disturbance from spreading again. When the scheduling convergence value still fails to reach the convergence threshold within multiple consecutive scheduling windows, it indicates that the current link is no longer a short-term jitter or instantaneous congestion, but has entered a persistent abnormal state. In this state, a serial port loopback alarm record is generated to trigger subsequent maintenance and protection measures. Compared with existing practices that rely solely on fixed threshold rate limiting or solely on the depth of the sending or receiving queue to determine congestion, the aforementioned processing path simultaneously introduces the number of isolated loopback frames, the number of suspected loopback frames, the number of actual response frames, the number of successfully sent frames, the number of retransmitted frames, and the storm diffusion value for joint determination. This can distinguish between short-term queue fluctuations and continuous loopback instability, reduce false alarm records caused by instantaneous queue accumulation, reduce throughput loss caused by ineffective rate limiting to the sending channel, shorten the duration of continuous blocking after the recovery of actual response frames, and reduce the additional latency during the link recovery phase.

[0061] The specific formula for the scheduling convergence value is as follows:

[0062] ;

[0063] In the formula, This represents the scheduling convergence value, reflecting the degree to which the communication link has recovered to a stable transmission and reception state after the implementation of backflow isolation, cascading blocking, and resource suppression measures. This indicates the number of actual response frames, reflecting the number of frames that the receiving side determines as genuine peripheral responses; This indicates the number of successfully sent frames, reflecting the number of frames that the sending side has completed sending and has not been revoked; This indicates the number of suspected backflow frames, reflecting the number of frames still identified as suspected backflow frames within the current scheduling window; This indicates the number of retransmitted frames, reflecting the number of retransmissions triggered by an anomaly within the current scheduling window; Indicates the storm diffusion value; This indicates the isolation effectiveness rate, reflecting the degree of suppression coverage of the number of isolated return frames relative to the number of suspected return frames.

[0064] Table 1 shows the communication scheduling convergence data for embedded devices based on multi-serial port collaboration in this embodiment. In Group 1, the number of isolated return frames is 5, the number of suspected return frames is 42, the number of actual response frames is 8, the number of successfully transmitted frames is 11, the number of retransmitted frames is 36, the storm diffusion value is 8.2, and the calculated scheduling convergence value is 1.6. In Group 2, the number of isolated return frames is 27, the number of suspected return frames is 35, the number of actual response frames is 24, the number of successfully transmitted frames is 29, the number of retransmitted frames is 18, the storm diffusion value is 4.5, and the calculated scheduling convergence value is 4.2. The third group has 41 isolated return frames, 13 suspected return frames, 47 real response frames, 52 successfully sent frames, and 7 retransmission frames. The storm spread value is 1.8, and the calculated scheduling convergence value is 7.5. The fourth group has 58 isolated return frames, 2 suspected return frames, 76 real response frames, 81 successfully sent frames, and 1 retransmission frame. The storm spread value is 0.3, and the calculated scheduling convergence value is 9.8.

[0065] Table 1. Convergence Data Table for Embedded Device Communication Scheduling Based on Multi-Serial Port Collaboration

[0066] Data grouping Number of isolated return frames Number of suspected reflow frames Actual number of response frames Number of successfully sent frames Number of retransmitted frames Storm diffusion value Scheduling convergence value 1 5 42 8 11 36 8.2 1.6 2 27 35 24 29 18 4.5 4.2 3 41 13 47 52 7 1.8 7.5 4 58 2 76 81 1 0.3 9.8

[0067] like Figure 4 As shown, this is a convergence trend chart of multi-serial port collaborative embedded device communication scheduling provided in an embodiment of this application. The horizontal axis represents the scheduling window number, and the vertical axis represents the scheduling convergence value. (Referring to Table 1 and...) Figure 4As can be seen, the scheduling convergence value in the first scheduling state is only 1.6, corresponding to a severe unstable state with multiple serial ports experiencing backflow frames and communication storms; the scheduling convergence value in the second group rises to 4.2, corresponding to a gradual improvement state after the backflow isolation and storm suppression measures are activated; the scheduling convergence value in the third group reaches 7.5, corresponding to a convergence transition state with effective control of abnormal frames and continuous optimization of communication links; the scheduling convergence value in the fourth group is as high as 9.8, corresponding to a stable scheduling state with complete isolation of backflow frames and complete suppression of storm propagation. Table 1 provides a direct and quantitative comparison of the numerical differences in the number of isolated backflow frames, suspected backflow frames, actual response frames, successfully transmitted frames, retransmitted frames, and storm spread values ​​under four typical scheduling states. It accurately highlights a strong positive correlation between scheduling convergence value and isolation effectiveness and effective communication volume, and a strong negative correlation with instability residual quantity. This fully verifies that the frame-level backflow identification, storm spread suppression, and scheduling convergence verification modules of this application can effectively block multi-serial port self-excited response loops, alleviate communication resource compression, and calibrate scheduling operation status. This provides intuitive data support and scientific basis for the stable scheduling, anomaly isolation, and closed-loop convergence of subsequent multi-serial port collaborative communication, effectively ensuring the reliability and stability of communication scheduling for multi-serial port collaborative embedded devices.

[0068] This implementation scheme, through joint analysis of the number of isolated backflow frames, suspected backflow frames, actual response frames, successfully transmitted frames, retransmission frames, and storm spread values, comprehensively assesses the recovery status of multi-serial port communication links within the current scheduling window from three aspects: backflow isolation coverage, effective communication recovery, and instability residual effects. The scheduling convergence value is used as the basis for determining normal scheduling recovery, extended isolation duration, and serial port loopback alarms. This avoids false alarms, excessive blocking, and delayed recovery issues caused by relying solely on a single queue indicator or fixed rate limiting conditions. It ensures timely scheduling recovery when actual response frames and successfully transmitted frames increase, and maintains isolation and suppression measures even when suspected backflow frames, retransmission frames, and storm spread values ​​remain excessively high. This improves the accuracy of link recovery judgment and reduces the impact of ineffective rate limiting on throughput and latency.

[0069] Specifically, the steps for performing normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations based on the scheduling convergence analysis results are as follows: By comparing the scheduling convergence value and the convergence threshold in real time, when the scheduling convergence value is greater than or equal to the convergence threshold, it indicates that the instability impact corresponding to the number of actual response frames, the number of successfully sent frames, the number of suspected backflow frames, the number of retransmission frames, and the storm spread value of the currently hit serial port has fallen back to the recoverable range. At this time, the one-way release restriction on the hit serial port is lifted, and the service frame enqueue is restored. The scheduling window represents the data around the sending queue depth, receiving queue depth, interrupt trigger count, CPU utilization, number of remaining cache blocks, number of busy DMA channels, number of actual response frames, and number of suspected backflow frames. The number of similar return frames, the number of isolated return frames, the number of successfully sent frames, and the number of retransmitted frames are statistically analyzed and merged within a fixed time interval for judgment. The observation period represents a continuous observation interval for retaining the DMA block reception status after the one-way release restriction is lifted. The observation period is taken as the length of a scheduling window to confirm that the serial port pair hit after the recovery service frame is enqueued has not re-entered the storm propagation path. After retaining the DMA block reception for one observation period, the reception process switches back to frame-by-frame reception, shortens the retention time of the serial port pair transmission image, clears the return frame records that have been verified in the isolation queue, restores the cross-port linkage trigger flag, and prioritizes the release of real response candidate frames corresponding to the same device address and the same function code.

[0070] When the scheduling convergence value is less than the convergence threshold, it indicates that the residual term of the internal instability of the hit serial port is still too large. At this time, a pass-through verification path is retained for the real response candidate frame. After the verification is passed, it is written into the real response queue first to increase the number of real response frames. Service frames that have been sent but have not hit the return flow identification path are given priority to retain their sending qualification, reducing the number of cancelled transmissions and increasing the number of successfully sent frames. Suspected return flow frames in the isolation queue are re-verified according to device address, function code, and frame sequence number. Duplicate return flow frames are merged and cleared to improve the isolation efficiency. The abnormal retransmission trigger chain of the hit serial port is frozen. Only one retransmission task is retained for the same device address to reduce the number of retransmission frames. The one-way release state of the hit serial port is maintained. The DMA block reception is maintained for the hit serial port reception processing. The number of new service frames enqueued in each scheduling window is limited to k, where k represents the number of new service frames allowed to be written into the transmission queue in a scheduling window for the hit serial port. The maximum number of service frames, k, is determined by the send queue capacity, receive queue capacity, interrupt safety limit, CPU usage safety limit, total number of cache blocks, and total number of DMA channels. This ensures that the send queue depth, receive queue depth, interrupt trigger count, and CPU usage do not exceed the corresponding safety boundaries after a new service frame enters the system. This reduces the interrupt trigger count, CPU usage, send queue depth, and receive queue depth, thus weakening the storm propagation value. When the scheduling convergence value of n consecutive scheduling windows is still less than the convergence threshold, a serial port loopback alarm record is generated, and the transmission of non-core service frames on the hit serial port pair is shut down. Only heartbeat frames, status query frames, and recovery control frames are retained. Here, n represents the number of consecutive instability judgments. n is determined based on the statistical results of the number of scheduling windows experienced by the hit serial port pair from the backflow identification hit to the recovery of stability during historical operation. This is used to characterize the continuous alarm trigger boundary after a single suppression path fails to complete convergence.

[0071] In this implementation plan, a switching relationship between the recovery path, the continuous suppression path, and the alarm path is established around the scheduling convergence value and the convergence threshold. After entering the convergence interval, the serial port can gradually remove the one-way release restriction, restore the queuing of service frames, shorten the transmission mirror hold time, and rebuild the cross-port linkage triggering capability. When not entering the convergence interval, it can continuously retain the priority verification and release of real response candidate frames, clear suspected backflow frames repeatedly, reduce abnormal retransmissions, maintain DMA block reception, and control the number of newly added service frames enqueued. This simultaneously increases the number of real response frames, the number of successfully transmitted frames, and the isolation efficiency, reduces the number of retransmission frames, and weakens the storm spread value. If the convergence requirements are not met after multiple consecutive scheduling windows, the serial port loopback alarm and non-core service frame closure processing are further triggered. This achieves the effect of hierarchical recovery of multi-serial port communication links according to the convergence status, continuous suppression, and fault alarm linkage control, effectively supporting stable recovery after backflow storms and risk convergence in unstable continuation scenarios.

[0072] Specifically, this embodiment provides an embedded device communication scheduling system based on multi-serial port collaboration, applied to an embedded device communication scheduling method based on multi-serial port collaboration. It includes a multi-serial port message acquisition and preprocessing module, used to acquire multi-serial port communication scheduling data, preprocess the multi-serial port communication scheduling data, store it, and construct a serial port scheduling database. During the acquisition process, it uniformly accesses sent message data, received message data, queue status data, processing interrupt data, buffer occupancy data, DMA channel status data, backflow handling result data, and sent execution result data, and completes time alignment, field extraction, anomaly removal, candidate pairing, scheduling window merging, and status association processing, providing a continuous and complete data foundation for subsequent frame-level backflow identification, storm diffusion calculation, and scheduling convergence analysis.

[0073] The frame-level backflow identification module is used to perform frame-level backflow identification based on the same source matching of transmitted and received frames, CRC consistency mark and port offset value. According to the backflow identification result, it performs real response release and backflow frame isolation operations. During the identification process, it combines the number of byte same bits, the length of consecutive same byte segments, the number of byte misses, the transmit and receive interval value and the port offset value to form the discrimination result of the source relationship of the received frame, and transmits the change status of the number of real response frames, the number of suspected backflow frames and the number of isolated backflow frames to the subsequent scheduling link.

[0074] The storm propagation suppression scheduling module is used to perform storm propagation calculations based on queue occupancy, interrupt load, and resource utilization data. Based on the propagation calculation results, it performs one-way release, cascade transmission blocking, and DMA block reception switching operations. When the storm propagation value reaches the propagation range, it implements targeted suppression on the hit serial port pairs, reducing the depth of the transmission queue, the depth of the reception queue, the number of interrupt triggers, and the CPU utilization rate, reducing the number of suspected backflow frames and increasing the number of remaining buffer blocks, thereby blocking the continuous amplification of the propagation chain caused by backflow misjudgment.

[0075] The scheduling convergence verification module is used to perform scheduling convergence analysis based on the number of isolated return frames, suspected return frames, actual response frames, successfully sent frames, and retransmitted frames. Based on the scheduling convergence analysis results, it performs normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations. During the analysis, it combines the storm diffusion value to comprehensively determine the recovery status and unstable residual status of the current hit serial port pair. Based on the change of scheduling convergence value, it decides to restore the enqueueing of service frames, maintain the one-way release status, extend the isolation duration, or generate a serial port loopback alarm record, thereby forming a multi-serial port collaborative communication scheduling link that is sequentially connected from data acquisition, source identification, diffusion suppression to convergence recovery.

[0076] In this implementation scheme, by setting up a multi-serial port message acquisition and preprocessing module, a frame-level backflow identification module, a storm propagation suppression scheduling module, and a scheduling convergence verification module, the multi-serial port communication process forms a complete processing link that sequentially connects data access, source identification, propagation suppression, and recovery verification. This not only unifies the processing of sent message data, received message data, queue status data, interrupt load data, resource usage data, and handling result data, but also effectively identifies and isolates cross-serial port backflow frames. When backflow risk propagates, it simultaneously reduces the sending queue depth, receiving queue depth, interrupt trigger count, and CPU utilization, thereby reducing the number of suspected backflow frames, the number of retransmitted frames, and increasing the number of remaining buffer blocks. Furthermore, by combining the number of isolated backflow frames, the number of real response frames, and the number of successfully sent frames, scheduling convergence analysis is completed, thereby improving the stability, controllability, and recovery capability of the multi-serial port collaborative communication process.

[0077] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0078] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. An embedded device communication scheduling method based on multi-serial port collaboration, characterized in that, Includes the following steps: S1: Collect multi-serial port communication scheduling data, preprocess the multi-serial port communication scheduling data, store it, and build a serial port scheduling database; S2 performs frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency flags, and port offset values, and performs real response release and backflow frame isolation operations based on the backflow identification results. S3 performs storm propagation calculations based on queue occupancy, interrupt load, and resource utilization data, and executes one-way release, cascaded transmission blocking, and DMA block reception switching operations based on the propagation calculation results. S4 performs scheduling convergence analysis based on the number of isolated return frames, suspected return frames, actual response frames, successfully sent frames, and retransmitted frames. Based on the scheduling convergence analysis results, it performs normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations. The specific steps for frame-level backflow identification based on same-source matching of transmitted and received frames, CRC consistency markers, and port offset values ​​are as follows: Get the number of byte parities, the length of consecutive byte segments, the number of bytes in the frame length, the CRC parity flag, the transmit / receive interval value, and the port offset value; The number of byte misses is obtained by comparing the difference between the frame length (number of bytes) and the number of bytes that match at the same position. The summation of the number of byte coincidences, the length of consecutive byte segments, and the CRC coincidence flags yields the content-fitting input; the summation of the number of byte misses, the port offset, and one yields the difference-reducing input. After dividing the content by the difference to weaken the input, an arctangent operation is performed to obtain the matching compressed item; Add one to the transmit / receive interval value, perform a square root operation, and then take the reciprocal to obtain the delay proximity term; sum the matching compression term and the delay proximity term to obtain the frame return flow identification value; The specific steps for performing storm diffusion calculations using queue occupancy, interruption load, and resource utilization data are as follows: Get the following data: send queue depth, send queue capacity, receive queue depth, receive queue capacity, interrupt trigger count, interrupt safety limit, CPU utilization, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of suspected backflow frames, number of busy DMA channels, and total number of DMA channels. Divide the send queue depth by the send queue capacity to obtain the send queue occupancy value; divide the receive queue depth by the receive queue capacity to obtain the receive queue occupancy value. Divide the interrupt trigger count by the interrupt safety limit to obtain the interrupt preload value; Divide the CPU utilization rate by the CPU utilization safety limit to obtain the processing occupancy value; square the transmit queue occupancy value, receive queue occupancy value, interrupt occupancy value, and processing occupancy value respectively, sum them, and then perform a square root operation to obtain the resource squeeze item; divide the number of remaining cache blocks by the total number of cache blocks plus one to obtain the cache buffer item; The injection diffusion term is obtained by summing the number of suspected return frames and the number of busy DMA channels, and then dividing by the total number of DMA channels plus one. Divide the resource squeeze item by the cache buffer item, and then sum it with the injection diffusion item to obtain the storm diffusion value; The specific steps for scheduling convergence analysis based on the number of isolated return frames, suspected return frames, actual response frames, successfully sent frames, and retransmitted frames are as follows: Obtain the number of isolated return frames, the number of suspected return frames, the number of actual response frames, the number of successfully sent frames, the number of retransmitted frames, and the storm spread value; Divide the number of isolated backflow frames by the number of suspected backflow frames plus one to obtain the isolation efficiency. Multiply the number of actual response frames plus one by the number of successfully sent frames plus one, and then perform a square root operation to obtain the effective communication term; square the number of suspected return frames, the number of retransmitted frames, and the storm spread value, sum them up, and then perform a square root operation to obtain the instability residual term; divide the instability residual term by the isolation effectiveness rate plus one to obtain the suppression correction term; divide the effective communication term by the sum of the suppression correction term and one to obtain the scheduling convergence value.

2. The embedded device communication scheduling method based on multi-serial port collaboration according to claim 1, characterized in that: The specific steps for collecting multi-serial port communication scheduling data are as follows: Collect multi-serial port communication scheduling data: obtain the sending serial port number, sending start time, sending completion time, frame length in bytes, frame header byte value, function code, device address, CRC check value, sending frame byte sequence, sending queue depth, sending queue capacity, number of successfully sent frames, and number of retransmitted frames through the sending record link; The receiving serial port number, receiving start time, receiving completion time, receiving frame byte sequence, receiving queue depth, receiving queue capacity, number of real response frames, number of suspected backflow frames, and number of isolated backflow frames are obtained through the receiving record link. The resource monitoring link obtains the number of interrupt triggers, interrupt safety limit, CPU utilization, CPU utilization safety limit, number of remaining cache blocks, total number of cache blocks, number of busy DMA channels, and total number of DMA channels.

3. The embedded device communication scheduling method based on multi-serial port collaboration according to claim 1, characterized in that: The specific steps for preprocessing and storing multi-serial port communication scheduling data and constructing a serial port scheduling database are as follows: The system performs timestamp alignment, incomplete frame removal, abnormal frame removal, duplicate frame merging, and unification of frame header fields, function code fields, device address fields, and CRC checksum fields for both sent and received data. Within the same backflow retrieval duration, each received frame is paired with the most recently sent image of each serial port to obtain the candidate sending serial port number and the expected response serial port number. The system obtains the number of byte matches based on the same-position comparison results of the sent frame byte sequence and the received frame byte sequence, the length of the continuous same byte segment based on the longest consecutive consistent byte interval, the number of byte misses based on the difference between the frame length bytes and the number of byte matches, the sending and receiving interval value based on the difference between the sending completion time and the receiving completion time, the CRC consistency flag based on the CRC checksum comparison results, and the port offset value based on the difference between the expected response serial port position and the actual receiving serial port position in the scheduling mapping table. After performing Z-score standardization on numerical data in multi-serial-port communication scheduling data, range normalization is performed to map each feature to a unified numerical range. The system performs scheduling window merging and port status association processing on port status data and resource usage data; after storing the standardized and normalized multi-serial port communication scheduling data, it constructs a serial port scheduling database.

4. The embedded device communication scheduling method based on multi-serial port collaboration according to claim 1, characterized in that: The specific steps for performing the real response release and return frame isolation operations based on the return flow identification results are as follows: By comparing the frame return identification value and the return identification threshold in real time, the current received frame is first written into the real response candidate queue, and the source verification measures are performed: the current received frame is compared with the device address and function code of the most recently issued command, the actual receiving serial port is verified with the expected response serial port, and it is determined whether the sending and receiving interval value is less than the interval threshold, and whether the current device address already has a real response frame that has passed the protocol verification in this scheduling window. When the source verification is successful, the normal response release path of the current received frame is retained and written to the real response queue; when the source verification fails, the current received frame is determined to be a backflow frame to be isolated and written to the isolation queue, and the retransmission action and cascading transmission action triggered by the current received event are cancelled. When the frame return identification value is greater than or equal to the return identification threshold, the currently received frame is determined to be a return frame and written into the isolation queue. The retransmission action and cascading transmission action triggered by the current reception event are canceled. The candidate sending serial port and the actual receiving serial port are combined into a hit serial port pair and switched to a one-way release state, retaining only the transmission in the down direction. At the same time, the holding time of the transmission mirror of the hit serial port pair is extended, the holding time of the transmission mirror of the irrelevant serial port is shortened, the range of candidate response serial ports is narrowed, the cross-port linkage trigger flag of the hit serial port pair is frozen, and the expected response serial port number is remapped according to the device address and function code. The position correspondence of the hit serial port pair is updated, thereby blocking the return frame from entering the scheduling chain.

5. The embedded device communication scheduling method based on multi-serial port collaboration according to claim 1, characterized in that: The specific steps for performing one-way release, cascaded transmission blocking, and DMA block receive handover operations based on the diffusion calculation results are as follows: By comparing the storm spread value and the spread threshold in real time, when the storm spread value is less than the spread threshold, the current multi-serial port collaborative scheduling strategy is maintained, only the isolation of the received frames that have hit the return flow is maintained, and the normal transmission and reception order of the missed serial ports is not changed. When the storm spread value is greater than or equal to the spread threshold, storm suppression measures are implemented: the hit serial port pair is switched to one-way release state, new service frames are suspended from being enqueued on the hit serial port pair, only heartbeat frames, status query frames, and recovery control frames are retained, and cross-port cascade transmission and abnormal retransmission triggering are frozen, reducing the depth of the transmission queue; duplicate return frames with the same function code, device address, and CRC check value in the isolation queue are merged and cleared, reducing the depth of the receive queue and reducing the number of suspected return frames; the receive processing is changed from frame-by-frame triggering to DMA block reception, reducing the number of interrupt triggers and CPU utilization; the DMA transfer channel and buffer block occupied by the isolated return frames on the hit serial port pair are released, the number of remaining buffer blocks is increased, and the number of isolated return frames, the number of suspected return frames, the number of real response frames, the number of successfully transmitted frames, and the number of retransmitted frames are sent to the scheduling convergence verification module.

6. The embedded device communication scheduling method based on multi-serial port collaboration according to claim 1, characterized in that: The specific steps for performing normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations based on the scheduling convergence analysis results are as follows: By comparing the scheduling convergence value and the convergence threshold in real time, when the scheduling convergence value is greater than or equal to the convergence threshold, the one-way release restriction of the hit serial port is lifted, the service frame is restored to the queue, the receiving and processing retains the DMA block for one observation period and then switches back to frame-by-frame reception, the holding time of the hit serial port for the transmitted image is shortened, the record of the backflow frame that has been verified in the isolation queue is cleared, the cross-port linkage trigger flag is restored, and the real response candidate frame corresponding to the same device address and the same function code is given priority to be released. When the scheduling convergence value is less than the convergence threshold, a direct verification path is retained for candidate frames of genuine responses. After verification, these frames are prioritized for writing into the genuine response queue, increasing the number of genuine response frames. Service frames that have been sent but have not hit the return flow identification path are given priority for re-sending eligibility, reducing the number of cancelled sends and increasing the number of successfully sent frames. Suspected return flow frames in the isolation queue are re-verified according to device address, function code, and frame sequence number, and duplicate return flow frames are merged and cleared to improve isolation efficiency. The abnormal retransmission trigger chain of the serial port hit is frozen, and only frames with the same device address are retained. Leave one task pending retransmission to reduce the number of retransmitted frames; maintain the one-way pass state of the hit serial port pair, maintain the DMA block reception for the hit serial port pair, and limit the number of new service frames enqueued in each scheduling window to k, thereby reducing the number of interrupt triggers, CPU utilization, send queue depth and receive queue depth, and weakening the storm spread value; when the scheduling convergence value of n consecutive scheduling windows is still less than the convergence threshold, generate a serial port loopback alarm record, close the transmission of non-core service frames on the hit serial port pair, and only retain heartbeat frames, status query frames and recovery control frames.

7. An embedded device communication scheduling system based on multi-serial port collaboration, used to execute the embedded device communication scheduling method based on multi-serial port collaboration as described in any one of claims 1-6, characterized in that... ,include: The multi-serial port message acquisition and preprocessing module is used to acquire multi-serial port communication scheduling data, preprocess the multi-serial port communication scheduling data, store it, and build a serial port scheduling database. The frame-level backflow identification module is used to perform frame-level backflow identification based on source matching of transmitted and received frames, CRC consistency flags, and port offset values. Based on the backflow identification results, it performs real response release and backflow frame isolation operations. The storm propagation suppression scheduling module is used to perform storm propagation calculations based on queue occupancy, interrupt load, and resource utilization data, and to perform one-way release, cascaded transmission blocking, and DMA block reception switching operations based on the propagation calculation results. The scheduling convergence verification module is used to perform scheduling convergence analysis based on the number of isolated return frames, the number of suspected return frames, the number of actual response frames, the number of successfully sent frames, and the number of retransmitted frames. Based on the scheduling convergence analysis results, it performs normal scheduling recovery, isolation duration extension, and serial port loopback alarm operations.

Citation Information

Patent Citations

  • A slave system and control method based on EtherCAT

    CN107707447B

  • An optimized Ethernet pass-through method for industrial serial port protocols

    CN110401670B

  • Serial port command analysis method based on finite state machine and annular queue

    CN107302531A

  • Data receiving and processing method based on serial port idle interruption and memory direct transmission

    CN121434124A