Can bus packet transmission method and apparatus, electronic device, storage medium and vehicle
By splitting and splicing long messages to transmit short messages, combined with the three-layer transmission protocol and half-duplex reply method, the compatibility problem of long messages and short messages on the CAN bus is solved, and efficient and reliable communication of on-board equipment is achieved.
Patent Information
- Application Number
- PCT/CN2024/115117
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-05
- Filing Date
- 2024-08-28
- Publication Date
- 2025-07-10
AI Technical Summary
The existing CAN bus message transmission method cannot effectively handle the compatibility of long messages and short messages on the same bus platform. Especially in on-board devices, long messages cannot be transmitted with single-frame CAN messages, resulting in the inability to meet the communication requirements.
By setting up a transmission protocol, long messages are split into short messages and sent on the sending end, and long messages are spliced on the receiving end. The three-layer transmission protocols of the link layer, network layer and application layer are processed, including data splitting of the link layer, address definition of the network layer and endian verification of the application layer, and data transmission is carried out in combination with half-duplex reply.
It realizes compatible transmission of long messages and short messages on the CAN bus, reduces the compatibility difficulty between new and old systems, and ensures the reliability and efficiency of communication.
Smart Images

Figure CN2024115117_10072025_PF_FP_ABST
Abstract
Description
CAN bus message transmission method, device, electronic device, storage medium and vehicle Technical Field
[0001] The present application relates to the field of data transmission, and in particular to a CAN bus message transmission method, a CAN bus message transmission device, an electronic device, a storage medium and a vehicle. Background Art
[0002] CAN bus is currently a popular communication bus. Due to its safety, reliability and excellent performance, it is gradually being used in the field of vehicle-mounted equipment.
[0003] The CAN bus commonly uses a single-frame transmission length of 8 bytes. However, as vehicle architectures evolve and the communication mechanisms of various electronic systems within vehicles change, the amount of data transmitted is also increasing. The 8-byte transmission length of the CAN bus single-frame transmission length no longer meets the communication needs of certain modules and specific scenarios for single long message data transmission. In certain specific scenarios, there is a need for long message data transmission, that is, a single frame of data exceeds 8 bytes. For example, such messages exist in the data exchange between ETC and the cockpit host. In this case, the long message cannot be transmitted within a single CAN message frame. Since devices that transmit long and short messages coexist on the same vehicle, the messages need to be processed.
[0004] Therefore, a solution for CAN bus message transmission of vehicle-mounted equipment is needed, so that long messages and short messages can be smoothly transmitted on the same bus platform.
[0005] Summary of the Invention
[0006] The object of the present invention is to provide a CAN bus message transmission method, a CAN bus message transmission device, an electronic device, a storage medium and a vehicle, so as to solve at least one of the above-mentioned technical problems.
[0007] The present invention provides the following solutions:
[0008] According to one aspect of the present invention, a CAN bus message transmission method is provided, the CAN bus message transmission method comprising:
[0009] Set the transmission protocol;
[0010] The transmission protocol includes the following steps: the sending end splits the long message into short messages and then sends them; the receiving end receives the short messages and then splices them into long messages;
[0011] in,
[0012] The sending end splits the long message to be sent according to the preset length of the short message;
[0013] in,
[0014] The receiving end verifies the short message according to a preset verification protocol for verifying the short message;
[0015] The receiving end checks the long message according to a preset check protocol for checking the long message.
[0016] Furthermore, the transmission protocol also includes: a link layer transmission protocol, a network layer transmission protocol and an application layer transmission protocol;
[0017] At the sending end, user data is split into short messages and sent via the application layer transmission protocol, network layer transmission protocol, and link layer transmission protocol;
[0018] At the receiving end, the short messages are spliced together through the link layer transmission protocol, network layer transmission protocol and application layer transmission protocol to restore the user data.
[0019] Furthermore, the link layer transmission protocol includes:
[0020] The sender obtains the long message data;
[0021] Determine whether the length of the long message data is less than 8 bytes;
[0022] If the length of the long message data is less than 8 bytes, the long message will be ignored;
[0023] If the length of the long message data is greater than or equal to 8 bytes, the length field of the short message data is 8 bytes, and the long message is split;
[0024] in,
[0025] The part of the split short message that is less than 8 bytes is filled with 0;
[0026] The receiving end splices the received short messages according to the order in which the long messages are split to obtain the short messages, and generates a long message.
[0027] Furthermore, the network layer transmission protocol includes:
[0028] Split the user data field into the first frame and single frame;
[0029] in,
[0030] Generate the first frame from the 1st to 6th bytes of the user data field;
[0031] The data after the 7th byte of the user data field is generated into a single frame.
[0032] Furthermore, the application layer transmission protocol includes:
[0033] Long message data uses little-endian byte order;
[0034] in,
[0035] The long message bytes include message ID byte, segment number byte, data byte and check byte;
[0036] The message ID byte is located at the first byte of the long message;
[0037] The segment number byte is located at the second byte of the long message;
[0038] The check byte is located at the end byte of the long message;
[0039] The data bytes are located between the segment sequence number bytes and the check bytes.
[0040] Furthermore, it is characterized in that the network layer transmission protocol also includes: using a half-duplex response mode for data transmission;
[0041] in,
[0042] After the first frame of data is transmitted by the sending end, the receiving end feeds back the flow control data;
[0043] Transmit single frame data based on the flow control data received by the sender.
[0044] According to two aspects of the present invention, a CAN bus message transmission device is provided, the CAN bus message transmission device comprising:
[0045] A transmission protocol module is used to set a transmission protocol, wherein the transmission protocol includes a sending end splitting a long message into short messages and then sending them, and a receiving end splicing the short messages into long messages after receiving them;
[0046] The message splitting module is used for the sending end to split the long message to be sent according to the preset length of the short message;
[0047] A short message verification module is used for the receiving end to verify the short message according to a preset verification protocol for verifying the short message;
[0048] The long message verification module is used for the receiving end to verify the long message according to the preset verification protocol for verifying the long message.
[0049] According to three aspects of the present invention, there is provided an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0050] The memory stores a computer program, which, when executed by the processor, enables the processor to execute the steps of the CAN bus message transmission method.
[0051] According to four aspects of the present invention, a computer-readable storage medium is provided, comprising: a computer program executable by an electronic device is stored therein, and when the computer program runs on the electronic device, the electronic device executes the steps of the CAN bus message transmission method.
[0052] According to five aspects of the present invention, there is provided a vehicle comprising:
[0053] An electronic device, used to implement the steps of the CAN bus message transmission method;
[0054] a processor, wherein the processor runs a program, and when the program runs, the steps of the CAN bus message transmission method are executed based on the data output by the electronic device;
[0055] The storage medium is used to store a program, and when the program is running, it executes the steps of the CAN bus message transmission method for data output from the electronic device.
[0056] Through the above solution, the following beneficial technical effects are achieved:
[0057] This application divides long messages into short messages and transmits the short messages uniformly on the CAN bus, so that old platforms can be easily compatible with new equipment, and vehicles will not be troubled by the problem of message length when upgrading new on-board equipment.
[0058] This application splices short messages into long messages and verifies the spliced long messages. Under the premise of using a short message platform, the communication mechanism between devices remains unchanged, reducing the compatibility difficulty between new and old systems on the CAN bus.
[0059] This application effectively ensures the reliability and efficiency of messages by performing double verification when converting between long and short messages, and can also perform single long message verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] FIG1 is a flowchart of a CAN bus message transmission method provided by one or more embodiments of the present invention.
[0061] FIG2 is a structural diagram of a CAN bus message transmission device provided by one or more embodiments of the present invention.
[0062] FIG3 is a schematic diagram of a three-layer transmission protocol according to a specific embodiment of the present invention.
[0063] FIG4 is a schematic diagram of a transmission timing of a half-duplex response mode according to a specific embodiment of the present invention.
[0064] FIG5 is a schematic diagram of application layer long message packetization according to a specific embodiment of the present invention.
[0065] FIG6 is a schematic diagram of long message packetization at the network layer according to a specific embodiment of the present invention.
[0066] FIG7 is a block diagram of an electronic device structure of a CAN bus message transmission method provided by one or more embodiments of the present invention. DETAILED DESCRIPTION
[0067] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0068] FIG1 is a flowchart of a CAN bus message transmission method provided by one or more embodiments of the present invention.
[0069] The CAN bus message transmission method shown in FIG1 includes:
[0070] Step S1, setting a transmission protocol, the transmission protocol includes: the sending end splits the long message into short messages and sends them, and the receiving end receives the short messages and splices them into long messages;
[0071] Step S2: The sending end splits the long message to be sent according to the preset length of the short message;
[0072] Step S3, the receiving end verifies the short message according to a preset verification protocol for verifying the short message;
[0073] Step S4: The receiving end checks the long message according to a preset check protocol for checking long messages.
[0074] Specifically, the transmission protocol involves three layers: the data link layer, the network layer, and the application layer. Based on these three layers, the sending end obtains message information from the application layer. After the long message at the network layer is received, it is split into short messages. These short messages are sent at the link layer. The receiving end then receives the short messages and splices them into long messages, allowing the application layer to obtain the long message. The receiving end can verify each short message at the link layer, and the spliced long message at the network layer.
[0075] In this embodiment, the transmission protocol also includes: a link layer transmission protocol, a network layer transmission protocol and an application layer transmission protocol;
[0076] At the sending end, user data is split into short messages and sent via the application layer transmission protocol, network layer transmission protocol, and link layer transmission protocol;
[0077] At the receiving end, the short messages are spliced together through the link layer transmission protocol, network layer transmission protocol and application layer transmission protocol to restore the user data.
[0078] Specifically, device A is the transmitter and device B is the receiver. For device A to transmit information to device B, the data must first be translated into a message at the application layer. This message is generated based on the device's own protocol and is a long message at the network layer. However, the CAN bus channel through which devices A and B interact uses short 8-byte messages. Therefore, the long message must be split into short messages and transmitted from device A to device B at the link layer to enable information exchange between devices A and B.
[0079] In this embodiment, the link layer transmission protocol includes:
[0080] The sender obtains the long message data;
[0081] Determine whether the length of the long message data is less than 8 bytes;
[0082] If the length of the long message data is less than 8 bytes, the long message will be ignored;
[0083] If the length of the long message data is greater than or equal to 8 bytes, the length field of the short message data is 8 bytes, and the long message is split;
[0084] in,
[0085] The part of the split short message that is less than 8 bytes is filled with 0;
[0086] The receiving end splices the received short messages according to the order in which the long messages are split to obtain the short messages, and generates a long message.
[0087] Specifically, if the length of an individual message is less than 8 bytes, it indicates that it is an invalid long message, not a standard short message, and is otherwise invalid data on the bus and can be discarded. Only message fragments less than 8 bytes generated during the splitting of a long message are valid data, and the missing parts can be padded with zeros. The receiver directly receives only short messages and generates a long message by splicing the received short messages in the order in which they were split. The split sequence information can be sent in the first frame. The receiver then splices the short messages based on the first frame to generate a complete long message.
[0088] In this embodiment, the network layer transmission protocol includes:
[0089] Split the user data field into the first frame and single frame;
[0090] in,
[0091] Generate the first frame from the 1st to 6th bytes of the user data field;
[0092] The data after the 7th byte of the user data field is generated into a single frame.
[0093] Specifically, the user data starts from DATA1 of the FF frame, that is, the FF frame transmits the first six bytes of user data. Starting from the seventh byte, the user data is stored in DATA1 to DATA7 of the CF frame.
[0094] In this embodiment, the application layer transport protocol includes:
[0095] Long message data uses little-endian byte order;
[0096] in,
[0097] The long message bytes include message ID byte, segment number byte, data byte and check byte;
[0098] The message ID byte is located at the first byte of the long message;
[0099] The segment number byte is located in the second byte of the long message;
[0100] The check byte is located at the end of the long message;
[0101] The data bytes are located between the segment number byte and the check byte.
[0102] Specifically, the long message bytes include the message ID byte, the segment number byte, the data byte and the check byte. The ID byte is used to mark the split long message, the segment number byte marks the number of the split short message, the data byte carries valid data, and the check byte checks the spliced long bytes, which is equivalent to directly checking the long bytes to prevent errors during the splicing process at the receiving end.
[0103] In this embodiment, the network layer transmission protocol further includes: using a half-duplex response mode for data transmission;
[0104] in,
[0105] After the first frame of data is transmitted by the sending end, the receiving end feeds back the flow control data;
[0106] Transmit single frame data based on the flow control data received by the sender.
[0107] Specifically, a half-duplex response mode is adopted for data transmission on the CAN bus. The sending end completes the transmission of the first frame of data, and the receiving end feeds back the flow control data, which is equivalent to establishing a handshake between the sending end and the receiving end. After that, data transmission is carried out to ensure the effective transmission of data.
[0108] Flow control data is transmitted between device B and device A in flow control frames, so that each short message is sent from device A to device B in a preset rhythm sequence.
[0109] FIG2 is a structural diagram of a CAN bus message transmission device provided by one or more embodiments of the present invention.
[0110] The CAN bus message transmission device shown in FIG2 includes: a transmission protocol module, a message splitting module, a short message check module, and a long message check module;
[0111] The transmission protocol module is used to set the transmission protocol. The transmission protocol includes the following steps: the sender splits the long message into short messages and sends them, and the receiver receives the short messages and splices them into long messages;
[0112] The message splitting module is used for the sending end to split the long message to be sent according to the preset length of the short message;
[0113] A short message verification module is used for the receiving end to verify the short message according to a preset verification protocol for verifying the short message;
[0114] The long message verification module is used for the receiving end to verify the long message according to the preset verification protocol for verifying the long message.
[0115] It is worth noting that although this system only discloses a transmission protocol module, a message splitting module, a short message verification module, and a long message verification module, relatively speaking, what the present invention wants to express is that, based on the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with the existing technology to form an infinite number of embodiments or technical solutions. In other words, this system is open rather than closed. Just because this embodiment only discloses individual basic functional modules, it cannot be considered that the scope of protection of the claims of the present invention is limited to the above-mentioned basic functional modules.
[0116] Through the above solution, the following beneficial technical effects are achieved:
[0117] This application divides long messages into short messages and transmits the short messages uniformly on the CAN bus, so that old platforms can be easily compatible with new equipment, and vehicles will not be troubled by the problem of message length when upgrading new on-board equipment.
[0118] This application splices short messages into long messages and verifies the spliced long messages. Under the premise of using a short message platform, the communication mechanism between devices remains unchanged, reducing the compatibility difficulty between new and old systems on the CAN bus.
[0119] This application effectively ensures the reliability and efficiency of messages by performing double verification when converting between long and short messages, and can also perform single long message verification.
[0120] FIG3 is a schematic diagram of a three-layer transmission protocol according to a specific embodiment of the present invention.
[0121] FIG4 is a schematic diagram of a transmission timing of a half-duplex response mode according to a specific embodiment of the present invention.
[0122] FIG5 is a schematic diagram of application layer long message packetization according to a specific embodiment of the present invention.
[0123] FIG6 is a schematic diagram of long message packetization at the network layer according to a specific embodiment of the present invention.
[0124] In one specific embodiment, a depacketization and repacketization method is used to send and receive long messages. This involves splitting the long message into multiple CAN frames at the transmitter and then reassembling the long message after receiving the multiple CAN frames and verifying their correctness. As shown in Figure 3, this embodiment involves three layers of transport protocols: the data link layer, the network layer, and the application layer.
[0125] In the link layer transmission protocol, based on the CAN standard frame transmission, the length field is fixed to 8, and any part less than 8 bytes is filled with 0. Any frame with a length field less than 8 will be ignored.
[0126] In the network layer transmission protocol, the transmission address is defined as shown in Table 1. As can be seen in Table 1, the protocol uses the CAN ID address of the CAN standard frame 11 bits.
[0127] Table 1
[0128] As shown in Figure 4, during the interaction between devices, the protocol uses a half-duplex response mode for transmission, that is, the receiver must respond to each frame of data from the sender and reply with a flow control packet. After receiving the flow control packet (flow control frame) from the receiver, the sender continues to transmit the next frame.
[0129] Table 2 defines the control information in the protocol, and Table 3 defines the information flag bits used to describe information such as data frame length, sequence number, and type.
[0130] Table 2
[0131] Table 3
[0132] When processing the user data field, the user data starts from DATA1 of the FF frame, that is, the FF frame transmits the first six bytes of user data. Starting from the seventh byte, the user data is stored in DATA1 to DATA7 of the CF frame.
[0133] In the application layer transmission protocol, the little endian byte order is used for byte order.
[0134] Table 4 shows the definition of long message data. Long message data is divided into the following three parts. The Sub-Function ID, or the message ID of the long message, is negotiated between the two users. For example, it can be 0x76 or 0x77. The Sub-Function ID is the first byte of the user's long message. Segment No. Because the FF frame length field (FF_DL) is 12 bits, the maximum size of a segment is 4095 bytes. However, long message data can be very large. When the data size of a long message exceeds 4095 bytes, it must be sent in segments. The segment number starts at 1 and increases segment by segment, with the last segment number being 0. If the long message has only one segment, the segment number is 0.
[0135] Figures 5 and 6 show the application layer packet and the network layer long packet. Sub-Function data represents data, and Check represents checksum. The check byte is placed at the last byte of the entire data packet. CRC8 checksum is used, starting from Byte 1 and continuing to the byte before Check.
[0136] The definition of the reply message ID is shown in Table 4.
[0137] Table 4
[0138] The reply message length is 3 bytes. The definition of the reply message data is shown in Table 5.
[0139] Table 5
[0140] The receiver can ignore all unsupported data packets and only receive data packets agreed upon by both parties.
[0141] If the FF_DL length received by the receiver does not match the actual data length, or the checksum is incorrect, the receiver will reply with a reception error (01). Otherwise, the receiver will reply with a reception correct (00).
[0142] If the sender receives an error response from the receiver, it needs to stop the current transmission and resend the erroneous segment packet, setting the maximum number of retransmissions allowed to 3.
[0143] FIG7 is a block diagram of an electronic device structure of a CAN bus message transmission method provided by one or more embodiments of the present invention.
[0144] As shown in FIG5 , the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0145] A computer program is stored in the memory. When the computer program is executed by the processor, the processor executes the steps of a CAN bus message transmission method.
[0146] The present application also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of a CAN bus message transmission method.
[0147] The present application also provides a vehicle, comprising:
[0148] An electronic device for implementing the steps of a CAN bus message transmission method;
[0149] a processor, wherein the processor runs a program and, when the program runs, executes the steps of the CAN bus message transmission method based on data output by the electronic device;
[0150] The storage medium is used to store a program, and when the program is running, it executes the steps of the CAN bus message transmission method for data output from the electronic device.
[0151] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0152] The electronic device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory. The operating system can be any one or more computer operating systems that control electronic devices through processes, such as the Linux operating system, the Unix operating system, the Android operating system, the iOS operating system, or the Windows operating system. In the embodiments of the present invention, the electronic device can be a handheld device such as a smartphone or a tablet computer, or an electronic device such as a desktop computer or a portable computer, which is not particularly limited in the embodiments of the present invention.
[0153] The execution subject of the electronic device control in the embodiment of the present invention can be an electronic device, or a functional module in the electronic device that can call a program and execute the program. The electronic device can obtain the firmware corresponding to the storage medium. The firmware corresponding to the storage medium is provided by the supplier. The firmware corresponding to different storage media can be the same or different, and is not limited here. After the electronic device obtains the firmware corresponding to the storage medium, it can write the firmware corresponding to the storage medium into the storage medium, specifically, burn the firmware corresponding to the storage medium into the storage medium. The process of burning the firmware into the storage medium can be implemented using existing technology and will not be described in detail in the embodiment of the present invention.
[0154] The electronic device can also obtain a reset command corresponding to the storage medium. The reset command corresponding to the storage medium is provided by the supplier. The reset commands corresponding to different storage media can be the same or different, and are not limited here.
[0155] In this case, the storage medium of the electronic device is a storage medium in which the corresponding firmware is written. The electronic device can respond to the reset command corresponding to the storage medium in which the corresponding firmware is written, thereby resetting the storage medium in which the corresponding firmware is written according to the reset command corresponding to the storage medium. The process of resetting the storage medium according to the reset command can be implemented in the existing technology and will not be described in detail in the embodiments of the present invention.
[0156] For the convenience of description, the above devices are described as various units and modules according to their functions. Of course, when implementing this application, the functions of each unit and module can be implemented in the same or multiple software and / or hardware.
[0157] Those skilled in the art will understand that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art in the art to which the present invention pertains. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with those in the context of the prior art and, unless specifically defined, will not be interpreted in an idealized or overly formal sense.
[0158] For simplicity of description, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because certain steps can be performed in other orders or simultaneously according to the embodiments of the present invention. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0159] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application or certain parts of the embodiments.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A CAN bus message transmission method, characterized in that, The described CAN bus message transmission method includes: Setting the transmission protocol; The transmission protocol includes that the sending end splits a long message into short messages and then sends them, and the receiving end splices the short messages into a long message after receiving them; Among them, The sending end splits the long message to be sent according to the preset length of the short message; Among them, The receiving end verifies the short message according to the preset verification protocol for verifying the short message; The receiving end verifies the long message according to the preset verification protocol for verifying the long message.
2. The CAN bus message transmission method according to claim 1, wherein The transmission protocol further includes: link layer transmission protocol, network layer transmission protocol, and application layer transmission protocol; At the sending end, the user data is split into short messages and sent through the application layer transmission protocol, network layer transmission protocol, and link layer transmission protocol; At the receiving end, the short messages are spliced through the link layer transmission protocol, network layer transmission protocol, and application layer transmission protocol to restore the user data.
3. The CAN bus message transmission method according to claim 2, wherein The link layer transmission protocol includes: The sending end obtains the long message data; Judging whether the length of the long message data is less than 8 bytes; If the length of the long message data is less than 8 bytes, then ignore the long message; If the length of the long message data is greater than or equal to 8 bytes, the corresponding length field of the short message data is 8 bytes, and the long message is split; Among them, The part of the split short message that is less than 8 bytes is filled with 0; The receiving end splices the received short messages according to the order of splitting the long message to generate a long message.
4. The CAN bus message transmission method according to claim 2, wherein The network layer transmission protocol includes: Splitting the fields of the user data into a first frame and single frames; Among them, Generating a first frame from the data of the 1st to 6th bytes of the user data field; Generating single frames from the data after the 7th byte of the user data field.
5. The CAN bus message transmission method according to claim 2, wherein The application layer transmission protocol includes: The long message data adopts little-endian byte order; Among them, The long message bytes include a message ID byte, a segment sequence number byte, data bytes, and a check byte; The message ID byte is located at the first byte of the long message; The segment sequence number byte is located at the 2nd byte of the long message; The check byte is located at the last byte of the long message; The data bytes are located between the segment sequence number byte and the check byte.
6. The CAN bus message transmission method according to claims 2 to 5, characterized in that The network layer transmission protocol further includes: using a half-duplex response method for data transmission; Among them, According to the completion of the transmission of the first frame data at the sending end, the receiving end feeds back flow control data; According to the sending end receiving the flow control data, single frame data is transmitted.
7. A CAN bus message transmission device, characterized in that, The CAN bus message transmission device includes: A transmission protocol module for setting the transmission protocol, where the transmission protocol includes that the sending end splits a long message into short messages and then sends them, and the receiving end splices the short messages into a long message after receiving them; A message splitting module for the sending end to split the long message to be sent according to the preset length of the short message; A short message verification module for the receiving end to verify the short message according to the preset verification protocol for verifying the short message; A long message verification module for the receiving end to verify the long message according to the preset verification protocol for verifying the long message.
8. An electronic device, characterized in that, Includes: A processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the CAN bus message transmission method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Includes: It stores a computer program that can be executed by an electronic device. When the computer program runs on the electronic device, it causes the electronic device to execute the steps of the CAN bus message transmission method according to any one of claims 1 to 6.
10. A vehicle, characterized in that, It includes: An electronic device for implementing the steps of the CAN bus message transmission method according to any one of claims 1 to 6; A processor that runs a program. When the program runs, it executes the steps of the CAN bus message transmission method according to any one of claims 1 to 6 on the data output from the electronic device; A storage medium for storing a program. When the program runs, it executes the steps of the CAN bus message transmission method according to any one of claims 1 to 6 on the data output from the electronic device.
Citation Information
Patent Citations
Coding method for CAN bus long message transmission
CN107919947A
Protocol stack communication method and device based on CAN bus and storage medium
CN113079074A
Method and device for transmitting CAN (Controller Area Network) message of electric vehicle
CN114422289A
Data transmission method and device of vehicle-mounted network, control equipment and automobile
CN114666760A
CAN bus message transmission method and device, electronic equipment, storage medium and vehicle
CN117857545A