Communication method for multi-application communication based on serial interface and storage medium
By establishing a point-to-point transmission channel based on a serial interface in a multi-chip ECU board, the problem of complex communication methods and multi-applications in the prior art cannot communicate through one interface is solved, and the reliability and priority management of multi-application parallel communication and data transmission is realized.
Patent Information
- Application Number
- CN202411644327.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-07
AI Technical Summary
The existing multi-chip ECU in-board communication method is complex in design, and it is impossible to realize multiple applications to communicate through one interface.
A point-to-point transmission channel is established based on the serial interface, resource provisioning is carried out through the software protocol stack, and multi-application parallel communication is realized through time-sharing multiplexing.
The design of the communication method on-board of multi-chip ECU is simplified, effective data exchange and collaboration between multiple applications are realized, the accuracy and reliability of data transmission are ensured, and the priority of data transmission is effectively managed.
Smart Images

Figure CN119583677A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method and storage medium for multi-application communication based on a serial interface. Background Art
[0002] An ECU may contain multiple processors or microcontrollers, each responsible for different functions, such as engine control, braking system, air conditioning system, etc. These processors need to exchange data and collaborate to ensure the normal operation of various vehicle systems. However, the current multi-chip ECU board communication method is relatively complex in design and cannot solve the problem of multiple applications in two chips communicating through one interface. Summary of the invention
[0003] This application solves the technical problem that the current multi-chip ECU intra-board communication method is relatively complex in design and cannot realize the communication of multiple applications in two chips through one interface. This application establishes a point-to-point transmission channel based on a serial interface, allocates resources by a software protocol stack, and realizes parallel communication of multiple applications through time-sharing multiplexing.
[0004] To solve the above problems, the present application provides a communication method for multi-application communication based on a serial interface, a protocol stack applied to multi-application communication, the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the communication method includes: establishing a point-to-point transmission channel between applications through the asynchronous full-duplex serial interface; the sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; the receiving end receives the data frame, and verifies the transmission integrity of the data packet according to the sending number.
[0005] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: by using an asynchronous full-duplex serial interface, the design complexity of the communication method within the multi-chip ECU board is reduced, making the overall system design simpler and more efficient. In addition, the problem of multiple applications in two chips communicating through one interface is solved, and effective data exchange and collaboration between multiple applications are realized. By establishing a point-to-point transmission channel between each application, the accuracy and reliability of data transmission can be ensured, and data confusion and loss can be avoided. The transport layer of the protocol stack sends data frames in sequence according to the priority of the point-to-point transmission channel of different applications in each application, effectively manages the priority of data transmission, and ensures the timely transmission of important data. The receiving end verifies the transmission integrity of the data packet according to the sending number, ensuring that the data will not be lost or damaged during the transmission process, thereby improving the reliability of data transmission.
[0006] In a possible design, a sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channels of different applications in each application, including: the sending end sets a sending number for the data packet; the data link layer adds the priority sequence of the control point transmission channel to the data packet, encapsulates the data frame into a data frame according to the information of the point-to-point transmission channel corresponding to the target application, and according to the control information; the transport layer determines the point-to-point transmission channel of the target application to which the data frame belongs based on the control information, and sends it to the receiving end according to the point-to-point priority of different applications in each application.
[0007] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: by adding control information in the data link layer and the transport layer, data frames can be sent according to the priority order of the point-to-point transmission channels of different applications in each application, effectively managing the priority of data transmission, ensuring that important data is transmitted first, and improving the performance and efficiency of the system. In addition, encapsulating data packets into data frames can improve the reliability and orderliness of data transmission, realize address identification and target positioning, improve the efficiency of data transmission, and also facilitate network management and troubleshooting.
[0008] In one possible design, when establishing a point-to-point transmission channel between applications, the communication method also includes: the sending end sends an initial packet to the receiving end; after receiving the initial packet, the receiving end returns an initial response packet to the sending end; wherein, the initial packet and the initial response packet store communication parameters so that a communication connection is correctly established between the sending end and the receiving end.
[0009] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: by using the initial packet and the initial response packet to store the communication parameters of both parties, the communication parameters can be exchanged and confirmed more effectively, ensuring the accuracy and consistency of the communication between the two parties. At the same time, the security of the identities and communication parameters of the two parties in communication can be ensured, and the security and reliability of communication can be improved. After the sending end sends the initial packet, the receiving end can quickly respond and send the initial response packet, thereby speeding up the establishment of the communication connection and reducing the time delay for communication establishment. This simplifies the design and implementation of the communication protocol, reduces the complexity of the communication system, and improves the maintainability and scalability of the system.
[0010] In one possible design, before the receiving end receives the data frame, the communication method also includes: caching the data frame in the protocol stack waiting for the receiving end to receive it; after the receiving end receives the data frame, the communication method also includes: the receiving end sends a response message to the sending end, and the response message is used to indicate that the receiving end has successfully received the data frame.
[0011] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: data frame caching can ensure reliable data transmission, reduce the risk of data loss, and improve the reliability of data transmission. The receiving end sends response information immediately after successfully receiving the data frame, which can reduce the round-trip time of communication, reduce the delay of data transmission, and improve communication efficiency. Regularly resending data frames can effectively deal with errors or packet loss that may occur in communication, reduce the communication error rate, and ensure the accuracy of data transmission.
[0012] Furthermore, before the receiving end sends response information to the sending end, the communication method also includes: the receiving end determines the sending number of the data frame: the response information includes a data correct response and a data error response, and the receiving end sends response information to the sending end, including: if the sending number is greater than the correct number, the receiving end sends a data error response to the sending end, and the data error response is used to request the sending end to send data corresponding to the correct number; if the sending number is less than or equal to the correct number, the receiving end sends a data correct response to the sending end.
[0013] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: the receiving end determines the correctness of the data frame according to the transmission number and sends a corresponding response, which can effectively identify and process the erroneous data frame and improve the reliability of data transmission. In addition, the receiving end sends a data error response to the sending end to request the retransmission of the data with the correct number, which can quickly correct the erroneous data frame, reduce the impact of data transmission errors, and improve the accuracy of communication. The receiving end sends a correct or erroneous response according to the transmission number, which can optimize the communication process, reduce unnecessary data retransmission, and improve communication efficiency and system performance.
[0014] In a possible design, the communication method also includes: when the sending end transmits a large amount of data to the receiving end, the protocol stack automatically splits the data into multiple fragment data packets, and the sending end sends the fragment data packets one by one; when the receiving end receives the fragment data packets, it sends a response data fragment packet to the sending end, requesting the sending end to continue sending the next fragment data packet; wherein, when the receiving end receives all the fragment data packets, the receiving end sends a response data packet to the sending end, indicating the end of data transmission.
[0015] Compared with the prior art, the technical effect achieved by adopting this technical solution is: by automatically splitting a large number of transmitted data packets into multiple fragmented data packets for transmission through the protocol stack, the efficiency of data transmission can be improved, the delay in the data transmission process can be reduced, and the communication performance can be improved. Splitting a data packet into multiple fragmented data packets can reduce the risk of failure of transmission of a single data packet, improve the reliability of data transmission, and ensure the integrity and accuracy of the data. In addition, automatically splitting data packets can better utilize network resources, avoid network congestion caused by excessively large data packets, and improve network utilization and communication efficiency.
[0016] In one possible design, the communication method also includes: when an abnormal interruption occurs between the sending end and the receiving end during the transmission process, the protocol stack will send channel reset information to the sending end and / or the receiving end to re-establish the communication connection between the sending end and the receiving end.
[0017] Compared with the prior art, the technical effect achieved by adopting this technical solution is: when an abnormal interruption occurs during the transmission process between the sending end and the receiving end, the communication connection can be reestablished in time by sending channel reset information, thereby improving the reliability of communication. This helps to avoid data loss or transmission errors and ensure that the data can reach the destination correctly. The channel reset technology can help the sending end and the receiving end quickly restore the communication connection, reduce the time of communication interruption, simplify the communication recovery process, reduce the complexity of communication recovery, and improve the maintainability and operability of the system, which improves the stability of the system and reduces the impact of communication failures on system operation.
[0018] The present application also provides a communication method for multi-application communication based on a serial interface, which is applied to a sending end, and the sending end and the receiving end communicate based on a protocol stack for multi-application communication. The hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; the communication method includes: the sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; so that the receiving end receives the data frame, and verifies the transmission integrity of the data packet according to the sending number.
[0019] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: a communication method for multi-application communication based on a serial interface of the present application is applied to the sending end, which has all the beneficial effects of the communication method for multi-application communication based on a serial interface of any technical solution of the present application, which will not be repeated here.
[0020] The present application also provides a communication method for multi-application communication based on a serial interface, which is applied to a receiving end, and the receiving end communicates with the sending end based on a protocol stack for multi-application communication, and the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; the communication method includes: the receiving end receives a data frame, and the data frame is encapsulated by the data link layer of the protocol stack based on a data packet, and is sent in sequence through the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; wherein, the data packet is sent to the data link layer of the protocol stack after the sending end sets a sending number; the receiving end verifies the transmission integrity of the data packet according to the sending number.
[0021] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: a communication method for multi-application communication based on a serial interface of the present application, applied to the receiving end, has all the beneficial effects of the communication method for multi-application communication based on a serial interface of any technical solution of the present application, which will not be repeated here.
[0022] The present application also provides a storage medium, the storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the storage medium is controlled to execute a communication method for multi-application communication based on a serial interface on a device.
[0023] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: the storage medium of the present application implements the communication method of multi-application communication based on a serial interface of any technical solution of the present application. Therefore, it has all the beneficial effects of the communication method of multi-application communication based on a serial interface of any technical solution of the present application, which will not be repeated here.
[0024] In a possible design, the data packet includes a start byte, data length, data type, data content, and a check result.
[0025] Compared with the existing technology, the technical effect achieved by adopting this technical solution is: organizing the data packet according to the fields such as the starting byte, data length, data type, and data content, which helps the receiving end to parse and process the data packet more easily and reduces the complexity of data processing. By setting the verification result in the data packet, it can effectively prevent the data from being tampered with or damaged, improve the security of communication, and ensure the reliability and security of data transmission.
[0026] In one possible design, a data packet includes a channel number, which is used to identify a point-to-point transmission channel corresponding to a target application to which the data packet belongs; before sending the data frame to a receiving end according to the priority of the point-to-point transmission channel corresponding to the target application, the communication method also includes: the transport layer determines the priority of the point-to-point transmission channel corresponding to the target application to which the data packet belongs according to the channel number.
[0027] Compared with the prior art, the technical effect achieved by adopting this technical solution is as follows: by determining the priority of the transmission channel according to the channel number, the communication priority between different applications can be managed more effectively, ensuring the priority transmission of important data and improving the communication efficiency of the system. By setting the channel number, the flexibility and scalability of the system are increased, and the communication between different applications can be flexibly adjusted and managed according to specific needs to meet the different communication needs of the system. Determining the priority of the transmission channel according to the channel number can enable the system to allocate communication resources more reasonably when resources are limited, thereby improving the resource utilization and performance of the system. At the same time, it effectively reduces the communication conflicts between different applications, avoids the confusion and conflicts in data transmission, and improves the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A flow chart of a communication method for multi-application communication based on a serial interface provided in this embodiment; Figure 2 A hierarchical division diagram of the protocol stack provided in this embodiment; Figure 3 The data flow diagram of the protocol stack provided in this embodiment. DETAILED DESCRIPTION
[0029] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0030] See also Figures 1 to 3 This embodiment provides a communication method for multi-application communication based on a serial interface, a protocol stack applied to multi-application communication, a hardware layer of the protocol stack using an asynchronous full-duplex serial interface, and the communication method includes: Establish point-to-point transmission channels between applications through asynchronous full-duplex serial interface; The sending end sets a sending number for the data packet, and the data packet is encapsulated into a data frame via the data link layer of the protocol stack. The data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; The receiving end receives the data frame and verifies the transmission integrity of the data packet based on the sending number.
[0031] Specifically, in this embodiment, ECU is an engine control unit, which is an important electronic control module on the car, responsible for monitoring and controlling various functions of the engine, such as the ignition system, fuel injection system, oxygen sensor, etc. ECU receives signals from various sensors and adjusts the operating parameters of the engine according to a preset program to ensure that the engine can operate efficiently, economically and environmentally friendly. Among them, multi-chip ECU intra-board communication refers to the process of data exchange and communication between different functional modules through an internal communication bus within an ECU module. In traditional ECU design, different functional modules may use independent processors and chips, which need to communicate with each other to coordinate their work.
[0032] Specifically, in this embodiment, the hardware layer of the protocol stack is an asynchronous full-duplex serial interface, which can establish a point-to-point transmission channel between applications, and the sending end sends the data packet to the receiving end through the transmission channel. Figure 2The layer division diagram of the protocol stack shown in the figure shows that the protocol stack includes the physical layer, data link layer, network layer, transport layer, session layer, presentation layer and application layer, among which the serial communication interface UART is placed in the physical layer and the data link layer, responsible for converting parallel data into serial data for transmission, and converting serial data into parallel data at the receiving end. The data link layer communication protocol MSTP is placed in the data link layer, network layer and transport layer, and is used to control the transmission and routing of data frames. In addition, system management, power management, security functions, update functions and diagnostic functions are all placed in the session layer, presentation layer and application layer for the management, control and maintenance of the system. Figure 3 As shown in the data flow diagram of the protocol stack, after being processed by the data link layer, transport layer, application layer and physical layer, the data packet from the sender is cached in the memory pool of the protocol stack and enters the waiting queue, waiting to be received by the receiver.
[0033] In one embodiment of the present application, a sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channels of different applications in each application, including: the sending end sets a sending number for the data packet; the data link layer adds the priority order of the control point transmission channel to the data packet, encapsulates the data frame into a data frame according to the information of the point-to-point transmission channel corresponding to the target application, and according to the control information; the transport layer determines the point-to-point transmission channel of the target application to which the data frame belongs based on the control information, and sends it to the receiving end according to the point-to-point priority of different applications in each application.
[0034] Specifically, the send number refers to a unique identifier assigned to each data packet during the data packet transmission process, which is used to identify the order and integrity of the data packet. The send number is usually an increasing number, and the send number will increase once each time a data packet is sent. The receiving end can sort the data packets in the correct order according to the send number of the received data packets to ensure the orderliness of the data. The receiving end can send confirmation information to the sending end through the send number to inform the sending end which data packets have been successfully received and which data packets need to be retransmitted.
[0035] In one embodiment of the present application, when a point-to-point transmission channel is established between applications, the communication method also includes: the sending end sends an initial packet to the receiving end; after the receiving end receives the initial packet, the receiving end returns an initial response packet to the sending end; wherein, the initial packet and the initial response packet store communication parameters so that a communication connection is correctly established between the sending end and the receiving end.
[0036] Specifically, the parameters of the communication between the two parties are stored in the initial packet and the initial response packet. By exchanging these parameters, the communication parameters between the sender and the receiver can be ensured to be consistent, avoiding communication failure or data transmission error due to parameter mismatch. In addition, by exchanging the initial packet and the initial response packet, the identity and legitimacy of the two communicating parties can be determined to avoid unauthorized communication or data exchange. Among them, the initial packet is a data packet sent by the sender to the receiver to request the establishment of a communication connection. In the initial packet, the sender will include some communication parameters, such as the initial sequence number, the maximum data segment size, etc., so that the receiver can correctly respond and establish a communication connection after receiving the initial packet. The initial response packet is a response data packet returned by the receiver to the sender after receiving the initial packet, which is used to confirm the receipt of the initial packet and agree to establish a communication connection. In the initial response packet, the receiver will include some communication parameters, such as the confirmation number, the window size, etc., so that the sender can confirm that the communication connection has been established and start data transmission after receiving the initial response packet.
[0037] In one embodiment of the present application, before the receiving end receives the data frame, the communication method also includes: caching the data frame in the protocol stack waiting for the receiving end to receive it; after the receiving end receives the data frame, the communication method also includes: the receiving end sends a response message to the sending end, and the response message is used to indicate that the receiving end has successfully received the data frame.
[0038] Specifically, the sender periodically resends data frames to ensure reliable data transmission. In network communications, data frames may be lost or damaged due to various reasons such as network congestion and packet loss, resulting in the receiver failing to correctly receive the data. By periodically resending data frames and waiting for the receiver's response information, the sender can ensure that the data can be correctly received by the receiver, thereby achieving reliable data transmission. When the sender sends data, the data needs to be processed and encapsulated by multiple network protocol layers, including the application layer, transport layer, network layer, and data link layer. The data frame is encapsulated and processed in these protocol layers before it can finally be sent. Therefore, the data frame needs to wait for the operating system to process and send it layer by layer in the protocol stack to ensure that the data can correctly reach the target receiver.
[0039] In one embodiment of the present application, before the receiving end sends response information to the sending end, the communication method also includes: the receiving end determines the sending number of the data frame: the response information includes a data correct response and a data error response, and the receiving end sends a response information to the sending end, including: if the sending number is greater than the correct number, the receiving end sends a data error response to the sending end, and the data error response is used to request the sending end to send data corresponding to the correct number; if the sending number is less than or equal to the correct number, the receiving end sends a data correct response to the sending end.
[0040] Specifically, the receiving end can judge the correctness of the data frame by sending the number because the sending end usually numbers the data frames in an ascending order, and the receiving end also expects to receive the data frames in the same order. If the sending number of the data frame received by the receiving end is greater than the correct number, it means that the sending end has sent a data frame that has been sent before. At this time, the receiving end will think that there is an error in the data frame and send a data error response to the sending end, requiring the sending end to send the data with the correct number. If the sending number is less than or equal to the correct number, it means that the received data frame is sent in sequence, and the receiving end will send a data correct response to the sending end. This mechanism can help ensure the order and integrity of the data and ensure that the data can be transmitted and received correctly. Among them, the data correct response indicates that the receiving end has successfully received the data sent by the sending end, and the sending end does not need to resend the data. The data error response indicates that there is a data packet transmission error at the sending end, and the sending end should resend the data corresponding to the correct number. This can ensure the integrity and correctness of the data.
[0041] In one embodiment of the present application, the communication method also includes: when the sending end transmits a large amount of data to the receiving end, the protocol stack automatically splits the data into multiple fragment data packets, and the sending end sends the fragment data packets one by one; when the receiving end receives the fragment data packets, it sends a response data fragment packet to the sending end to request the sending end to continue sending the next fragment data packet; wherein, when the receiving end receives all the fragment data packets, the receiving end will send a response data packet to the sending end, indicating the end of data transmission.
[0042] Specifically, when transmitting a large amount of data, an overly large data packet may exceed the maximum limit of network transmission or increase the risk of network congestion. Therefore, the protocol stack automatically splits the large data packet into multiple fragment data packets for transmission, and each fragment data packet carries a sequence number so that the receiving end can correctly reassemble the data. After the receiving end successfully receives the fragment data packet, it will send an acknowledgement data fragment packet to the sending end to notify the sending end that the fragment data packet has been successfully received. This helps the sending end know which data fragments have arrived at the receiving end and which need to be resent. When the receiving end successfully receives all the fragment data packets, it will send an acknowledgement data fragment packet to the sending end, indicating that all data fragments have been successfully received and data reassembly can be performed. This operation ensures the integrity and sequence of large data, and at the same time, the acknowledgement mechanism can promptly notify the sending end of the status of data transmission, ensuring reliable data transmission. Among them, the fragment data packet is a data unit that splits a large block of data into smaller data packets for transmission in the network. Each fragment data packet contains a part of the original data and some necessary control information, such as sequence number, data offset, etc. These fragment data packets can be sent and received independently during the transmission process, and then reassembled into complete data at the receiving end. When the receiver receives a fragment data packet, in order to confirm the receipt of the data and request the sender to continue to send the next fragment data packet, the receiver will send an acknowledgement data fragment packet to the sender. This acknowledgement data fragment packet contains some control information, such as confirmation number, window size, etc., so that the sender knows that the receiver is ready to receive the next data fragment. When the receiver receives all the fragment data packets and successfully reassembles them into complete data, the receiver will send an acknowledgement data packet to the sender to indicate the end of data transmission. This packet usually contains some control information to end the transmission so that the sender knows that the data has been successfully transmitted to the receiver.
[0043] In one embodiment of the present application, the communication method further includes: when an abnormal interruption occurs between the sending end and the receiving end during the transmission process, the protocol stack will send channel reset information to the sending end and / or the receiving end to re-establish the communication connection between the sending end and the receiving end.
[0044] Specifically, when the transmitter and / or receiver restarts or resets, the originally established transmission channel may be interrupted or invalid, resulting in interruption or error in data transmission. Channel reset is a commonly used technology in communication protocols, which is used to reestablish the communication connection when an abnormal interruption occurs during the communication process. When the transmitter or receiver detects a communication anomaly, the protocol stack sends a channel reset message to notify the other party to reestablish the connection. This helps to restore communication and ensure the correct transmission of data. In the channel reset process, two important data packets are usually involved: a channel reset packet and a channel reset response packet. The channel reset packet is a data packet sent by the transmitter to the receiver to request the reestablishment of the communication connection. The channel reset packet usually contains some specific control information to instruct the receiver to perform corresponding operations, such as reinitializing the communication status. The channel reset response packet is the receiver's response to the channel reset packet, which is used to confirm that the channel reset request has been received and agree to reestablish the communication connection. The channel reset response packet usually contains confirmation information to ensure that both parties are ready to resume communication.
[0045] In one embodiment of the present application, when the sending end and / or the receiving end is restarted or reset, if it is uncertain whether the peer application is started, only one data packet is sent until the peer replies with a correct response message, and then subsequent data is sent.
[0046] Specifically, subsequent data is sent only after confirming that the peer application has been started and is ready to receive data. This mechanism is to avoid problems caused by sending data before the communication connection is reestablished. When the sending or receiving end is restarted or reset, it may cause uncertainty in the communication state. At this time, sending data may cause data loss or transmission errors. Therefore, in order to ensure the reliability of communication, it is necessary to wait until the peer application has been started and is ready to receive data before sending subsequent data.
[0047] In one embodiment of the present application, in this embodiment, the communication method further includes a data correct packet and a data error packet.
[0048] Specifically, a correct data packet refers to a data packet sent by the sender. After the receiver receives it, it is found that the data is correct after verification. The receiver can continue to process this data packet. A data error packet refers to a data packet sent by the sender. After the receiver receives it, it is found that the data is erroneous after verification. The receiver needs to notify the sender or perform error processing.
[0049] In one embodiment of the present application, the data packet includes a start byte, a data length, a data type, data content, and a check result.
[0050] Specifically, in this embodiment, the start byte is used to identify the beginning of the data packet, helping the receiving end to correctly identify the boundary of the data packet. The data length indicates the length of the data portion in the data packet, helping the receiving end to correctly parse the data. The data type indicates the format or purpose of the data, helping the receiving end to correctly process the data. The data content is the data that actually needs to be transmitted. The check result is used to detect whether an error or data corruption occurs during data transmission, ensuring the integrity and accuracy of the data.
[0051] In one embodiment of the present application, the data packet also includes a channel number, which is used to distinguish the transmission channels between different applications; the transport layer will determine the priority of the transmission channel of the data packet based on the channel number, wherein the smaller the channel number, the higher the priority of the transmission channel of the data packet.
[0052] Specifically, the channel number is an identifier used to distinguish different transmission channels in data communication. A communication system may have multiple transmission channels, each of which may be used for different applications or services. In order to distinguish these different transmission channels, a unique channel number can be assigned to each channel. The reasonable setting of channel numbers can effectively manage and control the transmission order and priority of data between different transmission channels, ensuring that data transmission between different applications or services can be carried out in the expected order and priority. Through channel numbering, the flexibility and controllability of data transmission can be achieved, and the efficiency and performance of the communication system can be improved.
[0053] In one embodiment of the present application, the sending end determines the sending order of each data packet by sending numbers.
[0054] Specifically, by determining the sending order of data packets through the sending number, the order of data packets during transmission can be effectively guaranteed, and data parsing errors or communication confusion caused by disordered data packets can be avoided. The receiving end can sort and process the received data packets according to the sending number, which simplifies the processing flow of data packets and improves the efficiency and accuracy of data processing. The sending number can help the receiving end detect whether there is a data packet loss, so as to retransmit or process it in time, reduce the risk of data loss, and ensure the integrity of data transmission. In data communication, the sending end determines the sending order of each data packet through the sending number to ensure that the data packets can reach the receiving end in the correct order during the transmission process. Through the sending number, the sending end can assign a unique sequence number to each data packet, and the receiving end can reassemble the data packets in the correct order according to these sequence numbers to ensure the order of data.
[0055] The present application also provides a communication method for multi-application communication based on a serial interface, which is applied to a sending end, and the sending end and the receiving end communicate based on a protocol stack for multi-application communication. The hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; the communication method includes: the sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; so that the receiving end receives the data frame, and verifies the transmission integrity of the data packet according to the sending number.
[0056] Specifically, a communication method for multi-application communication based on a serial interface of the present application is applied to the sending end, which has all the beneficial effects of the communication method for multi-application communication based on a serial interface of any technical solution of the present application, which will not be repeated here.
[0057] The present application also provides a communication method for multi-application communication based on a serial interface, which is applied to a receiving end, and the receiving end communicates with the sending end based on a protocol stack for multi-application communication, and the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; the communication method includes: the receiving end receives a data frame, and the data frame is encapsulated by the data link layer of the protocol stack based on a data packet, and is sent in sequence through the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; wherein, the data packet is sent to the data link layer of the protocol stack after the sending end sets a sending number; the receiving end verifies the transmission integrity of the data packet according to the sending number.
[0058] Specifically, a communication method for multi-application communication based on a serial interface of the present application is applied to the receiving end, which has all the beneficial effects of the communication method for multi-application communication based on a serial interface of any technical solution of the present application, which will not be repeated here.
[0059] The present application also provides a storage medium, the storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the storage medium is controlled to execute a communication method for multi-application communication based on a serial interface on a device.
[0060] Specifically, the storage medium of the present application implements the communication method of multi-application communication based on serial interface of any technical solution of the present application. Therefore, it has all the beneficial effects of the communication method of multi-application communication based on serial interface of any technical solution of the present application, which will not be repeated here.
[0061] Although the present application is disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope defined by the claims.
Claims
1. A communication method for multi-application communication based on a serial interface, characterized in that: A protocol stack applied to the multi-application communication, wherein the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the communication method comprises: Establishing a point-to-point transmission channel between applications through the asynchronous full-duplex serial interface; The sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in the applications; The receiving end receives the data frame and verifies the transmission integrity of the data packet according to the sending number.
2. The communication method for multi-application communication based on a serial interface according to claim 1, characterized in that: The transmitting end sets a transmission number for a data packet, the data packet is encapsulated into a data frame via a data link layer of the protocol stack, and the data frame is sent in sequence via a transport layer of the protocol stack according to the priorities of point-to-point transmission channels of different applications in the applications, including: The sending end sets a sending number for the data packet; The data link layer adds control information to the data packet, and encapsulates the data packet into the data frame according to the control information; The transport layer determines the point-to-point transmission channel of the target application to which the data frame belongs based on the control information, and according to the priority order of the point-to-point transmission channels of different applications in the applications, sends the data frame to the receiving end according to the priority of the point-to-point transmission channel corresponding to the target application.
3. The communication method for multi-application communication based on a serial interface according to claim 1, characterized in that: When establishing a point-to-point transmission channel between the applications, the communication method further includes: The sending end sends an initial packet to the receiving end; After receiving the initial packet, the receiving end returns an initial response packet to the sending end; The initial packet and the initial response packet store communication parameters so that a communication connection is correctly established between the sending end and the receiving end.
4. The communication method for multi-application communication based on a serial interface according to claim 1, characterized in that: Before the receiving end receives the data frame, the communication method further includes: Buffering the data frame in the protocol stack and waiting for the receiving end to receive it; After the receiving end receives the data frame, the communication method further includes: The receiving end sends response information to the sending end, where the response information is used to indicate that the receiving end has successfully received the data frame.
5. The communication method for multi-application communication based on serial interface according to claim 4, characterized in that: Before the receiving end sends the response information to the sending end, the communication method further includes: The receiving end determines the sending number of the data frame: The response information includes a data correct response and a data error response, and the receiving end sends the response information to the sending end, including: If the sending number is greater than the correct number, the receiving end sends the data error response to the sending end, where the data error response is used to request the sending end to send data corresponding to the correct number; If the sending number is less than or equal to the correct number, the receiving end sends a data correct response to the sending end.
6. The communication method for multi-application communication based on a serial interface according to claim 1, characterized in that: The communication method further comprises: When the sending end transmits a large amount of data to the receiving end, the protocol stack automatically divides the data into multiple fragment data packets, and the sending end sends the fragment data packets one by one; When the receiving end receives the fragment data packet, it sends a response data fragment packet to the sending end to request the sending end to continue sending the next fragment data packet; wherein, when the receiving end receives all the fragment data packets, the receiving end sends a response data packet to the sending end to indicate the end of data transmission.
7. The communication method for multi-application communication based on a serial interface according to claim 1, characterized in that: The communication method further comprises: When an abnormal interruption occurs during the transmission between the sending end and the receiving end, the protocol stack will send channel reset information to the sending end and / or the receiving end to re-establish the communication connection between the sending end and the receiving end.
8. A communication method for multi-application communication based on a serial interface, characterized in that: Applied to a transmitting end, the transmitting end and the receiving end communicate based on the protocol stack of the multi-application communication, the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; The communication method comprises: The sending end sets a sending number for a data packet, the data packet is encapsulated into a data frame via the data link layer of the protocol stack, and the data frame is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in the applications; So that the receiving end receives the data frame and verifies the transmission integrity of the data packet according to the sending number.
9. A communication method for multi-application communication based on a serial interface, characterized in that: Applied to a receiving end, the receiving end communicates with the transmitting end based on the protocol stack of the multi-application communication, the hardware layer of the protocol stack uses an asynchronous full-duplex serial interface, and the asynchronous full-duplex serial interface is used to establish a point-to-point transmission channel between each application; The communication method comprises: The receiving end receives a data frame, which is encapsulated by the data link layer of the protocol stack based on a data packet, and is sent in sequence via the transport layer of the protocol stack according to the priority of the point-to-point transmission channel of different applications in each application; wherein the data packet is sent to the data link layer of the protocol stack after being set with a sending number by the sending end; The receiving end verifies the transmission integrity of the data packet according to the sending number.
10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is executed by the processor, the storage medium is controlled to execute the communication method for multi-application communication based on a serial interface according to any one of claims 1 to 9 on the device.
Citation Information
Cited By
WiFi data transmission method, device and system
CN120415642A
Conflict resolution method and device for time precision strobe signal of high-speed serial interface
CN120596420A