Vehicle control system quick response CAN communication method, system and device and medium
By using the master processor and slave processor in the vehicle control system, using hardware heartbeat signals and pre-cured applications, the CAN communication delay problem caused by the long start time of the vehicle controller is solved, and fast response and high Reliable vehicle control system.
Patent Information
- Application Number
- CN202411376127.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-27
AI Technical Summary
In the on-board CAN network of construction machinery or engineering vehicles, due to the long program handling time and running time of the motion controller, it is impossible to complete the CAN communication handshake with the ECU within the specified time, causing an abnormal alarm for the vehicle to start, affecting normal work.
A vehicle control system is adopted to quickly respond to CAN communication method, and the main processor and slave processor work together, and the hardware heartbeat signal is used to determine the communication takeover party. The pre-cured application process the communication matters with the master control node to ensure the CAN The continuity of communication and reasonable allocation of resources are provided, and the two-way mobile phone system is used to enhance the robustness of the system.
Significantly improves system response speed and processing efficiency, avoids communication interruptions or delays caused by the inadequate main processor, improves system reliability and stability, and ensures that the vehicle controller can respond quickly to ECU CAN communications when starting up.
Smart Images

Figure CN119210928A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle control and network communication, and in particular to a method, device, system and medium for a vehicle control system to quickly respond to CAN communication. Background Art
[0002] In the field of engineering machinery or engineering vehicles, the vehicle-mounted CAN network is the most commonly used networking method and is widely used to connect products such as ECUs, motion controllers, intelligent distributed IO, vehicle-mounted displays, and operation panels, forming a typical scenario of multiple nodes mounted on a CAN bus. In this networking mode, the vehicle control core ECU unit needs to quickly (usually within 1 second) communicate with other products through CAN after power-on to complete handshakes and data exchange. If the communication is not completed within this time window, the vehicle will start abnormally and trigger an alarm, especially when it comes to safety, which will directly affect the normal operation of the vehicle.
[0003] Specifically speaking, the control core of the vehicle, the motion controller, has two internal running programs: the system program and the user application program. The system program may run on the Linux system or the real-time system, and is usually stored in the external flash; the user application is generally the codesys configuration program, which is also stored in the external flash. After power-on, the processor first moves the program in the flash to the internal RAM for execution, then starts the system and runs the configuration, and the CAN initialization work is performed after the configuration runs. Since the entire startup process covers the program transfer time and running time, if the controller uses a real-time system, due to the uncertain size of the customer application, such as some applications exceeding 500kB, and the entire flash communicates with the MCU via SPI, the transfer time may be close to 1 second; if the controller uses the Linux system, the entire system startup time T is greater than 5 seconds. This brings about potential problems with CAN communication after the ECU is powered on: if the CAN communication handshake with the ECU is not completed within the specified time, the ECU will determine that the vehicle startup is abnormal, and then trigger a fault alarm, causing the vehicle to fail to work properly. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a vehicle control system quick response CAN communication method, device, system and medium, which solves the technical problem that in the on-board CAN network networking mode of engineering machinery or engineering vehicles, due to the long program transfer time and running time during the startup of the motion controller, it may cause it to fail to complete the CAN communication handshake with the ECU within the specified time, thereby triggering an abnormal vehicle startup alarm and affecting the normal operation of the vehicle.
[0006] (II) Technical solution
[0007] In order to achieve the above object, the main technical solutions adopted by the present invention include:
[0008] In a first aspect, an embodiment of the present invention provides a method for quickly responding to CAN communication of a vehicle control system, wherein the system includes a master control node and at least one node device interacting with the master control node through a CAN bus. After the system is powered on, for a node device including a master processor and a slave processor, the method includes:
[0009] In response to the communication needs of the master control node, it starts initialization synchronously with the main processor and determines the communication takeover party based on the monitored hardware heartbeat signal;
[0010] If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and a CAN communication channel is established between the slave processor and the master control node;
[0011] Handle communication with the master node through pre-cured applications;
[0012] After the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node.
[0013] Optionally, in response to the communication demand of the master control node, starting initialization synchronously with the main processor, and determining the communication takeover party according to the monitored hardware heartbeat signal includes:
[0014] After receiving the communication demand instruction from the master control node, it starts the initialization operation synchronously with the main processor;
[0015] Detecting whether there is a hardware heartbeat signal of the first stage; wherein the hardware heartbeat signal of the first stage is a square wave signal of a predetermined frequency;
[0016] If the hardware heartbeat signal of the first stage is detected, the communication takeover party is determined to be the main processor, and the waiting state is maintained, and the main processor takes over the CAN bus to communicate and interact with the main control node;
[0017] If the hardware heartbeat signal of the first stage is not detected, it is determined that the communication takeover party is the slave processor, and continues to wait for the master processor to start up.
[0018] Optionally, if the communication takeover party is determined to be a slave processor, configuring the initial CAN ID as the CAN ID of the master processor, and establishing a CAN communication channel between the slave processor and the master control node includes:
[0019] If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and the CAN communication parameters are set;
[0020] Establish a CAN communication channel between the slave processor and the master node through the configured CAN ID and pre-set communication parameters;
[0021] Communicate with the master control node based on the established CAN communication channel and back up related communication data.
[0022] Optionally, after the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, data generated by the communication with the master control node is sent to the main processor, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node, including:
[0023] After the communication matters are processed, a hardware heartbeat signal of the second stage is sent out, and after the main processor is started, the hardware heartbeat signal of the second stage is received and a response to the hardware heartbeat signal of the second stage is sent out, or a handshake signal actively sent out by the main processor is received; wherein the hardware heartbeat signal of the second stage is a square wave signal of a predetermined frequency;
[0024] Upon receiving a response or handshake signal of the hardware heartbeat signal of the second stage, the data message generated by the communication with the main processor is sent to the main processor;
[0025] Close the CAN communication channel between the slave processor and the master node, and turn off the hardware heartbeat signal of the second stage, so that the master processor can take over the CAN bus, configure the set CAN ID, and communicate with the master node.
[0026] Optionally, after closing the CAN communication channel between the slave processor and the master control node and turning off the second-stage hardware heartbeat signal so that the master processor takes over the CAN bus, configures the set CAN ID, and communicates with the master control node, it also includes:
[0027] When the main processor fails to communicate with the master control node after taking over the CAN bus, if the CAN communication channel between the slave processor and the master control node is not closed and the hardware heartbeat signal of the second stage is abnormal, the CAN bus is cut off according to the fault notification sent by the main processor, and the main processor is waited to take over the CAN bus;
[0028] If the SPI communication between the master processor and the slave processor is abnormal and the hardware heartbeat signal of the second stage is normal, wait for the master processor to take over the CAN bus. When the master processor fails to take over the CAN bus, continue to communicate with the master control node and send out an alarm signal;
[0029] If the SPI communication between the master processor and the slave processor and the hardware heartbeat signal of the second stage are both abnormal, it is determined that the slave processor has crashed, and the crash handling process is executed.
[0030] Optionally, after the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, a new CAN ID is configured, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node, and further includes:
[0031] After the main processor takes over the CAN bus, the third-stage hardware heartbeat signal actively sent by the main processor is monitored, the operation of reinitializing the CAN bus is performed, and the configured CAN ID is reconfigured as a new CAN ID; wherein the third-stage hardware heartbeat signal is a square wave signal of a predetermined frequency;
[0032] If the hardware heartbeat signal in the third stage is normal, the main processor communicates with the master control node to receive and store the SPI data sent by the main processor;
[0033] If the hardware heartbeat signal in the third stage is abnormal, further monitor the SPI data;
[0034] If the SPI data does not send a command to cut off the CAN bus, the main processor is judged to be working abnormally, and the CAN bus is taken over again to continue the communication matters of the main processor, and an alarm signal is issued;
[0035] If the SPI data issues a command to cut off the CAN bus, it will take over the CAN bus work and only send out an alarm signal;
[0036] After completing the communication matters of the main processor, the slave processor can choose to continue communicating with the master control node or terminate the communication work according to user needs.
[0037] In a second aspect, an embodiment of the present invention provides a vehicle control system that quickly responds to a CAN communication device, including:
[0038] The initialization and takeover determination module is used to respond to the communication requirements of the master control node, start initialization synchronously with the main processor, and determine the communication takeover party according to the monitored hardware heartbeat signal;
[0039] A communication channel building module is used to configure the initial CAN ID as the CAN ID of the master processor and build a CAN communication channel between the slave processor and the master control node if the communication takeover party is determined to be a slave processor;
[0040] A communication event processing module is used to process communication events with the master control node through a pre-cured application program;
[0041] The communication handover module is used to send a handshake signal to the main processor or receive another handshake signal actively sent by the main processor after the communication matters are processed, send the data generated by the communication with the master control node to the main processor, and close the CAN communication channel between the slave processor and the master control node, so that the main processor takes over the CAN bus and communicates with the master control node.
[0042] In a third aspect, an embodiment of the present invention provides a vehicle control system for quickly responding to CAN communications, comprising: a CAN bus component, the CAN bus component comprising a master control node, and at least one node device that interacts with the master control node via the CAN bus, wherein at least one of the node devices includes a main processor and a slave processor, and the slave processor is used to execute the method described above.
[0043] Optionally, the terminal resistance of the CAN bus components is set to 120Ω, and the entire bus layout adopts a daisy chain structure.
[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having computer executable instructions stored thereon, and when the executable instructions are executed by a processor, a vehicle control system quickly responds to CAN communication method as described above.
[0045] (III) Beneficial effects
[0046] The beneficial effects of the present invention are:
[0047] The present invention can significantly improve the system response speed and processing efficiency at startup, especially in the scenario where the controller takes a long time to start up and cannot quickly respond to the CAN communication of the master control node. Specifically, after the system is powered on, the slave processor immediately performs the initialization operation, which lays a solid foundation for the subsequent rapid response. Then, the slave processor cleverly configures its own CAN ID as the CAN ID of the master processor. At this time, since the CAN of the master processor has not yet completed initialization and the CAN bus is not enabled, this move of the slave processor effectively fills this blank period and ensures the continuity of CAN communication.
[0048] Furthermore, the slave processor runs internally fixed applications that are specifically used to handle communications with the master node, thereby sharing the burden that the master processor may face during the startup phase, allowing the system to handle communication tasks more efficiently. After the slave processor successfully completes the communication with the master node, it will actively send a signal to the master processor, not only reminding the master processor that the task has been completed, but also applying to close the CAN communication. This mechanism ensures the reasonable allocation and utilization of resources.
[0049] More importantly, if the master processor does not detect the handshake signal sent by the slave processor within the predetermined time, the master processor can actively send a handshake signal to the slave processor. This two-way communication confirmation mechanism greatly enhances the robustness of the system. Through such a design, even if the master processor is delayed during startup or operation, the slave processor can promptly remind the master processor that it is ready and can take over the CAN bus at any time, thereby effectively avoiding communication interruptions or delays caused by the master processor not being ready, greatly improving the reliability and stability of the system.
[0050] Therefore, the present invention not only solves the problem that the controller cannot quickly respond to ECU CAN communication when the startup time is long, but also greatly improves the reliability and response speed of the system through the ingenious design of the processor and the two-way handshake mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of a process flow of a vehicle control system rapid response CAN communication method provided by an embodiment of the present invention;
[0052] Figure 2 A specific flow chart of step S1 of a method for quickly responding to CAN communication of a vehicle control system provided by an embodiment of the present invention;
[0053] Figure 3 A specific flow chart of step S2 of a method for quickly responding to CAN communication of a vehicle control system provided by an embodiment of the present invention;
[0054] Figure 4 A specific flow chart of step S4 of a method for quickly responding to CAN communication of a vehicle control system provided by an embodiment of the present invention;
[0055] Figure 5 A schematic diagram of a specific flow chart after step S43 of a method for quickly responding to CAN communication of a vehicle control system provided by an embodiment of the present invention;
[0056] Figure 6 A schematic diagram of a specific flow chart after step S4 of a method for quickly responding to CAN communication of a vehicle control system provided by an embodiment of the present invention;
[0057] Figure 7 A schematic diagram of the overall process of a vehicle control system fast response CAN communication method provided by an embodiment of the present invention;
[0058] Figure 8 A schematic diagram of the composition of a vehicle control system for quickly responding to CAN communication provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0060] like Figure 1 As shown, a vehicle control system fast response CAN communication method proposed in an embodiment of the present invention, it should be understood that the system includes a master control node, and at least one node device that interacts with the master control node through a CAN bus. After the system is powered on, for the node device including a master processor and a slave processor, the method includes: responding to the communication needs of the master control node, starting initialization synchronously with the master processor, and determining the communication takeover party according to the monitored hardware heartbeat signal; if the communication takeover party is determined to be a slave processor, configuring the initial CAN ID as the CAN ID of the master processor, and building a CAN communication channel between the slave processor and the master control node; processing communication matters with the master control node through a pre-cured application program; after the communication matters are processed, sending a handshake signal to the master processor or receiving another handshake signal actively sent by the master processor, sending data generated by the communication with the master control node to the master processor, and closing the CAN communication channel between the slave processor and the master control node, so that the master processor takes over the CAN bus and communicates with the master control node.
[0061] The present invention can significantly improve the system response speed and processing efficiency at startup, especially in the scenario where the controller takes a long time to start up and cannot quickly respond to the CAN communication of the master control node. Specifically, after the system is powered on, the slave processor immediately performs the initialization operation, which lays a solid foundation for the subsequent rapid response. Then, the slave processor cleverly configures its own CAN ID as the CAN ID of the master processor. At this time, since the CAN of the master processor has not yet completed initialization and the CAN bus is not enabled, this move of the slave processor effectively fills this blank period and ensures the continuity of CAN communication.
[0062] Furthermore, the slave processor runs internally fixed applications that are specifically used to handle communications with the master node, thereby sharing the burden that the master processor may face during the startup phase, allowing the system to handle communication tasks more efficiently. After the slave processor successfully completes the communication with the master node, it will actively send a signal to the master processor, not only reminding the master processor that the task has been completed, but also applying to close the CAN communication. This mechanism ensures the reasonable allocation and utilization of resources.
[0063] More importantly, if the master processor does not detect the handshake signal sent by the slave processor within the predetermined time, the master processor can actively send a handshake signal to the slave processor. This two-way communication confirmation mechanism greatly enhances the robustness of the system. Through such a design, even if the master processor is delayed during startup or operation, the slave processor can promptly remind the master processor that it is ready and can take over the CAN bus at any time, thereby effectively avoiding communication interruptions or delays caused by the master processor not being ready, greatly improving the reliability and stability of the system.
[0064] Therefore, the present invention not only solves the problem that the controller cannot quickly respond to ECU CAN communication when the startup time is long, but also greatly improves the reliability and response speed of the system through the ingenious design of the processor and the two-way handshake mechanism.
[0065] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0066] Specifically, an embodiment of the present invention provides a method for quickly responding to CAN communication of a vehicle control system, wherein the system includes a master control node and at least one node device that interacts with the master control node through a CAN bus. After the system is powered on, for a node device including a master processor and a slave processor, the method includes:
[0067] S1. In response to the communication requirements of the master control node, it starts initialization synchronously with the main processor and determines the communication takeover party based on the monitored hardware heartbeat signal.
[0068] Furthermore, if Figure 2 As shown, step S1 includes:
[0069] S11. After receiving the communication requirement instruction from the master control node, start the initialization operation synchronously with the main processor.
[0070] After the whole system is powered on, the master node needs to communicate quickly with each node device through the CAN bus, and the main processor takes a long time to load the application and system program, so the startup time is long. The relatively simple application deployed inside the slave processor starts very quickly, and the main processor startup process is long, which may not be able to respond to the master node CAN bus communication needs in time. Therefore, the slave processor initializes its internal CAN controller immediately after powering on.
[0071] S12, detecting whether there is a hardware heartbeat signal of the first stage, wherein the hardware heartbeat signal of the first stage is a square wave signal of a predetermined frequency, preferably a square wave signal of 1 kHz.
[0072] S13a, if the hardware heartbeat signal of the first stage is detected, the communication takeover party is determined to be the main processor, and the waiting state is maintained, and the main processor takes over the CAN bus to communicate and interact with the main control node.
[0073] Since the slave processor has not yet sent a heartbeat signal, if a heartbeat signal is detected, it is determined that the signal is sent by the master processor, indicating that the master processor has been started and taken over the CAN bus. At this time, the slave processor enters the standby state, waiting for the master processor to communicate directly with the ECU.
[0074] S13b, if the hardware heartbeat signal of the first stage is not detected, it is determined that the communication takeover party is the slave processor, and continues to wait for the main processor to start up.
[0075] If the heartbeat signal is not detected, the slave processor takes over the communication control of the CAN bus while allowing the master processor to continue its startup process.
[0076] S2. If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and a CAN communication channel is established between the slave processor and the master control node.
[0077] Furthermore, if Figure 3 As shown, step S2 includes:
[0078] S21. If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and the communication parameters of the CAN are set.
[0079] This is done to ensure the continuity and consistency of communication and avoid communication interruption or confusion due to ID changes. In addition to configuring the CAN ID, the slave processor also needs to set a series of communication parameters, such as baud rate, data bit length, stop bit, etc., to ensure smooth communication with the master node.
[0080] S22. Establish a CAN communication channel between the slave processor and the master control node through the configured CAN ID and pre-set communication parameters.
[0081] S23. Communicate with the master control node based on the established CAN communication channel, and back up relevant communication data.
[0082] S3. Process the communication with the master node through the pre-cured application.
[0083] It should be clear that a fixed, unchangeable application has been pre-embedded in the processor. This program has been written when the processor leaves the factory and is usually used to perform specific tasks or functions. The main task of this pre-cured application is to handle communication with the master control node (such as ECU or other main controller). This includes communication activities such as sending data, receiving instructions, and responding to requests. Because the application is pre-cured, it can start performing communication tasks immediately after the processor is powered on without waiting for additional software to be loaded or installed.
[0084] S4. After the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node.
[0085] Furthermore, if Figure 4 As shown, step S4 includes:
[0086] S41, after the communication matters are processed, the hardware heartbeat signal of the second stage is sent, and after the main processor is started, the hardware heartbeat signal of the second stage is received and the response to the hardware heartbeat signal of the second stage is sent, or the handshake signal actively sent by the main processor is received. The hardware heartbeat signal of the second stage is a square wave signal of a predetermined frequency. Preferably, the signal is a square wave signal of 1kHz.
[0087] Specifically, there are two control logics:
[0088] After completing all necessary communication tasks, the slave processor will actively send out a second-stage hardware heartbeat signal. This signal is a hardware-level signal used to notify the master processor that the slave processor has completed its communication tasks and is in normal working state.
[0089] After the slave processor sends the hardware heartbeat signal of the second stage, it will wait for the master processor to start up. During the startup process, the master processor will perform a series of initialization operations, including loading application programs and system programs.
[0090] Once the master processor has finished booting and received the second stage hardware heartbeat signal from the slave processor, it will send a response signal. This response signal is a confirmation of the hardware heartbeat signal sent by the slave processor, indicating that the master processor has received the signal and is ready for the next step.
[0091] If the master processor does not detect the second-stage hardware heartbeat signal sent by the slave processor, it may actively send a handshake signal to the slave processor.
[0092] This handshake signal is used to remind the slave processor that the master processor is ready and can take over the CAN bus at any time, that is, the master processor is ready to communicate.
[0093] S42, upon receiving the response or handshake signal of the hardware heartbeat signal of the second stage, the data message generated by the communication with the main processor is sent to the main processor. These data messages may contain important communication information, status updates, sensor data, etc., which need to be transmitted from the processor to the main processor for further processing or analysis.
[0094] S43, close the CAN communication channel between the slave processor and the master control node, turn off the hardware heartbeat signal of the second stage, so that the master processor takes over the CAN bus, configures the set CAN ID, and communicates with the master control node.
[0095] After completing the transmission of the data message, the slave processor will close the CAN communication channel with the master node (such as ECU). This means that the slave processor will stop sending or receiving any messages on the CAN bus, thereby releasing control of the CAN bus. The slave processor will also turn off the second-stage hardware heartbeat signal previously issued. Turning off this signal is the slave processor's indication to the master processor that it has completed all necessary communication tasks and that the master processor can now take over the CAN bus. In addition, the established ID is configured (the same as the initial ID after the slave processor is powered on, as the ID of the entire node device).
[0096] Then, if Figure 5 As shown, after step S43, the following steps are also included:
[0097] S44. When the main processor fails to communicate with the master control node after taking over the CAN bus, if the CAN communication channel between the slave processor and the master control node is not closed and the hardware heartbeat signal of the second stage is abnormal, the CAN bus is cut off according to the fault notification sent by the main processor, and wait for the main processor to take over the CAN bus.
[0098] S45a, if the SPI communication between the master processor and the slave processor is abnormal and the hardware heartbeat signal of the second stage is normal, wait for the master processor to take over the CAN bus. When the master processor fails to take over the CAN bus, continue to communicate with the master control node and send out an alarm signal.
[0099] S45b. If the SPI communication between the master processor and the slave processor and the hardware heartbeat signal of the second stage are both abnormal, it is determined that the slave processor has crashed, and the crash handling process is executed.
[0100] It should be made clear that SPI communication abnormality: when the SPI (Serial Peripheral Interface) communication between the master processor and the slave processor is interrupted, data transmission errors occur, the connection cannot be established, the communication rate is abnormal, or any other situation that causes normal communication to be impossible, it is called "SPI communication abnormality". This includes signal loss, data corruption, communication protocol errors, etc. These conditions may cause the master processor to be unable to correctly and effectively transmit and interact with the slave processor.
[0101] And, hardware heartbeat signal abnormality: refers to the slave processor not sending heartbeat signals according to the predetermined frequency or mode, or the master processor cannot detect the slave processor's heartbeat signal. Specifically, there is no heartbeat signal, or the heartbeat signal's frequency, period, waveform and other parameters do not meet expectations, which may cause the master processor to determine that the slave processor has stopped working or is in an abnormal working state.
[0102] In the embodiment of the present invention, if the SPI communication is abnormal and the hardware heartbeat signal is abnormal (no heartbeat signal), the slave is judged to be dead. As long as one of the signals is present, it is considered that the slave processor is still working.
[0103] The above steps describe the communication and fault handling process between the slave processor and the master processor under different abnormal situations. These steps ensure that the system can respond in time when a fault occurs and take appropriate measures to restore or maintain normal operation of the system.
[0104] In one embodiment, when the slave processor takes over the communication between the CAN bus and the master control node, if the master processor is ready at this time, it sends a request to the slave processor that it is ready to take over the CAN bus communication. During the monitoring process, when the master processor monitors that the hardware heartbeat signal of the second stage is abnormal (preferably, in a disappeared state), the master processor needs to try to take over immediately, because at this time there may be a problem with the slave processor and it cannot always communicate with the master control node through CAN, or there are instructions related to the slave processor cutting off the CAN bus in the SPI related message. The master processor immediately enables CAN and takes over the CAN bus communication with the ECU. If the communication is unsuccessful, it is considered that the slave processor has not cut off the CAN bus, the slave processor is still working normally, the bus has not been released, and there is a problem with the heartbeat signal, and the indicator light flashes at a frequency of 0.5Hz. At this time, the master processor needs to communicate with the slave processor through SPI, inform it that there is a problem with the hardware heartbeat signal of the second stage, and notify the slave processor to cut off the CAN bus, and the master processor will take over the CAN bus. If there is a problem with the SPI communication (the hardware heartbeat signal of the second stage is normal), the master processor must immediately try to take over the CAN bus. If the takeover is unsuccessful, the slave processor can only continue CAN communication with the ECU, and an alarm will be sounded, and the indicator light will flash at a frequency of 1Hz. In another case, if both the SPI and the second-stage hardware heartbeat signals of the slave processor are lost, the slave processor is considered to have crashed. At this time, all indicator lights are off. Under normal working conditions, the indicator light is green.
[0105] Furthermore, if Figure 6 As shown, after step S4, the following steps are also included:
[0106] S61. After the main processor takes over the CAN bus, monitor the third-stage hardware heartbeat signal actively sent by the main processor, execute the operation of reinitializing the CAN bus, and reconfigure the configured CAN ID as a new CAN ID; wherein the third-stage hardware heartbeat signal is a square wave signal of a predetermined frequency.
[0107] S62a, if the hardware heartbeat signal of the third stage is normal, the main processor communicates with the main control node, and receives and stores the SPI data sent by the main processor.
[0108] S62b. If the hardware heartbeat signal in the third stage is abnormal, further monitor the SPI data.
[0109] S63a, if the SPI data does not send a CAN bus disconnection instruction, it is determined that the main processor is working abnormally, takes over the CAN bus work again to continue the communication matters of the main processor, and sends an alarm signal.
[0110] S63b: If the SPI data issues a command to cut off the CAN bus, the CAN bus operation is taken over and only an alarm signal is issued.
[0111] S64. After completing the communication matters of the master processor, the slave processor is selected to continue to communicate with the master control node or terminate the communication work according to user needs.
[0112] In one embodiment, after the master processor takes over the CAN bus, it actively sends out a hardware heartbeat signal, and the slave processor monitors the signal, reinitializes the CAN from the slave processor, and configures another CAN id (other id numbers on the bus).
[0113] The slave processor monitors the hardware heartbeat signal. If the heartbeat signal is normal, the master processor communicates normally and sends relevant data to the slave processor for backup via SPI. Otherwise, the SPI data is monitored. If no bus cut-off instruction is issued in the SPI data, the master processor is considered to be abnormal, and the slave processor takes over the CAN bus work (with other ID numbers), reports an error, and the indicator light flashes at a frequency of 2Hz. If the SPI data is normal, it is considered that the X signal is abnormal, the slave processor does not take over, but the indicator light flashes at a frequency of 5Hz, and an alarm is issued.
[0114] After the slave processor takes over the CAN bus, the slave processor starts the abnormal working mechanism and performs CAN communication with the ECU with the new ID. After the communication is completed, the slave processor is selected to continue CAN communication with the ECU or terminate it according to user needs.
[0115] In a specific embodiment, reference Figure 7 , the overall process of the above method is:
[0116] (1) After the ECU, node device, etc., which serve as the master control node, are powered on, they begin to initialize. The ECU initializes the CAN and outputs CAN data to communicate with the node device.
[0117] (2) The main processor and the slave processor in the node device start initialization synchronously. Since the two have different programs and different processing tasks, the main processor starts slowly and the slave processor starts quickly. When the slave processor is ready to take over the CAN bus, it needs to detect the hardware heartbeat signal. Since the slave processor has not yet sent a heartbeat signal, if the hardware heartbeat signal is sent at this time, it must be sent by the main processor, indicating that the main processor has been started and has taken over the CAN bus. At this time, the main processor can communicate directly with the ECU. Otherwise, the slave processor takes over the CAN bus and the main processor continues to start.
[0118] (3) After the slave processor takes over the CAN bus, it can communicate with the ECU, back up relevant data, and send out a hardware heartbeat signal. After the master processor is started (slower than the slave processor, exceeding the ECU communication time requirement), the hardware heartbeat signal is monitored. If a hardware heartbeat signal is found, the master processor sends a signal to the slave processor via SPI indicating that the master processor is ready. If the master processor does not find the signal, it means that the communication between the slave processor and the ECU is not completed, and the master processor continues to wait for the hardware heartbeat signal sent by the slave processor.
[0119] (4) After the main processor sends a signal to the slave processor via SPI indicating that the main processor is ready, the slave processor immediately sends a message indicating that it has communicated with the ECU to the main processor, and at the same time disconnects the CAN bus and turns off the hardware heartbeat signal.
[0120] (5) When the main processor monitors the hardware heartbeat signal, or there is an instruction from the processor to cut off the CAN bus in the SPI related message, the main processor immediately enables CAN and takes over the CAN bus to communicate with the ECU.
[0121] (6) After the master processor takes over the CAN bus, it actively sends out a hardware heartbeat signal, and the slave processor monitors the signal at the same time, reinitializes the CAN from the slave processor, and configures another CAN ID (other ID numbers on the bus).
[0122] (7) The slave processor monitors the hardware heartbeat signal. If the heartbeat signal is normal, the master processor communicates normally and sends relevant data to the slave processor for backup via SPI. Otherwise, the SPI data is monitored. If no bus disconnection instruction is issued in the SPI data, the master processor is considered to be abnormal. The slave processor takes over the CAN bus operation (with other ID numbers) and reports an error. If the SPI data is normal, the hardware heartbeat signal is considered to be abnormal. The slave processor does not take over but issues an alarm.
[0123] (8) After the slave processor takes over the CAN bus, the slave processor starts the abnormal working mechanism and communicates with the ECU through CAN using the new ID. After the communication is completed, the slave processor is selected to continue CAN communication with the ECU or terminate it according to user needs.
[0124] In addition, an embodiment of the present invention provides a vehicle control system that quickly responds to CAN communication equipment, including:
[0125] The initialization and takeover determination module is used to respond to the communication requirements of the master control node, start initialization synchronously with the main processor, and determine the communication takeover party based on the monitored hardware heartbeat signal.
[0126] The communication channel building module is used to configure the initial CAN ID as the CAN ID of the master processor if the communication takeover party is determined to be a slave processor, and to build a CAN communication channel between the slave processor and the master control node.
[0127] The communication matters processing module is used to process the communication matters between the master control node through the pre-cured application program.
[0128] The communication handover module is used to send a handshake signal to the main processor or receive another handshake signal actively sent by the main processor after the communication matters are processed, send the data generated by the communication with the master control node to the main processor, and close the CAN communication channel between the slave processor and the master control node, so that the main processor takes over the CAN bus and communicates with the master control node.
[0129] Next, an embodiment of the present invention provides a vehicle control system for quickly responding to CAN communication, including: a CAN bus component, the CAN bus component includes a master control node, and at least one node device that interacts with the master control node through the CAN bus, and there is at least one device including a main processor and a slave processor among the node devices, and the slave processor is used to execute the method as described above.
[0130] Specifically, refer to Figure 8 ,There are master node 0 (ECU CAN unit) on the CAN bus, the remaining nodes 1 (such as motion controller U1 CAN), node 2 (intelligent distributed IO CAN), extending to node N, the CAN bus terminal resistance is 120Ω respectively, and the entire bus adopts a daisy chain layout. ECU communicates with the motion controller U1 through the CAN bus.
[0131] Furthermore, an embodiment of the present invention provides a computer-readable medium having computer executable instructions stored thereon, and when the executable instructions are executed by a processor, a vehicle control system quickly responds to CAN communication method as described above is implemented.
[0132] These instructions have a significant feature, that is, when they are executed by the processor, they can implement a specific method for the vehicle control system to quickly respond to CAN communications. In short, this computer-readable medium stores a set of programs or algorithms that enable the vehicle control system to respond to CAN communications more quickly, thereby improving the overall performance and efficiency of the system. This innovation has brought new breakthroughs and possibilities to the communication technology of vehicle control systems.
[0133] In summary, the embodiments of the present invention provide a vehicle control system that quickly responds to CAN communication methods, systems, devices, and media. The present invention adopts a method in which the main processor or SOC communicates with the ECU via CAN. The CAN inside the slave processor is also connected to the CAN bus as a node, and the CAN ID changes according to application requirements during use. Specifically, the following CAN communication response method is applied: after the entire vehicle control system is powered on, the slave processor immediately initializes its internal CAN controller after power-on, and configures the CAN ID as the main processor CAN ID (at this time, the main processor CAN has not been initialized and the CAN bus is not enabled). The internal solidified application is used to handle communication matters with the ECU. After the processing is completed, the slave processor actively sends a signal to the main processor to remind the main processor that the task has been processed and to apply to close the CAN communication; or if the main processor does not detect the handshake signal sent by the slave processor, it can actively send a handshake signal to the slave processor to remind the slave processor that the main processor is ready and can take over the CAN bus at any time. When the main processor starts normally and receives the handshake signal from the slave processor, the slave processor transmits the data communicated with the ECU to the main processor via SPI, and then the CAN bus of the slave processor is closed, the main processor enables the CAN controller and CAN bus, and configures the established ID (the same as the initial ID after the slave processor is powered on, as the ID of the entire controller). At this time, the main processor officially takes over the CAN bus and ECU communication.
[0134] During the entire subsequent communication process, the CAN communication of the slave processor is reinitialized to generate a new CAN id. We can monitor the main processor and the ECU bus through the slave processor. The main processor transmits relevant data to the slave processor, and the data is backed up to the slave processor. The heartbeat connection with the slave processor is maintained through the handshake signal. Once the slave processor finds that the main processor is working abnormally, it can use the emergency processing mechanism to communicate with the ECU to make the system work normally.
[0135] Through the above method, the problem that the controller cannot respond quickly to ECU CAN communication when the startup time is long can be solved, and the CAN inside the slave processor can be used as a sub-node and can be used as a backup for the CAN bus. In the event of failure of the main processor, the slave processor can temporarily replace the main processor to handle related tasks, greatly improving the reliability of the system.
[0136] Since the system / device described in the above embodiments of the present invention is a system / device used to implement the method of the above embodiments of the present invention, a person skilled in the art can understand the specific structure and deformation of the system / device based on the method described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the method of the above embodiments of the present invention belong to the scope of protection of the present invention.
[0137] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0138] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.
[0139] It should be noted that, in the present invention, any figure mark between brackets should not be understood as limiting the present invention. The word "comprising" does not exclude the existence of components or steps not listed in the present invention. The word "one" or "an" preceding a component does not exclude the existence of multiple such components. The present invention can be implemented with the aid of hardware including several different components and with the aid of appropriately programmed computers. In the present invention where several devices are listed, several of these devices can be embodied by the same hardware. The use of the words first, second, third, etc. is only for convenience of expression and does not indicate any order. These words can be understood as part of the component name.
[0140] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0141] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the present invention should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0142] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention belong to the scope of the present invention and its equivalent technology, the present invention should also include these modifications and variations.
Claims
1. A vehicle control system fast response CAN communication method, characterized in that: The system includes a master control node and at least one node device interacting with the master control node through a CAN bus. After the system is powered on, for the node device including a master processor and a slave processor, the method includes: In response to the communication needs of the master control node, it starts initialization synchronously with the main processor and determines the communication takeover party based on the monitored hardware heartbeat signal; If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and a CAN communication channel is established between the slave processor and the master control node; Handle communication with the master node through pre-cured applications; After the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node.
2. The vehicle control system fast response CAN communication method as claimed in claim 1, characterized in that: In response to the communication requirements of the master control node, initialization is started synchronously with the main processor, and the communication takeover party is determined according to the monitored hardware heartbeat signal, including: After receiving the communication demand instruction from the master control node, it starts the initialization operation synchronously with the main processor; Detecting whether there is a hardware heartbeat signal of the first stage; wherein the hardware heartbeat signal of the first stage is a square wave signal of a predetermined frequency; If the hardware heartbeat signal of the first stage is detected, the communication takeover party is determined to be the main processor, and the waiting state is maintained, and the main processor takes over the CAN bus to communicate and interact with the main control node; If the hardware heartbeat signal of the first stage is not detected, it is determined that the communication takeover party is the slave processor, and continues to wait for the master processor to start up.
3. The vehicle control system fast response CAN communication method as claimed in claim 1, characterized in that: If the communication takeover party is determined to be a slave processor, the initial CAN ID is configured as the CAN ID of the master processor, and the CAN communication channel between the slave processor and the master control node is established, including: If the communication takeover party is determined to be a slave processor, the initial CANID is configured as the CAN ID of the master processor, and the CAN communication parameters are set; Establish a CAN communication channel between the slave processor and the master node through the configured CAN ID and pre-set communication parameters; Communicate with the master control node based on the established CAN communication channel and back up related communication data.
4. The vehicle control system fast response CAN communication method as claimed in claim 1, characterized in that: After the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node, including: After the communication matters are processed, a hardware heartbeat signal of the second stage is sent out, and after the main processor is started, the hardware heartbeat signal of the second stage is received and a response to the hardware heartbeat signal of the second stage is sent out, or a handshake signal actively sent out by the main processor is received; wherein the hardware heartbeat signal of the second stage is a square wave signal of a predetermined frequency; Upon receiving a response or handshake signal of the hardware heartbeat signal of the second stage, the data message generated by the communication with the main processor is sent to the main processor; Close the CAN communication channel between the slave processor and the master node, and turn off the hardware heartbeat signal of the second stage, so that the master processor can take over the CAN bus, configure the set CAN ID, and communicate with the master node.
5. The vehicle control system fast response CAN communication method as claimed in claim 4, characterized in that: After closing the CAN communication channel between the slave processor and the master node, turning off the second-stage hardware heartbeat signal so that the master processor takes over the CAN bus, configures the set CAN ID, and communicates with the master node, it also includes: When the main processor fails to communicate with the master control node after taking over the CAN bus, if the CAN communication channel between the slave processor and the master control node is not closed and the hardware heartbeat signal of the second stage is abnormal, the CAN bus is cut off according to the fault notification sent by the main processor, and the main processor is waited to take over the CAN bus; If the SPI communication between the master processor and the slave processor is abnormal and the hardware heartbeat signal of the second stage is normal, wait for the master processor to take over the CAN bus. When the master processor fails to take over the CAN bus, continue to communicate with the master control node and send out an alarm signal; If the SPI communication between the master processor and the slave processor and the hardware heartbeat signal of the second stage are both abnormal, it is determined that the slave processor has crashed, and the crash handling process is executed.
6. The vehicle control system fast response CAN communication method as claimed in claim 4, characterized in that: After the communication matters are processed, a handshake signal is sent to the main processor or another handshake signal actively sent by the main processor is received, the data generated by the communication with the master control node is sent to the main processor, a new CAN ID is configured, and the CAN communication channel between the slave processor and the master control node is closed, so that the main processor takes over the CAN bus and communicates with the master control node, and further includes: After the main processor takes over the CAN bus, the third-stage hardware heartbeat signal actively sent by the main processor is monitored, the operation of reinitializing the CAN bus is performed, and the configured CAN ID is reconfigured as a new CAN ID; wherein the third-stage hardware heartbeat signal is a square wave signal of a predetermined frequency; If the hardware heartbeat signal in the third stage is normal, the main processor communicates with the master control node to receive and store the SPI data sent by the main processor; If the hardware heartbeat signal in the third stage is abnormal, further monitor the SPI data; If the SPI data does not send a command to cut off the CAN bus, the main processor is judged to be working abnormally, and the CAN bus is taken over again to continue the communication matters of the main processor, and an alarm signal is issued; If the SPI data issues a command to cut off the CAN bus, it will take over the CAN bus work and only send out an alarm signal; After completing the communication matters of the main processor, the slave processor can choose to continue communicating with the master control node or terminate the communication work according to user needs.
7. A vehicle control system fast response CAN communication device, characterized in that: include: The initialization and takeover determination module is used to respond to the communication requirements of the master control node, start initialization synchronously with the main processor, and determine the communication takeover party according to the monitored hardware heartbeat signal; A communication channel building module is used to configure the initial CAN ID as the CAN ID of the master processor and build a CAN communication channel between the slave processor and the master control node if the communication takeover party is determined to be a slave processor; A communication event processing module is used to process communication events with the master control node through a pre-cured application program; The communication handover module is used to send a handshake signal to the main processor or receive another handshake signal actively sent by the main processor after the communication matters are processed, send the data generated by the communication with the master control node to the main processor, and close the CAN communication channel between the slave processor and the master control node, so that the main processor takes over the CAN bus and communicates with the master control node.
8. A vehicle control system for rapid response to CAN communication, characterized in that: include: A CAN bus component, the CAN bus component includes a master control node and at least one node device that interacts with the master control node through the CAN bus, and there is at least one device including a main processor and a slave processor among the node devices, and the slave processor is used to execute the method described in any one of claims 1-6.
9. The vehicle control system for rapid response to CAN communication as claimed in claim 8, characterized in that: The terminal resistance of the CAN bus components is set to 120Ω, and the entire bus layout adopts a daisy chain structure.
10. A computer-readable medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by the processor, a vehicle control system fast response CAN communication method as described in any one of claims 1-6 is implemented.
