Message generation method, device, medium and equipment

By generating a target message sequence that meets the preset conditions, CAN bus message encoding is optimized, and the problem of lengthening caused by filling bits is solved, transmission efficiency is improved and electromagnetic radiation interference is reduced.

CN117955770BActive Publication Date: 2024-12-24XIAOMI EV TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410175923.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-07
Publication Date
2024-12-24
Estimated Expiration
2044-02-07

AI Technical Summary

Technical Problem

A large number of padding bits in the communication packets of the CAN bus cause the length of the packet to grow, reducing transmission efficiency.

Method used

By generating a target message sequence that meets preset conditions, limiting the message length, and using the threshold relationship between Mason's rotation algorithm and fill encoding to optimize message encoding to ensure that the message length is as short as possible.

Benefits of technology

It improves the transmission efficiency of the CAN bus, reduces electromagnetic radiation interference, and avoids the problem of excessive coding length caused by filling bits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117955770B_ABST
    Figure CN117955770B_ABST
Patent Text Reader

Abstract

The present disclosure provides a message generation method, device, medium and equipment, which relate to the field of communication technology. The message generation method includes: determining a message to be encoded, and generating a target message sequence that meets a preset condition according to the message to be encoded, wherein the preset condition is used to limit the length of the target message sequence. The present disclosure limits the length of the target message sequence by preset conditions, so that the final message length can be shortened as much as possible, thereby improving the transmission efficiency of the CAN bus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a message generation method, device, medium and equipment. Background Art

[0002] When encoding the communication message of the CAN bus (Controller Area Network), if a preset number of identical bits appear in a message format, such as a data frame and a remote frame, padding bits will be inserted into the code stream actually sent. A large number of padding bits may cause the message length to become longer, reducing the transmission efficiency of the CAN bus. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides a message generation method, device, medium and equipment.

[0004] According to a first aspect of an embodiment of the present disclosure, a message generation method is provided, including:

[0005] Determine the message to be encoded;

[0006] A target message sequence satisfying a preset condition is generated according to the message to be encoded, wherein the preset condition is used to limit the length of the target message sequence.

[0007] Optionally, generating a target message sequence satisfying a preset condition according to the message to be encoded includes:

[0008] Generate a sequence of messages to be confirmed according to the message to be encoded;

[0009] Determining whether the message sequence to be confirmed meets the preset condition;

[0010] When the message sequence to be confirmed does not meet the preset condition, returning to the step of generating a message sequence to be confirmed according to the message to be encoded, until the message sequence to be confirmed meets the preset condition;

[0011] The target message sequence is obtained according to the message sequence to be confirmed that meets the preset condition.

[0012] Optionally, the sequence of messages to be confirmed includes a padding code of unused bits, and determining whether the sequence of messages to be confirmed meets the preset condition includes:

[0013] When the run number of the padding code is less than a first threshold, determining that the message sequence to be confirmed meets the preset condition;

[0014] When the number of runs of the padding code is greater than or equal to the first threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0015] Optionally, the sequence of messages to be confirmed includes a padding code of unused bits, and determining whether the sequence of messages to be confirmed meets the preset condition includes:

[0016] Determine a first target number of first type codes in the padding code, the first type codes being codes having a run number greater than a second threshold;

[0017] It is determined whether the sequence of messages to be confirmed meets the preset condition according to the relationship between the first target quantity and the first quantity threshold.

[0018] Optionally, determining whether the to-be-confirmed message sequence satisfies the preset condition according to a magnitude relationship between the first target quantity and a first quantity threshold includes:

[0019] When the first target number is less than the first number threshold, determining that the message sequence to be confirmed meets the preset condition;

[0020] When the first target number is greater than or equal to the first number threshold, it is determined that the sequence of messages to be confirmed does not meet the preset condition.

[0021] Optionally, the sequence of messages to be confirmed includes a padding code of unused bits, and determining whether the sequence of messages to be confirmed meets the preset condition includes:

[0022] Determining a target second quantity threshold according to the target number of unused bits and a preset relationship between the number of unused bits in the message sequence and the second quantity threshold;

[0023] According to the second target number of the second type code in the filling code and the target second number threshold, it is determined whether the message sequence to be confirmed meets the preset condition, and the second type code is a code with a run number greater than a third threshold.

[0024] Optionally, determining whether the message sequence to be confirmed meets a preset condition according to the second target number that the number of runs of the padding code is greater than a third threshold and the target second number threshold includes:

[0025] When the second target number is less than the target second number threshold, determining that the message sequence to be confirmed meets the preset condition;

[0026] When the second target number is greater than or equal to the target second number threshold, it is determined that the to-be-confirmed message sequence does not meet the preset condition.

[0027] Optionally, generating a sequence of messages to be confirmed according to the message to be encoded includes:

[0028] The message sequence to be confirmed is generated according to the message to be encoded by using a Mersenne twister algorithm.

[0029] Optionally, after generating a target message sequence satisfying a preset condition according to the message to be encoded, the method further includes:

[0030] The target message sequence is stored in a target message table.

[0031] Optionally, the method further comprises:

[0032] The target message sequence to be transmitted is determined from the target message table and transmitted to the target controller, and the target controller is determined according to the address segment in the target message sequence.

[0033] According to a second aspect of an embodiment of the present disclosure, a message generating device is provided, including:

[0034] A determination module, configured to determine a message to be encoded;

[0035] The generating module is configured to generate a target message sequence satisfying a preset condition according to the message to be encoded, wherein the preset condition is used to limit the length of the target message sequence.

[0036] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the message generation method provided by the first aspect of the embodiment of the present disclosure is implemented.

[0037] According to a fourth aspect of an embodiment of the present disclosure, a device is provided, including:

[0038] A storage device for storing a computer program;

[0039] An execution device is used to execute the computer program to implement the message generation method provided in the first aspect of the embodiment of the present disclosure.

[0040] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0041] The present invention generates a target message sequence that meets preset conditions through a message to be encoded, and the preset conditions are used to limit the length of the target message sequence. In this way, by limiting the length of the target message sequence through the preset conditions, the final message length can be shortened as much as possible, which can improve the transmission efficiency of the CAN bus.

[0042] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0044] Figure 1 The figure is a flow chart of a message generating method according to an exemplary embodiment.

[0045] Figure 2 It is a schematic diagram showing components of a target message sequence or a message sequence to be confirmed according to an exemplary embodiment.

[0046] Figure 3 The figure is a flowchart of another message generating method according to an exemplary embodiment.

[0047] Figure 4 It is a schematic diagram of simulation results of a first mode of padding coding according to an exemplary embodiment.

[0048] Figure 5 It is a schematic diagram of simulation results of a second padding encoding method according to an exemplary embodiment.

[0049] Figure 6 It is a schematic diagram of simulation results of padding coding of unused bits obtained by the message generation method of the present disclosure according to an exemplary embodiment.

[0050] Figure 7 The present invention is a block diagram of a message generating device according to an exemplary embodiment.

[0051] Figure 8 It is a block diagram of a device according to an exemplary embodiment. DETAILED DESCRIPTION

[0052] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0053] In the related art, the message length for communication between CAN bus networks can be 8, 12, 16, 20, 24, 32, 48, or 64 bits, while the message length for communication on the CANFD bus (CAN with Flexible Data-Rate) can be increased to 512 bits. In the same communication network, messages of the same length are generally used for communication. The actual message length often does not fill the entire message length, and there are unused bits. For example, if the valid message is only 5 bits, a 64-bit message will still be used for transmission, and the remaining 59 bits are unused bits. Among them, the unused bits can be filled with 0 or 1.

[0054] The CAN bus is encoded according to the NRZ (Non-Return to Zero) method. To ensure the synchronization of the system, if there are multiple consecutive identical bits including padding bits in the data frame or remote frame, for example, 5 consecutive identical bits, padding bits will be inserted into the actual transmitted code stream, and the padding bits are the inverse value of the previous bit. If continuous 0 or 1 is used as padding for unused bits, a large number of padding bits may cause the message length to become longer. The longer the message length, the longer the transmission time, thus reducing the transmission efficiency of the CAN bus.

[0055] See also Figure 1 , Figure 1 is a flow chart of a message generation method according to an exemplary embodiment. Figure 1 As shown, the message generation method includes the following steps.

[0056] In step S101, a message to be encoded is determined.

[0057] In step S102, a target message sequence satisfying a preset condition is generated according to the message to be encoded, where the preset condition is used to limit the length of the target message sequence.

[0058] For example, the message generation method can be implemented by MCU (Micro Controller Unit, microcontroller), or can be implemented by other controllers, and can further be implemented by multiple controllers inside a device that communicates through a bus network. The message to be encoded includes data or instructions that may be used when controllers communicate with each other, etc. The bits used in the encoding length of the message to be encoded in the entire message generally cannot fill the entire preset message length. The target message sequence is a string of pseudo-random codes that can be generated by a preset algorithm. The target message sequence is generated based on the message to be encoded, and it can be considered that the target message sequence includes the code corresponding to the message to be encoded.

[0059] For example, the preset condition is used to limit the length of the target message sequence, and can be set according to actual needs. For example, the preset condition can be set to the target message sequence length is less than a preset value, or the preset condition can be set to the number of runs of unused bits in the target message sequence is less than a run number threshold, and can also be set to the number of target coding types of unused bits is less than a preset number threshold, wherein the target coding type is a coding with a run number less than the run number threshold.

[0060] The present invention generates a target message sequence that meets preset conditions through a message to be encoded, and the preset conditions are used to limit the length of the target message sequence. In this way, by limiting the length of the target message sequence through the preset conditions, the final message length can be shortened as much as possible, which can improve the transmission efficiency of the CAN bus.

[0061] As an optional embodiment, generating a target message sequence satisfying a preset condition according to the message to be encoded includes:

[0062] Generate a sequence of messages to be confirmed according to the messages to be encoded;

[0063] Determine whether the message sequence to be confirmed meets the preset conditions;

[0064] When the message sequence to be confirmed does not meet the preset condition, return to the step of generating the message sequence to be confirmed according to the message to be encoded, until the message sequence to be confirmed meets the preset condition;

[0065] The target message sequence is obtained according to the message sequence to be confirmed that meets the preset conditions.

[0066] For example, refer to Figure 2 , Figure 2 The components of the target message sequence or the message sequence to be confirmed are shown, wherein the message to be encoded is located at the front end of the target message sequence or the message sequence to be confirmed, and in the target message sequence or the message sequence to be confirmed, except for the message to be encoded, there are padding codes for unused bits. It can be understood that when the message to be encoded is included in the message sequence to be confirmed, if a preset number of consecutive identical bits appear, padding bits are added after the same bits, and when the code is filled in the unused bits, if a preset number of consecutive identical bits appear in the filled code, padding bits are also added after the same bits, which causes the length of the message after the final encoding to exceed the original preset message length.

[0067] For example, a string of pseudo-random codes may be generated according to the message to be encoded, and the string of pseudo-random codes includes the message to be encoded. The pseudo-random codes are used as the message sequence to be confirmed, and whether the preset conditions are met is further determined. When the message sequence to be confirmed does not meet the preset conditions, the message sequence to be confirmed is regenerated according to the message to be encoded until the message sequence to be confirmed meets the preset conditions. When the message sequence to be confirmed meets the preset conditions, the message sequence to be confirmed that meets the preset conditions can be confirmed as the target message sequence.

[0068] For example, only one string of pseudo-random codes is generated at a time, and a string of pseudo-random codes is repeatedly generated according to the message to be encoded until the generated pseudo-random codes meet the preset conditions, thereby obtaining the target message sequence. It can be understood that the message sequence to be confirmed is different each time.

[0069] In addition, a reminder mechanism can be set according to the duration or number of times the generation task is executed to remind the user that the duration of generating the target message sequence is too long or the number of times is too many, so that the user can readjust the preset conditions according to the reminder and actual situation.

[0070] In an achievable implementation manner, the message sequence to be confirmed includes a padding code of unused bits, and determining whether the message sequence to be confirmed meets a preset condition includes:

[0071] When the number of runs of the padding code is less than the first threshold, determining that the message sequence to be confirmed meets the preset condition;

[0072] When the number of runs of the padding code is greater than or equal to the first threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0073] For example, the run number refers to the number of identical numbers that appear consecutively in a sequence. Since in the encoding method of the related art, when the run number is greater than or equal to 5, padding bits are added, the first threshold value can be a number less than 5, but in order to ensure the randomness of the encoding, the first threshold value is set to 5. Therefore, when the run number of the padding code is less than 5, it is determined that the message sequence to be confirmed meets the preset condition; when the run number of the padding code is greater than or equal to 5, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0074] In another achievable implementation manner, the message sequence to be confirmed includes a padding code of unused bits, and determining whether the message sequence to be confirmed meets a preset condition includes:

[0075] Determine a first target number of first type codes in the filling code, the first type codes being codes having a run number greater than a second threshold;

[0076] It is determined whether the sequence of messages to be confirmed meets a preset condition according to a relationship between the first target quantity and the first quantity threshold.

[0077] For example, the first type of coding represents a coding with a run number greater than the second threshold. In the related art, when the run number is greater than or equal to 5, padding bits are added during message coding. In addition, the randomness of the coding with a run number less than 2 is poor. Therefore, the second threshold can be less than 5, for example, 3 or 4. In order to ensure randomness, the second threshold can be set to 4. The first target number is the number of the first type of coding in the padding coding. The first number threshold can be set according to the actual situation. For example, when the preset message length of the target message sequence is fixed to 64 bits, the first number threshold can be set to 5-12, and can be further set to 8.

[0078] As an optional embodiment, determining whether the sequence of messages to be confirmed meets a preset condition according to a magnitude relationship between the first target quantity and the first quantity threshold includes:

[0079] When the first target number is less than the first number threshold, determining that the message sequence to be confirmed meets a preset condition;

[0080] When the first target number is greater than or equal to the first number threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0081] For example, when the first target number is less than the first number threshold, it can be determined that the message sequence to be confirmed meets the preset condition; when the first target number is greater than or equal to the first number threshold, it can be determined that the message sequence to be confirmed does not meet the preset condition. As an example, the preset message length is 64 bits, when the number of codes with a run number greater than 4 in the padding code is less than 8, it can be determined that the message sequence to be confirmed meets the preset condition; when the number of codes with a run number greater than 4 in the padding code is greater than or equal to 8, it can be determined that the message sequence to be confirmed does not meet the preset condition.

[0082] For example, taking the preset message length fixed to 12 bits and the first quantity threshold value of 2 as an example, if the message to be encoded is "0110", a string of 14-bit pseudo-random codes "01100000111110" is generated as the coding sequence to be confirmed, and the 9th bit "1" and the 14th bit "0" are padding bits. Among them, the number of codes with a run number greater than 4 in the padding code here is 2, and it can be determined that the message sequence to be confirmed does not meet the preset conditions; if a string of 13-bit pseudo-random codes "0110000011101" is generated as the coding sequence to be confirmed, the 9th bit "1" is a padding bit, so that the number of codes with a run number greater than 4 in the padding code is 1, and it can be determined that the message sequence to be confirmed meets the preset conditions. If the padding code is the last 7 bits, the number of codes with a run number greater than 4 in the padding code here is 1, and it can be determined that the message sequence to be confirmed meets the preset conditions. Similarly, if the message to be encoded is "011000", the pseudo-random code "01100000111110" is used as the coding sequence to be confirmed, the "1" in the 9th bit and the "0" in the 14th bit are filling bits, and the number of codes with a run number greater than 4 in the filling code here is 1, and it can also be determined that the message sequence to be confirmed meets the preset conditions.

[0083] As another achievable implementation manner, the message sequence to be confirmed includes a padding code of unused bits, and determining whether the message sequence to be confirmed meets a preset condition includes:

[0084] Determining a target second quantity threshold according to a target number of unused bits and a preset relationship between the number of unused bits in the message sequence and the second quantity threshold;

[0085] According to the second target number of the second type code in the filling code and the target second number threshold, it is determined whether the message sequence to be confirmed meets the preset condition, and the second type code is a code with a run number greater than the third threshold.

[0086] For example, the second type of coding characterizes the coding whose run number is greater than the third threshold. Among them, in the coding method of the related art, when the run number is greater than or equal to 5, padding bits are added, and the randomness of the coding whose run number is less than 2 is poor. Therefore, the third threshold can be less than 5, for example, it can be 3 or 4, and further to ensure randomness, the third threshold can be set to 4. The second target number is the number of the second type of coding in the padding coding, and the target second number threshold can be set according to the target number of unused bits, and the preset relationship between the number of unused bits in the message sequence and the second number threshold.

[0087] For example, the length of the message to be encoded may be different during message encoding, so that the number of unused bits is different. For example, when the preset message length is 64 bits, if the length of the message to be encoded is 5 bits, the target number of unused bits is 59 bits, and if the length of the message to be encoded is 36 bits, the target number of unused bits is 18 bits. Therefore, the threshold value can be set for the number of second type codes in the padding code according to the target number of unused bits, and the preset relationship between the number of unused bits in the message sequence and the second quantity threshold. Here, the preset relationship can be set according to the actual needs of the user. For example, the preset relationship can be set to a positive correlation, that is, the more the number of unused bits, the larger the target second quantity threshold, so that when the target number of unused bits is large, the target message sequence can be obtained as quickly as possible, and when the target number of unused bits is small, the target message sequence can be shortened as much as possible.

[0088] As an example, the target second quantity threshold value can be determined according to the target number of bits interval in which the target number of unused bits is located. Among them, if the target number of unused bits is in the first digit interval, the target second quantity threshold value is the first numerical value, if the target number of unused bits is in the second digit interval, the target second quantity threshold value is the second numerical value, the value of the first digit interval is less than the value of the second digit interval, and the first numerical value is less than the second numerical value. For example, when the first digit interval is 12-24 bits and the second digit interval is 24-36 bits, correspondingly, the first numerical value can be set to 4 and the second numerical value can be set to 8. The data examples here are only examples, and the number of target digit intervals and the number of second quantity threshold values ​​can be set according to actual conditions and are not intended to limit the present disclosure.

[0089] As an optional embodiment, determining whether the message sequence to be confirmed meets a preset condition according to the second target number that the number of runs of the padding code is greater than the third threshold and the target second number threshold includes:

[0090] When the second target number is less than the target second number threshold, determining that the message sequence to be confirmed meets the preset condition;

[0091] When the second target number is greater than or equal to the target second number threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0092] For example, when the second target number is less than the target second number threshold, it can be determined that the sequence of messages to be confirmed meets the preset condition; when the second target number is greater than or equal to the target second number threshold, it can be determined that the sequence of messages to be confirmed does not meet the preset condition.

[0093] As an example, when the preset message length is fixed to 16 bits and the target second quantity threshold is 2, and the message to be encoded is "0011", if a string of 19-bit pseudo-random codes "0011111000001111100" is generated as the coding sequence to be confirmed, the "0" at the 8th bit, the "1" at the 13th bit, and the "0" at the 18th bit are padding bits. Among them, the number of codes with a run number greater than 4 in the padding code here is 3, and it can be determined that the message sequence to be confirmed does not meet the preset conditions. If a string of 17-bit pseudo-random codes "00110000011101100" is generated as the coding sequence to be confirmed, the "1" at the 10th bit is a padding bit, and thus, the number of codes with a run number greater than 4 in the padding code is 1, it can be determined that the message sequence to be confirmed meets the preset conditions.

[0094] Referring to all the above examples, the larger the number of codes with a run number greater than 4 in the padding code, the longer the length of the generated code sequence to be confirmed. Therefore, through reasonable preset conditions, the length of the target code sequence can be shortened, and the time length for generating the target message sequence can also be reasonably controlled.

[0095] As an optional embodiment, generating a sequence of messages to be confirmed according to the message to be encoded includes:

[0096] According to the message to be encoded, a sequence of messages to be confirmed is generated by the Mersenne Twister algorithm.

[0097] For example, the Mersenne twister algorithm is a pseudo-random number generation algorithm based on matrix linear recursion on a finite binary field. It can quickly generate high-quality pseudo-random numbers and correct many defects of the classical random number generation algorithm. The entire algorithm is mainly divided into three stages: obtaining the basic Mersenne twister chain; performing the twister algorithm on the twister chain; and the third stage: processing the results obtained by the twister algorithm.

[0098] As an optional embodiment, after generating a target message sequence satisfying a preset condition according to the message to be encoded, the method further includes:

[0099] The target message sequence is stored in the target message table.

[0100] For example, the target message sequence generated by using the message to be encoded can be stored in the target message table, wherein each controller can store a target message table. When any controller determines that the data to be sent is the same as the valid data corresponding to the message to be encoded in the target message sequence, the target message sequence can be obtained from the target message table, and the target message sequence does not need to be repeatedly generated in real time, thereby ensuring the real-time nature of the transmitted data.

[0101] In addition, when generating the target message sequence, an anti-repetition mechanism may be provided to ensure that the target message sequences stored in the target message table do not repeat each other. For example, when the message to be encoded is "0011" or "0011000", the generated pseudo-random code may be "00110000011101100". Therefore, after generating the target message sequence that meets the preset condition according to the message to be encoded, the method further includes: querying the target message table; when all message sequences in the target message table do not match the target message sequence, storing the target message sequence in the target message table; when any message sequence in the target message table matches the target message sequence, performing again the step of generating the target message sequence that meets the preset condition according to the message to be encoded, until all message sequences in the target message table do not match the target message sequence.

[0102] As an optional embodiment, the method further includes:

[0103] The target message sequence to be transmitted is determined from the target message table and transmitted to the target controller, and the target controller is determined according to the address segment in the target message sequence.

[0104] For example, the target message sequence includes an address segment, and the address segment can be used to determine the destination of the message, that is, the target controller. The target message sequence can be transmitted inside different controllers, or it can be transmitted inside the same controller. For example, when receiving a target request instruction sent by a target controller, the target message sequence can be obtained from the target message table, without generating the target message sequence in real time, and the real-time nature of the transmitted data can be guaranteed. For another example, it can be set to send specific messages in a sequential periodic manner, and the target message sequence can be sent periodically. The CAN bus system communicates through data frame messages and remote frame messages, and these messages can follow different standards, depending on the application field and the requirements of the device. In the data frame and the remote frame, a start identifier SOF, an arbitration segment, a control segment, a data field, a check field, and an end identifier are included.

[0105] As a specific implementation method, see Figure 2 ,as well as Figure 3A flowchart of another message generation method is shown. The method includes the following steps: the controller generates a pseudo-random code sequence of a preset message length by using a Mersenne twister algorithm according to the message to be encoded; a target message sequence whose previous message is the message to be encoded and whose padding code of unused bits meets the preset conditions is screened out from the pseudo-random code sequence, and the target message sequence is stored in the target message table of the controller. When the controller may need to transmit a message, the message sequence to be transmitted is obtained by querying the target message table, and the message sequence to be transmitted is transmitted to the controller itself or other controllers.

[0106] As shown above, when the message has the same preset number of consecutive bits in the encoding, padding bits will be inserted into the actual transmitted code stream. A large number of padding bits may cause the message length to become longer. In addition, electromagnetic radiation interference in a specific frequency band may occur.

[0107] As a specific implementation method, the message generation method provided by the present disclosure can also realize the spread spectrum of electromagnetic radiation interference of the CAN bus to avoid electromagnetic compatibility problems. Figure 4-6 ,in, Figure 4 This is a schematic diagram of the simulation results when the filling code is the first method. Figure 5 This is a schematic diagram of the simulation results when the filling code is the second method. Figure 6 It is a schematic diagram of the simulation results of the filling coding of the unused bits obtained by the message generation method in the present invention. Specifically, the first method may be to fill the unused bits by coding with a run number less than the first target threshold, for example, the first target threshold is 4, and the first method is to fill the unused bits by continuous "0000"; the second method may be to fill the unused bits by coding with a run number less than the second target threshold, the second target threshold is less than the first target threshold, for example, the second target threshold is 2, and the second method is to fill the unused bits by continuous "0011", or, fill the unused bits by continuous "0101". It can be seen that when the unused bits are filled with the unused bits by the first method and the second method, interference is generated at certain specific frequency points in the spectrum. After the filling coding of the unused bits obtained by the message generation method in the present invention is adopted, the peaks in the spectrum disappear, which means that the electromagnetic radiation interference of the CAN bus is spread spectrum. Comparison Figure 4 and Figure 6In the first mode, when continuous 0s are used as unused bit filling, the frequency point m1 with the highest interference is 167kHz, and the corresponding interference is -4.5667dB. When the unused bit filling code obtained by the message generation method in the present disclosure is used, the frequency point m1 with the highest interference is 167kHz, and the corresponding interference is -20.0662dB, and the interference is reduced by about 15dB. Therefore, when the unused bit filling code obtained by the message generation method in the present disclosure is used, the interference of electromagnetic emission of the CAN bus in a specific frequency band can be significantly reduced.

[0108] Figure 7 is a block diagram of a message generating device according to an exemplary embodiment. Figure 7 The message generating device includes a determining module 701 and a generating module 702.

[0109] The determination module 701 is configured to determine a message to be encoded;

[0110] The generating module 702 is configured to generate a target message sequence satisfying a preset condition according to the message to be encoded, where the preset condition is used to limit the length of the target message sequence.

[0111] As an optional embodiment, the generating module 702 includes:

[0112] A first generating submodule is configured to generate a sequence of messages to be confirmed according to the messages to be encoded;

[0113] A determination submodule is configured to determine whether the message sequence to be confirmed meets a preset condition;

[0114] The second generating submodule is configured to return to the step of generating a sequence of messages to be confirmed according to the messages to be encoded when the sequence of messages to be confirmed does not meet the preset condition, until the sequence of messages to be confirmed meets the preset condition;

[0115] The obtaining submodule is configured to obtain a target message sequence according to a sequence of to-be-confirmed messages that meets a preset condition.

[0116] As an optional embodiment, the message sequence to be confirmed includes a padding code of unused bits, and the determination submodule is specifically configured as follows:

[0117] When the number of runs of the padding code is less than the first threshold, determining that the message sequence to be confirmed meets the preset condition;

[0118] When the number of runs of the padding code is greater than or equal to the first threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0119] As an optional embodiment, the message sequence to be confirmed includes a padding code of unused bits, and the determination submodule is specifically configured as follows:

[0120] Determine a first target number of first type codes in the filling code, the first type codes being codes having a run number greater than a second threshold;

[0121] It is determined whether the sequence of messages to be confirmed meets a preset condition according to a relationship between the first target quantity and the first quantity threshold.

[0122] As an optional embodiment, the determination submodule is further configured as follows:

[0123] When the first target number is less than the first number threshold, determining that the message sequence to be confirmed meets a preset condition;

[0124] When the first target number is greater than or equal to the first number threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0125] As an optional embodiment, the determination submodule is specifically configured as follows:

[0126] Determining a target second quantity threshold according to a target number of unused bits and a preset relationship between the number of unused bits in the message sequence and the second quantity threshold;

[0127] According to the second target number of the second type code in the filling code and the target second number threshold, it is determined whether the message sequence to be confirmed meets the preset condition, and the second type code is a code with a run number greater than the third threshold.

[0128] As an optional embodiment, the determination submodule is further configured as follows:

[0129] When the second target number is less than the target second number threshold, determining that the message sequence to be confirmed meets the preset condition;

[0130] When the second target number is greater than or equal to the target second number threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

[0131] As an optional embodiment, the first generating submodule is specifically configured as follows:

[0132] According to the message to be encoded, a sequence of messages to be confirmed is generated by the Mersenne Twister algorithm.

[0133] As an optional embodiment, the message generating device further includes:

[0134] The storage module is configured to store the target message sequence in the target message table.

[0135] As an optional embodiment, the message generating device further includes:

[0136] The message transmission module is configured to determine a target message sequence to be transmitted from the target message table and transmit it to a target controller, and the target controller is determined according to an address segment in the target message sequence.

[0137] Regarding the message generating device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the message generating method, and will not be elaborated here.

[0138] The present disclosure also provides a computer-readable storage medium on which computer program instructions are stored. When the program instructions are executed by a processor, the message generation method provided by the present disclosure is implemented.

[0139] The present disclosure also provides a device, comprising:

[0140] A storage device for storing a computer program;

[0141] An execution device is used to execute the computer program to implement the message generation method provided by the present disclosure.

[0142] Figure 8 800 is a block diagram of a device 800 according to an exemplary embodiment. For example, the device 800 may be a device that communicates via a bus, such as a machine device, a robot, a sensor, an engine, a drive system, a navigation control system, etc. in a factory automation system; or may be a control system, a signal system, etc. of a vehicle, a train in a railway or rail transit; or may be a medical device, a monitor, etc.

[0143] Reference Figure 8 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output interface 812 , a sensor component 814 , and a communication component 816 .

[0144] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned message generation method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0145] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0146] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0147] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0148] The audio component 810 is configured to output and / or input audio signals. In some embodiments, the audio component 810 includes a speaker for outputting audio signals.

[0149] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0150] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0151] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0152] In an exemplary embodiment, the device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the above-mentioned message generation method.

[0153] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of the device 800 to complete the above-mentioned message generation method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0154] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable device. The computer program has a code portion for executing the above-mentioned message generation method when executed by the programmable device.

[0155] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0156] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A message generation method, characterized in that: include: Determine the message to be encoded; According to the message to be encoded, a target message sequence that meets a preset condition is generated, wherein the target message sequence includes the message to be encoded and a padding code of unused bits, and the preset condition is used to limit the length of the target message sequence, wherein the preset condition includes any one of the following: The length of the target message sequence is less than a preset value; The number of runs of the padding code of the unused bits is less than a first threshold; A first target number of first type codes in the filling code of the unused bits is less than a first number threshold, wherein the first type code is a code with a run number greater than a second threshold; The second target number of the second type of code in the filling code of the unused bits is less than the target second number threshold, the target second number threshold is determined according to the target number of the unused bits, and the second type of code is a code with a run number greater than a third threshold.

2. The method according to claim 1, characterized in that Generating a target message sequence that meets a preset condition according to the message to be encoded includes: Generate a sequence of messages to be confirmed according to the message to be encoded; Determining whether the message sequence to be confirmed meets the preset condition; When the message sequence to be confirmed does not meet the preset condition, returning to the step of generating a message sequence to be confirmed according to the message to be encoded, until the message sequence to be confirmed meets the preset condition; The target message sequence is obtained according to the message sequence to be confirmed that meets the preset condition.

3. The method according to claim 2, characterized in that Determining whether the message sequence to be confirmed meets the preset condition includes: When the number of runs of the padding code of the unused bits in the to-be-confirmed message sequence is less than a first threshold, determining that the to-be-confirmed message sequence meets the preset condition; When the number of runs of the padding code of unused bits in the message sequence to be confirmed is greater than or equal to the first threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

4. The method according to claim 2, characterized in that: Determining whether the message sequence to be confirmed meets the preset condition includes: Determine a first target number of first type codes in the padding codes of unused bits of the to-be-confirmed message sequence; It is determined whether the sequence of messages to be confirmed meets the preset condition according to the relationship between the first target quantity and the first quantity threshold.

5. The method according to claim 4, characterized in that Determining whether the to-be-confirmed message sequence satisfies the preset condition according to the relationship between the first target quantity and the first quantity threshold includes: When the first target number is less than the first number threshold, determining that the message sequence to be confirmed meets the preset condition; When the first target number is greater than or equal to the first number threshold, it is determined that the message sequence to be confirmed does not meet the preset condition.

6. The method according to claim 2, characterized in that Determining whether the message sequence to be confirmed meets the preset condition includes: Determining a target second quantity threshold according to a target number of unused bits in the message sequence to be confirmed and a preset relationship between the number of unused bits in the message sequence and the second quantity threshold; It is determined whether the message sequence to be confirmed meets a preset condition according to a second target number of second type codes in the filling code of unused bits of the message sequence to be confirmed and the target second number threshold.

7. The method according to claim 6, characterized in that Determining whether the to-be-confirmed message sequence meets a preset condition according to a second target number of second type codes in the filling code of unused bits of the to-be-confirmed message sequence and the target second number threshold, includes: When the second target number is less than the target second number threshold, determining that the message sequence to be confirmed meets the preset condition; When the second target number is greater than or equal to the target second number threshold, it is determined that the to-be-confirmed message sequence does not meet the preset condition.

8. The method according to any one of claims 2 to 7, characterized in that: Generating a sequence of messages to be confirmed according to the message to be encoded, including: The message sequence to be confirmed is generated according to the message to be encoded by using a Mersenne twister algorithm.

9. The method according to any one of claims 1 to 7, characterized in that: After generating a target message sequence satisfying a preset condition according to the message to be encoded, the method further includes: The target message sequence is stored in a target message table.

10. The method according to claim 9, characterized in that The method further comprises: The target message sequence to be transmitted is determined from the target message table and transmitted to the target controller, and the target controller is determined according to the address segment in the target message sequence.

11. A message generating device, characterized in that: include: A determination module, configured to determine a message to be encoded; A generating module is configured to generate a target message sequence that meets a preset condition according to the message to be encoded, wherein the target message sequence includes the message to be encoded and a padding code of unused bits, and the preset condition is used to limit the length of the target message sequence, wherein the preset condition includes any one of the following: The length of the target message sequence is less than a preset value; The number of runs of the padding code of the unused bits is less than a first threshold; A first target number of first type codes in the filling code of the unused bits is less than a first number threshold, wherein the first type code is a code with a run number greater than a second threshold; The second target number of the second type of code in the filling code of the unused bits is less than the target second number threshold, the target second number threshold is determined according to the target number of the unused bits, and the second type of code is a code with a run number greater than a third threshold.

12. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the message generation method described in any one of claims 1-10 is implemented.

13. A message generating device, characterized in that: include: A storage device for storing a computer program; An execution device is used to execute the computer program to implement the message generation method described in any one of claims 1-10.