UART data forwarding and synchronization optimization system and method
By introducing data preparation, read, write and signal implementation modules into the UART data transmission system, using double buffers and timestamp tags, the problem of data loss in UART data transmission is solved, and data transmission efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411615812.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art has the lack of effective data loss solutions in UART data transmission, resulting in inefficiency in data transmission and overall speed delay.
A UART data forwarding and synchronization optimization system is proposed, including a data preparation module, a data reading and writing module and a signal implementation module. By collecting and sorting data, adding timestamp tags, and monitoring the buffer status in real time in the double buffer, predicting the data transmission time, detecting the data retransmission status, and performing data feedback and fusion and sorting, finally matching and implementing the transmission channel.
It significantly improves data transmission efficiency, reduces data loss, avoids invalid transmission problems caused by data loss, and improves transmission accuracy and system response speed.
Smart Images

Figure CN119576835A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data transmission optimization, and in particular relates to a UART data forwarding and synchronization optimization system and method. Background Art
[0002] Universal Asynchronous Receiver / Transmitter (UART) is a widely used serial communication interface, especially in embedded systems, sensor networks, industrial control and various Internet of Things (IoT) devices. Due to its simplicity and cost-effectiveness, UART has become the first choice for many low-speed data transmission applications.
[0003] The invention patent with publication number CN109189702A discloses a data transmission buffer design method for Scatter-GatherDMA. The invention creates two DMA linked lists and controls the buffers corresponding to the two DMA linked lists through interrupts until the data transmission is completed. When performing data transmission, the invention sends the physical address to the corresponding DMA linked list and fills in the bytes in the DMA linked list. When the data received by the data receiving end does not match the original data, because the data in the two DMA linked lists have been transmitted to the device, if the original data needs to be obtained, the complete transmission process needs to be carried out again, resulting in a low efficiency in solving the missing data and ultimately delaying the overall data transmission speed.
[0004] The present invention provides a UART data forwarding and synchronization optimization system and method to solve the above technical problems. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a UART data forwarding and synchronization optimization system and method, which is used to solve the technical problem in the prior art that data transmission efficiency cannot be guaranteed due to the lack of reasonable solution to data loss.
[0006] To achieve the above object, the first aspect of the present invention provides a UART data forwarding and synchronization optimization system, comprising: a data preparation module, a data reading and writing module and a signal execution module;
[0007] Data preparation module: used to collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add timestamp tags to the sequential read and write data;
[0008] Data reading and writing module: used to input sequential reading and writing data into the first buffer and the second buffer, and monitor the buffer status of the first buffer and the second buffer in real time, control the allocation of sequential reading and writing data according to the buffer status, and obtain the predicted execution time by combining the timestamp label and the sequential reading and writing data;
[0009] Signal execution module: used to receive the read and write completion data transmitted by the buffer; obtain the data retransmission status based on the predicted execution time and the actual read and write amount of the read and write completion data; provide data feedback for the read and write completion data; merge and organize the read and write completion data according to the data retransmission status to obtain the execution data; match the corresponding execution transmission channel for the execution data according to the sent data.
[0010] Preferably, the step of classifying and sorting the transmitted data to obtain sequential read and write data includes:
[0011] Extracting transmission data; the transmission data includes the transmission data volume and transmission requirements of different data packets;
[0012] Obtain the sending priority of the sending data according to the sending requirements; divide the sending data into several groups of classified read and write data groups according to the sending requirements, and set a screening coefficient based on the sending data volume and sending priority of the classified read and write data; sort from large to small according to the size of the screening coefficient to obtain sequential read and write data.
[0013] Preferably, obtaining the sending priority of the sending data according to the sending requirement includes:
[0014] Extract the sending requirement and the current time; the sending requirement includes the data sending time, the required receiving time and the required receiving object of the sent data; the required receiving object includes the device identifier and the required state of the target object, and the required state includes an urgent object and a non-urgent object;
[0015] Mark the difference between the data sending time and the current time as the sent time, and mark the difference between the required receiving time and the current time as the receiving difference time; set an emergency coefficient for the emergency object; the emergency coefficient is set according to the urgency of the receiver's need for the data packet;
[0016] By the formula YXJi=(YFi+JTi -1 )×JX calculates the sending priority YXJi of the data packet numbered i; where YFi represents the sending time of the data packet numbered i, JTi represents the receiving difference time of the data packet numbered i, and JX is the urgency coefficient; i=1, 2, 3…n, n is a positive integer; 2>JX>1.
[0017] Preferably, the sending data is divided into several groups of classified read and write data groups according to the sending requirements, including:
[0018] Extract the sending requirements of the sent data;
[0019] Identify the device identifier of the target object, divide the sent data with the same device identifier into classified read-write data of corresponding identification groups, and obtain several groups of classified read-write data groups with different identification groups.
[0020] Preferably, the step of setting the screening coefficient based on the amount of data sent and the sending priority of the classified read and write data includes:
[0021] Extract the sending data volume and sending priority of classified read and write data;
[0022] Normalize the data volume sent by the classified read and write data to obtain the standard data volume sent;
[0023] By the formula XSXi=e -(FSi-1) ×YXJi calculates the screening coefficient XSXi of the data packet numbered i; where FSi represents the standard sending data volume of the data packet numbered i.
[0024] Preferably, the step of controlling the allocation order of reading and writing data according to the buffer state includes:
[0025] S1: extracting the buffer states of the first buffer and the second buffer; the buffer states include a saturation state and a vacancy state;
[0026] S2: Determine whether the buffer state of the first buffer is saturated; if yes, input the sequential read and write data in the first buffer into the read and write unit for reading and writing, input the sequential read and write data into the second buffer in order and jump to S3; if no, input the sequential read and write data into the first buffer and monitor the buffer state of the first buffer;
[0027] S3: Determine whether the buffer state of the second buffer is saturated; if yes, jump to S4; if no, input the sequential read and write data into the second buffer;
[0028] S4: Continue to input the sequential read and write data into the first buffer.
[0029] Preferably, the combining of the timestamp label and the sequential read and write data to obtain the predicted execution time includes:
[0030] Extract the timestamp tag, extract the corresponding data channel transmission speed from the database, and detect the read and write time when the sequential read and write data is completed;
[0031] The predicted read and write time of the sequential read and write data is obtained by dividing the amount of sequential read and write data by the data channel transmission speed; the predicted read and write time, the read and write time and the timestamp label are combined to obtain the predicted execution time.
[0032] Preferably, obtaining the data retransmission status based on the predicted execution time and the actual read and write amount of the read and write completed data includes:
[0033] A1: Extract the predicted execution time and the actual read and write volume of the read and write completion data;
[0034] A2: Set the retransmission detection time; determine whether the predicted execution time is greater than the retransmission detection time; if yes, mark the data retransmission status of the previously read and written data as lost; if no, jump to A3;
[0035] A3: Determine whether the actual read / write amount is the same as the amount of sequential read / write data; if so, mark the data retransmission state of the read / write completed data as the transmission state; if not, mark the data retransmission state of the read / write completed data as the lost state.
[0036] Preferably, the step of providing data feedback on the read and write completion data includes:
[0037] After receiving the read / write completion data, the data receiver detects the data retransmission status of the read / write completion data, and combines the data retransmission status of the read / write completion data with the timestamp tag to obtain a feedback data packet;
[0038] Send the feedback data packet to the data sender for confirmation.
[0039] Preferably, the step of fusing and arranging the data according to the data retransmission status to obtain the implementation data includes:
[0040] Extract data retransmission status;
[0041] Determine whether the data retransmission status is a lost state; if yes, notify the data sender to resend the retransmission data packet, insert the retransmission data packet into the buffer for transmission; and detect the available state of the retransmission data packet; if no, continue to run the data;
[0042] Preferably, the step of inserting the retransmitted data packet into the buffer for transmission includes:
[0043] Extract the retransmission timestamp tag of the retransmitted data packet, match the retransmission timestamp tag with the current sequential read / write data timestamp tag, mark the sequential read / write data with the same retransmission timestamp tag as the current sequential read / write data; insert the retransmitted data packet into the current sequential read / write data buffer for transmission.
[0044] Preferably, the detecting the available state of the retransmitted data packet comprises:
[0045] B1: extract retransmitted data packets and sequential read and write data;
[0046] B2: Determine whether the actual read and write volume of the retransmitted data packet is the same as the volume of the sequential read and write data; if yes, directly apply the retransmitted data packet; if no, merge the read and write completion data with the retransmitted data packet to obtain the implementation data, and jump to B3;
[0047] B3: Determine whether the amount of the execution data is the same as the amount of the sequential read and write data; if yes, mark the available state of the retransmitted data packet as a compliant state; if no, mark the available state of the retransmitted data packet as an incomplete state.
[0048] Preferably, the step of fusing the read / write completion data with the retransmitted data packet to obtain the execution data includes:
[0049] Extract read and write completion data and retransmit data packets;
[0050] Detect the repeated parts in the read / write completion data and the retransmitted data packet, remove the repeated parts in the retransmitted data packet to obtain the leak-filling data; add the leak-filling data to the read / write completion data to obtain the implementation data.
[0051] Preferably, the step of matching the execution data with the corresponding execution transmission channel according to the sent data includes:
[0052] Extract the sent data;
[0053] Determine whether the device identifier of the receiving object is the same as the identification group corresponding to the implementation data; if yes, mark the corresponding channel as the implementation transmission channel and input the implementation data into the implementation transmission channel; if no, mark the corresponding channel as a non-matching channel.
[0054] The second aspect of the present invention discloses a UART data forwarding and synchronization optimization method, which is applied to the above-mentioned UART data forwarding and synchronization optimization system, and is characterized in that it includes:
[0055] Step 1: Collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add a timestamp tag to the sequential read and write data;
[0056] Step 2: inputting the sequential read / write data into the first buffer and the second buffer, and monitoring the buffer status of the first buffer and the second buffer in real time, controlling the allocation of the sequential read / write data according to the buffer status, and combining the timestamp tag with the sequential read / write data to obtain the predicted execution time;
[0057] Step 3: Based on the predicted execution time and the actual read and write volume of the read and write completion data, the data retransmission status is obtained; data feedback is performed on the read and write completion data; the read and write completion data is merged and sorted according to the data retransmission status to obtain the execution data; and the execution data is matched with the corresponding execution transmission channel according to the sent data.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] 1. The present invention collects and sorts the transmission data to obtain sequential read and write data, and adds a timestamp tag to the sequential read and write data, thereby ensuring that key information can be processed and sent as soon as possible, and helps to more efficiently utilize limited bandwidth resources; a double buffer is set, the sequential read and write data is input into the buffer and the buffer state of the buffer is monitored, the sequential read and write data transmission is controlled according to the buffer state of the first buffer and the second buffer, and the predicted execution time is predicted in combination with the timestamp tag and the sequential read and write data, the double buffer can ensure the continuity of the data flow, reduce the waiting time for data transmission, improve the overall data transmission efficiency, make full use of CPU resources, and improve the response speed of the system; receive the read and write completion data, obtain the data retransmission status of the data packet based on the predicted execution time and the actual read and write amount of the read and write completion data, if data loss occurs, data feedback is performed, the retransmitted data packet is retransmitted to the data receiver, the read and write completion data and the retransmitted data packet are merged according to the data retransmission status to obtain the execution data, and the execution transmission channel corresponding to the execution data is matched for confirmation, which can significantly reduce the situation of data loss, avoid the occurrence of invalid transmission problems caused by data loss, and improve transmission efficiency and transmission accuracy.
[0060] 2. The present invention detects the actual read and write volume of the retransmitted data packet and compares it with the data volume of the sequential read and write data. If they are different, it means that the data transmission is still incomplete. However, the duplicate data in the data packet and the retransmitted data packet is detected and removed, and the retransmitted data packet with the duplicate data removed is merged with the data packet to obtain the implementation data, and the data volume of the implementation data is detected. If the data volume is the same, it means that the fusion forms complete data. If they are still different, it means that there may be a problem with the data transmission channel and it needs to be checked. Errors or incompleteness in data transmission can be detected. By removing duplicate data, unnecessary data retransmission is avoided, thereby saving bandwidth resources, and problems with the data channel can be discovered in time and corrected in time. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 The following is a flowchart of an embodiment of the present invention.
[0063] Figure 2 It is a system composition diagram of the present invention.
[0064] Figure 3The complete flow chart of controlling the allocation of sequential read and write data in one embodiment of the present invention. DETAILED DESCRIPTION
[0065] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0066] See also Figure 1-Figure 3 , the first aspect of the present invention provides a UART data forwarding and synchronization optimization system, including: a data preparation module, a data reading and writing module and a signal implementation module;
[0067] Data preparation module: used to collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add timestamp tags to the sequential read and write data.
[0068] Exemplarily, several groups of sending data to be sent by the sender are collected, and each group of sending data needs to be sent to different devices for communication; the sending data includes communication data of known data volume and sending requirements; the sending requirements include data sending time, required receiving time and required receiving object, the data sending time is the time when the group of data is sent from the sender to the universal asynchronous receiver-transmitter (UART), the required receiving time is the time when the sender requires the data to be sent to the corresponding communication device, and the required receiving object is a communication device with a device identifier.
[0069] In this embodiment, a data packet is randomly selected and numbered as 1. The difference between the current time and the data transmission time, i.e., the transmission time, is 1 second. The difference between the current time and the required reception time, i.e., the reception difference time, is 2 seconds. In this embodiment, the urgency coefficient set for the emergency object is 1.5. The urgency coefficient can be set according to the urgency of the receiver's demand for the data packet, or the data transmission needs to meet a certain transmission speed. In order to speed up the data transmission, the transmission speed that needs to be met is set; by the formula YXJi=(YFi+JTi -1 )×JX calculates the sending priority of the data packet to be YXJ1=2.25.
[0070] The larger the difference between the current time and the data sending time, that is, the sent time, the longer the data has been waiting for transmission, so the priority is higher. The smaller the difference between the current time and the required receiving time, that is, the receiving difference time, the closer the data is to the receiving deadline required by the sender, and the higher the priority.
[0071] Identify the device identifier of the target object of the data packet numbered 1, mark the device identifier as a Class A identifier, combine the data packets whose device identifiers are also Class A identifiers to obtain a Class A group of classified read-write data groups whose device identifiers are Class A identifiers; combine other types of identifiers to obtain other groups of classified read-write data groups; the data volume of the data packet numbered 1 in the Class A group of classified read-write data groups is 200 bytes, normalize the data volume of the data packet in the classified read-write data, and obtain the standard data volume of the data packet numbered 1 as 0.2; by the formula XSXi=e -(FSi-1) ×YXJi calculates the filtering coefficient XSX1=5.02 for the data packet numbered 1; sorts the data sent in the same group from large to small according to the size of the filtering coefficient to obtain sequential read and write data; adds a timestamp label with the current time to each sequential read and write data; the present application gives priority to the transmission of data packets with smaller data volumes, which can give priority to solving the problem of data accumulation and help to more efficiently utilize limited bandwidth resources.
[0072] As another preferred embodiment, different from the above-mentioned priority transmission of data packets with smaller data volume, data packets with larger data volume can also be transmitted preferentially, by formula XSXi=e FSi+1 ×YXJi calculates the screening coefficient of the data packet numbered i, and then sorts the sent data. Transmitting a data packet with a large amount of data at one time can reduce the transmission delay of multiple transmissions of small data packets, thereby reducing the overall transmission delay.
[0073] Data read and write module: used to input sequential read and write data into the first buffer and the second buffer, and monitor the buffer status of the first buffer and the second buffer in real time, control the allocation of sequential read and write data according to the buffer status, and combine the timestamp label with the sequential read and write data to obtain the predicted execution time.
[0074] Exemplarily, in this embodiment, in order to ensure the continuity of the data flow and prevent data transmission interruption, the present application is provided with a double buffer, which are marked as a first buffer and a second buffer respectively, and each group of classified read and write data is provided with a corresponding double buffer; the sequential read and write order is input into the first buffer in the sorting order, and a counter is used to monitor the amount of data in the first buffer and the second buffer respectively. If the amount of data in the first buffer and the second buffer reaches the capacity upper limit, the buffer state is saturated; if the amount of data is zero, the buffer state is empty.
[0075] In another embodiment, corresponding thresholds may be set for the saturation state and the vacancy state, and the buffer state of the buffer may be determined when the data volume does not reach an upper limit or zero but reaches a certain threshold.
[0076] During the transmission process, the sequential read and write data is first transmitted to the first buffer. If the sequential read and write data is not completely transmitted and the first buffer has reached saturation, the remaining sequential read and write data transmission is switched to the second buffer. After the first buffer reaches saturation, the data starts to be read and written. After the reading and writing are completed, all the data in the buffer is output to the data transmission channel; if the second buffer reaches saturation, the sequential read and write data transmission is switched to the first buffer for continued transmission; alternating transmission of the double buffers can ensure the continuity and efficiency of data processing.
[0077] After the reading and writing are completed, the reading and writing time when the sequential reading and writing is completed is detected, the timestamp label of the sequential reading and writing data is extracted, and the transmission speed of the data channel corresponding to the sequential reading and writing data is extracted from the database; the data volume of the sequential reading and writing data is divided by the transmission speed of the data channel to obtain the predicted reading and writing time of the sequential reading and writing data, and the reading and writing time is added to the predicted reading and writing time and the time corresponding to the timestamp label to obtain the predicted execution time; in this embodiment, the data volume of the data packet numbered 1 is 200 bytes, the transmission speed of the data channel is 400 bytes per second, and the reading and writing time is 2 seconds after the timestamp label, then the predicted execution time is 2.5 seconds.
[0078] Signal execution module: used to receive the read and write completion data transmitted by the buffer; obtain the data retransmission status based on the predicted execution time and the actual read and write amount of the read and write completion data; provide data feedback for the read and write completion data; merge and organize the read and write completion data according to the data retransmission status to obtain the execution data; match the corresponding execution transmission channel for the execution data according to the sent data.
[0079] Exemplarily, after the buffer completes the reading and writing of sequential read and write data, the read and write completion data is obtained. In order to ensure that the data can be transmitted to the data receiver completely and quickly, the present application is provided with a retransmission mechanism. The retransmission detection time set in this embodiment is 5 seconds, and the retransmission detection time is set according to the data volume of the data packet and the network delay; larger data packets require longer transmission time and higher packet loss rate, so the set retransmission detection time needs to be longer. In this embodiment, the retransmission detection time is set according to the average data volume of the data packet; it is judged whether the predicted execution time is greater than the retransmission detection time. If it is judged that the predicted execution time is less than the retransmission detection time, it means that the data packet can be transmitted to the communication device in time; it is further judged whether the actual read and write amount is the same as the data volume of the sequential read and write data. The actual read and write amount obtained in this embodiment is 180 bytes, and the actual read and write amount is less than the data volume of the sequential read and write data, which means that data loss occurred in the data packet during data transmission, and the data retransmission status of the read and write completion data is marked as lost status.
[0080] It is detected that the data retransmission status of the read and write completion data is in a lost state, and the data retransmission status of the read and write completion data is in a lost state. The data retransmission status of the read and write completion data is combined with the timestamp label to obtain a feedback data packet, and the feedback data packet is sent to the data sender; after the data sender receives the feedback data, it matches the sequential read and write data according to the timestamp label in the feedback data packet, adds a new timestamp label to the sequential read and write data and combines them to obtain a retransmission data packet, marks the new timestamp label as a retransmission timestamp label, matches the retransmission timestamp label with the current sequential read and write data, marks the sequential read and write data with the same retransmission timestamp label as the current sequential read and write data, inserts the retransmission data packet behind the current sequential read and write data for transmission, and finally retransmits the retransmission data packet to the data receiver.
[0081] Continue to determine whether the actual read and write volume of the retransmitted data packet is the same as the data volume of the sequential read and write data. In this embodiment, the actual read and write volume of the retransmitted data packet is 190 bytes. The retransmitted data packet still has data loss problems during transmission. However, in order to save the time cost and transmission rate required for data transmission, it is possible to detect whether the retransmitted data packet can be combined with the read and write completion data to form a complete data packet. If a complete data packet can be formed, there is no need to continue retransmitting. Detect the repeated parts in the read and write completion data and the retransmitted data packet, and detect that there are 170 repeated bytes in the read and write completion data and the retransmitted data packet. The repeated bytes in the retransmitted data packet are removed, and 10 bytes out of the 30 bytes are bytes already in the read and write completion data. The existing 10 bytes are removed, and the remaining 20 bytes of the data packet are marked as leak-filling data, and the leak-filling data are added to the read and write completion data to obtain the implementation data.
[0082] Continue to determine whether the amount of data executed is the same as the amount of data read and written sequentially. It is determined that the amount of data executed and the amount of data read and written sequentially are both 200 bytes, indicating that the read and write data are complete data, and the available status of the retransmitted data packet is marked as compliant.
[0083] As another preferred embodiment, if the amount of execution data obtained by sending retransmitted data packets for fusion is different from the amount of data read and written sequentially, it means that the retransmitted data packet and the read and write completion data have lost the same data packet, and the available state of the retransmitted data packet is marked as an incomplete state. The data transmission channel of the buffer can be checked, or retransmission can be continued to ensure the availability of the execution data, but the number of retransmissions needs to take into account the increase in time cost caused by retransmission and the impact of increased transmission rate of data transmission; if the amount of data of the retransmitted data packet is small, the impact on cost and transmission rate is small, and multiple retransmissions can be performed to ensure the integrity and availability of the transmitted data.
[0084] In this embodiment, the identifier corresponding to the data packet numbered 1 is a Class A identifier, and it is determined whether the device identifier of the receiving object is a Class A identifier; it is determined that the device identifier of the receiving object is a Class A identifier, indicating that the data transmission is correct, and the corresponding channel is marked as an implementation transmission channel, and the implementation data is input into the implementation transmission channel to complete the data transmission.
[0085] A second aspect of the present invention provides a UART data forwarding and synchronization optimization method, comprising:
[0086] Step 1: Collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add a timestamp tag to the sequential read and write data;
[0087] Step 2: inputting the sequential read / write data into the first buffer and the second buffer, and monitoring the buffer status of the first buffer and the second buffer in real time, controlling the allocation of the sequential read / write data according to the buffer status, and combining the timestamp tag with the sequential read / write data to obtain the predicted execution time;
[0088] Step 3: Based on the predicted execution time and the actual read and write volume of the read and write completion data, the data retransmission status is obtained; data feedback is performed on the read and write completion data; the read and write completion data is merged and sorted according to the data retransmission status to obtain the execution data; and the execution data is matched with the corresponding execution transmission channel according to the sent data.
[0089] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0090] Working principle of the present invention:
[0091] The present invention collects sending data, calculates sending priority according to the sending data, calculates screening coefficient according to the sending priority and the data volume of the sending data; obtains sequential read and write data based on the screening coefficient, and adds a timestamp label to the sequential read and write data; sets a double buffer, and monitors the buffer status in real time, controls the transmission of sequential read and write data according to the buffer status, and obtains a predicted execution time in combination with the timestamp label and the sequential read and write data; obtains reading and writing completion data after the reading and writing are completed, compares the reading and writing completion data with the data volume of the sequential read and write data, and obtains a data retransmission status according to the comparison result; generates a feedback data packet according to the data retransmission status, sends a retransmission data packet based on the feedback data packet, merges and organizes the retransmission data packet with the reading and writing completion data to obtain execution data, and matches the execution transmission channel corresponding to the execution data.
[0092] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A UART data forwarding and synchronization optimization system, characterized in that: include: Data preparation module, data reading and writing module and signal execution module; Data preparation module: used to collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add timestamp tags to the sequential read and write data; Data reading and writing module: used to input sequential reading and writing data into the first buffer and the second buffer, and monitor the buffer status of the first buffer and the second buffer in real time, control the allocation of sequential reading and writing data according to the buffer status, and obtain the predicted execution time by combining the timestamp label and the sequential reading and writing data; Signal execution module: used to receive the read and write completion data transmitted by the buffer; obtain the data retransmission status based on the predicted execution time and the actual read and write amount of the read and write completion data; provide data feedback for the read and write completion data; merge and organize the read and write completion data according to the data retransmission status to obtain the execution data; match the corresponding execution transmission channel for the execution data according to the sent data.
2. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The step of classifying and sorting the transmitted data to obtain sequential read and write data includes: Extracting transmission data; the transmission data includes the transmission data volume and transmission requirements of different data packets; Obtain the sending priority of the sending data according to the sending requirements; divide the sending data into several groups of classified read and write data groups according to the sending requirements, and set a screening coefficient based on the sending data volume and sending priority of the classified read and write data; sort from large to small according to the size of the screening coefficient to obtain sequential read and write data.
3. A UART data forwarding and synchronization optimization system according to claim 2, characterized in that: The obtaining the sending priority of the sending data according to the sending requirement includes: Extract the sending requirement and the current time; the sending requirement includes the data sending time, the required receiving time and the required receiving object of the sent data; the required receiving object includes the device identifier and the required state of the target object, and the required state includes an urgent object and a non-urgent object; Mark the difference between the data sending time and the current time as the sent time, and mark the difference between the required receiving time and the current time as the receiving difference time; set an emergency coefficient for the emergency object; the emergency coefficient is set according to the urgency of the receiver's need for the data packet; By the formula YXJi=(YFi+JTi -1 )×JX calculates the sending priority YXJi of the data packet numbered i; where YFi represents the sending time of the data packet numbered i, JTi represents the receiving difference time of the data packet numbered i, and JX is the urgency coefficient; i=1, 2, 3…n, n is a positive integer; 2>JX>1.
4. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The sending data is divided into several groups of classified read and write data groups according to the sending requirements, including: Extract the sending requirements of the sent data; Identify the device identifier of the target object, divide the sent data with the same device identifier into classified read-write data of corresponding identification groups, and obtain several groups of classified read-write data groups with different identification groups.
5. A UART data forwarding and synchronization optimization system according to claim 2, characterized in that: The method of setting the screening coefficient based on the amount of data sent and the sending priority of the classified read and write data includes: Extract the sending data volume and sending priority of classified read and write data; Normalize the data volume sent by the classified read and write data to obtain the standard data volume sent; By the formula XSXi=e -(FSi-1) ×YXJi calculates the screening coefficient XSXi of the data packet numbered i; where FSi represents the standard sending data volume of the data packet numbered i.
6. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The step of controlling the allocation order of reading and writing data according to the buffer state includes: S1: extracting the buffer states of the first buffer and the second buffer; the buffer states include a saturation state and a vacancy state; S2: Determine whether the buffer state of the first buffer is saturated; if yes, input the sequential read and write data in the first buffer into the read and write unit for reading and writing, input the sequential read and write data into the second buffer in order and jump to S3; if no, input the sequential read and write data into the first buffer and monitor the buffer state of the first buffer; S3: Determine whether the buffer state of the second buffer is saturated; if yes, jump to S4; if no, input the sequential read and write data into the second buffer; S4: Continue to input the sequential read and write data into the first buffer.
7. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The combining of the timestamp label and the sequential read and write data to obtain the predicted execution time includes: Extract the timestamp tag, extract the corresponding data channel transmission speed from the database, and detect the read and write time when the sequential read and write data is completed; The predicted read and write time of the sequential read and write data is obtained by dividing the amount of sequential read and write data by the data channel transmission speed; the predicted read and write time, the read and write time and the timestamp label are combined to obtain the predicted execution time.
8. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The data retransmission status is obtained based on the predicted execution time and the actual read and write amount of the read and write completed data, including: A1: Extract the predicted execution time and the actual read and write volume of the read and write completion data; A2: Set the retransmission detection time; determine whether the predicted execution time is greater than the retransmission detection time; if yes, mark the data retransmission status of the previously read and written data as lost; if no, jump to A3; A3: Determine whether the actual read / write amount is the same as the amount of sequential read / write data; if so, mark the data retransmission state of the read / write completed data as the transmission state; if not, mark the data retransmission state of the read / write completed data as the lost state.
9. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The data feedback of the read and write completion data includes: After receiving the read / write completion data, the data receiver detects the data retransmission status of the read / write completion data, and combines the data retransmission status of the read / write completion data with the timestamp tag to obtain a feedback data packet; Send the feedback data packet to the data sender for confirmation.
10. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The step of fusing and arranging the data according to the data retransmission status to obtain the execution data includes: Extract data retransmission status; Determine whether the data retransmission status is a lost state; if yes, notify the data sender to resend the retransmission data packet, queue the retransmission data packet into the buffer for transmission; and detect the available status of the retransmission data packet; if no, continue to run the data.
11. A UART data forwarding and synchronization optimization system according to claim 10, characterized in that: The step of inserting the retransmitted data packet into the buffer for transmission comprises: Extract the retransmission timestamp tag of the retransmitted data packet, match the retransmission timestamp tag with the current sequential read / write data timestamp tag, mark the sequential read / write data with the same retransmission timestamp tag as the current sequential read / write data; insert the retransmitted data packet into the current sequential read / write data buffer for transmission.
12. A UART data forwarding and synchronization optimization system according to claim 10, characterized in that: The detecting the available state of the retransmitted data packet comprises: B1: extract retransmitted data packets and sequential read and write data; B2: Determine whether the actual read and write volume of the retransmitted data packet is the same as the volume of the sequential read and write data; if yes, directly apply the retransmitted data packet; if no, merge the read and write completion data with the retransmitted data packet to obtain the implementation data, and jump to B3; B3: Determine whether the amount of the execution data is the same as the amount of the sequential read and write data; if yes, mark the available state of the retransmitted data packet as a compliant state; if no, mark the available state of the retransmitted data packet as an incomplete state.
13. A UART data forwarding and synchronization optimization system according to claim 12, characterized in that: The step of fusing the read / write completion data with the retransmission data packet to obtain the execution data includes: Extract read and write completion data and retransmit data packets; Detect the repeated parts in the read / write completion data and the retransmitted data packet, remove the repeated parts in the retransmitted data packet to obtain the leak-filling data; add the leak-filling data to the read / write completion data to obtain the implementation data.
14. A UART data forwarding and synchronization optimization system according to claim 1, characterized in that: The step of matching the execution data with the corresponding execution transmission channel according to the sent data includes: Extract the sent data; Determine whether the device identifier of the receiving object is the same as the identification group corresponding to the implementation data; if yes, mark the corresponding channel as the implementation transmission channel and input the implementation data into the implementation transmission channel; if no, mark the corresponding channel as a non-matching channel.
15. A UART data forwarding and synchronization optimization method, applied to a UART data forwarding and synchronization optimization system according to any one of claims 1 to 14, characterized in that: include: Step 1: Collect the sent data, classify and sort the sent data to obtain sequential read and write data, and add a timestamp tag to the sequential read and write data; Step 2: inputting the sequential read / write data into the first buffer and the second buffer, and monitoring the buffer status of the first buffer and the second buffer in real time, controlling the allocation of the sequential read / write data according to the buffer status, and combining the timestamp tag with the sequential read / write data to obtain the predicted execution time; Step 3: Based on the predicted execution time and the actual read and write volume of the read and write completion data, the data retransmission status is obtained; data feedback is performed on the read and write completion data; the read and write completion data is merged and sorted according to the data retransmission status to obtain the execution data; and the execution data is matched with the corresponding execution transmission channel according to the sent data.
Citation Information
Patent Citations
A data transfer buffer design method of Scatter-Gather DMA
CN109189702A