CN110266571B - Method and device for improving reliability of CAN bus data transmission and computer equipment - Google Patents

Method and device for improving reliability of CAN bus data transmission and computer equipment Download PDF

Info

Publication number
CN110266571B
CN110266571B CN201910520074.0A CN201910520074A CN110266571B CN 110266571 B CN110266571 B CN 110266571B CN 201910520074 A CN201910520074 A CN 201910520074A CN 110266571 B CN110266571 B CN 110266571B
Authority
CN
China
Prior art keywords
data
common
data frame
transmitted
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910520074.0A
Other languages
Chinese (zh)
Other versions
CN110266571A (en
Inventor
王文灿
马翠明
黄佳星
黄强
吕泽川
高崇光
叶铁英
玉维友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN201910520074.0A priority Critical patent/CN110266571B/en
Publication of CN110266571A publication Critical patent/CN110266571A/en
Application granted granted Critical
Publication of CN110266571B publication Critical patent/CN110266571B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Communication Control (AREA)

Abstract

The application relates to a method, a device and computer equipment for improving the reliability of CAN bus data transmission, wherein the method comprises the following steps: acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment; counting the repeated transmission quantity of the calibration data segment; determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section; acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted; and sending the common data frame to be transmitted to a data receiving device. By adopting the method and the device, the number of the divided frames of the data frames is effectively reduced, the utilization rate of the CAN bus is improved, and the reliability of CAN bus communication data transmission is enhanced.

Description

Method and device for improving reliability of CAN bus data transmission and computer equipment
Technical Field
The present application relates to the field of data transmission technologies, and in particular, to a method and an apparatus for improving reliability of data transmission of a CAN bus, a computer device, and a storage medium.
Background
CAN (controller Area network) is a serial communication protocol of ISO international standardization, belongs to the field of field bus, and is a serial communication network that effectively supports distributed control or real-time control, and the data transmission realized by CAN usually adopts a frame transmission mode, i.e. the messages transmitted on the bus are transmitted in a frame structure, and the frame structure specifically includes four types: data frames, remote frames, error frames, and overload frames.
The data frame format is a main frame format of equipment communication, effective data can be fixedly stored to realize information communication, and when the data volume needing to be transmitted in actual communication is large, the effective data of the equipment is divided into a plurality of data frames to be transmitted.
However, due to repeated transmission of the same data often occurring in a plurality of data frames, the problems of bus communication network congestion, data redundancy and the like are caused, so that the communication between the devices is influenced, and the reliability of the bus is reduced.
Therefore, the existing CAN bus data transmission method has the problem of low data transmission reliability.
Disclosure of Invention
Therefore, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for improving the reliability of data transmission of the CAN bus, which CAN reasonably solve the above technical problems, in order to solve the technical problem of low reliability of data transmission of the CAN bus data transmission method.
A method for improving the data transmission reliability of a CAN bus comprises the following steps:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
counting the repeated transmission quantity of the calibration data segment;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to a data receiving device.
In one embodiment, the calibration data segment includes an arbitration segment and a control segment, and the counting the retransmission amount of the calibration data segment includes:
determining arbitration control segment data for the transmitted data frame; the arbitration control section data is data of the arbitration section and the control section;
and counting the number of the repeated data of the arbitration control section as the repeated transmission amount of the calibration data section.
In one embodiment, the determining that the calibration data segment is generic data according to the repeated transmission amount of the calibration data segment includes:
counting the total amount of the data frames of the transmitted data frames;
calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage;
and when the repetition percentage reaches a preset repetition percentage threshold value, determining the calibration data segment as common data.
In one embodiment, the method further comprises:
and when the repetition percentage does not reach the repetition percentage threshold, accumulating the repeated transmission quantity of the calibration data segment until the repetition percentage of the calibration data segment reaches the repetition percentage threshold.
In one embodiment, the obtaining the data frame to be transmitted, and when the data frame to be transmitted includes the common data, replacing the common data with a common identifier to obtain the common data frame to be transmitted includes:
acquiring a data frame to be transmitted;
determining arbitration control section data of the data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of the data frame to be transmitted;
and when the arbitration control section data is matched with the common data, replacing the arbitration control section data with a common identifier to obtain the common data frame to be transmitted.
In one embodiment, the replacing the arbitration control section data with a common identifier when the arbitration control section data matches the common data to obtain the common data frame to be transmitted includes:
when the arbitration control section data is matched with the common data, determining the arbitration control section data as the common data;
according to the common data, common identification matched with the common data is obtained from a plurality of pre-stored common identifications; the plurality of common identifications are respectively matched with a plurality of common data;
and replacing the common data with the common identification to obtain the common data frame to be transmitted.
In one embodiment, the method further comprises:
and when the data frame to be transmitted does not contain the common data, sending the data frame to be transmitted to the data receiving equipment.
In one embodiment, the sending the frame of the common data to be transmitted to a data receiving device includes:
and sending the common data frame to be transmitted to the data receiving equipment according to a preset cycle time.
A method for improving the data transmission reliability of a CAN bus comprises the following steps:
receiving a data frame of a data transmitting device;
when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications;
and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
In one embodiment, after receiving the data frame of the data transmission device, the method further includes:
extracting a calibration data section of the data frame; the calibration data segment is an arbitration segment and a control segment of the data frame;
determining a total number of data bits of the calibration data segment;
when the total number of the data bits is smaller than a preset data bit threshold value, determining the data frame as the common data frame; the calibration data section of the commonality data frame includes the commonality identification.
In one embodiment, the method further comprises:
if the plurality of common data do not include common data matched with the common identification, generating a communication fault prompt; and the communication fault prompt is used for prompting the communication fault of the CAN bus.
An apparatus for improving reliability of CAN bus data transmission, the apparatus comprising:
a transmitted data frame acquisition module for acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
the repeated transmission quantity counting module is used for counting the repeated transmission quantity of the calibration data section;
the common data determining module is used for determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
the device comprises a common data frame acquisition module, a common identification module and a common data frame transmission module, wherein the common data frame acquisition module is used for acquiring a data frame to be transmitted, and replacing the common data with the common identification when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and the common data frame sending module is used for sending the common data frame to be transmitted to the data receiving equipment.
An apparatus for improving reliability of CAN bus data transmission, the apparatus comprising:
the data frame receiving module is used for receiving a data frame of the data sending equipment;
the common data acquisition module is used for acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame when the data frame is the common data frame; the plurality of common data are respectively matched with a plurality of common identifications;
and the effective data frame acquisition module is used for replacing the common identification of the common data frame with the common data to obtain an effective data frame.
A system for improving CAN bus data transmission reliability, the system comprising:
a data transmitting device and a data receiving device;
the data receiving device is used for receiving the data frame of the data sending device, and when the data frame is a common data frame, obtaining common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame, and further replacing the common identification of the common data frame with the common data to obtain an effective data frame; the plurality of common data are respectively matched with a plurality of common identifications;
the data sending equipment is used for obtaining a transmitted data frame, counting the repeated transmission quantity of a calibration data section in the transmitted data frame, determining the calibration data section as common data according to the repeated transmission quantity so as to obtain a data frame to be transmitted, replacing the common data with a common identifier when the data frame to be transmitted contains the common data so as to obtain a common data frame to be transmitted, and finally sending the common data frame to be transmitted to the data receiving equipment.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
counting the repeated transmission quantity of the calibration data segment;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to a data receiving device.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving a data frame of a data transmitting device;
when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications;
and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
counting the repeated transmission quantity of the calibration data segment;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to a data receiving device.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a data frame of a data transmitting device;
when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications;
and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
In the method, the device, the system, the computer device and the storage medium for improving the reliability of the data transmission of the CAN bus, the data sending device determines and marks the common data mainly by counting the repeated transmission quantity of the specified data section in the transmitted data frame so as to judge whether the data frame to be transmitted contains the marked common data, if so, the common data is replaced by the preset common identification to generate the common data frame to be transmitted, and the common data frame to be transmitted is sent to the data receiving device so that the data receiving device CAN analyze the common data frame to obtain complete and effective data. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of a method for improving reliability of CAN bus data transmission;
FIG. 2 is a schematic flow chart illustrating a method for improving reliability of CAN bus data transmission according to an embodiment;
FIG. 3 is a diagram illustrating a format of a CAN data frame of the method for improving the reliability of CAN bus data transmission according to an embodiment;
FIG. 4 is a schematic flow chart illustrating a method for improving reliability of CAN bus data transmission in another embodiment;
FIG. 5 is a block diagram of an embodiment of an apparatus for improving the reliability of CAN bus data transmission;
FIG. 6 is a block diagram of an apparatus for improving the reliability of CAN bus data transmission in another embodiment;
FIG. 7 is a schematic diagram of a system for improving reliability of CAN bus data transmission according to an embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The method for improving the data transmission reliability of the CAN bus CAN be applied to the application environment shown in fig. 1, wherein the application environment CAN be data communication between internal devices of an air conditioner or a scene that a master control center of the air conditioner executes data transmission control on a plurality of air conditioners. In a system for improving the data transmission reliability of the CAN bus, a data transmitting device 102 and a data receiving device 104 may be included.
The data sending device 102 and the data receiving device 104 may be microprocessors in which different management systems are set inside the air conditioner, or may be servers of a master control center of the air conditioner, and the communication between the data sending device 102 and the data receiving device 104 may be established through a network, or may be a wired or wireless communication module to implement data transmission communication.
In one embodiment, as shown in fig. 2, a method for improving reliability of CAN bus data transmission is provided, which is described by taking the method as an example applied to the data transmission device 102 in fig. 1, and includes the following steps:
step S210, acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment.
The transmitted data frame refers to data in a data frame format transmitted by the data transmitting device 102, and the data frame format of the transmitted data frame can be referred to fig. 3.
The calibration data segment refers to a data segment calibrated in advance in a transmitted data frame, and the calibration data segment is used as a basis for extracting the characteristic of the common data, namely a marking source of the common data. It should be noted that, as shown in fig. 3, the CAN data frame format includes a plurality of data segments, where the data segments depend on specific data transmitted between the devices, and therefore, data stored in the data segments is changed, and the check segment synchronizes with the change of the data in the data segments, so that the calibration data segments as the common data sources are mainly the arbitration segment and the control segment.
In the specific implementation, to determine the common data existing in the data frame, the transmitted data frame needs to be acquired first, and whether the common data needs to be extracted from the subsequent data frame to be transmitted is determined by recording the mark of the specified data segment in the transmitted data frame.
For example, in a data transmission process, data is transmitted in a frame structure form, whether common data extraction is performed on a current data frame to be transmitted is judged, all transmitted data frames need to be acquired, whether common data exists in the transmitted data frames is judged by utilizing similarity of a marked data section in the transmitted data frames, common data extraction and marking CAN be performed on candidate data frames to be transmitted, the common data is replaced by the common identification with small occupied storage space, occupied data bits of the marked data section are shortened, the data section CAN correspondingly expand the storable data bits, the number of data division data frames is reduced, the utilization rate of a CAN bus is reduced, communication network blockage is avoided, and reliability of data transmission is improved.
Step S220, counting the repeated transmission quantity of the calibration data section.
The repeated transmission amount may be the number of repeated occurrences of the calibration data segment, or may be the total amount of data of the calibration data segment with the same property, for example, 20, 30, 40, etc.
In a specific implementation, after the data sending device 102 obtains the transmitted data frame, the statistics of the retransmission amount is performed on the calibration data segment existing in the transmitted data frame, where the statistics may be that a counter is used to implement repeated recording on the same calibration data segment in the data frame transmission process, and if a plurality of different calibration data segments occur, a plurality of counters are used to complete the recording of the retransmission amount.
For example, if the currently transmitted data frame totals 30 frames, there are 30 calibration data segments, where there are 12 calibration data segments a, 15 calibration data segments B, and 3 calibration data segments C, the retransmission amount of the calibration data segment a is 12, the retransmission amount of the calibration data segment B is 15, and the retransmission amount of the calibration data segment C is 3.
And step S230, determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section.
Wherein, the common data refers to the calibration data segment which is marked as the repeated transmission amount reaches the requirement, the common data comprises the data stored in the calibration data segment which meets the requirement, and if the calibration data segment which meets the requirement of the repeated transmission amount comprises data "01010011010" of the arbitration segment and data "1010" of the control segment, the common data can be determined to be "010100110101010".
In the specific implementation, the calibration data section of the transmitted data frame is used for judging whether the data frame to be transmitted has calibrated common data, then the repeated transmission quantity of the calibration data section in the transmitted data frame is firstly discriminated, that is, whether the repeated transmission quantity meets the preset requirement is judged, if so, the discriminated data of the calibration data section is determined to be common data, if not, the common data is not marked, and the repeated transmission quantity is continuously accumulated until the requirement is met.
For example, when the amount of repeated transmission of the current calibration data segment a reaches 12 and the preset number requirement is 10, the data "010100110101010" in the calibration data segment a is marked as common data, the common data is stored in the register of the microprocessor, and meanwhile, the corresponding common identifier is generated, so as to form a mapping relationship between the common data and the common identifier. The common identifier is necessarily an identifier in which the stored data bits are smaller than the common data, and the common identifier may be an identifier composed of a character string.
Step S240, obtaining the data frame to be transmitted, and replacing the common data with the common identification when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted.
The data frame to be transmitted refers to a data frame which is transmitted after being analyzed and processed currently.
The common data frame to be transmitted may be a data frame in which common data exists in the data frame to be transmitted and the common data is replaced with the common identifier.
The common identifier refers to an identifier stored in a register and having a mapping relationship with common data, and the common identifier includes, but is not limited to, all forms of expressions such as binary data, and preferably uses hexadecimal data as a convention between devices, for example, binary numbers "10001", "01111", or hexadecimal numbers "0 x 11", "0 x 0F", and the like.
It should be noted that, because the total number of the storage data bits of the arbitration segment and the control segment in the CAN data frame is 15 bits, the present application proposes to replace data with an identifier whose storage data bits are less than 15 bits, so as to achieve the purpose of expanding the effective data storage space of the data segment, and therefore, on the basis of achieving the purpose of the present invention, the present application proposes to ensure the available number of the common identifiers, and to control the storage data bits of the common identifiers, for example: if the data bits of the common mark are set to 8 bits, 256 common marks are included in total, and if the data bits of the common mark are set to 5 bits, 32 common marks are included in total, so that in practical application, the number of storage bits of the common mark can be set according to the specific number of marks, and the length of the common mark is not limited on the basis of being less than 15 bits.
In the specific implementation, when a frame of data is transmitted, the frame of data needs to be analyzed and discriminated, and a rule is set for a processing mode of the data frame to be transmitted, that is, common data meeting requirements in all transmitted data frames needs to be marked, so that when the data frame to be transmitted containing the common data appears again, the common data can be replaced by a common identifier with a smaller storage amount according to a mapping relation established in advance, and the common data frame to be transmitted with the common identifier is obtained.
For example, the common data marked currently includes "010100110101010", and if the calibration data segment in the data frame to be transmitted also stores the data "010100110101010", the common identifier of the common data "010100110101010" in the preset mapping table is correspondingly obtained as "0 x 0F", and the common data is replaced with the common identifier, so as to obtain the common data frame to be transmitted with the calibration data segment storing data as "0 x 0F".
It should be noted that the data segment storage data bits in the CAN data frame are 0 to 64 bits, and the data storage bits of the arbitration segment and the control segment are 11+4 to 15 bits, so that after the common data in the calibration data segment is replaced by the common identifier, the data storage space of the calibration data segment will be released, and the released storage space CAN be used for storing valid data, so that the data actually stored in the data segment is not limited to 0 to 64 bits, but also the storage space released by the calibration data segment.
For example, if the stored data bits of the common identifier are only 4 bits, after the common identifier of which 15 bits are replaced by 4 bits is replaced, the data storage bits of the data segment are expanded from 0-64 bits to 0-75 bits, so that the method CAN not only increase the length of the data segment in each frame data and expand the storage space of valid data without changing the total length of the data frame, but also improve the utilization rate of the CAN bus.
Step S250, sending the common data frame to be transmitted to the data receiving device.
In a specific implementation, if the data frame to be transmitted includes the marked common data and is replaced by the common identifier to form a new common data frame to be transmitted, the common data frame to be transmitted may be sent to the data receiving device 104, and if the data frame to be transmitted does not include the marked common data, the data sending device 102 may still send the data frame to be transmitted to the data receiving device 104.
According to the method for improving the CAN bus data transmission reliability, the data sending equipment determines and marks the common data mainly by counting the repeated transmission quantity of the specified data section in the transmitted data frame, so as to judge whether the data frame to be transmitted contains the marked common data or not, if so, the common data is replaced by the preset common identification to generate the common data frame to be transmitted, and the common data frame to be transmitted is sent to the data receiving equipment so that the data receiving equipment CAN analyze the common data frame to obtain complete and effective data. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
In one embodiment, the calibration data segment includes an arbitration segment and a control segment, and the step of counting the amount of repetitive transmissions of the calibration data segment includes:
determining arbitration control segment data of a transmitted data frame; the arbitration control section data is data of an arbitration section and a control section; and counting the number of the repeated data of the arbitration control section as the repeated transmission quantity of the calibration data section.
In a specific implementation, the repeated transmission amount of the calibration data segment in the transmitted data frame may be counted by first determining an arbitration segment and a control segment of the transmitted data frame, combining the data of the arbitration segment and the control segment, and counting the number of repetitions of the data of the same arbitration control segment in all the transmitted data frames, which may also be referred to as the same number, as the repeated transmission amount of the calibration data segment.
For example, the arbitration control segment data of the transmitted data frame is "010100110101010", where "01010011010" is the data of the arbitration segment and "1010" is the data of the control segment, and if there are 12 identical calibration data segments "010100110101010" in the 30 frames of transmitted data, the repeat transmission amount of the calibration data segment is 12.
In one embodiment, the step of determining the calibration data segment as common data according to the repeated transmission amount of the calibration data segment includes:
counting the total amount of data frames of the transmitted data frames; calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage; and when the repetition percentage reaches a preset repetition percentage threshold value, determining the calibration data segment as common data.
The total number of data frames refers to the total number of data frames that have been transmitted to the data receiving device 104, and is, for example, 10, 20, 30, etc.
The repetition percentage may be a repetition ratio of a statistically obtained quotient of the transmission amount of the repetition and the total amount of the data frames, for example, 20%, 40%, 60%, and the like.
The repetition percentage threshold may be a repetition percentage threshold preset according to specific situations or requirements and stored in the microprocessor, for example, 80%.
In the specific implementation, the common data is determined according to the repeated transmission quantity of the calibration data segment, the total quantity of the data frames of the transmitted data frames can be firstly counted, and then the quotient of the repeated transmission quantity and the total quantity of the data frames counted in the preorder step is calculated to obtain the repetition percentage. If the calibration data segment includes a plurality of calibration data segments, for example, the calibration data segment a and the calibration data segment B, the repetition percentage of the two calibration data segments in the total amount of the data frame is calculated respectively, and the common data is determined according to the relationship between the repetition percentage and the repetition percentage threshold.
For example, the total amount of data frames of the transmitted data frame is "30", and there are two types of calibration data sections in the transmitted data frame: the data storage method comprises a calibration data section A and a calibration data section B, wherein the repeated transmission quantity of the calibration data section A is 12%, the repeated transmission quantity of the calibration data section B is 18%, the repeated percentage of the calibration data section A is 40%, the repeated percentage of the calibration data section B is 60%, and when the preset repeated percentage threshold is 50%, only the calibration data section B meets the condition, so that the data stored in the calibration data section B is determined to be common data, and the data are marked and stored.
In one embodiment, the step of determining the calibration data segment as common data according to the repeated transmission amount of the calibration data segment further includes:
and when the repetition percentage does not reach the repetition percentage threshold value, accumulating the repeated transmission quantity of the calibration data section until the repetition percentage of the calibration data section reaches the repetition percentage threshold value.
In a specific implementation, according to the above embodiment, if the repetition percentage of a certain calibration data segment cannot meet the threshold condition, the repeated transmission amount of the calibration data segment is continuously accumulated, that is, the data frame to be transmitted is acquired and screened to be accumulated until the data frame meets the threshold condition, and the data frame can be marked as common data.
For example, according to the above embodiment, the repetition percentage of the calibration data segment a is "40%", the repetition percentage of the calibration data segment B is "60%", when the preset repetition percentage threshold is "50%", only the calibration data segment B satisfies the condition, and the calibration data segment a does not reach the preset threshold, the repeated transmission amount of the calibration data segment a continues to be accumulated until it satisfies the threshold condition.
In one embodiment, the step of obtaining the data frame to be transmitted, and replacing the common data with the common identifier when the data frame to be transmitted contains the common data, to obtain the common data frame to be transmitted, includes:
acquiring a data frame to be transmitted; determining arbitration control section data of a data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of a data frame to be transmitted; and when the data of the arbitration control section is matched with the common data, replacing the data of the arbitration control section with the common identification to obtain a common data frame to be transmitted.
In the specific implementation, whether the data frame to be transmitted contains the marked common data or not is judged, the arbitration control section data of the data frame to be transmitted can be determined at first, and the existence of the common data in the data frame to be transmitted is determined by utilizing the matching relation between the arbitration control end data and the common data.
For example, the arbitration control section data of the data frame to be transmitted is "010100110101010", and the bit processor stores and inquires the marked common data "010100110101010", and if the two data are the same, the data frame to be transmitted is judged to have common data, and the common data is replaced by the corresponding common identifier "0 x 0F" stored in the microprocessor, so as to obtain the newly generated common data frame to be transmitted.
In one embodiment, when the arbitration control section data matches the common data, replacing the arbitration control section data with the common identifier to obtain a common data frame to be transmitted, includes:
when the data of the arbitration control section is matched with the common data, determining that the data of the arbitration control section is the common data; according to the common data, common identification matched with the common data is obtained from a plurality of pre-stored common identifications; the plurality of common identifications are respectively matched with the plurality of common data; and replacing the common data with the common identification to obtain a common data frame to be transmitted.
In the specific implementation, the common data is replaced by the common identifier, the query and the replacement are performed through a preset and stored "common data-common identifier" mapping table, the common data in the mapping table corresponds to the common identifier one to one, after the common data in the data frame to be transmitted is determined, the common identifier can be obtained through query, and the replacement step is completed.
In one embodiment, after acquiring the data frame to be transmitted, the method further includes:
and when the data frame to be transmitted does not contain the common data, sending the data frame to be transmitted to the data receiving equipment.
In a specific implementation, if the data frame to be transmitted does not contain the common data, the data frame to be transmitted is directly sent to the data receiving device 104 without performing the identifier replacement processing.
In one embodiment, the step of sending the common data frame to be transmitted to the data receiving device includes:
and sending the common data frame to be transmitted to data receiving equipment according to preset cycle time.
The cycle time may be a preset time for sending the frame timing of the common data to be transmitted, for example, every 10s, 30s, 60s, and the like.
In specific implementation, in order to prevent the data receiving device from failing to receive the common data, the common data frame to be transmitted is sent in a timing sending manner.
According to the scheme provided by the embodiment of the invention, the data sending equipment judges whether the arbitration section and the control section can be marked as the common data or not by analyzing whether the data repetition quantity of the arbitration section and the control section in the transmitted data frame reaches the threshold condition or not, so as to discriminate whether the arbitration section and the control section in the data frame to be transmitted are consistent with the common data or not, and the common data contained in the arbitration section and the control section are replaced by the preset common identification after the judgment is consistent, so that the common data frame to be transmitted is obtained and then sent to the data receiving equipment. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
In another embodiment, as shown in fig. 4, a method for improving the reliability of CAN bus data transmission is provided, which is described by taking the method as an example applied to the data receiving device 104 in fig. 1, and includes the following steps:
step S410, receiving a data frame of the data sending equipment;
step S420, when the data frame is a common data frame, according to the common identification of the common data frame, common data matched with the common identification is obtained from a plurality of pre-stored common data; the plurality of common data are respectively matched with the plurality of common identifications;
and step S430, replacing the common identification of the common data frame with the common data to obtain an effective data frame.
The valid data frame may be a data frame in which all data segments have complete data, and the valid data frame may be acquired by the data receiving device 104 and may be analyzed and processed by the data receiving device 104.
In a specific implementation, the data sending device 102 may send a common data frame or a normal data frame to the data receiving device 104, where the normal data frame refers to a data frame that is not replaced by the common identifier and stores complete data. After the data receiving device 104 receives the common data frame sent by the data sending device 102, it is first determined whether the common data frame includes the common identifier that has been stored and set, and if so, the common identifier is subjected to data replacement by matching the common data through the mapping table, so as to obtain an effective data frame with complete data.
According to the method for improving the CAN bus data transmission reliability, after the data receiving equipment receives the common data frame sent by the data sending equipment, whether the common identification exists in the common data frame or not is identified, and if the common identification is identified and the corresponding common data is inquired, the common data is replaced by the identification, so that the effective data frame with complete data is obtained. By adopting the scheme, the number of the divided frames of the data frames is effectively reduced, the utilization rate of the CAN bus is effectively improved, and the reliability of CAN bus communication data transmission is enhanced.
In one embodiment, after receiving the data frame of the data transmitting device, the method further includes:
extracting a calibration data section of the data frame; the calibration data segment is an arbitration segment and a control segment of the data frame; determining the total number of data bits of the calibration data section; when the total number of the data bits is smaller than a preset data bit threshold value, determining the data frame as a common data frame; the calibration data section of the commonality data frame includes a commonality identification.
Wherein the total number of data bits may be the total number of bits of stored data in the calibration data segment, e.g., 10, 20, 30, etc.
In a specific implementation, after a data frame sent by the data sending device 102 is received, the data frame needs to be identified, and whether the data frame is a common data frame is identified, where the identification manner may be to perform threshold judgment on the total number of data bits of the calibration data section of the data frame, that is, when a threshold condition is satisfied, it may be determined that the data frame is a common data frame, and then the corresponding calibration data section includes a common identifier. The data bit threshold may be set according to the total number of bits of data of the arbitration segment and the control segment in the original data frame, that is, the data bit of the arbitration segment in the original data frame to be transmitted is 11 bits, and the data bit of the control segment is 4 bits, then the data bit threshold may be set to 15, and the setting rule depends on that the data bit of the common identifier is definitely smaller than the data bit of the calibration data segment.
In one embodiment, if the plurality of common data does not include common data matched with the common identifier, a communication fault prompt is generated; the communication fault prompt is used for prompting the CAN bus communication fault.
In a specific implementation, if the common data frame obtained by the data receiving device 104 does not have corresponding common data in the common identifier included in the common data frame, a communication fault prompt is generated, and the prompt can be displayed by the data receiving device 104 itself or transmitted to other devices for displaying and prompting.
According to the scheme provided by the embodiment of the invention, after the data receiving equipment receives the data frame sent by the data sending equipment, common frame identification needs to be carried out on the data frame, namely, whether the total number of data bits of a calibration data section is smaller than a preset threshold value or not is identified, if the data frame is the common data frame, the identification data is replaced, the common data frame is used for directly acquiring effective data, and if the common identification in the common data frame does not have corresponding common data storage records, a communication fault prompt is generated to prompt the CAN bus communication fault. By adopting the scheme, the number of the divided frames of the data frames is effectively reduced, the utilization rate of the CAN bus is effectively improved, and the reliability of CAN bus communication data transmission is enhanced.
It should be understood that although the steps in the flowcharts of fig. 2 and 4 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps of fig. 2 and 4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 5, an apparatus for improving reliability of CAN bus data transmission is provided, which includes a transmitted data frame acquiring module 510, a retransmission amount counting module 520, a common data determining module 530, a common data frame acquiring module 540, and a common data frame transmitting module 550, wherein:
a transmitted data frame acquisition module 510, configured to acquire a transmitted data frame; the transmitted data frame includes a calibration data segment;
a repeated transmission amount counting module 520, configured to count a repeated transmission amount of the calibration data segment;
a common data determining module 530, configured to determine the calibration data segment as common data according to the repeated transmission amount of the calibration data segment;
the common data frame acquiring module 540 is configured to acquire a data frame to be transmitted, and when the data frame to be transmitted contains common data, replace the common data with a common identifier to obtain a common data frame to be transmitted;
the common data frame sending module 550 is configured to send a common data frame to be transmitted to the data receiving device.
According to the scheme provided by the embodiment of the invention, the data sending equipment determines and marks the common data mainly by counting the repeated transmission quantity of the specified data section in the transmitted data frame so as to judge whether the data frame to be transmitted contains the marked common data, if so, the common data is replaced by the preset common mark to generate the common data frame to be transmitted, and the common data frame to be transmitted is sent to the data receiving equipment so that the data receiving equipment can analyze the common data frame to obtain complete and effective data. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
In one embodiment, the calibration data segment includes an arbitration segment and a control segment, and the retransmission amount statistics module 520 includes:
an arbitration control section data determination submodule for determining arbitration control section data of the transmitted data frame; the arbitration control section data is data of the arbitration section and the control section; and the repeated quantity counting submodule is used for counting the repeated quantity of the data of the arbitration control section as the repeated transmission quantity of the calibration data section.
In one embodiment, the commonality data determination module 530 includes:
the data frame total amount counting submodule is used for counting the total amount of the data frames of the transmitted data frames; the repetition percentage calculation submodule is used for calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage; and the percentage threshold judgment submodule is used for determining the calibration data segment as common data when the repetition percentage reaches a preset repetition percentage threshold.
In one embodiment, the commonality data determination module 530 further comprises:
and the repeated transmission quantity accumulation submodule is used for accumulating the repeated transmission quantity of the calibration data section when the repeated percentage does not reach the repeated percentage threshold value until the repeated percentage of the calibration data section reaches the repeated percentage threshold value.
In one embodiment, the common data frame acquiring module 540 includes:
the data frame acquisition submodule is used for acquiring a data frame to be transmitted; the arbitration control section data determining submodule is used for determining arbitration control section data of the data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of the data frame to be transmitted; and the common identifier replacing submodule is used for replacing the arbitration control section data with the common identifier when the arbitration control section data is matched with the common data to obtain the common data frame to be transmitted.
In one embodiment, the commonality identification replacement sub-module comprises:
a commonality data determination unit for determining the arbitration control section data as the commonality data when the arbitration control section data matches the commonality data; the common identifier acquiring unit is used for acquiring common identifiers matched with the common data from a plurality of pre-stored common identifiers according to the common data; the plurality of common identifications are respectively matched with a plurality of common data; and the common identifier replacing unit is used for replacing the common data with the common identifier to obtain the common data frame to be transmitted.
In one embodiment, the apparatus for improving reliability of CAN bus data transmission further comprises:
and the data frame to be transmitted sending module is used for sending the data frame to be transmitted to the data receiving equipment when the data frame to be transmitted does not contain the common data.
In one embodiment, the common data frame sending module 550 includes:
and the common data frame period sending submodule is used for sending the common data frame to be transmitted to the data receiving equipment according to preset period time.
According to the scheme provided by the embodiment of the invention, the data sending equipment judges whether the arbitration section and the control section can be marked as the common data or not by analyzing whether the data repetition quantity of the arbitration section and the control section in the transmitted data frame reaches the threshold condition or not, so as to discriminate whether the arbitration section and the control section in the data frame to be transmitted are consistent with the common data or not, and the common data contained in the arbitration section and the control section are replaced by the preset common identification after the judgment is consistent, so that the common data frame to be transmitted is obtained and then sent to the data receiving equipment. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
In another embodiment, as shown in fig. 6, an apparatus for improving reliability of CAN bus data transmission is provided, which includes a data frame receiving module 610, a common data acquiring module 620, and a valid data frame acquiring module, wherein:
a data frame receiving module 610, configured to receive a data frame of a data sending device;
a common data obtaining module 620, configured to, when the data frame is a common data frame, obtain common data matched with the common identifier from a plurality of pre-stored common data according to the common identifier of the common data frame; the plurality of common data are respectively matched with the plurality of common identifications;
the valid data frame obtaining module 630 is configured to replace the common identifier of the common data frame with the common data to obtain a valid data frame.
According to the scheme provided by the embodiment of the invention, after receiving the common data frame sent by the data sending equipment, the data receiving equipment identifies whether the common identification exists in the common data frame, and if the common identification is identified and the corresponding common data is inquired, the identification is replaced by the common data, so that the effective data frame with complete data is obtained. By adopting the scheme, the number of the divided frames of the data frames is effectively reduced, the utilization rate of the CAN bus is effectively improved, and the reliability of CAN bus communication data transmission is enhanced.
In one embodiment, the apparatus for improving reliability of CAN bus data transmission further comprises:
a calibration data segment extraction module for extracting a calibration data segment of the data frame; the calibration data segment is an arbitration segment and a control segment of the data frame; a data bit total number determining module, configured to determine a total number of data bits of the calibration data segment; a common data frame determining module, configured to determine that the data frame is the common data frame when the total number of data bits is smaller than a preset data bit threshold; the calibration data section of the commonality data frame includes the commonality identification.
In one embodiment, the apparatus for improving reliability of CAN bus data transmission further comprises:
the communication fault prompt generation module is used for generating a communication fault prompt if the plurality of common data do not include common data matched with the common identification; and the communication fault prompt is used for prompting the communication fault of the CAN bus.
According to the scheme provided by the embodiment of the invention, after the data receiving equipment receives the data frame sent by the data sending equipment, common frame identification needs to be carried out on the data frame, namely, whether the total number of data bits of a calibration data section is smaller than a preset threshold value or not is identified, if the data frame is the common data frame, the identification data is replaced, the common data frame is used for directly acquiring effective data, and if the common identification in the common data frame does not have corresponding common data storage records, a communication fault prompt is generated to prompt the CAN bus communication fault. By adopting the scheme, the number of the divided frames of the data frames is effectively reduced, the utilization rate of the CAN bus is effectively improved, and the reliability of CAN bus communication data transmission is enhanced.
For specific limitations of the device for improving the data transmission reliability of the CAN bus, reference may be made to the above limitations of the method for improving the data transmission reliability of the CAN bus, and details are not described here. All modules in the device for improving the data transmission reliability of the CAN bus CAN be completely or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, as shown in fig. 7, a system for improving reliability of CAN bus data transmission is provided, which includes a data transmitting device 710 and a data receiving device 720, wherein:
the data sending device 710 is configured to obtain a transmitted data frame, count the retransmission amount of a calibrated data segment in the transmitted data frame, determine that the calibrated data segment is common data according to the retransmission amount, obtain a data frame to be transmitted, replace the common data with a common identifier when the data frame to be transmitted contains the common data, obtain the common data frame to be transmitted, and finally send the common data frame to be transmitted to the data receiving device;
the data receiving device 720 is configured to receive a data frame of the data sending device, and when the data frame is a common data frame, obtain common data matched with the common identifier from a plurality of pre-stored common data according to the common identifier of the common data frame, and further replace the common identifier of the common data frame with the common data to obtain an effective data frame; the plurality of common data are respectively matched with the plurality of common identifications.
According to the scheme provided by the embodiment of the invention, the data sending equipment determines and marks the common data mainly by counting the repeated transmission quantity of the specified data section in the transmitted data frame so as to judge whether the data frame to be transmitted contains the marked common data, if so, the common data is replaced by the preset common mark to generate the common data frame to be transmitted, and the common data frame to be transmitted is sent to the data receiving equipment so that the data receiving equipment can analyze the common data frame to obtain complete and effective data. By adopting the scheme, the same data in the communication data between the devices are subjected to common extraction and identification replacement so as to expand the storage space of the effective data in the data frame, thereby not only effectively reducing the number of divided frames of the data frame, but also effectively improving the utilization rate of the CAN bus and enhancing the reliability of CAN bus communication data transmission.
For specific limitations of the system for improving the data transmission reliability of the CAN bus, reference may be made to the above limitations of the method for improving the data transmission reliability of the CAN bus, and details are not described here. All modules in the system for improving the data transmission reliability of the CAN bus CAN be completely or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing identification information and device information. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program realizes a method for improving the reliability of CAN bus data transmission when being executed by a processor.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
counting the repeated transmission quantity of the calibration data section;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to the data receiving equipment.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining arbitration control segment data for the transmitted data frame; the arbitration control section data is data of the arbitration section and the control section; and counting the number of the repeated data of the arbitration control section as the repeated transmission amount of the calibration data section.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
counting the total amount of the data frames of the transmitted data frames; calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage; and when the repetition percentage reaches a preset repetition percentage threshold value, determining the calibration data segment as common data.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and when the repetition percentage does not reach the repetition percentage threshold, accumulating the repeated transmission quantity of the calibration data segment until the repetition percentage of the calibration data segment reaches the repetition percentage threshold.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a data frame to be transmitted; determining arbitration control section data of the data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of the data frame to be transmitted; and when the arbitration control section data is matched with the common data, replacing the arbitration control section data with a common identifier to obtain the common data frame to be transmitted.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
when the arbitration control section data is matched with the common data, determining the arbitration control section data as the common data; according to the common data, common identification matched with the common data is obtained from a plurality of pre-stored common identifications; the plurality of common identifications are respectively matched with a plurality of common data; and replacing the common data with the common identification to obtain the common data frame to be transmitted.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and when the data frame to be transmitted does not contain the common data, sending the data frame to be transmitted to the data receiving equipment.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and sending the common data frame to be transmitted to the data receiving equipment according to a preset cycle time.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
receiving a data frame of a data transmitting device; when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications; and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
extracting a calibration data section of the data frame; the calibration data segment is an arbitration segment and a control segment of the data frame; determining a total number of data bits of the calibration data segment; when the total number of the data bits is smaller than a preset data bit threshold value, determining the data frame as the common data frame; the calibration data section of the commonality data frame includes the commonality identification.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the plurality of common data do not include common data matched with the common identification, generating a communication fault prompt; and the communication fault prompt is used for prompting the communication fault of the CAN bus.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment;
counting the repeated transmission quantity of the calibration data segment;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to a data receiving device.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining arbitration control segment data for the transmitted data frame; the arbitration control section data is data of the arbitration section and the control section; and counting the number of the repeated data of the arbitration control section as the repeated transmission amount of the calibration data section.
In one embodiment, the computer program when executed by the processor further performs the steps of:
counting the total amount of the data frames of the transmitted data frames; calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage; and when the repetition percentage reaches a preset repetition percentage threshold value, determining the calibration data segment as common data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and when the repetition percentage does not reach the repetition percentage threshold, accumulating the repeated transmission quantity of the calibration data segment until the repetition percentage of the calibration data segment reaches the repetition percentage threshold.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a data frame to be transmitted; determining arbitration control section data of the data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of the data frame to be transmitted; and when the arbitration control section data is matched with the common data, replacing the arbitration control section data with a common identifier to obtain the common data frame to be transmitted.
In one embodiment, the computer program when executed by the processor further performs the steps of:
when the arbitration control section data is matched with the common data, determining the arbitration control section data as the common data; according to the common data, common identification matched with the common data is obtained from a plurality of pre-stored common identifications; the plurality of common identifications are respectively matched with a plurality of common data; and replacing the common data with the common identification to obtain the common data frame to be transmitted.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and when the data frame to be transmitted does not contain the common data, sending the data frame to be transmitted to the data receiving equipment.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and sending the common data frame to be transmitted to the data receiving equipment according to a preset cycle time.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving a data frame of a data transmitting device; when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications; and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a calibration data section of the data frame; the calibration data segment is an arbitration segment and a control segment of the data frame; determining a total number of data bits of the calibration data segment; when the total number of the data bits is smaller than a preset data bit threshold value, determining the data frame as the common data frame; the calibration data section of the commonality data frame includes the commonality identification.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the plurality of common data do not include common data matched with the common identification, generating a communication fault prompt; and the communication fault prompt is used for prompting the communication fault of the CAN bus.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (16)

1. A method for improving the data transmission reliability of a CAN bus is characterized by comprising the following steps:
acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment; the calibration data section comprises an arbitration section and a control section;
counting the repeated transmission quantity of the calibration data segment;
determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
acquiring a data frame to be transmitted, and replacing the common data with a common identifier when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and sending the common data frame to be transmitted to a data receiving device.
2. The method of claim 1, wherein the calibration data segment includes an arbitration segment and a control segment, and wherein the counting the amount of repetitive transmissions of the calibration data segment comprises:
determining arbitration control segment data for the transmitted data frame; the arbitration control section data is data of the arbitration section and the control section;
and counting the number of the repeated data of the arbitration control section as the repeated transmission amount of the calibration data section.
3. The method according to claim 1, wherein the determining the calibration data segment as commonality data based on the amount of repetitive transmission of the calibration data segment comprises:
counting the total amount of the data frames of the transmitted data frames;
calculating a quotient value of the repeated transmission quantity and the total quantity of the data frames to obtain a repetition percentage;
and when the repetition percentage reaches a preset repetition percentage threshold value, determining the calibration data segment as common data.
4. The method of claim 3, further comprising:
and when the repetition percentage does not reach the repetition percentage threshold, accumulating the repeated transmission quantity of the calibration data segment until the repetition percentage of the calibration data segment reaches the repetition percentage threshold.
5. The method according to claim 1, wherein the obtaining a data frame to be transmitted, and when the data frame to be transmitted contains the common data, replacing the common data with a common identifier to obtain a common data frame to be transmitted, comprises:
acquiring a data frame to be transmitted;
determining arbitration control section data of the data frame to be transmitted; the arbitration control section data is arbitration section data and control section data of the data frame to be transmitted;
and when the arbitration control section data is matched with the common data, replacing the arbitration control section data with a common identifier to obtain the common data frame to be transmitted.
6. The method according to claim 5, wherein the replacing the arbitration control section data with a common identifier when the arbitration control section data matches the common data to obtain the common data frame to be transmitted comprises:
when the arbitration control section data is matched with the common data, determining the arbitration control section data as the common data;
according to the common data, common identification matched with the common data is obtained from a plurality of pre-stored common identifications; the plurality of common identifications are respectively matched with a plurality of common data;
and replacing the common data with the common identification to obtain the common data frame to be transmitted.
7. The method of claim 1, further comprising:
and when the data frame to be transmitted does not contain the common data, sending the data frame to be transmitted to the data receiving equipment.
8. The method of claim 1, wherein the sending the frame of common data to be transmitted to a data receiving device comprises:
and sending the common data frame to be transmitted to the data receiving equipment according to a preset cycle time.
9. A method for improving the data transmission reliability of a CAN bus is characterized by comprising the following steps:
receiving a data frame of a data transmitting device; the data frame comprises a calibration data segment; the calibration data section comprises an arbitration section and a control section;
when the data frame is a common data frame, acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame; the plurality of common data are respectively matched with a plurality of common identifications; the calibration data section of the common data frame comprises the common identification;
and replacing the common identification of the common data frame with the common data to obtain an effective data frame.
10. The method according to claim 9, further comprising, after the receiving the data frame of the data transmission apparatus:
extracting a calibration data section of the data frame;
determining a total number of data bits of the calibration data segment;
and when the total number of the data bits is smaller than a preset data bit threshold value, determining that the data frame is the common data frame.
11. The method of claim 9, further comprising:
if the plurality of common data do not include common data matched with the common identification, generating a communication fault prompt; and the communication fault prompt is used for prompting the communication fault of the CAN bus.
12. An apparatus for improving reliability of CAN bus data transmission, the apparatus comprising:
a transmitted data frame acquisition module for acquiring a transmitted data frame; the transmitted data frame includes a calibration data segment; the calibration data section comprises an arbitration section and a control section;
the repeated transmission quantity counting module is used for counting the repeated transmission quantity of the calibration data section;
the common data determining module is used for determining the calibration data section as common data according to the repeated transmission quantity of the calibration data section;
the device comprises a common data frame acquisition module, a common identification module and a common data frame transmission module, wherein the common data frame acquisition module is used for acquiring a data frame to be transmitted, and replacing the common data with the common identification when the data frame to be transmitted contains the common data to obtain the common data frame to be transmitted;
and the common data frame sending module is used for sending the common data frame to be transmitted to the data receiving equipment.
13. An apparatus for improving reliability of CAN bus data transmission, the apparatus comprising:
the data frame receiving module is used for receiving a data frame of the data sending equipment; the data frame comprises a calibration data segment; the calibration data section comprises an arbitration section and a control section;
the common data acquisition module is used for acquiring common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame when the data frame is the common data frame; the plurality of common data are respectively matched with a plurality of common identifications; the calibration data section of the common data frame comprises the common identification;
and the effective data frame acquisition module is used for replacing the common identification of the common data frame with the common data to obtain an effective data frame.
14. A system for improving the reliability of CAN bus data transmission, the system comprising:
a data transmitting device and a data receiving device;
the data receiving device is used for receiving the data frame of the data sending device, and when the data frame is a common data frame, obtaining common data matched with the common identification from a plurality of pre-stored common data according to the common identification of the common data frame, and further replacing the common identification of the common data frame with the common data to obtain an effective data frame; the plurality of common data are respectively matched with a plurality of common identifications;
the data sending equipment is used for acquiring a transmitted data frame, counting the repeated transmission quantity of a calibration data section in the transmitted data frame, determining the calibration data section as common data according to the repeated transmission quantity so as to acquire a data frame to be transmitted, replacing the common data with a common identifier when the data frame to be transmitted contains the common data so as to acquire a common data frame to be transmitted, and finally sending the common data frame to be transmitted to the data receiving equipment; the calibration data section includes an arbitration section and a control section.
15. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 11 when executing the computer program.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 11.
CN201910520074.0A 2019-06-17 2019-06-17 Method and device for improving reliability of CAN bus data transmission and computer equipment Active CN110266571B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910520074.0A CN110266571B (en) 2019-06-17 2019-06-17 Method and device for improving reliability of CAN bus data transmission and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910520074.0A CN110266571B (en) 2019-06-17 2019-06-17 Method and device for improving reliability of CAN bus data transmission and computer equipment

Publications (2)

Publication Number Publication Date
CN110266571A CN110266571A (en) 2019-09-20
CN110266571B true CN110266571B (en) 2020-11-03

Family

ID=67918584

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910520074.0A Active CN110266571B (en) 2019-06-17 2019-06-17 Method and device for improving reliability of CAN bus data transmission and computer equipment

Country Status (1)

Country Link
CN (1) CN110266571B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600961A (en) * 2020-05-22 2020-08-28 山东超越数控电子股份有限公司 Method, system, equipment and medium for transmitting bitmap file through CAN port
CN114257617A (en) * 2021-12-09 2022-03-29 北京天融信网络安全技术有限公司 Data processing method, device, equipment and computer readable storage medium
CN115314339B (en) * 2022-08-04 2023-06-23 潍柴动力股份有限公司 Weight checking method and device for CAN channel standard quantity, processor and vehicle

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075261A (en) * 2007-06-12 2007-11-21 腾讯科技(深圳)有限公司 Method and device for compressing index
CN101523732A (en) * 2006-09-01 2009-09-02 帕克比特软件股份有限公司 Method and system for transmitting a data file over a data network
CN104917591A (en) * 2015-06-11 2015-09-16 中国电子科技集团公司第五十四研究所 Satellite network data package compression method suitable for uni-directional lossy link
CN109861798A (en) * 2018-12-28 2019-06-07 惠科股份有限公司 Transmission method, device and the computer readable storage medium of data

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7908399B2 (en) * 2003-05-30 2011-03-15 Cisco Technology, Inc. Compression of repeated patterns in full bandwidth channels over a packet network
CN101369967A (en) * 2007-08-14 2009-02-18 华为技术有限公司 Method, base station and terminal for transmitting and receiving data
US9954892B2 (en) * 2015-09-28 2018-04-24 Nxp B.V. Controller area network (CAN) device and method for controlling CAN traffic

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101523732A (en) * 2006-09-01 2009-09-02 帕克比特软件股份有限公司 Method and system for transmitting a data file over a data network
CN101075261A (en) * 2007-06-12 2007-11-21 腾讯科技(深圳)有限公司 Method and device for compressing index
CN104917591A (en) * 2015-06-11 2015-09-16 中国电子科技集团公司第五十四研究所 Satellite network data package compression method suitable for uni-directional lossy link
CN109861798A (en) * 2018-12-28 2019-06-07 惠科股份有限公司 Transmission method, device and the computer readable storage medium of data

Also Published As

Publication number Publication date
CN110266571A (en) 2019-09-20

Similar Documents

Publication Publication Date Title
CN110266571B (en) Method and device for improving reliability of CAN bus data transmission and computer equipment
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN107888397B (en) Method and device for determining fault type
CN109542428B (en) Service processing method, device, computer equipment and storage medium
CN112153048B (en) Information analysis method, information analysis device, information analysis system, storage medium, and electronic device
CN111585837B (en) Internet of things data link monitoring method and device, computer equipment and storage medium
CN111143163A (en) Data monitoring method and device, computer equipment and storage medium
CN109218131B (en) Network monitoring method and device, computer equipment and storage medium
CN111432039A (en) Data request method, device and equipment in CDN and CDN node
CN110131852B (en) Air conditioner data collection method and device, computer equipment and storage medium
CN107005433B (en) Flow table entry timing processing method and device
CN108696446B (en) Method and device for updating flow characteristic information and central node server
CN111431733A (en) Service alarm coverage information evaluation method and device
CN111260227A (en) Service data source processing method and device, computer equipment and storage medium
CN110888892A (en) Block synchronization method, device and storage medium
CN112068982B (en) Automobile code setting method and device, computer equipment and storage medium
JP6992309B2 (en) Transmitter, receiver, and communication method
CN113079063A (en) Offline judgment method, system and device for charging device and computer storage medium
CN110989333B (en) Redundancy control method based on multiple computing cores, computing cores and redundancy control system
CN114567682A (en) Equipment state monitoring method and signal maintenance support system
CN112822123A (en) Data acquisition method and device
CN111667190A (en) Electric power construction grounding monitoring method and device and server
CN115080366B (en) Alarm method, alarm device, computer equipment and storage medium
CN109960922B (en) Method and device for identifying newly activated equipment
EP4064633A1 (en) Data compression method and apparatus, network device, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant