A method and system for preventing packet loss in vehicle networking terminal communication

By defining the anti-packet loss communication protocol and retransmission mechanism between the sending end and the receiving end of the Internet of Vehicles terminal, the packet loss problem during the MCU chip receiving data is solved, the stability and reliability of data transmission are improved, and the troubleshooting is reduced The time and cost of the problem.

CN114928431BActive Publication Date: 2024-11-29WUHAN SOUTH SAGITTARIUS INTEGRATION CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210771972.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2024-11-29
Estimated Expiration
2042-06-30

AI Technical Summary

Technical Problem

In the Internet of Vehicles terminal, MCU chips often experience errors when receiving serial port data, resulting in packet verification failure and packet loss, affecting terminal functions, and it is difficult to find these abnormalities during the development and testing stages, resulting in various problems in the market products.

Method used

Define an anti-packet loss communication protocol. The data frame is processed by setting unique serial numbers and preset rules between the sending and receiving ends to realize the retransmission and confirmation mechanism of data packets to ensure the integrity and reliability of data transmission.

Benefits of technology

By adding an anti-error retransmission mechanism on the sending and receiving ends of the Internet of Vehicles terminal, the problem of failure of data packet reception is avoided, the stability and reliability of inter-board communication is improved, and the time and cost of troubleshooting problems are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114928431B_ABST
    Figure CN114928431B_ABST
Patent Text Reader

Abstract

A method for anti-packet loss communication of a vehicle networking terminal includes: defining an anti-packet loss communication protocol for communication between a sending end and a receiving end; according to the defined anti-packet loss communication protocol, the sending end sets the operation command and instruction direction in the anti-packet loss communication protocol according to the demand; the anti-packet loss protocol layer interface of the sending end sets the unique sequence number of the current data frame according to the instruction direction of the current data frame, resets the anti-packet loss information object according to the first preset rule, and sends the data frame to the receiving end of the vehicle networking terminal; the receiving end judges the data frame according to the second preset rule, and the anti-packet loss protocol layer interface layer of the receiving end replies the corresponding data frame to the sending end according to the judgment result; the sending end judges the received data frame according to the third preset rule, and confirms whether the anti-packet loss protocol data packet is sent successfully according to the judgment result. Data reception timeout judgment and retransmission processing are realized, and the efficiency and security of vehicle networking terminal communication are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of vehicle networking terminal communication, and in particular to a method and system for preventing packet loss in vehicle networking terminal communication. Background Art

[0002] The Internet of Vehicles terminal is an inevitable trend and legal requirement in the current automotive industry. Whether it is a commercial vehicle or a passenger vehicle, whether it is a new energy vehicle or a diesel vehicle, according to the national standards of GB17691 and GBT32960, all vehicles listed after 2021 need to be equipped with an Internet of Vehicles terminal. Therefore, it can be seen that the demand for Internet of Vehicles terminals will be very large. In addition, since Internet of Vehicles terminals often contain an MPU and an MCU chip, and the two chips communicate through the serial port protocol, in actual applications, the MCU side often has errors when receiving serial port data, resulting in the failure of the entire data packet verification, resulting in packet loss, and then causing abnormal functions of the Internet of Vehicles terminal. Usually, this functional abnormality is not necessary, and it is difficult to find this abnormality during the development and testing phase, which ultimately leads to various problems in the products that flow to the market. Summary of the invention

[0003] In view of the above problems, the present invention is proposed to provide a method for preventing packet loss in vehicle networking terminal communication, which overcomes the above problems or at least partially solves the above problems.

[0004] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:

[0005] A method for preventing packet loss communication of an Internet of Vehicles terminal, comprising:

[0006] S100. Define the anti-packet loss communication protocol for communication between the sender and the receiver;

[0007] S200. According to the defined anti-packet loss communication protocol, the transmitter sets the operation command and instruction direction in the anti-packet loss communication protocol according to the demand, and saves the complete anti-packet loss communication protocol data frame to the serial port data transmission queue;

[0008] S300. The anti-packet loss protocol layer interface of the transmitting end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, creates a new anti-packet loss information object, resets the anti-packet loss information object according to the first preset rule, and then adds the anti-packet loss information object to the anti-packet loss queue, and finally calls the serial port sending interface of the system to send the data frame to the receiving end of the Internet of Vehicles terminal;

[0009] S400. When the receiving end anti-packet loss protocol layer interface layer receives the data frame sent by the receiving end, the data frame is judged according to the second preset rule, and the receiving end anti-packet loss protocol layer interface layer replies to the sending end according to the judgment result. The corresponding data frame;

[0010] S500. When receiving the data frame sent by the receiving end, the interface layer of the anti-packet loss protocol layer at the sending end judges the received data frame according to the third preset rule, and confirms whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0011] Furthermore, in S100, the transmitting end and the receiving end may be an MCU chip or an MPU chip.

[0012] Furthermore, in S100, an anti-packet loss communication protocol for communication between the sending end and the receiving end is defined, wherein the anti-packet loss communication protocol consists of eight parts: frame header, check type, data length, instruction direction, command sequence number, operation command, data content and check bit.

[0013] Further, in S200, the sending end sets the operation command and instruction direction in the anti-packet loss communication protocol according to the needs, wherein the operation command includes the operation type and the command word, and the instruction direction includes the main answer, response, MCU anti-packet loss response and MPU anti-packet loss response.

[0014] Further, in S300, the anti-packet loss protocol layer interface of the sending end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, specifically including: when the anti-packet loss protocol layer interface determines that the instruction direction of this data frame is the main send, the unique serial number of the data frame is increased by 1.

[0015] Further, in S300, the anti-packet loss information object is reset according to the first preset rule, and the first preset rule is: the operation type, command word, command sequence number, data length, and data content information of the data frame to be sent are assigned to the anti-packet loss information object, and the anti-packet loss mechanism validity field of the anti-packet loss information object is set to valid, the response status is set to waiting for response, the number of retransmissions is set to 0, and the timeout period is set to 0.

[0016] Further, in S400, when the anti-packet loss protocol layer interface layer at the receiving end receives the data frame sent by the receiving end, it judges the data frame according to the second preset rule. The second preset rule includes: the anti-packet loss protocol layer interface layer at the receiving end judges the value of the instruction direction field of the data frame, and continues to judge whether the value of the command sequence number field is greater than 0. When the value of the instruction direction field is 0, representing the main sending instruction, and the value of the command sequence number field is greater than 0, the anti-packet loss protocol layer interface layer at the receiving end immediately replies to the sending end with a data frame whose instruction direction field value is MCU anti-packet loss response or MPU anti-packet loss response. The operation type, command word, and command sequence number of the replied data frame need to be consistent with those sent by the sending end, and there is no need to carry data content.

[0017] Further, in S500, when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, the received data frame is judged according to the third preset rule. The third preset rule includes: when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, it judges that the instruction direction is the MCU anti-packet loss response or the MPU anti-packet loss response, and further judges whether the command sequence number, operation type, and command word of the received data frame are the same as the command sequence number, operation type, and command word of the anti-packet loss information object in the anti-packet loss queue. When it is judged that they are the same, the whether the anti-packet loss mechanism is valid field of this anti-packet loss information object is set to invalid, and the response status is set to received confirmation reception response.

[0018] Furthermore, the sending end will also execute a timeout retransmission process in an independent thread, which specifically includes: first, determining whether the anti-packet loss queue is empty; if the anti-packet loss queue is not empty, traversing each anti-packet loss information object; and then determining whether the response status is waiting for response; if it is waiting for response, increasing the response timeout; and finally determining whether the timeout is greater than a preset threshold; if it is greater than the preset threshold, retransmitting, adding 1 to the number of retransmissions, and resetting the timeout to 0; if the number of retransmissions is greater than 3 times, setting the response status to waiting timeout, and setting the field for whether the anti-packet loss mechanism is effective to invalid.

[0019] Furthermore, the anti-packet loss protocol layer at the sending end needs to periodically reset the anti-packet loss information objects in the anti-packet loss queue whose anti-packet loss mechanism is invalid to the default values, where the response status, number of retransmissions, timeout time, sequence number, and data frame length default values ​​are set to 0, the operation type and command word are reset to 0xFF, the storage space applied for the data content is released, and then it is deleted from the queue.

[0020] Furthermore, a system for anti-packet loss communication of a vehicle networking terminal includes: an anti-packet loss communication protocol definition module, a sending end and a receiving end, wherein:

[0021] The anti-packet loss communication protocol definition module is used to define the anti-packet loss communication protocol for communication between the sending end and the receiving end;

[0022] The sending end is an MCU chip or an MPU chip, which is used to set the operation commands and instruction directions in the anti-packet loss communication protocol according to the defined anti-packet loss communication protocol according to the needs, and save the complete anti-packet loss communication protocol data frame to the serial port data sending queue; it is also used to set the unique serial number of the current data frame according to the instruction direction of the current data frame, and create a new anti-packet loss information object, reset this anti-packet loss information object according to the first preset rule, and then add this anti-packet loss information object to the anti-packet loss queue, and finally call the system's serial port sending interface to send the data frame to the receiving end of the Internet of Vehicles terminal; it is also used to judge the received data frame according to the third preset rule when receiving the data frame sent by the receiving end, and confirm whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0023] The receiving end is an MCU chip or an MPU chip, which is used to judge the data frame according to the second preset rule when receiving the data frame sent by the receiving end. According to the judgment result, the receiving end anti-packet loss protocol layer interface layer replies to the sending end with the corresponding data frame.

[0024] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:

[0025] The present invention discloses a method for anti-packet loss communication of a vehicle networking terminal, comprising: defining an anti-packet loss communication protocol for communication between a sending end and a receiving end; according to the defined anti-packet loss communication protocol, the sending end sets the operation command and instruction direction in the anti-packet loss communication protocol according to demand; the anti-packet loss protocol layer interface of the sending end sets the unique sequence number of the current data frame according to the instruction direction of the current data frame, creates a new anti-packet loss information object, resets the anti-packet loss information object according to a first preset rule, then adds the anti-packet loss information object to an anti-packet loss queue, and finally calls the serial port sending interface of the system to send the data frame to the receiving end of the vehicle networking terminal; when the anti-packet loss protocol layer interface layer of the receiving end receives the data frame sent by the receiving end, the data frame is judged according to a second preset rule, and the anti-packet loss protocol layer interface layer of the receiving end replies the corresponding data frame to the sending end according to the judgment result; when the anti-packet loss protocol layer interface layer of the sending end receives the data frame sent by the receiving end, the received data frame is judged according to a third preset rule, and whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0026] The present invention realizes the timeout judgment and retransmission processing of data reception by adding an error-proof retransmission mechanism between the communication protocols of the sending end and the receiving end of the vehicle networking communication terminal. It avoids the problem of data packet reception failure caused by the data sender sending frame loss or the receiving end receiving frame leakage or thread blocking, increases the stability and reliability of inter-board communication, improves the efficiency and security of module application execution, and reduces the time and cost of troubleshooting such problems.

[0027] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0029] Figure 1 This is a flow chart of a method for preventing packet loss in vehicle networking terminal communication in embodiment 1 of the present invention;

[0030] Figure 2 This is a flow chart of the anti-packet loss algorithm for the Internet of Vehicles terminal in Example 1 of the present invention.

[0031] Figure 3 This is a serial port communication block diagram of an Internet of Vehicles terminal in Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0032] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0033] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a method for preventing packet loss communication of an Internet of Vehicles terminal.

[0034] Example 1

[0035] This embodiment discloses a method for preventing packet loss in vehicle networking terminal communication. Figure 1 ,include:

[0036] S100. Define an anti-packet loss communication protocol for communication between the transmitter and the receiver; specifically, in this embodiment, the transmitter and the receiver may be an MCU chip or an MPU chip. That is, in this embodiment, not only can the MCU chip communicate with the MPU chip, but also the MCU chip and the MCU chip, the MPU chip and the MPU chip, and the MPU chip and the MCU chip can communicate.

[0037] In this embodiment S100, the anti-packet loss communication protocol for communication between the transmitting end and the receiving end is defined, wherein the anti-packet loss communication protocol consists of 8 parts: frame header, check type, data length, instruction direction, command sequence number, operation command, data content and check bit. In this embodiment, the specific settings of the anti-packet loss communication protocol are shown in Table 1.

[0038] Table 1 Anti-packet loss communication protocol

[0039]

[0040] S200. According to the defined anti-packet loss communication protocol, the transmitter sets the operation command and instruction direction in the anti-packet loss communication protocol according to the demand, and saves the complete anti-packet loss communication protocol data frame to the serial port data transmission queue;

[0041] In the present embodiment S200, the transmitting end sets the operation command and instruction direction in the anti-packet loss communication protocol according to the demand, wherein the operation command is as shown in Table 1, including the operation type and the command word, and the instruction direction is as shown in Table 2, including the main answer, the response, the MCU anti-packet loss response and the MPU anti-packet loss response. Among them, the MCU anti-packet loss response represents the anti-packet loss response sent by the MCU to the MPU. It should not carry data content, and this command should not be passed to the MPU application layer. Except for the logic module of the confirmation response mechanism of the anti-packet loss function, other modules should not parse this instruction. The MPU anti-packet loss response represents the anti-packet loss response sent by the MPU to the MCU. It should not carry data content, and this command should not be passed to the MCU application layer. Except for the logic module of the confirmation response mechanism of the anti-packet loss function, other modules should not parse this instruction.

[0042] Table 2 Command direction definition

[0043]

[0044] S300. The anti-packet loss protocol layer interface of the transmitting end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, creates a new anti-packet loss information object, resets the anti-packet loss information object according to the first preset rule, and then adds the anti-packet loss information object to the anti-packet loss queue, and finally calls the serial port sending interface of the system to send the data frame to the receiving end of the Internet of Vehicles terminal;

[0045] In this embodiment S300, the anti-packet loss information object is reset according to the first preset rule, and the first preset rule is: the operation type, command word, command sequence number, data length, and data content information of the data frame to be sent are assigned to the anti-packet loss information object, and the anti-packet loss mechanism validity field of the anti-packet loss information object is set to valid, the response status is set to waiting for response, the number of retransmissions is set to 0, and the timeout period is set to 0.

[0046] S400. When the receiving end anti-packet loss protocol layer interface layer receives the data frame sent by the receiving end, the data frame is judged according to the second preset rule, and the receiving end anti-packet loss protocol layer interface layer replies to the sending end according to the judgment result. The corresponding data frame;

[0047] In the present embodiment S400, when the anti-packet loss protocol layer interface layer at the receiving end receives the data frame sent by the receiving end, it judges the data frame according to the second preset rule. The second preset rule includes: the anti-packet loss protocol layer interface layer at the receiving end judges the value of the instruction direction field of the data frame, and continues to judge that the value of the command sequence number field is greater than 0. When the value of the instruction direction field is 0, representing the main sending instruction, and the value of the command sequence number field is greater than 0, the anti-packet loss protocol layer interface layer at the receiving end immediately replies to the sending end with a data frame whose instruction direction field value is the MCU anti-packet loss response. The operation type, command word, and command sequence number of the replied data frame need to be consistent with those sent by the sending end, and there is no need to carry data content.

[0048] S500. When receiving the data frame sent by the receiving end, the interface layer of the anti-packet loss protocol layer at the sending end judges the received data frame according to the third preset rule, and confirms whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0049] In this embodiment S500, when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, the received data frame is judged according to the third preset rule. The third preset rule includes: when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, it judges that the instruction direction is the MCU anti-packet loss response, and further judges whether the command sequence number, operation type, and command word of the received data frame are the same as the command sequence number, operation type, and command word of the anti-packet loss information object in the anti-packet loss queue. When it is judged that they are the same, the whether the anti-packet loss mechanism of this anti-packet loss information object is valid field is set to invalid, and the response status is set to received confirmation reception response.

[0050] In some preferred embodiments, Figure 2, the sending end will also execute the timeout retransmission process in an independent thread, which specifically includes: first, judging whether the anti-packet loss queue is empty, if the anti-packet loss queue is not empty, traversing each anti-packet loss information object, then judging whether the response state is waiting for response, if it is waiting for response, increasing the response timeout, and finally judging whether the timeout is greater than the preset threshold, if it is greater than the preset threshold, retransmitting, and adding 1 to the number of retransmissions, and resetting the timeout to 0, if the number of retransmissions is greater than 3 times, then setting the response state to waiting timeout, and setting the field of whether the anti-packet loss mechanism is valid to invalid. In some preferred embodiments, if it is waiting for response, the response timeout is increased by 20 milliseconds, and finally judging whether the timeout is greater than the preset threshold, the preset threshold is 300 milliseconds.

[0051] In some preferred embodiments, the anti-packet loss protocol layer at the sending end needs to periodically reset the anti-packet loss information objects whose anti-packet loss mechanism is invalid in the anti-packet loss queue to default values, wherein the response status, number of retransmissions, timeout period, sequence number, and data frame length default values ​​are set to 0, the operation type and command word are reset to 0xFF, the storage space requested for the data content is released, and then the data is deleted from the queue.

[0052] The present embodiment discloses a method for anti-packet loss communication of an Internet of Vehicles terminal, comprising: defining an anti-packet loss communication protocol for communication between a sending end and a receiving end; according to the defined anti-packet loss communication protocol, the sending end sets the operation command and instruction direction in the anti-packet loss communication protocol according to demand; the anti-packet loss protocol layer interface of the sending end sets the unique sequence number of the current data frame according to the instruction direction of the current data frame, creates a new anti-packet loss information object, resets the anti-packet loss information object according to a first preset rule, and then adds the anti-packet loss information object to an anti-packet loss queue, and finally calls the serial port sending interface of the system to send the data frame to the receiving end of the Internet of Vehicles terminal; when the anti-packet loss protocol layer interface layer of the receiving end receives the data frame sent by the receiving end, the data frame is judged according to a second preset rule, and the anti-packet loss protocol layer interface layer of the receiving end replies the corresponding data frame to the sending end according to the judgment result; when the anti-packet loss protocol layer interface layer of the sending end receives the data frame sent by the receiving end, the received data frame is judged according to a third preset rule, and whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0053] This embodiment implements the timeout judgment and retransmission processing of data reception by adding an error-proof retransmission mechanism between the communication protocols of the sending end and the receiving end of the vehicle networking communication terminal. It avoids the problem of data packet reception failure caused by the data sender sending frame loss or the receiving end receiving frame leakage or thread blocking, increases the stability and reliability of inter-board communication, improves the efficiency and security of module application execution, and reduces the time and cost of troubleshooting such problems.

[0054] Example 2

[0055] In order to better understand the technical solution of the present invention, in Example 2, the MPU sends a VIN setting instruction to the MCU. Specifically, Figure 3 A method for preventing packet loss in a vehicle networking terminal. The transmitting end and the receiving end are respectively an MPU chip and an MCU chip. The MPU chip has 4G function or 5G function and runs an embedded Linux system. It can connect to the vehicle networking platform through the mobile Internet. The MPU chips available on the market include SIM7600CE module of SIMCom or EC20R2 module of Quectel. The MCU chips available on the market include KF32A152 module of Xinwang Microelectronics or S32K144 module of NXP Semiconductors. It can communicate with the electronic control unit ECU on the vehicle through the CAN bus. The hardware chip types are not limited to the chip types mentioned above.

[0056] When the MPU-side functional module wants to set the VIN data to the MCU-side, the operation type of the anti-packet loss communication protocol data frame is set to setting (for example, 0x00), the command word is set to calibrate VIN (for example, 0x02), and the specific content of VIN (for example, LGAG4DY32KXXICS0A) is filled into the data content field, and the instruction direction is set to main send (0x00). The complete anti-packet loss communication protocol data frame is saved in the serial port data sending queue, and the anti-packet loss protocol layer interface is called in an independent thread. The anti-packet loss protocol layer interface determines that the instruction direction of this data frame is main send, adds 1 to the SN (sequence code) field of the data frame, and creates a new anti-packet loss information data structure object, and assigns the operation type, command word, command sequence number, data length, data content and other information of the data frame to be sent to this anti-packet loss information object.

[0057] In this embodiment, as shown in Table 3, according to the anti-packet loss information data structure, the anti-packet loss mechanism validity (valid) field of the anti-packet loss information object is set to valid (1), the reply status (reply_sts) is set to waiting for reply (1), the number of retransmissions is set to 0, the timeout is set to 0, and then the anti-packet loss information object is added to the anti-packet loss queue, and finally the serial port sending interface of the Linux system is called to send the data frame to the MCU end of the Internet of Vehicles terminal.

[0058] Table 3 Anti-packet loss information data structure

[0059]

[0060]

[0061] When the anti-packet loss protocol layer interface layer on the MCU side receives the data frame sent by the MPU side, it determines that the value of the instruction direction field of this data frame is 0, which means it is the main TX instruction, and determines that the value of the command sequence number field is greater than 0. The anti-packet loss protocol layer interface layer on the MCU side immediately replies to the MPU side with a data frame whose instruction direction field is MCU anti-packet loss response (0x02). The operation type, command word, and command sequence number of the replied data frame need to be consistent with those sent by the MPU, and no data content needs to be carried.

[0062] When the MPU-side anti-packet loss protocol layer interface layer receives the data frame sent from the MCU, it determines that the instruction direction is the MCU anti-packet loss response (0x02), and further determines whether the command sequence number, operation type, and command word of the received data frame are the same as the command sequence number, operation type, and command word of the anti-packet loss information object in the anti-packet loss queue. If they are the same, the anti-packet loss mechanism of this anti-packet loss information object is set to invalid (0), and the response status (reply_sts) is set to received confirmation response (2).

[0063] Finally, the MPU-side application layer program needs to execute the timeout retransmission process in an independent thread. Specifically, it determines whether the anti-packet loss queue is empty. If not, it traverses each anti-packet loss information object to determine whether the response state is waiting for response. If so, it adds 20 milliseconds to the response timeout, and further determines whether the timeout is greater than 300 milliseconds. If it is greater than 300 milliseconds, it will retransmit, and increase the number of retransmissions by 1, and reset the timeout to 0. If the number of retransmissions is greater than 3 times, the response state is set to waiting timeout (3), and the anti-packet loss mechanism is valid (valid) The field is set to invalid (0), such as Figure 3 The MPU-side packet loss prevention protocol layer needs to reset the packet loss prevention information objects with invalid packet loss prevention mechanisms in the packet loss prevention queue to default values ​​at regular intervals (20-100 milliseconds), i.e., set the response status, number of retransmissions, timeout, sequence number, and data frame length to 0, reset the operation type and command word to 0xFF, release the storage space applied for the data content, and then delete it from the queue.

[0064] In this way, the entire process of setting VIN on the MPU side is completed, and other instructions such as querying information also follow the same sending and receiving process.

[0065] In the above example, the MPU is the sending end. If the MCU is the sending end, the process that needs to be executed on the MPU side is executed on the MCU side, and the process that needs to be executed on the MCU side is executed on the MPU side. This can also achieve the purpose of anti-packet loss sending.

[0066] Example 3

[0067] This embodiment discloses a system for anti-packet loss communication of a vehicle networking terminal, including: an anti-packet loss communication protocol definition module, a sending end and a receiving end, wherein:

[0068] The anti-packet loss communication protocol definition module is used to define the anti-packet loss communication protocol for communication between the sending end and the receiving end;

[0069] The sending end is an MCU chip or an MPU chip, which is used to set the operation commands and instruction directions in the anti-packet loss communication protocol according to the defined anti-packet loss communication protocol according to the needs, and save the complete anti-packet loss communication protocol data frame to the serial port data sending queue; it is also used to set the unique serial number of the current data frame according to the instruction direction of the current data frame, and create a new anti-packet loss information object, reset this anti-packet loss information object according to the first preset rule, and then add this anti-packet loss information object to the anti-packet loss queue, and finally call the system's serial port sending interface to send the data frame to the receiving end of the Internet of Vehicles terminal; it is also used to judge the received data frame according to the third preset rule when receiving the data frame sent by the receiving end, and confirm whether the anti-packet loss protocol data packet is sent successfully according to the judgment result.

[0070] The receiving end is an MCU chip or an MPU chip, which is used to judge the data frame according to the second preset rule when receiving the data frame sent by the receiving end. According to the judgment result, the receiving end anti-packet loss protocol layer interface layer replies to the sending end with the corresponding data frame.

[0071] Among them, the specific working methods of the anti-packet loss communication protocol definition module, the sending end and the receiving end have been introduced in detail in Example 1, and will not be repeated here.

[0072] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0073] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0074] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein can all be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above around their functions. Whether such functions are implemented as hardware or software depends on specific applications and the design constraints imposed on the entire system. A skilled person can implement the described functions in an alternative manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of the present disclosure.

[0075] The steps of the method or algorithm described in conjunction with the embodiments herein may be directly embodied as hardware, a software module executed by a processor, or a combination thereof. The software module may be located in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and the storage medium may also be present in a user terminal as discrete components.

[0076] For software implementation, the techniques described in this application can be implemented with modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or outside the processor. In the latter case, it is coupled to the processor in a communication manner via various means, which are well known in the art.

[0077] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

Claims

1. A method for preventing packet loss in vehicle networking terminal communication, characterized in that: include: S100. Define the anti-packet loss communication protocol for communication between the sender and the receiver; S200. According to the defined anti-packet loss communication protocol, the transmitter sets the operation command and instruction direction in the anti-packet loss communication protocol according to the demand, and saves the complete anti-packet loss communication protocol data frame to the serial port data transmission queue; S300. The anti-packet loss protocol layer interface of the sending end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, creates a new anti-packet loss information object, resets the anti-packet loss information object according to the first preset rule, then adds the anti-packet loss information object to the anti-packet loss queue, and finally calls the serial port sending interface of the system to send the data frame to the receiving end of the Internet of Vehicles terminal; In S300, the anti-packet loss protocol layer interface of the sending end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, specifically including: when the anti-packet loss protocol layer interface determines that the instruction direction of the data frame is the main send, the unique serial number of the data frame is increased by 1; In S300, the anti-packet loss information object is reset according to the first preset rule, and the first preset rule is: the operation type, command word, command serial number, data length, and data content information of the data frame to be sent are assigned to the anti-packet loss information object, and the anti-packet loss mechanism validity field of the anti-packet loss information object is set to valid, the response state is set to wait for response, the number of retransmissions is set to 0, and the timeout period is set to 0; S400. When the anti-packet loss protocol layer interface layer at the receiving end receives the data frame sent by the sending end, it judges the data frame according to the second preset rule, and replies the corresponding data frame to the sending end according to the judgment result; in S400, when the anti-packet loss protocol layer interface layer at the receiving end receives the data frame sent by the sending end, it judges the data frame according to the second preset rule, and the second preset rule includes: the anti-packet loss protocol layer interface layer at the receiving end judges the value of the instruction direction field of the data frame, and continues to judge whether the value of the command sequence number field is greater than 0. When the value of the instruction direction field is 0, representing the main sending instruction, and the value of the command sequence number field is greater than 0, the anti-packet loss protocol layer interface layer at the receiving end immediately replies to the sending end with a data frame whose instruction direction field value is MCU anti-packet loss response or MPU anti-packet loss response. The operation type, command word, and command sequence number of the replied data frame need to be consistent with those sent by the sending end, and no data content needs to be carried; S500. When the transmitting end anti-packet loss protocol layer interface layer receives the data frame sent by the receiving end, the received data frame is judged according to the third preset rule, and the anti-packet loss protocol data packet is confirmed to be sent successfully according to the judgment result; In S500, when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, it judges the received data frame according to the third preset rule. The third preset rule includes: when the anti-packet loss protocol layer interface layer at the sending end receives the data frame sent by the receiving end, it judges that the instruction direction is the MCU anti-packet loss response or the MPU anti-packet loss response, and further judges whether the command sequence number, operation type, and command word of the received data frame are the same as the command sequence number, operation type, and command word of the anti-packet loss information object in the anti-packet loss queue. When it is judged that they are the same, the whether the anti-packet loss mechanism of this anti-packet loss information object is valid field is set to invalid, and the response status is set to received confirmation reception response.

2. A method for preventing packet loss in vehicle networking terminal communication as claimed in claim 1, characterized in that: In S100, the sending end and the receiving end are MCU chips or MPU chips; an anti-packet loss communication protocol for communication between the sending end and the receiving end is defined, wherein the anti-packet loss communication protocol consists of eight parts: frame header, check type, data length, instruction direction, command sequence number, operation command, data content and check bit.

3. A method for preventing packet loss in vehicle networking terminal communication as claimed in claim 2, characterized in that: In S200, the sending end sets the operation command and instruction direction in the anti-packet loss communication protocol according to the needs, where the operation command includes the operation type and the command word, and the instruction direction includes the main sender, MCU anti-packet loss response and MPU anti-packet loss response.

4. A method for preventing packet loss in vehicle networking terminal communication as claimed in claim 1, characterized in that: The sending end will also execute the timeout retransmission process in an independent thread, which specifically includes: first determine whether the anti-packet loss queue is empty. If the anti-packet loss queue is not empty, traverse each anti-packet loss information object, and then determine whether the response status is waiting for response. If it is waiting for response, increase the response timeout time, and finally determine whether the timeout time is greater than the preset threshold. If it is greater than the preset threshold, retransmit, increase the number of retransmissions by 1, and reset the timeout time to 0. If the number of retransmissions is greater than 3 times, the response status is set to waiting timeout, and the field of whether the anti-packet loss mechanism is valid is set to invalid.

5. The method for preventing packet loss in vehicle networking terminal communication as claimed in claim 1, characterized in that: The anti-packet loss protocol layer at the sending end needs to periodically reset the anti-packet loss information objects in the anti-packet loss queue whose anti-packet loss mechanism is invalid to the default values, where the response status, number of retransmissions, timeout, sequence number, and data frame length default values ​​are set to 0, the operation type and command word are reset to 0xFF, the storage space applied for the data content is released, and then it is deleted from the queue.

6. A system for preventing packet loss in vehicle networking terminals, characterized in that: include: The anti-packet loss communication protocol defines the module, the sender, and the receiver, where: The anti-packet loss communication protocol definition module is used to define the anti-packet loss communication protocol for communication between the sending end and the receiving end; The sending end is an MCU chip or an MPU chip, which is used to set the operation command and instruction direction in the anti-packet loss communication protocol according to the defined anti-packet loss communication protocol according to the requirements, and save the complete anti-packet loss communication protocol data frame to the serial port data sending queue; it is also used to set the unique sequence number of the current data frame according to the instruction direction of the current data frame, and create a new anti-packet loss information object, reset the anti-packet loss information object according to the first preset rule, and then add the anti-packet loss information object to the anti-packet loss queue, and finally call the system's serial port sending interface to send the data frame to the receiving end of the Internet of Vehicles terminal; it is also used to judge the received data frame according to the third preset rule when receiving the data frame sent by the receiving end, and confirm whether the anti-packet loss protocol data packet is sent successfully according to the judgment result; Among them, the anti-packet loss protocol layer interface of the sending end sets the unique serial number of the current data frame according to the instruction direction of the current data frame, specifically including: when the anti-packet loss protocol layer interface determines that the instruction direction of this data frame is the main send, the unique serial number of the data frame is added by 1; the first preset rule is: the operation type, command word, command sequence number, data length, and data content information of the data frame to be sent are assigned to this anti-packet loss information object, and the anti-packet loss mechanism of this anti-packet loss information object is set to valid, the response state is set to waiting for response, the number of retransmissions is set to 0, and the timeout time is set to 0; the third preset rule includes: when the anti-packet loss protocol layer interface layer of the sending end receives the data frame sent by the receiving end, it determines that the instruction direction is MCU anti-packet loss response or MPU anti-packet loss response, and further determines whether the command sequence number, operation type, and command word of the received data frame are the same as the command sequence number, operation type, and command word of the anti-packet loss information object in the anti-packet loss queue. When it is determined that they are the same, the anti-packet loss mechanism of this anti-packet loss information object is set to invalid. The response state is set to receive a confirmation reception response; The receiving end is an MCU chip or an MPU chip, which is used to judge the data frame according to the second preset rule when receiving the data frame sent by the receiving end, and the receiving end anti-packet loss protocol layer interface layer replies the corresponding data frame to the sending end according to the judgment result; Among them, the second preset rule includes: the anti-packet loss protocol layer interface layer at the receiving end determines the value of the instruction direction field of this data frame, and continues to determine whether the value of the command sequence number field is greater than 0. When the value of the instruction direction field is 0, representing the main sending instruction, and the value of the command sequence number field is greater than 0, the anti-packet loss protocol layer interface layer at the receiving end immediately replies to the sending end with a data frame whose instruction direction field value is MCU anti-packet loss response or MPU anti-packet loss response. The operation type, command word, and command sequence number of the replied data frame need to be consistent with those sent by the sending end, and there is no need to carry data content.

Citation Information

Patent Citations

  • Protocol communication method and system thereof

    CN102438012A