CN117376319A - CAN bus ID conflict recognition and processing method and related device - Google Patents

CAN bus ID conflict recognition and processing method and related device Download PDF

Info

Publication number
CN117376319A
CN117376319A CN202311349509.2A CN202311349509A CN117376319A CN 117376319 A CN117376319 A CN 117376319A CN 202311349509 A CN202311349509 A CN 202311349509A CN 117376319 A CN117376319 A CN 117376319A
Authority
CN
China
Prior art keywords
message
sending
target message
frequency
transmission
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.)
Pending
Application number
CN202311349509.2A
Other languages
Chinese (zh)
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.)
Weichai Power Co Ltd
Weifang Weichai Power Technology Co Ltd
Original Assignee
Weichai Power Co Ltd
Weifang Weichai Power Technology Co Ltd
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 Weichai Power Co Ltd, Weifang Weichai Power Technology Co Ltd filed Critical Weichai Power Co Ltd
Priority to CN202311349509.2A priority Critical patent/CN117376319A/en
Publication of CN117376319A publication Critical patent/CN117376319A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses
    • 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
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • 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)

Abstract

The invention discloses a CAN bus ID conflict recognition and processing method and a related device, wherein the method comprises the following steps: under the condition that bus errors exist in the messages sent by the current ECU, acquiring all the messages sent by the current ECU; grouping all messages based on the CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent; taking the target message as a receiving message, and judging whether the target message can be received or not; if so, judging that the message is a conflict message with ID conflict, acquiring a first sending frequency and a second sending frequency of the message, determining a sending mode of the target message based on the first sending frequency and the second sending frequency, and sending the target message based on the sending mode. In the process, firstly, the conflict message is identified, and then, the problem that the whole vehicle is paralyzed in communication due to the fact that some nodes are closed because of frequent transmission failure is avoided by adjusting the transmission mode of the conflict message.

Description

CAN bus ID conflict recognition and processing method and related device
Technical Field
The invention relates to the technical field of data processing, in particular to a CAN bus ID conflict recognition and processing method and a related device.
Background
In the whole vehicle CAN network, when a plurality of CAN nodes use the same ID to send messages due to the data calibration matching problem or due to the malicious attack of the CAN network, the message sending conflict CAN occur due to the failure of ID arbitration.
Because no node exits from the bus competition, when the low level data of a message of one node is covered by the high level of another node, the node CAN report an error frame, the sent data is invalid, the normal CAN data interaction is affected, and when serious, certain CAN nodes CAN enter a closing (BUSOFF) state, and the whole vehicle communication network is paralyzed.
Disclosure of Invention
In view of this, the present invention provides a method and related device for identifying and processing a CAN bus ID collision, which are used to solve the problem in the prior art that, because no node exits from bus contention, when the low level data of a message of a certain node is covered by the high level of another node, the node will report an error frame, send data failure, affect normal CAN data interaction, and cause some CAN nodes to enter a shutdown (BUSOFF) state when serious, and the whole vehicle communication network is paralyzed. The specific scheme is as follows:
a CAN bus ID conflict recognition and processing method comprises the following steps:
detecting whether a message sent by a current ECU has bus errors or not, and if so, acquiring all messages sent by the current ECU;
grouping all the messages based on a CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent;
taking the target message as a receiving message, and judging whether the target message can be received or not;
if yes, judging that the target message is a conflict message with ID conflict, and acquiring a first sending frequency and a second sending frequency of the target message, wherein the first sending frequency is the frequency of sending the target message of the current ECU, and the second sending frequency is the frequency of sending the target message by a conflict node;
and determining a transmission mode of the target message based on the first transmission frequency and the second transmission frequency, and transmitting the target message based on the transmission mode.
The method, optionally, detects whether the message sent by the current ECU has a bus error, including:
searching a transceiver error state register on a CAN node in the current ECU;
traversing the transceiver error state register to find out whether an error code corresponding to the message exists in the transceiver error state register;
if yes, judging whether the error code belongs to a preset error code, wherein the preset error code comprises the following steps: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors;
if the message belongs to the message, judging that the bus error exists in the message, otherwise, judging that the bus error does not exist in the message.
The method, optionally, groups all the messages based on the CAN node to obtain at least one group message, and obtains a target message of failure in sending each group message, including:
traversing all the messages to obtain each CAN node for transmitting all the messages;
dividing messages sent by the same CAN nodes into the same group to obtain at least one message group;
and acquiring the sending identification of each message in each message group, and determining the target message based on the sending identification.
The method, optionally, further comprises:
acquiring a first number and a second number of the transmission of each target message, wherein the first number represents the total number of times of the transmission of the current target message, and the second number represents the number of times of the transmission failure of the current target message;
determining a transmission failure rate of each target message based on the first number and the second number;
and acquiring the corresponding target message according to the descending order of the sending failure rate.
In the above method, optionally, determining a transmission mode of the target packet based on the first transmission frequency and the second transmission frequency, and transmitting the target packet based on the transmission mode includes:
comparing the first transmission frequency with the second transmission frequency;
if the second sending frequency is larger than the first sending frequency, sending the target message after receiving the target message;
and if the second transmission frequency is smaller than the first transmission frequency, keeping the transmission period of the current ECU unchanged, and transmitting the target message based on the transmission period.
A CAN bus ID collision recognition and processing apparatus comprising:
the detection and acquisition module is used for detecting whether the message sent by the current ECU has bus errors or not, and if so, acquiring all the messages sent by the current ECU;
the grouping and acquiring module is used for grouping all the messages based on the CAN node to obtain at least one message group, and acquiring a target message of failure in sending each message group;
the judging module is used for taking the target message as a receiving message and judging whether the target message can be received or not;
the acquisition module is used for judging that the target message is a conflict message with ID conflict, and acquiring a first transmission frequency and a second transmission frequency of the target message, wherein the first transmission frequency is the frequency of the current ECU for transmitting the target message, and the second transmission frequency is the frequency of a conflict node for transmitting the target message;
and the determining and transmitting module is used for determining the transmitting mode of the target message based on the first transmitting frequency and the second transmitting frequency and transmitting the target message based on the transmitting mode.
The above apparatus, optionally, the detecting and acquiring module includes:
a first searching unit, configured to search a transceiver error status register on a CAN node in the current ECU;
the second searching unit is used for traversing the transceiver error state register to find out whether an error code corresponding to the message exists in the transceiver error state register;
the judging unit is used for judging whether the error code belongs to a preset error code or not if the error code exists, wherein the preset error code comprises: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors;
and the judging unit is used for judging that the message has bus errors if the message belongs to the message, otherwise, judging that the message does not have bus errors.
The above apparatus, optionally, the grouping and acquiring module includes:
the first acquisition unit is used for traversing all the messages and acquiring each CAN node for transmitting all the messages;
the grouping unit is used for dividing the messages sent by the same CAN nodes into the same group to obtain at least one message group;
the grouping and determining unit is used for obtaining the sending identification of each message in each message grouping and determining the target message based on the sending identification.
The above device, optionally, further comprises:
the statistics unit is used for obtaining a first number and a second number of the sending of each target message, wherein the first number represents the total number of sending of the current target message, and the second number represents the number of failed sending of the current target message;
a determining unit, configured to determine a transmission failure rate of each target packet based on the first number and the second number;
and the second acquisition unit is used for acquiring the corresponding target message in descending order according to the sending failure rate.
The above apparatus, optionally, the determining and sending module includes:
a comparing unit configured to compare the first transmission frequency with the second transmission frequency;
the first sending unit is used for sending the target message after receiving the target message if the second sending frequency is larger than the first sending frequency;
and the second sending unit is used for keeping the sending period of the current ECU unchanged if the second sending frequency is smaller than the first sending frequency, and sending the target message based on the sending period.
A storage medium comprising a stored program, wherein the program performs the above-described CAN bus ID collision recognition and processing method.
The processor is used for running a program, wherein the CAN bus ID conflict recognition and processing method is executed when the program runs.
Compared with the prior art, the invention has the following advantages:
the invention discloses a CAN bus ID conflict recognition and processing method and a related device, wherein the method comprises the following steps: under the condition that bus errors exist in the messages sent by the current ECU, acquiring all the messages sent by the current ECU; grouping all messages based on the CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent; taking the target message as a receiving message, and judging whether the target message can be received or not; if so, judging that the message is a conflict message with ID conflict, acquiring a first sending frequency and a second sending frequency of the message, determining a sending mode of the target message based on the first sending frequency and the second sending frequency, and sending the target message based on the sending mode. In the process, firstly, the conflict message is identified, and then, the problem that the whole vehicle is paralyzed in communication due to the fact that some nodes are closed because of frequent transmission failure is avoided by adjusting the transmission mode of the conflict message.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for identifying and processing CAN bus ID collision, which is disclosed in the embodiment of the invention;
FIG. 2 is a block diagram of a device for identifying and processing CAN bus ID collision according to an embodiment of the invention;
fig. 3 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention discloses a method for identifying and processing ID conflict of a CAN bus and a related device, which are used for solving the problems that in a whole vehicle CAN network, the problem of data calibration and matching or the problem of paralysis of the whole vehicle communication network is solved, when a plurality of CAN nodes use the same ID to send messages, the message sending conflict CAN occur, normal CAN data interaction is influenced, and when serious, certain CAN nodes CAN enter a shutdown (BUSOFF) state, and the execution flow of the method is shown in a figure 1, and the method comprises the following steps:
s101, detecting whether a message sent by a current ECU has bus errors or not, and if so, acquiring all messages sent by the current ECU;
in the embodiment of the invention, during the message sending process, the error state register of the transceiver records: the method comprises the steps of receiving error count of a total message, total transmitting error count, error codes and the like, wherein each error code corresponds to a bus error type, and the bus error type comprises the following steps: bit errors, padding errors, CRC errors, format errors, and ACK errors.
Further to the above error types may be caused by bus signal interference, mismatching of node communication rates, different power-on timings of the controller, and generation of ACK, CRC type bus errors.
Therefore, under the condition that the current ECU sends a message, a transceiver error state register on a CAN node in the current ECU is searched, wherein the searching mode CAN be searching at a designated position or searching based on a preset identifier, and the searching mode and the existence form of the preset identifier are not particularly limited in the embodiment of the invention. Traversing the transceiver error status register to find out whether an error code corresponding to the message exists, wherein preferably, the searching mode may be that the error code is found out at a designated position, if so, it is determined whether the error code belongs to a preset error code, where the preset error code includes: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors. If the message belongs to the group, judging that the bus error exists in the message, acquiring all messages sent by the current ECU, wherein the message is failed to be sent, otherwise, judging that the bus error does not exist in the message, and the message is successfully sent.
S102, grouping all the messages based on a CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent;
in the embodiment of the invention, all messages are traversed, all CAN nodes for transmitting all the messages are obtained, the messages transmitted by the same CAN nodes are divided into the same group to obtain at least one message group, and a transmission identifier of each message in each message group is obtained, wherein the transmission identifier is used for representing whether the corresponding message is successfully transmitted or not, and a target message of transmission failure in each group is determined based on the transmission identifier.
In the embodiment of the invention, the CAN nodes refer to the external communication of the ECU by a plurality of CAN paths, the engine ECU generally has three to four CAN paths, and the purpose of the CAN node grouping according to the ECU is that ID conflict is possible in different CAN node communication networks of the ECU, and the ID conflict is required to be searched in a message sent to the network by the ECU.
Further, a first number and a second number of the transmissions of each target message are obtained, wherein the first number represents the total number of times the current target message is transmitted, the second number represents the number of times the current target message is transmitted in failure, the transmission failure rate of each target message is determined based on the first number and the second number, and the corresponding target message is obtained according to the transmission failure rate in descending order.
Because the ECU controller on the whole vehicle has the message transmission failure caused by the ID conflict with other CAN nodes, the method is obviously characterized in that the ECU CAN detect the increase of the transmission failure count of the conflict message, and the transmission failure rate of the conflict message with the ID conflict CAN be obviously higher than that of other ECU transmission messages. Therefore, the target message in the corresponding message packet is acquired according to the descending order of the failure rate, so that the possibility of determining the conflict message can be improved.
S103, taking the target message as a receiving message, and judging whether the target message can be received or not;
in the embodiment of the invention, the target message is used as a receiving message, the bus is traversed, whether the target message is received in the bus or not is searched, namely whether other nodes send the target message or not is searched, the target message is compared with the messages sent by other nodes in the bus, whether the target message and the messages sent by other nodes in the bus are identical or not is judged, and the comparison of all the messages in the bus is completed.
S104, judging that the target message is a conflict message with ID conflict, and acquiring a first transmission frequency and a second transmission frequency of the target message, wherein the first transmission frequency is the frequency of the current ECU for transmitting the target message, and the second transmission frequency is the frequency of a conflict node for transmitting the target message;
in the embodiment of the present invention, if the target message is received, it is determined that the target message is a collision message with an ID collision, and a first sending frequency and a second sending frequency of the target message are obtained, where the first sending frequency is a frequency of sending the target message by the current ECU, and the second sending frequency is a frequency of sending the target message by a collision node, and the first sending frequency and the second sending frequency may be obtained based on a communication protocol or obtained at a preset position, and in the embodiment of the present invention, a specific obtaining mode is not limited.
Preferably, the ID of the conflict message is displayed in the whole vehicle instrument, further fault reasons are displayed through the instrument, degradation measures such as message sending time adjustment are automatically made, continuous accumulation of failure counting errors of sending data is avoided, the node enters a message receiving and sending closing state, and the CAN communication fault rate of the whole vehicle CAN be effectively reduced.
S105, determining a transmission mode of the target message based on the first transmission frequency and the second transmission frequency, and transmitting the target message based on the transmission mode.
In the embodiment of the invention, the first transmission frequency is compared with the second transmission frequency, if the second transmission frequency is larger than the first transmission frequency, the target message is transmitted after the target message is received, and if the second transmission frequency is smaller than the first transmission frequency, the current transmission period of the ECU is kept unchanged, and the target message is transmitted based on the transmission period.
In the above process, a preset frequency threshold and a preset difference threshold are set, where the values of the preset frequency threshold and the preset difference threshold may be set based on experience or specific situations, and in the embodiment of the present invention, specific limitation is not performed.
If the first transmission frequency is higher than a preset frequency threshold, in the case that the second transmission frequency is higher than the first transmission frequency, in order to avoid ID collision, the target message is immediately transmitted after the target message is received, if the second transmission frequency is lower than the first transmission frequency, if the difference between the first transmission frequency and the second transmission frequency is higher than a preset difference threshold, the transmission period of the current ECU is kept unchanged, and the target message is transmitted based on the transmission period, otherwise, if the difference between the first transmission frequency and the second transmission frequency is lower than a preset difference threshold, in order to avoid ID collision, the target message is immediately transmitted after the target message is received.
If the first transmission frequency is smaller than a preset frequency threshold, if the second transmission frequency is larger than the first transmission frequency, if a difference value between the second transmission frequency and the first transmission frequency is larger than the preset difference threshold, in order to avoid ID collision, the target message is immediately transmitted after the target message is received, if the difference value between the second transmission frequency and the first transmission frequency is smaller than the preset difference threshold, a transmission period of the current ECU is kept unchanged, the target message is transmitted based on the transmission period, or if the second transmission frequency is smaller than the first transmission frequency, the transmission period of the current ECU is kept unchanged, and the target message is transmitted based on the transmission period.
The invention discloses a CAN bus ID conflict recognition and processing method, which comprises the following steps: under the condition that bus errors exist in the messages sent by the current ECU, acquiring all the messages sent by the current ECU; grouping all messages based on the CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent; taking the target message as a receiving message, and judging whether the target message can be received or not; if so, judging that the message is a conflict message with ID conflict, acquiring a first sending frequency and a second sending frequency of the message, determining a sending mode of the target message based on the first sending frequency and the second sending frequency, and sending the target message based on the sending mode. In the process, firstly, the conflict message is identified, and then, the problem that the whole vehicle is paralyzed in communication due to the fact that some nodes are closed because of frequent transmission failure is avoided by adjusting the transmission mode of the conflict message.
In the embodiment of the invention, an ECU (electronic control unit) is designed to automatically detect the ID conflict function of the bus message, and the reason of communication errors is displayed through an instrument, so that the conflict message ID is used for helping the troubleshooting and maintenance. According to the ID conflict feature of the CAN bus message transmission, the ECU transmission message most likely to have ID conflict is screened out through error frame type and statistics of the failure rate of the transmission of the different ID transmission messages of the ECU. All the ECU sending messages (usually tens of messages) can be prevented from being configured into receiving messages to confirm ID conflict one by one, so that the identification efficiency is improved, and the interrupt load of the ECU message receiving is reduced. And after the ECU identifies faults, according to the fault types, automatically adjusting a communication message sending mechanism (maintaining a message sending period or adjusting a sending moment), and avoiding collision of the same ID messages under the condition of ensuring timely message signal transmission, thereby reducing the fault influence caused by ID collision.
Based on the above-mentioned method for identifying and processing the collision of the ID of the CAN bus, the embodiment of the present invention further provides a device for identifying and processing the collision of the ID of the CAN bus, where the structural block diagram of the device is shown in fig. 2, and the device includes:
the device comprises a detection and acquisition module 201, a grouping and acquisition module 202, a judgment module 203, an acquisition module 204 and a determination and transmission module 205.
Wherein,
the detecting and acquiring module 201 is configured to detect whether a bus error exists in a message sent by a current ECU, and if so, acquire all messages sent by the current ECU;
the grouping and acquiring module 202 is configured to group all the messages based on a CAN node to obtain at least one message group, and acquire a target message of failure in sending each message group;
the judging module 203 is configured to judge whether the target packet can be received by using the target packet as a receiving packet;
the obtaining module 204 is configured to determine that the target message is a collision message with an ID collision if the target message is the collision message, and obtain a first sending frequency and a second sending frequency of the target message, where the first sending frequency is a frequency of sending the target message by the current ECU, and the second sending frequency is a frequency of sending the target message by a collision node;
the determining and sending module 205 is configured to determine a sending manner of the target packet based on the first sending frequency and the second sending frequency, and send the target packet based on the sending manner.
The invention discloses a CAN bus ID conflict recognition and processing device, which comprises: under the condition that bus errors exist in the messages sent by the current ECU, acquiring all the messages sent by the current ECU; grouping all messages based on the CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent; taking the target message as a receiving message, and judging whether the target message can be received or not; if so, judging that the message is a conflict message with ID conflict, acquiring a first sending frequency and a second sending frequency of the message, determining a sending mode of the target message based on the first sending frequency and the second sending frequency, and sending the target message based on the sending mode. In the process, firstly, the conflict message is identified, and then, the problem that the whole vehicle is paralyzed in communication due to the fact that some nodes are closed because of frequent transmission failure is avoided by adjusting the transmission mode of the conflict message.
In the embodiment of the present invention, the detecting and acquiring module 201 includes:
the device comprises a first searching unit, a second searching unit, a judging unit and a judging unit.
Wherein,
the first searching unit is used for searching a transceiver error state register on a CAN node in the current ECU;
the second searching unit is configured to search through the transceiver error status register for whether an error code corresponding to the message exists;
the judging unit is configured to judge whether the error code belongs to a preset error code if the error code exists, where the preset error code includes: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors;
and the judging unit is used for judging that the message has bus errors if the message belongs to the bus error, otherwise, judging that the message has no bus errors.
In an embodiment of the present invention, the grouping and obtaining module 202 includes:
the apparatus includes a first acquisition unit, a grouping unit, and a grouping and determining unit.
Wherein,
the first acquisition unit is used for traversing all the messages and acquiring each CAN node for transmitting all the messages;
the grouping unit is used for dividing the messages sent by the same CAN nodes into the same group to obtain at least one message group;
the grouping and determining unit is used for obtaining the sending identification of each message in each message grouping and determining the target message based on the sending identification.
In an embodiment of the present invention, the grouping and obtaining module 202 further includes:
the device comprises a statistics unit, a determination unit and a second acquisition unit.
Wherein,
the statistics unit is configured to obtain a first number and a second number of transmissions of each target packet, where the first number represents a total number of times that the current target packet is transmitted, and the second number represents a number of times that the current target packet is failed to be transmitted, and respectively count the first number of times that the current target packet is transmitted in each packet and the second number of times that the target packet is transmitted;
the determining unit is configured to determine a failure rate of transmission of each target packet based on the first number and the second number;
the second obtaining unit is configured to obtain the corresponding target message in descending order according to the sending failure rate, and obtain the target message in the corresponding message packet in descending order according to the failure rate.
In the embodiment of the present invention, the determining and sending module 205 includes:
a comparing unit, a first transmitting unit and a second transmitting unit.
Wherein,
the comparing unit is used for comparing the first transmission frequency with the second transmission frequency;
the first sending unit is configured to send the target message after receiving the target message if the second sending frequency is greater than the first sending frequency;
and the second sending unit is used for keeping the sending period of the current ECU unchanged if the second sending frequency is smaller than the first sending frequency, and sending the target message based on the sending period.
The distribution device comprises a processor and a memory, wherein the detection and acquisition module, the grouping and acquisition module, the judgment module, the acquisition module, the determination and transmission module and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be set with one or more than one, and the problem of communication paralysis of the whole vehicle caused by the fact that certain nodes are in a closed state due to frequent transmission failure is avoided by adjusting kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a computer storage medium, wherein a program is stored on the computer storage medium, and the program realizes the CAN bus ID conflict recognition and processing method when being executed by a processor.
The embodiment of the invention provides a processor which is used for running a program, wherein the CAN bus ID conflict recognition and processing method is executed when the program runs.
An embodiment of the present invention provides an apparatus, where a structural block diagram of the apparatus is shown in fig. 3, and the apparatus includes: a processor 301, a storage medium 302, and a program stored on the storage medium 302 and executable on the processor 302, the processor 301 implementing the following steps when executing the program:
detecting whether a message sent by a current ECU has bus errors or not, and if so, acquiring all messages sent by the current ECU;
grouping all the messages based on a CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent;
taking the target message as a receiving message, and judging whether the target message can be received or not;
if yes, judging that the target message is a conflict message with ID conflict, and acquiring a first sending frequency and a second sending frequency of the target message, wherein the first sending frequency is the frequency of sending the target message of the current ECU, and the second sending frequency is the frequency of sending the target message by a conflict node;
and determining a transmission mode of the target message based on the first transmission frequency and the second transmission frequency, and transmitting the target message based on the transmission mode.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (12)

1. The CAN bus ID conflict recognition and processing method is characterized by comprising the following steps:
detecting whether a message sent by a current ECU has bus errors or not, and if so, acquiring all messages sent by the current ECU;
grouping all the messages based on a CAN node to obtain at least one message group, and obtaining a target message of which each message group fails to be sent;
taking the target message as a receiving message, and judging whether the target message can be received or not;
if yes, judging that the target message is a conflict message with ID conflict, and acquiring a first sending frequency and a second sending frequency of the target message, wherein the first sending frequency is the frequency of sending the target message of the current ECU, and the second sending frequency is the frequency of sending the target message by a conflict node;
and determining a transmission mode of the target message based on the first transmission frequency and the second transmission frequency, and transmitting the target message based on the transmission mode.
2. The method of claim 1, wherein detecting whether a bus error exists in a message sent by a current ECU comprises:
searching a transceiver error state register on a CAN node in the current ECU;
traversing the transceiver error state register to find out whether an error code corresponding to the message exists in the transceiver error state register;
if yes, judging whether the error code belongs to a preset error code, wherein the preset error code comprises the following steps: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors;
if the message belongs to the message, judging that the bus error exists in the message, otherwise, judging that the bus error does not exist in the message.
3. The method of claim 1, wherein grouping the entire messages based on the CAN node to obtain at least one packet message, obtaining a target message for which transmission of each packet message fails, comprises:
traversing all the messages to obtain each CAN node for transmitting all the messages;
dividing messages sent by the same CAN nodes into the same group to obtain at least one message group;
and acquiring the sending identification of each message in each message group, and determining the target message based on the sending identification.
4. A method according to claim 3, further comprising:
acquiring a first number and a second number of the transmission of each target message, wherein the first number represents the total number of times of the transmission of the current target message, and the second number represents the number of times of the transmission failure of the current target message;
determining a transmission failure rate of each target message based on the first number and the second number;
and acquiring the corresponding target message according to the descending order of the sending failure rate.
5. The method of claim 1, wherein determining a transmission manner of the target message based on the first transmission frequency and the second transmission frequency, and transmitting the target message based on the transmission manner, comprises:
comparing the first transmission frequency with the second transmission frequency;
if the second sending frequency is larger than the first sending frequency, sending the target message after receiving the target message;
and if the second transmission frequency is smaller than the first transmission frequency, keeping the transmission period of the current ECU unchanged, and transmitting the target message based on the transmission period.
6. A CAN bus ID collision recognition and processing apparatus, comprising:
the detection and acquisition module is used for detecting whether the message sent by the current ECU has bus errors or not, and if so, acquiring all the messages sent by the current ECU;
the grouping and acquiring module is used for grouping all the messages based on the CAN node to obtain at least one message group, and acquiring a target message of failure in sending each message group;
the judging module is used for taking the target message as a receiving message and judging whether the target message can be received or not;
the acquisition module is used for judging that the target message is a conflict message with ID conflict, and acquiring a first transmission frequency and a second transmission frequency of the target message, wherein the first transmission frequency is the frequency of the current ECU for transmitting the target message, and the second transmission frequency is the frequency of a conflict node for transmitting the target message;
and the determining and transmitting module is used for determining the transmitting mode of the target message based on the first transmitting frequency and the second transmitting frequency and transmitting the target message based on the transmitting mode.
7. The apparatus of claim 6, wherein the means for detecting and acquiring comprises:
a first searching unit, configured to search a transceiver error status register on a CAN node in the current ECU;
the second searching unit is used for traversing the transceiver error state register to find out whether an error code corresponding to the message exists in the transceiver error state register;
the judging unit is used for judging whether the error code belongs to a preset error code or not if the error code exists, wherein the preset error code comprises: at least one of padding errors, bit errors, CRC errors, ACK errors, and format errors; and the judging unit is used for judging that the message has bus errors if the message belongs to the message, otherwise, judging that the message does not have bus errors.
8. The apparatus of claim 6, wherein the grouping and obtaining module comprises:
the first acquisition unit is used for traversing all the messages and acquiring each CAN node for transmitting all the messages;
the grouping unit is used for dividing the messages sent by the same CAN nodes into the same group to obtain at least one message group;
the grouping and determining unit is used for obtaining the sending identification of each message in each message grouping and determining the target message based on the sending identification.
9. The apparatus as recited in claim 8, further comprising:
the statistics unit is used for obtaining a first number and a second number of the sending of each target message, wherein the first number represents the total number of sending of the current target message, and the second number represents the number of failed sending of the current target message;
a determining unit, configured to determine a transmission failure rate of each target packet based on the first number and the second number;
and the second acquisition unit is used for acquiring the corresponding target message in descending order according to the sending failure rate.
10. The apparatus of claim 6, wherein the means for determining and transmitting comprises:
a comparing unit configured to compare the first transmission frequency with the second transmission frequency;
the first sending unit is used for sending the target message after receiving the target message if the second sending frequency is larger than the first sending frequency;
and the second sending unit is used for keeping the sending period of the current ECU unchanged if the second sending frequency is smaller than the first sending frequency, and sending the target message based on the sending period.
11. A storage medium comprising a stored program, wherein the program performs the CAN bus ID collision recognition and processing method of claims 1-5.
12. A processor, wherein the processor is configured to run a program, and wherein the program, when run, performs the CAN bus ID collision recognition and processing method of claims 1-5.
CN202311349509.2A 2023-10-18 2023-10-18 CAN bus ID conflict recognition and processing method and related device Pending CN117376319A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311349509.2A CN117376319A (en) 2023-10-18 2023-10-18 CAN bus ID conflict recognition and processing method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311349509.2A CN117376319A (en) 2023-10-18 2023-10-18 CAN bus ID conflict recognition and processing method and related device

Publications (1)

Publication Number Publication Date
CN117376319A true CN117376319A (en) 2024-01-09

Family

ID=89390600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311349509.2A Pending CN117376319A (en) 2023-10-18 2023-10-18 CAN bus ID conflict recognition and processing method and related device

Country Status (1)

Country Link
CN (1) CN117376319A (en)

Similar Documents

Publication Publication Date Title
US11411681B2 (en) In-vehicle information processing for unauthorized data
US10902109B2 (en) Misuse detection method, misuse detection electronic control unit, and misuse detection system
EP2624140A1 (en) Method and system for detecting anomaly of network processor
CN111988191B (en) Fault detection method and device for distributed communication network
CN113341906B (en) Fault processing method, device and equipment and automobile
US11444891B2 (en) Electronic control unit, abnormality determination program, and abnormality determination method
CN114731301B (en) Determination method, determination system, and program recording medium
CN113132160B (en) Method and system for detecting network sub-health state of client node
WO2023241703A1 (en) Fault processing method and device, and computer-readable storage medium
CN111315026B (en) Channel selection method, device, gateway and computer readable storage medium
EP3447650B1 (en) System and method of monitoring a serial bus
US20150258999A1 (en) Method and apparatus for isolating a fault-active controller in a controller area network
CN117376319A (en) CAN bus ID conflict recognition and processing method and related device
CN115603975B (en) Message intrusion detection method and device, electronic equipment and storage medium
CN114301815B (en) Method and device for processing broadcast storm
EP1583290B1 (en) System and method for reacting to miscabling defects in resilient packet ring networks
CN111757371A (en) Statistical method of transmission delay, server and storage medium
CN115499294A (en) Distributed storage environment network sub-health detection and fault automatic processing method
CN115022078A (en) Controller built-in network safety protection method and device and electronic equipment
CN110138657B (en) Aggregation link switching method, device, equipment and storage medium between switches
US20110264974A1 (en) Method for operating a communication system having a plurality of nodes, and a communication system therefor
US20240314018A1 (en) Method and apparatus for determining a first causal map
CN112818055B (en) Block chain performance optimization method, device and equipment
US20230322242A1 (en) Autonomous driving control apparatus and method thereof
US8271828B2 (en) Restarting networks

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