A method and device for improving the quality of Can data transparent transmission
Patent Information
- Application Number
- CN202211468434.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-11-22
AI Technical Summary
一种采用UDP方式,这种方式解决了数据延迟的问题,一般延迟达到30-50ms,但会导致新的问题是udp网络传送可能丢失数据包和数据包没有按照次序到达
[0036] Compared with the existing technology, the beneficial effects of the present invention are: transparent transmission of data according to the method defined in the present invention can realize effective transparent transmission of CAN data on a network with a UDP data packet loss rate of 1%-2%. It can meet the remote diagnosis requirements of most current professional diagnostic instruments.
Smart Images

Figure CN115776357B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method and a device for improving the quality of Can data transparent transmission. Background Art
[0002] Realizing CAN data transparent transmission is very meaningful in the scenario of vehicle remote diagnosis. In order to realize vehicle remote diagnosis, there are generally two ways: 1. Connect a professional diagnostic instrument to the faulty vehicle, and the professional diagnostic instrument parses the data and interacts with the remote technician-side software through the network. This method requires professional diagnostic instrument manufacturers to transform existing diagnostic instruments to realize remote functions. 2. Install CAN transparent transmission device A and transparent transmission device B. Transparent transmission device A is installed on the faulty vehicle on site, and transparent transmission device B is installed on the technician side. When in use, the technician connects the connector of the diagnostic device to the transparent transmission device B through the OBDII interface, so that it can interact with the faulty vehicle remotely as if using a diagnostic instrument locally.
[0003] The prior art has the following problems:
[0004] Device A and device B communicate through the network. The communication method uses TCP or UDP protocol. One uses the TCP protocol. Although TCP transmission can ensure no packet loss and the order of data packet transmission, under general network conditions, the TCP mechanism will delay too long, especially when using mobile networks, the delay may reach hundreds of milliseconds. International standard vehicle diagnostic protocols such as ISO14229 have clear delay definitions for CAN communication, and the delay between continuous CAN frames is generally no more than 200ms. Therefore, the TCP communication method is obviously not suitable for this scenario. One uses UDP, which solves the problem of data delay. The general delay reaches 30-50ms, but it will cause new problems. UDP network transmission may lose data packets and data packets do not arrive in order.
[0005] In summary, the present invention provides a method and device for improving the quality of Can data transparent transmission. Summary of the invention
[0006] The object of the present invention is to provide a method and device for improving the quality of Can data transparent transmission to ensure the orderly and timely transmission of data packets.
[0007] To achieve the above object, the present invention provides the following technical solution: a method for improving the quality of Can data transparent transmission, the method comprising:
[0008] Step S100 encapsulates each CAN data frame, adds a data packet header, CAN data serial number and CRC check;
[0009] Step S200: The transparent transmission device sets a receiving buffer and a sending buffer;
[0010] Step S300: The transparent transmission device numbers each data received from the Can bus in a circular manner from (0 to 254) (after 254, the next Can data number is 0), encapsulates the frame according to the number and puts it into the corresponding position in the sending buffer array; and sends the frame through the network interface at the same time;
[0011] Step S400: The transparent transmission device receives a data frame from the network interface and checks the integrity of the frame data according to the frame definition;
[0012] Step S500 After receiving the control frame, the transparent transmission device finds the corresponding frame from the position of lostidbeg in the sending buffer array, and sends all frames from lostidBeg to LostidEnd through the network again;
[0013] In step S600, if the transparent transmission device still fails to receive a frame with a correct number 200ms after sending a control frame, the missing number is skipped and the device is set to be in a synchronous state.
[0014] As a preferred embodiment of the present invention, the Can data frame format is as follows:
[0015] Byte 1, 0x24; Byte 2, flowid; Byte 3-Byte 14, Can data frame; Byte 15, CRC check code; the frame with flowid 255 is a control frame; control frames are used to distinguish data frames.
[0016] As a preferred embodiment of the present invention, the receiving buffer in step S200 stores the data frames received from the network UDP interface, and the sending buffer stores the CAN data obtained from the CAN bus. Both the sending buffer and the receiving buffer are defined as 255*15 arrays.
[0017] As a preferred embodiment of the present invention, the detailed steps of step S400 are as follows:
[0018] If the frame data is complete, it is placed in the corresponding array position in the receive buffer according to the flowid number in the frame; if the flowid of the frame is the flowid+1 of the previous frame received, it is judged to be continuous and is sent to the CAN network immediately.
[0019] As a preferred implementation scheme described in the present invention, some frames may be lost in step S400 due to network transmission reasons, resulting in discontinuous received numbers; after the transparent transmission device determines that the frames are discontinuous, it immediately sends a control frame to the other party.
[0020] As a preferred implementation scheme of the present invention, the control frame format is as follows:
[0021] Byte 1, 0x24; Byte 2, 0xff; Byte 3, 0x01; Byte 4, LostidBeg; Byte 5, LostidEnd; Byte 6-Byte 14, empty; Byte 15, CRC check code; 0x1 in Byte 3 indicates the supplementary data control frame; Byte 4 is the start frame number missing by the receiver, Byte 5 is the currently received number, and the frames between the two are lost frames.
[0022] As a preferred embodiment of the present invention, the method further includes a synchronization control frame, which is used to enable the communicating parties to maintain synchronization at the beginning of communication or after the communication is interrupted for a period of time. The specific use steps are as follows:
[0023] When one party in communication determines that no data has been received for more than 500ms, it sends a synchronization frame to the other party. Byte 3 0x02 in the synchronization frame indicates that this frame is a synchronization control frame. Byte 4 synId indicates the frame number of the next data to be sent by this party. After the other party receives the synchronization frame, synId defaults to the next received frame number, so that both parties can keep in sync and will not be mistakenly judged as frame loss.
[0024] The format of the synchronization control frame is as follows: byte 1, 0x24; byte 2, 0xff; byte 3, 0x02; byte 4, synId; byte 5-byte 14, empty; byte 15, Crc check code.
[0025] As a preferred embodiment of the present invention, the process flow of sending the receiving buffer to the Can bus in this method is as follows:
[0026] The receiving buffer reads frame data from the UDP port and sends it to the Can network;
[0027] I. After receiving the latest data frame, put the frame into the position i of the receive buffer list according to the sequence number i of byte 2 of the data frame;
[0028] II. Determine whether byte 1 of the data frame at position i in the send list is 0x42. If it is 0x42, return to step I and wait for a new frame to be read;
[0029] III. If it is not 0xff, send the current frame data to the CAN network, and set byte 1 to 0x42, which means that this data has been sent to the CAN network; and i=i+1; return to step II.
[0030] As a preferred embodiment of the present invention, in this method, the process of sending the sending buffer to the network bus is as follows: the sending buffer reads data from the CAN network, and puts each Can data frame into the corresponding sending buffer according to the number (0-254 cycle);
[0031] I. Monitor Can network and
[0032] II. Receive the latest CAN data frame, number it as i in sequence, and put the frame into position i in the send buffer list;
[0033] III. Monitor the retransmission frame signal. If a retransmission data frame is received, go to step IV. Otherwise, send the data frame at the current position i and mark the first byte of the frame as 0x42 (indicating that it has been sent), i=i+1; return to step I.
[0034] IV. Determine whether the first bytes of the data frames between LostidBeg and LostidEnd in the resent data frames are all 0x42; if they are all 0x42, it means that the data of these frames can be sent; send these frames to the network in sequence; otherwise, it means that the data in the buffer has been updated, the buffer data has expired and the frame resending operation cannot be performed; return to step I.
[0035] A device for improving the quality of Can data transparent transmission, wherein the device is used to execute the above method.
[0036] Compared with the prior art, the beneficial effects of the present invention are: by performing data transparent transmission according to the method defined in the present invention, on a network with a UDP data packet loss rate of 1%-2%, effective transparent transmission of CAN data can be achieved, which can meet the remote diagnosis requirements of most current professional diagnostic instruments. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention.
[0038] Figure 1 A schematic diagram of an application scenario of a method and a device for improving the quality of Can data transparent transmission according to the present invention;
[0039] Figure 2 A Can data frame encapsulation format diagram of a method and device for improving Can data transparent transmission quality according to the present invention;
[0040] Figure 3 A control frame format diagram of a method and device for improving the quality of Can data transparent transmission according to the present invention;
[0041] Figure 4 A synchronous control frame format diagram of a method and device for improving the quality of Can data transparent transmission according to the present invention. DETAILED DESCRIPTION
[0042] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0043] See also Figure 1-Figure 4 The present invention provides a method for improving the quality of Can data transparent transmission, the method comprising:
[0044] Step S100 encapsulates each CAN data frame, adds a data packet header, CAN data serial number and CRC check;
[0045] Step S200: The transparent transmission device sets a receiving buffer and a sending buffer;
[0046] Step S300: The transparent transmission device numbers each data received from the Can bus in a circular manner from (0 to 254) (after 254, the next Can data number is 0), encapsulates the frame according to the number and puts it into the corresponding position in the sending buffer array; and sends the frame through the network interface at the same time;
[0047] Step S400: The transparent transmission device receives a data frame from the network interface and checks the integrity of the frame data according to the frame definition;
[0048] Step S500 After receiving the control frame, the transparent transmission device finds the corresponding frame from the position of lostidbeg in the sending buffer array, and sends all frames from lostidBeg to LostidEnd through the network again;
[0049] In step S600, if the transparent transmission device still fails to receive a frame with a correct number 200ms after sending a control frame, the missing number is skipped and the device is set to be in a synchronous state.
[0050] As a preferred embodiment of the present invention, the Can data frame format is as follows:
[0051] Byte 1, 0x24; Byte 2, flowid; Byte 3-Byte 14, Can data frame; Byte 15, CRC check code; the frame with flowid 255 is a control frame; control frames are used to distinguish data frames.
[0052] As a preferred embodiment of the present invention, the receiving buffer in step S200 stores the data frames received from the network UDP interface, and the sending buffer stores the CAN data obtained from the CAN bus. Both the sending buffer and the receiving buffer are defined as 255*15 arrays.
[0053] As a preferred embodiment of the present invention, the detailed steps of step S400 are as follows:
[0054] If the frame data is complete, it is placed in the corresponding array position in the receive buffer according to the flowid number in the frame; if the flowid of the frame is the flowid+1 of the previous frame received, it is judged to be continuous and is sent to the CAN network immediately.
[0055] As a preferred implementation scheme described in the present invention, some frames may be lost in step S400 due to network transmission reasons, resulting in discontinuous received numbers; after the transparent transmission device determines that the frames are discontinuous, it immediately sends a control frame to the other party.
[0056] As a preferred implementation scheme of the present invention, the control frame format is as follows:
[0057] Byte 1, 0x24; Byte 2, 0xff; Byte 3, 0x01; Byte 4, LostidBeg; Byte 5, LostidEnd; Byte 6-Byte 14, empty; Byte 15, CRC check code; 0x1 in Byte 3 indicates the supplementary data control frame; Byte 4 is the start frame number missing by the receiver, Byte 5 is the currently received number, and the frames between the two are lost frames.
[0058] As a preferred embodiment of the present invention, the method further includes a synchronization control frame, which is used to enable the communicating parties to maintain synchronization at the beginning of communication or after the communication is interrupted for a period of time. The specific use steps are as follows:
[0059] When one party in communication determines that no data has been received for more than 500ms, it sends a synchronization frame to the other party. Byte 3 0x02 in the synchronization frame indicates that this frame is a synchronization control frame. Byte 4 synId indicates the frame number of the next data to be sent by this party. After the other party receives the synchronization frame, synId defaults to the next received frame number, so that both parties can keep in sync and will not be mistakenly judged as frame loss.
[0060] The format of the synchronization control frame is as follows: byte 1, 0x24; byte 2, 0xff; byte 3, 0x02; byte 4, synId; byte 5-byte 14, empty; byte 15, Crc check code.
[0061] As a preferred embodiment of the present invention, the process flow of sending the receiving buffer to the Can bus in this method is as follows:
[0062] The receiving buffer reads frame data from the UDP port and sends it to the Can network;
[0063] I. After receiving the latest data frame, put the frame into the position i of the receive buffer list according to the sequence number i of byte 2 of the data frame;
[0064] II. Determine whether byte 1 of the data frame at position i in the send list is 0x42. If it is 0x42, return to step I and wait for a new frame to be read;
[0065] III. If it is not 0xff, send the current frame data to the CAN network, and set byte 1 to 0x42, which means that this data has been sent to the CAN network; and i=i+1; return to step II.
[0066] As a preferred embodiment of the present invention, in this method, the process of sending the sending buffer to the network bus is as follows: the sending buffer reads data from the CAN network, and puts each Can data frame into the corresponding sending buffer according to the number (0-254 cycle);
[0067] I. Monitor Can network and
[0068] II. Receive the latest CAN data frame, number it as i in sequence, and put the frame into position i in the send buffer list;
[0069] III. Monitor the retransmission frame signal. If a retransmission data frame is received, go to step IV. Otherwise, send the data frame at the current position i and mark the first byte of the frame as 0x42 (indicating that it has been sent), i=i+1; return to step I.
[0070] IV. Determine whether the first bytes of the data frames between LostidBeg and LostidEnd in the resent data frames are all 0x42; if they are all 0x42, it means that the data of these frames can be sent; send these frames to the network in sequence; otherwise, it means that the data in the buffer has been updated, the buffer data has expired and the frame resending operation cannot be performed; return to step I.
[0071] Example:
[0072] Please refer to the instruction manual Figure 1-4 , where the actual use process of this method is as follows:
[0073] 1. Encapsulate each CAN data frame, add the data packet header, CAN data serial number and CRC check, the encapsulation format is as follows Figure 2, where the frame with flowid 255 is a control frame. Control frames are used to distinguish data frames.
[0074] 2. The transparent transmission device sets a receiving buffer and a sending buffer. The receiving buffer stores the data frames received from the network UDP interface. The sending buffer is the CAN data obtained from the CAN bus. Both the sending buffer and the receiving buffer are defined as 255*15 arrays.
[0075] 3. Each data received by the transparent transmission device from the CAN bus is numbered in a circular manner from (0-254) (after 254, the next CAN data number is 0), and the frame is encapsulated according to the number and placed in the corresponding position in the send buffer array. At the same time, the frame is sent through the network interface.
[0076] 4. The transparent transmission device receives the data frame from the network interface and verifies the integrity of the frame data according to the frame definition. If it is complete, it is placed in the corresponding array position in the receiving buffer according to the flowid number in the frame. If the flowid of the frame is the flowid+1 of the previous frame received, it is judged that the number is continuous and is sent to the CAN network immediately. Due to network transmission reasons, some frames may be lost, resulting in discontinuous received numbers. After the transparent transmission device determines that the frame is discontinuous, it immediately sends a control frame to the other party. The control frame format is as follows Figure 3 .
[0077] 0x1 in byte 3 indicates a supplementary data control frame. Byte 4 is the start frame number that the receiver missed, byte 5 is the number currently received, and the frames between the two are lost frames.
[0078] 5. After receiving the control frame, the transparent transmission device finds the corresponding frame from the position of lostidbeg in the send buffer array, and sends all frames from lostidBeg to LostidEnd through the network again.
[0079] 6. If the transparent transmission device fails to receive the frame with the correct number within 200ms after sending the control frame, the missing number will be skipped and the device will be set to be in the synchronous state.
[0080] 7. The synchronous control frame format is as follows Figure 4 .
[0081] In order to keep both parties in sync at the beginning of communication or after a period of interruption, a synchronization frame is required. When one party determines that no data has been received for more than 500ms, it sends a synchronization frame to the other party. Byte 30x02 in the synchronization frame indicates that this frame is a synchronization control frame. Byte 4 synId indicates the frame number from which the party will start to send data next. After the other party receives the synchronization frame, the default synId is the frame number received next, so that both parties can keep in sync and will not be mistakenly judged as frame loss.
[0082] 8. Processing of receiving buffer and sending to Can bus:
[0083] The receiving buffer reads frame data from the UDP port and sends it to the Can network:
[0084] I. Receive the latest data frame and put the frame into position i of the receive buffer list according to the sequence number i of byte 2 of the data frame.
[0085] II. Determine whether byte 1 of the data frame at position i in the send list is 0x42. If it is 0x42, return to step I and wait for a new frame to be read.
[0086] III. If it is not 0xff, send the current frame data to the CAN network, and set byte 1 to 0x42 (indicating that this data has been sent to the CAN network). And i=i+1; return to step II.
[0087] 9. Send buffer to the network bus process.
[0088] The sending buffer reads data from the CAN network and puts each CAN data frame into the corresponding sending buffer according to the number (0-254 cycle).
[0089] I. Monitor Can network and
[0090] II. Receive the latest CAN data frame, number it as i in sequence, and put the frame into position i in the send buffer list.
[0091] III. Monitor the retransmission frame signal. If a retransmission data frame is received, go to step IV. Otherwise, send the data frame at the current position i. Mark the first byte of the frame as 0x42 (indicating that it has been sent), i=i+1; return to step I.
[0092] IV. Determine whether the first byte of the data frames between LostidBeg and LostidEnd in the resent data frame is 0x42. If they are all 0x42, it means that the data of these frames can be sent. Send these frames to the network in sequence. Otherwise, it means that the data in the buffer has been updated, and the buffer data has expired and cannot be resent. Return to step I.
[0093] In summary, data transparent transmission according to this definition can achieve effective transparent transmission of CAN data on a network with a UDP packet loss rate of 1%-2%, which can meet the remote diagnosis requirements of most current professional diagnostic instruments.
[0094] Exemplarily, the processor takes out instructions one by one from the memory, analyzes the instructions, and then completes the corresponding operations according to the instruction requirements, generating a series of control commands, so that the various parts of the computer automatically, continuously and coordinately move to become an organic whole, realize the input of programs, the input of data, and the calculation and output of results. The arithmetic operations or logical operations generated in this process are all completed by the operator; the memory includes a read-only memory (ROM), which is used to store computer programs, and a protection device is provided outside the memory.
[0095] Exemplarily, the computer program may be divided into one or more modules, one or more modules are stored in a memory and executed by a processor to implement the present invention. One or more modules may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in a terminal device.
[0096] Those skilled in the art will understand that the description of the above service equipment is merely an example and does not constitute a limitation on the terminal equipment. It may include more or fewer components than described above, or a combination of certain components, or different components, for example, it may include input and output devices, network access devices, buses, etc.
[0097] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire user terminal.
[0098] The memory can be used to store computer programs and / or modules. The processor can realize various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as an information collection template display function, a product information release function, etc.); the data storage area can store data created according to the use of the berth status display system (such as product information collection templates corresponding to different product types, product information that different product providers need to release, etc.). In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0099] If the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the modules / units in the above-mentioned embodiment system, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can realize the functions of the above-mentioned various system embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0100] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0101] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for improving the quality of CAN data transparent transmission, characterized in that: The method comprises: Step S100 encapsulates each CAN data frame, adds a data packet header, CAN data serial number and crc check; Step S200: both transparent transmission device A and transparent transmission device B set a receiving buffer and a sending buffer; Step S300: Transmit device A receives each data from the CAN bus in a cyclic numbering sequence of 0-254. After reaching 254, the next CAN data is numbered 0. After the frame is encapsulated according to the number, it is placed in the corresponding position in the send buffer array; and the frame is sent through the network interface at the same time; Step S400: Transparent transmission device B receives a data frame from the network interface and checks the integrity of the frame data according to the frame definition; Step S500 After the transparent transmission device A receives the control frame, it finds the corresponding frame from the position of lostidbeg in the send buffer array, and sends all frames from lostidBeg to LostidEnd through the network again; Step S600: If transparent transmission device B fails to receive a frame with the correct number 200ms after sending the control frame, it skips the missing number and sets it to be in a synchronous state; the CAN data frame format is as follows: Byte 1, 0x24; Byte 2, flowid; Byte 3-Byte 14, CAN data frame; Byte 15, CRC check code; the frame with flowid 255 is a control frame; the control frame is used to distinguish the data frame; In step S200, the receiving buffer stores the data frames received from the network UDP interface; the sending buffer is the CAN data obtained from the CAN bus; the sending buffer and the receiving buffer are both defined as 255*15 arrays; The detailed steps of step S400 are as follows: If the frame data is complete, it is placed in the corresponding array position in the receive buffer according to the flowid number in the frame; if the flowid of the frame is the flowid of the previous frame received + 1, it is judged that the number is continuous and is sent to the CAN network immediately; In the step S400, some frames may be lost due to network transmission reasons, resulting in discontinuous received numbers; when the transparent transmission device B determines that the frames are discontinuous, it immediately sends a control frame to the transparent transmission device A; The control frame format is as follows: Byte 1, 0x24; Byte 2, 0xff; Byte 3, 0x01; Byte 4, LostidBeg; Byte 5, LostidEnd; Byte 6-Byte 14, empty; Byte 15, Crc check code; 0x01 in Byte 3 indicates the supplementary data control frame; Byte 4 is the start frame number missing by the receiver, Byte 5 is the number currently received, and the frames between the two are lost frames; The method also includes a synchronization control frame, which is used to enable the communicating parties to maintain synchronization at the beginning of communication or after the communication is interrupted for a period of time. The specific use steps are as follows: When one party in communication determines that no data has been received for more than 500ms, it sends a synchronization frame to the other party. Byte 3 0x02 in the synchronization frame indicates that this frame is a synchronization control frame. Byte 4 synId indicates the frame number of the next data to be sent by this party. After the other party receives the synchronization frame, synId defaults to the next received frame number, so that both parties can keep in sync and will not be mistakenly judged as frame loss. The format of the synchronization control frame is as follows: Byte 1, 0x24; Byte 2, 0xff; Byte 3, 0x02; Byte 4, synId; Byte 5-Byte 14, empty; Byte 15, Crc check code; In this method, the process flow of sending the receiving buffer to the CAN bus is as follows: The receiving buffer reads frame data from the UDP port and sends it to the CAN network; I. After receiving the latest data frame, put the frame into the position i of the receive buffer list according to the sequence number i of byte 2 of the data frame; II. Determine whether byte 1 of the data frame at position i in the send list is 0x42. If it is 0x42, return to step I and wait for a new frame to be read. Otherwise, continue to execute III. III. If it is not 0xff, send the current frame data to the CAN network, and set byte 1 to 0x42, which means that this data has been sent to the CAN network; and i=i+1; return to step II; In this method, the process of sending the send buffer to the network bus is as follows: the send buffer reads data from the CAN network and puts each CAN data frame into the corresponding send buffer according to the 0-254 circular number; I. Monitor CAN bus and network II. Receive the latest CAN data frame, number it as i in sequence, and put the frame into position i in the send buffer list; III. Monitor the network retransmission frame signal. If a retransmission data frame is received, go to step IV. Otherwise, send the data frame at the current position i and mark the first byte of the frame as 0x42, indicating that it has been sent, i=i+1; return to step I. IV. Determine whether the first bytes of the data frames between LostidBeg and LostidEnd in the resent data frames are all 0x42; if they are all 0x42, it means that the data of these frames can be sent; send these frames to the network in sequence; otherwise, it means that the data in the buffer has been updated, the buffer data has expired and the frame resending operation cannot be performed; return to step I.
2. A device for improving the quality of CAN data transparent transmission, characterized in that: The device is used to execute the method according to claim 1.
