Method, device and equipment for recovering CAN (Controller Area Network) communication failure of locomotive braking system
By programming the bus shutdown state of the CAN controller in the locomotive braking system, the node recovery waiting time is controlled, which solves the risk problem when the CAN node is recovered quickly, and improves the availability and response capabilities of the locomotive braking system.
Patent Information
- Application Number
- CN202411782114.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-05-06
AI Technical Summary
After the CAN node in the existing locomotive braking system enters the bus off state, there is a high risk of rapid recovery of participating in bus communication, reducing the availability of the locomotive braking system.
The MCU programes the recovery process of the CAN controller bus shutdown state, and controls the waiting time for the active error active state to recover from the bus shutdown state, obtains the sending error count of the CAN node in real time, and determines the appropriate waiting time to restart the recovery CAN node to participate in bus communication based on the error count and the count of the recovery counter.
Reduce risks, improve the availability of locomotive braking systems, and improve the node's rapid functional response capabilities through flexible control of the recovery process.
Smart Images

Figure CN119945880A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of locomotive communication technology, and in particular to a method, device and equipment for recovering CAN communication fault of a locomotive brake system. Background Art
[0002] The ISO-compliant Controller Area Network (CAN) bus is a serial communication network that effectively supports distributed control and real-time control and has been widely used in locomotive braking systems. In order to prevent a device inside the locomotive braking system from being unable to correctly send and receive messages due to its own reasons (such as hardware damage), and constantly destroying the CAN bus data frame, thereby affecting other normal node communications, the CAN network has a strict error diagnosis function. The CAN general specification stipulates that each CAN controller has a send error counter and a receive error counter. Depending on the count value, the node will be in different action states (error active, error passive, and bus off), and the state transition will be performed according to the change of the count value.
[0003] At present, when the CAN nodes in the locomotive braking system enter the bus-off state, they can easily resume communication when the bus is idle. However, since serious errors have occurred in the nodes when entering the bus-off state and they are in an untrusted state, quickly resuming participation in bus communication has a high risk, which reduces the availability of the locomotive braking system. Summary of the invention
[0004] The purpose of the present invention is to at least provide a method, device and equipment for recovering CAN communication fault of a locomotive brake system, so as to solve the problem that the existing method has high risk and reduces the availability of the locomotive brake system.
[0005] To solve the above technical problems, at least one embodiment of the present application provides a method for recovering a CAN communication fault of a locomotive brake system, comprising:
[0006] Acquire the sending error count of the CAN node in the locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state;
[0007] When the CAN node in the locomotive braking system is in a bus-off state, the message transmission and reception are stopped, and after waiting for a first time period, the CAN node is restarted to participate in bus communication, and the recovery counter is counted;
[0008] When the count of the recovery counter is greater than or equal to the second value, the CAN node is restarted to resume participating in the bus communication after waiting for the second time period.
[0009] In some embodiments, the first duration is less than the second duration.
[0010] In some embodiments, the first time duration, the second time duration and the second value are determined according to the CAN communication baud rate, the number of nodes and the tolerable recovery time duration of the locomotive braking system.
[0011] In some embodiments, the first duration, the second duration, and the second value are determined according to the following expression:
[0012] T1≥128*11*(1 / k)*n;
[0013] T2 ≥ T1*N;
[0014] T1*N+T2≤T
[0015] Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
[0016] At least one embodiment of the present application further provides a locomotive brake system CAN communication fault recovery device, comprising:
[0017] An acquisition control module is used to acquire the sending error count of the CAN node in the locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state;
[0018] A first recovery module is used for stopping the transmission and reception of messages when the CAN node in the locomotive braking system is in a bus-off state, restarting and recovering the CAN node to participate in bus communication after waiting for a first time period, and counting a recovery counter;
[0019] The second recovery module is used for restarting and recovering the CAN node to participate in bus communication after waiting for a second time period when the count of the recovery counter is greater than or equal to a second value.
[0020] In some embodiments, the first duration is less than the second duration.
[0021] In some embodiments, the first time duration, the second time duration and the second value are determined according to the CAN communication baud rate, the number of nodes and the tolerable recovery time duration of the locomotive braking system.
[0022] In some embodiments, the first duration, the second duration, and the second value are determined according to the following expression:
[0023] T1≥128*11*(1 / k)*n;
[0024] T2 ≥ T1*N;
[0025] T1*N+T2≤T
[0026] Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
[0027] At least one embodiment of the present application also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned locomotive braking system CAN communication fault recovery method.
[0028] At least one embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the above-mentioned locomotive brake system CAN communication fault recovery method.
[0029] The embodiments of the present application provide a method, device and equipment for recovering CAN communication faults in a locomotive brake system. By acquiring the sending error count of the CAN node in the locomotive brake system in real time, when the sending error count exceeds a first value, the CAN node in the locomotive brake system is controlled to enter a bus-off state; when the CAN node in the locomotive brake system is in a bus-off state, message transmission and reception are stopped, and after waiting for a first time, the CAN node is restarted to participate in bus communication, and the recovery counter is counted; when the count of the recovery counter is greater than or equal to a second value, the CAN node is restarted to participate in bus communication after waiting for a second time. The risk is reduced and the availability of the locomotive brake system is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] One or more embodiments are exemplarily described by the pictures in the corresponding drawings, and these exemplary descriptions do not constitute limitations on the embodiments.
[0031] Figure 1 It is a schematic diagram of CAN node state conversion in the prior art;
[0032] Figure 2 is a flow chart of a method for recovering a CAN communication fault in a locomotive brake system provided by an embodiment of the present application;
[0033] Figure 3 is a flow chart of a method for recovering a CAN communication fault of a locomotive brake system provided by another embodiment of the present application;
[0034] Figure 4 This is a schematic diagram of CAN node state transition provided by an embodiment of the present application;
[0035] Figure 5is a schematic diagram of a CAN communication fault recovery device for a locomotive brake system provided by an embodiment of the present application;
[0036] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0037] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not be construed as any limitation, and the various embodiments can be combined and referenced with each other under the premise of no contradiction.
[0038] In order to facilitate understanding of the embodiments of the present application, relevant content about the CAN node status is first introduced here.
[0039] Each CAN controller has a transmit error counter (TEC) and a receive error counter (REC). Depending on the count value, the node will be in different action states (error active, error passive and bus off), and the state transition will be performed according to the change of the count value.
[0040] The three error states of error active, error passive and bus off are used to identify the severity of the fault. Among them, bus off is the most serious error state of the node. The node has different characteristics in different states. In the bus off state, the node cannot send messages or respond to messages on the bus, which means that it can no longer have any impact on the bus. The rules of state jump and error counting enable the node to have a better self-error handling and recovery mechanism when a communication failure occurs. During the communication process, the recovery process of the node in the error active and error passive states generally does not require additional programming processing by the MCU, and the inherent functions of the CAN controller can be used directly. However, for the bus off state, the inherent recovery process of the CAN controller is often not used directly, but programmed and controlled.
[0041] Depending on whether the microcontroller unit (MCU) turns on the automatic recovery function of the CAN controller, the recovery of the CAN node inside the locomotive braking system after entering the bus-off state is divided into two cases. When the CAN node inside the locomotive braking system enters the bus-off state, if the MCU only turns on the automatic recovery function, the CAN controller can resume communication after detecting 128 consecutive 11 recessive bits. The recovery process is as follows: Figure 1 As shown in (a). In actual application, this condition is easy to achieve. Taking the baud rate of 250K as an example, 128*11*(1 / 250000)=0.005632s, which means that if the frame interval time of the CAN bus where the node is located is greater than 0.005632s, the node can easily resume communication during the bus idle time. When entering the bus-off state, the node has already suffered a serious error and is in an untrustworthy state. If it quickly resumes participating in bus communication, there is a high risk. Therefore, in actual application, it is necessary to program the recovery process of the CAN controller bus-off state through the MCU to control the waiting time for the node to recover from the bus-off state to the active error active state, so as to achieve the purpose of improving flexibility and ensuring the rapid response of the node in terms of function. When the MCU does not turn on the automatic recovery function of the CAN controller and does not actively intervene in the bus-off error, the node will not be able to "automatically" resume bus communication and can only be restored by powering on again. The recovery process is as follows: Figure 1 As shown in (b).
[0042] In order to solve at least one problem existing in the prior art, the present application proposes a recovery method for the CAN bus closed state inside the locomotive braking system. The MCU programs the recovery process of the CAN controller bus closed state, and controls the waiting time for the node to recover the active error active state from the bus closed state, so as to achieve the purpose of improving flexibility and ensuring the fast functional response of the node, thereby improving the availability of the locomotive braking system internal network control. The method provided by the present application will be described in detail below through specific embodiments. The following content is only for the convenience of understanding the implementation details provided, and is not necessary for the implementation of this solution.
[0043] Embodiment 1:
[0044] Figure 2 1 is a flow chart of a method for recovering a CAN communication fault in a locomotive brake system provided by an embodiment of the present application. The method for recovering a CAN communication fault in a locomotive brake system provided by this embodiment can be applied to electronic devices with communication, computing and data storage capabilities. The specific process can be as follows: Figure 2 As shown, it may include:
[0045] S201. Acquire the sending error count of the CAN node in the locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state.
[0046] When a CAN node in a locomotive brake system sends a message in a normal mode, if a sending error occurs, the sending error count will increase. As long as the sending error count does not exceed the first value (255), the CAN controller will automatically resend the message. If multiple errors occur, causing the sending error count to accumulate to more than 255, the node will jump to the bus off state. The first value in this embodiment can be 255.
[0047] S202: When the CAN node in the locomotive braking system is in a bus-off state, stop sending and receiving messages, restart and restore the CAN node to participate in bus communication after waiting for a first period of time, and count the recovery counter.
[0048] The MCU can know that the node has entered the bus-off state at the first time (for example, the CAN node state can be obtained by querying the corresponding bit of the status register in the error interrupt processing logic). When the CAN node in the locomotive braking system is in the bus-off state, the MCU controls the CAN controller to stop sending and receiving messages, and waits to enter the first type of recovery process. In the first type of recovery process, after waiting for a first period of time, the MCU restarts and restores the CAN controller to participate in bus communication, thus completing a first type of recovery process and counting the recovery counter (that is, the count of the recovery counter is increased by 1).
[0049] S203: When the count of the recovery counter is greater than or equal to the second value, restarting and recovering the CAN node to participate in bus communication after waiting for a second time period.
[0050] Each time the node enters the first type of recovery process, the count of the recovery counter is increased by 1. When the count of the recovery counter reaches the set second value, the second type of recovery process is entered, that is, it is necessary to wait for the second time when entering the bus off state again. Among them, the first time is less than the second time. In other words, after the first type of recovery process is changed to the second type of recovery process, the difficulty of the node to restore communication is increased by extending the waiting time, and the risk is reduced.
[0051] The locomotive brake system CAN communication fault recovery method provided in this embodiment obtains the sending error count of the CAN node in the locomotive brake system in real time. When the sending error count exceeds the first value, the CAN node in the locomotive brake system is controlled to enter the bus-off state; when the CAN node in the locomotive brake system is in the bus-off state, the message transmission and reception is stopped, and the CAN node is restarted to participate in the bus communication after waiting for the first time, and the recovery counter is counted; when the count of the recovery counter is greater than or equal to the second value, the CAN node is restarted to participate in the bus communication after waiting for the second time. Reduced risk and improved the availability of the locomotive brake system. The recovery process of the CAN controller bus-off state is programmed and processed by the MCU, and the waiting time for the control node to recover the active error active state from the bus-off state is achieved, so as to achieve the purpose of both improving flexibility and ensuring the rapid functional response of the node, thereby improving the availability of the intranet control of the locomotive brake system.
[0052] Based on the above embodiment, the following will further explain in detail how to determine the first duration, the second duration, and the second value. In an optional implementation, the first duration, the second duration, and the second value can be determined based on the CAN communication baud rate, the number of nodes, and the tolerable recovery time of the locomotive braking system. Specifically, the first duration, the second duration, and the second value can be determined according to the following expression:
[0053] T1≥128*11*(1 / k)*n;
[0054] T2 ≥ T1*N;
[0055] T1*N+T2≤T
[0056] Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
[0057] For example, when T = 1500ms, k = 250K, n = 6, T1 can be 100ms, N can be 5, and T2 can be 1000ms. By programming and controlling the recovery behavior after the bus is closed through the MCU, the error management and recovery mechanism of the CAN controller is actually supplemented, making the recovery process after the bus is closed more flexible and more adaptable to the needs of the application.
[0058] Embodiment 2:
[0059] The following will further illustrate the locomotive brake system CAN communication fault recovery method provided by the present application through a specific example, and its specific process can be as follows: Figure 3 In this embodiment, the CAN node state conversion is as follows Figure 4 shown.
[0060] (1) When a node is sending a message in normal transmission mode, if a transmission error occurs, the transmission error count will increase. As long as the transmission error count does not exceed 255, the CAN controller will automatically resend the message. If multiple errors occur and the transmission error count accumulates to more than 255, the node will jump to the bus off state.
[0061] (2) The MCU is able to know immediately that the node has entered the bus shutdown state (for example, by querying the corresponding bit of the status register in the error interrupt processing logic). At this time, the MCU controls the CAN controller to enter the "fast recovery" process (the first type of recovery process), that is, to control the CAN controller to stop sending and receiving messages and wait. After the timing reaches the required time T1, the MCU restarts and restores the CAN controller to participate in bus communication, thus completing a "fast recovery" process.
[0062] (3) Every time a node enters the "fast recovery" process, the MCU will count this. When the node's "fast recovery" count reaches the set value N, the MCU will extend the waiting time T2 for resuming bus communication when it enters the bus-off state again, thus realizing the "slow recovery" process (the second type of recovery process). The main difference between the "fast recovery" and "slow recovery" processes lies in the different waiting times for the node to participate in bus communication.
[0063] (4) The waiting time for "fast recovery" and "slow recovery", as well as the number of times the "fast recovery" count enters the "slow recovery" process, the duration T1 / T2 and the number of times N are determined based on the CAN communication baud rate k, the number of nodes n, the tolerable recovery time T of the braking system, etc.
[0064] When the CAN node inside the locomotive braking system enters the bus-off state, if the MCU only turns on the automatic recovery function, the node can easily resume communication during the bus idle time. When entering the bus-off state, a serious error has occurred in the node and it is in an untrusted state. If it is quickly restored to participate in the bus communication, there is a high risk. The present invention programs the recovery process of the CAN controller bus-off state through the MCU, and controls the waiting time for the node to recover from the bus-off state to the active error active state, thereby achieving the purpose of both improving flexibility and ensuring the node's rapid functional response, thereby improving the availability of intranet control of the locomotive braking system.
[0065] Embodiment three:
[0066] Another embodiment of the present application relates to a CAN communication fault recovery device for a locomotive brake system. The implementation details of the CAN communication fault recovery device for a locomotive brake system of this embodiment are specifically described below. The following content is only for the convenience of understanding the implementation details provided, and is not necessary for the implementation of this solution. The schematic diagram of the CAN communication fault recovery device for a locomotive brake system of this embodiment can be as follows: Figure 5 As shown, it includes: an acquisition control module 501, a first recovery module 502 and a second recovery module 503.
[0067] An acquisition control module 501 is used to acquire the sending error count of the CAN node in the locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state;
[0068] The first recovery module 502 is used for stopping the message transmission and reception when the CAN node in the locomotive braking system is in the bus-off state, restarting and recovering the CAN node to participate in the bus communication after waiting for a first time period, and counting the recovery counter;
[0069] The second recovery module 503 is used to restart and recover the CAN node to participate in bus communication after waiting for a second time period when the count of the recovery counter is greater than or equal to a second value.
[0070] In some embodiments, the first duration is less than the second duration.
[0071] In some embodiments, the first time duration, the second time duration and the second value are determined according to the CAN communication baud rate, the number of nodes and the tolerable recovery time duration of the locomotive braking system.
[0072] In some embodiments, the first duration, the second duration, and the second value are determined according to the following expression:
[0073] T1≥128*11*(1 / k)*n;
[0074] T2 ≥ T1*N;
[0075] T1*N+T2≤T
[0076] Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
[0077] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.
[0078] Embodiment 4:
[0079] Another embodiment of the present application relates to an electronic device, such as Figure 6 As shown, it includes: at least one processor 601; and a memory 602 that is communicatively connected to the at least one processor 601; wherein the memory 602 stores instructions that can be executed by the at least one processor 601, and the instructions are executed by the at least one processor 601 so that the at least one processor 601 can execute the locomotive brake system CAN communication fault recovery method in the above-mentioned embodiments.
[0080] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.
[0081] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0082] Embodiment five:
[0083] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.
[0084] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as: ROM), random access memory (Random Access Memory, referred to as: RAM), disk or optical disk and other media that can store program codes.
[0085] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. A method for recovering a CAN communication fault in a locomotive brake system, characterized in that: include: Acquire the sending error count of the CAN node in the locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state; When the CAN node in the locomotive braking system is in a bus-off state, the message transmission and reception are stopped, and after waiting for a first time period, the CAN node is restarted to participate in bus communication, and a recovery counter is counted; When the count of the recovery counter is greater than or equal to the second value, the CAN node is restarted and restored to participate in bus communication after waiting for a second time period.
2. The method according to claim 1, characterized in that The first duration is shorter than the second duration.
3. The method according to claim 1, characterized in that The first duration, the second duration and the second value are determined according to the CAN communication baud rate, the number of nodes and the tolerable recovery duration of the locomotive braking system.
4. The method according to claim 3, characterized in that The first duration, the second duration and the second value are determined according to the following expression: T1≥128*11*(1 / k)*n; T2 ≥ T1*N; T1*N+T2≤T Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
5. A locomotive brake system CAN communication fault recovery device, characterized in that: include: An acquisition control module is used to acquire a sending error count of a CAN node in a locomotive braking system in real time, and when the sending error count exceeds a first value, control the CAN node in the locomotive braking system to enter a bus-off state; A first recovery module, used for stopping message transmission and reception when the CAN node in the locomotive braking system is in a bus-off state, restarting and recovering the CAN node to participate in bus communication after waiting for a first time period, and counting a recovery counter; The second recovery module is used for restarting and recovering the CAN node to participate in bus communication after waiting for a second time period when the count of the recovery counter is greater than or equal to a second value.
6. The device according to claim 5, characterized in that The first duration is shorter than the second duration.
7. The device according to claim 5, characterized in that The first duration, the second duration and the second value are determined according to the CAN communication baud rate, the number of nodes and the tolerable recovery duration of the locomotive braking system.
8. The device according to claim 7, characterized in that The first duration, the second duration and the second value are determined according to the following expression: T1≥128*11*(1 / k)*n; T2 ≥ T1*N; T1*N+T2≤T Among them, T1 represents the first duration, T2 represents the second duration, N represents the second value, k represents the CAN communication baud rate, n represents the number of nodes, and T represents the tolerable recovery time of the locomotive braking system.
9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the locomotive brake system CAN communication failure recovery method as described in any one of claims 1 to 4.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the locomotive brake system CAN communication failure recovery method according to any one of claims 1 to 4 is implemented.