Method and system for communication between upper computer and ECU
By broadcasting handshake CAN data frames on the CAN bus and resolving ID conflicts, the handshake and monitoring of the host computer and multiple ECUs are realized, which solves the problem of being unable to control multiple ECUs at the same time in the existing technology and improves work efficiency.
Patent Information
- Application Number
- CN202410561943.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2024-08-23
AI Technical Summary
Existing technology cannot control and monitor multiple ECUs at the same time, resulting in low operator efficiency and production efficiency.
By broadcasting handshake CAN data frames on the CAN bus, the ECU replies with its ID information, determines and resolves ID conflicts, and realizes handshake and monitoring control between the host computer and multiple ECUs.
It realizes the host computer's control and monitoring of multiple ECUs at the same time, automatically identifies multiple ECUs, and improves work efficiency.
Smart Images

Figure CN118540177A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method and system between a host computer and an ECU (electronic control unit). Background Art
[0002] ECU is an important electronic product component, which is widely used in electronic production and plays a very important role in people's daily life. ECU is a miniature computer management center, which takes signal (data) acquisition, calculation and processing, analysis and judgment, and decision-making as input, and then issues control instructions and directs the actuator to work as output. Sometimes, it also provides stable power supply or reference voltage to the sensor. All its functions are completed by the sum of various hardware and software, and its core is a microcomputer system with single-chip microcomputer as the main body.
[0003] As an important electronic product component, ECU is widely used in various fields, including the automotive industry, industrial automation, aerospace, medical equipment, etc. It plays the role of a microcomputer management center, responsible for receiving signals from various sensors, data acquisition, processing, analysis and judgment, and then issuing corresponding control instructions to adjust the work of the actuator according to the preset algorithm and logic to achieve automatic control and optimized operation of the system. The functions of ECU cover signal acquisition, data processing, control instruction issuance and other aspects, which need to rely on complex hardware and software systems to achieve. Its core is built on microcomputer systems such as single-chip microcomputers, with the characteristics of high integration, strong flexibility and high reliability, which plays a vital role in the production and life of modern society.
[0004] The host computer is a computer software system that is usually used to monitor and control remote devices or systems. It acquires and processes various data in real time by establishing a communication connection with the ECU, and provides information and control functions to operators through a visual interface. The functions of the host computer include:
[0005] 1. Real-time monitoring of the operating status and working parameters of ECU or system
[0006] 2. Real-time collection of various data, including sensor data, equipment status, etc.
[0007] 3. Set, adjust and configure ECU parameters
[0008] 4. Issue alarms or warning messages based on preset rules or thresholds
[0009] The host computer is the core part of the host computer system, responsible for data acquisition, processing, display and sending of control instructions. It is usually a software system deployed on a computer with a graphical user interface (GUI) through which operators interact with the system. The host computer obtains data from the ECU, processes and analyzes it according to preset algorithms and logic, and then sends control instructions to the ECU through a communication protocol to achieve control and management of the equipment.
[0010] Normally, one host computer software can only control and monitor one ECU at a time; it is usually impossible to use multiple host computer software to control multiple ECUs, which undoubtedly greatly increases the workload for operators who need to control or collect data from multiple ECUs, and may lead to low work efficiency and production efficiency. In real applications, this limitation may become a challenge when multiple ECUs need to be centrally controlled and monitored. Therefore, solutions must be sought to improve the work efficiency of operators and optimize production processes. Summary of the invention
[0011] The purpose of the present invention is to provide a communication method and system between a host computer and ECUs, so as to overcome the defect in the prior art that the host computer cannot control and monitor multiple ECUs at the same time.
[0012] To achieve this object, the present invention adopts the following technical solutions:
[0013] A communication method between a host computer and an ECU, comprising:
[0014] The host computer broadcasts CAN data frames for handshake on the CAN bus;
[0015] Each ECU on the CAN bus that needs to shake hands with the host computer, after receiving the CAN data frame for handshake, replies to the host computer with a CAN data frame carrying the ID information of the ECU;
[0016] The host computer, when receiving the CAN data frames replied by at least two ECUs, determines whether there is an ID conflict problem between the ECUs, and if so, reconfigures the ID of the ECU with the ID conflict and notifies the corresponding ECU to complete the handshake between the host computer and the at least two ECUs;
[0017] After the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands.
[0018] Optionally, the step of reconfiguring the ID of the ECU having the ID conflict and notifying the corresponding ECU includes:
[0019] For ECUs with ID conflicts, set new IDs automatically or manually;
[0020] The host computer sends the new ID to the corresponding ECU where the ID conflict occurs, and the ECU saves the new ID as its own CAN transmission ID after receiving it.
[0021] Optionally, the communication method further includes:
[0022] While broadcasting the CAN data frame for handshake on the CAN bus, the host computer starts a timer;
[0023] When the timer times out, the host computer counts the CAN data frames replied by each ECU and saves the ID of the ECU carried therein, thereby determining whether there is an ID conflict problem between multiple ECUs.
[0024] Optionally, after receiving the CAN data frame for handshake, each ECU that needs to shake hands with the host computer randomly waits for a preset time length and then replies to the host computer with a CAN data frame carrying the ID information of the ECU itself.
[0025] Optionally, the preset duration ranges from 0ms to 1020ms.
[0026] Optionally, the communication method further includes: the host computer, when receiving only a CAN data frame replied by a single ECU, executes a single-machine handshake process.
[0027] A communication system between a host computer and an ECU, comprising:
[0028] The host computer is used to broadcast CAN data frames for handshake on the CAN bus; it is also used to determine whether there is an ID conflict problem between the ECUs when receiving CAN data frames replied by at least two ECUs. If so, the ID of the ECU with ID conflict is reconfigured and the corresponding ECU is notified to complete the handshake between the host computer and the at least two ECUs; after the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands;
[0029] At least one ECU is located on the CAN bus and is used to reply to the host computer with a CAN data frame carrying the ID information of the ECU after receiving the CAN data frame for handshake.
[0030] Optionally, the host computer, in terms of reconfiguring the ID of the ECU having the ID conflict and notifying the corresponding ECU, is specifically used to:
[0031] For the ECU with ID conflict, a new ID is automatically or manually set; the new ID is sent to the corresponding ECU with ID conflict, and the ECU saves the new ID as its own CAN transmission ID after receiving it.
[0032] Optionally, the host computer is also used for:
[0033] While broadcasting the CAN data frame for handshake on the CAN bus, a timer is started; when the timer times out, the CAN data frames replied by each ECU are counted and the ID of the ECU carried therein is saved, thereby determining whether there is an ID conflict problem between multiple ECUs.
[0034] A storage medium stores a plurality of instructions, wherein the instructions are suitable for a processor to load to execute the steps in any of the above methods for communication between a host computer and an ECU.
[0035] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0036] In the embodiment of the present invention, the host computer achieves the purpose of successfully handshaking with multiple ECUs by solving the ID conflict problem between multiple ECUs, can automatically identify multiple ECUs, and realize the control and monitoring function of multiple ECUs by one host computer at the same time, which greatly improves work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0038] Figure 1 This is a communication system architecture diagram between the host computer and the ECU provided in an embodiment of the present invention.
[0039] Figure 2 A flow chart of the overall communication method between the host computer and the ECU provided in an embodiment of the present invention.
[0040] Figure 3 A handshake flow chart between a host computer and a single ECU provided in an embodiment of the present invention.
[0041] Figure 4 A handshake flow chart between a host computer and multiple ECUs provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Regarding the shortcomings of existing technologies, please refer to Figure 1 , an embodiment of the present invention provides a communication system between a host computer and an ECU, comprising:
[0044] The host computer is used to broadcast CAN data frames for handshake on the CAN bus; it is also used to determine whether there is an ID conflict problem between the ECUs when receiving CAN data frames replied by at least two ECUs. If so, the ID of the ECU with ID conflict is reconfigured and the corresponding ECU is notified to complete the handshake between the host computer and the at least two ECUs; after the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands;
[0045] At least one ECU is located on the CAN bus and is used to reply to the host computer with a CAN data frame carrying the ID information of the ECU after receiving the CAN data frame for handshake.
[0046] This communication system is suitable for projects that control and monitor multiple ECUs. It can automatically identify multiple ECUs and effectively solve the problem of one host computer software controlling and monitoring multiple ECUs at the same time.
[0047] Accordingly, see Figures 2 to 4 The embodiment of the present invention further provides a communication method between a host computer and an ECU, comprising:
[0048] The host computer broadcasts CAN data frames for handshake on the CAN bus;
[0049] Each ECU on the CAN bus that needs to shake hands with the host computer, after receiving the CAN data frame for handshake, replies to the host computer with a CAN data frame carrying the ID information of the ECU;
[0050] The host computer, when receiving CAN data frames replied by at least two ECUs, determines whether there is an ID conflict problem between the ECUs. If so, the ID of the ECU with the ID conflict is reconfigured and the corresponding ECU is notified to complete the handshake between the host computer and the at least two ECUs; when only the CAN data frame replied by a single ECU is received, the conventional single-machine handshake process is entered;
[0051] After the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands.
[0052] The single-machine handshake process and the multi-machine handshake process are described in detail below.
[0053] 1. Ordinary single ECU handshake
[0054] The host computer and ECU control and monitoring use CAN protocol for communication. Before communication begins, the host computer needs to handshake with the ECU. Figure 3 , the handshake process is as follows: the host computer first sends a CAN data frame for handshake in broadcast form. After receiving the handshake CAN data frame, the ECU will reply a CAN data frame to the host computer, indicating that the ECU needs to shake hands with the host computer. After the host computer receives the CAN data frame replied by the ECU, it will extract the send ID as the ECU ID. Once the host computer obtains the ECU ID, it means that the handshake between the host computer and the ECU is successful. This process ensures the establishment and normal progress of communication.
[0055] After the host computer successfully shakes hands with the ECU, it can obtain the current parameters of the ECU and has the ability to modify these parameters. At the same time, the host computer can also view the monitoring quantity of the ECU in real time and monitor the operation of the equipment. In addition, the host computer also has the function of sending start or stop instructions to the ECU to realize the start or stop control of the equipment. These functions enable the host computer to flexibly interact with the ECU to realize comprehensive monitoring and control of the equipment, thereby ensuring the safe operation of the equipment. The process is shown in Figure 3.
[0056] 2. Multi-ECU handshake
[0057] When there are multiple ECUs on the CAN bus, the handshake process between the host computer and the ECU will change. Figure 4First, the host computer sends a CAN data frame for handshake broadcast and starts a timer, which is set to 1020ms to ensure that the ECU can reply in time. After receiving the handshake CAN data frame, the ECU will randomly wait for 0ms to 1020ms before replying a CAN data frame, indicating that it needs to handshake with the host computer. This random waiting design is designed to avoid arbitration problems on the CAN bus and ensure the smooth progress of the handshake process. The data frame replied by the ECU contains the ID of the ECU for the host computer to identify and record. Once the host computer's timer times out, it will count the data frames replied by the ECU and save the ID. If it is found that the IDs of the two ECUs are the same, the host computer will pop up a window for modifying the ID. The operator can choose to automatically set the ECU ID or manually enter the ECU ID. After confirming the set ID, the host computer sends a CAN data frame with the corresponding ID to the ECU. After receiving it, the ECU saves the set ID as its own CAN send ID. After completing this process, it means that the handshake of the host computer with multiple ECUs is completed, ensuring the stability and reliability of communication. The design of this process ensures smooth communication in a complex multi-ECU environment, ensuring the stability and reliability of the system.
[0058] When the 1020ms timer of the host computer times out, if only one reply data frame is received from the ECU, it means that there is only one device on the CAN bus. In this case, the host computer will enter the single-machine handshake process. Figure 3 In the single-machine handshake process, the host computer will directly process the handshake request and response from a single ECU without considering the ID conflict between multiple devices. This process design can flexibly cope with different numbers of devices, ensuring smooth communication and system stability.
[0059] Those skilled in the art will appreciate that all or part of the steps in the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0060] To this end, an embodiment of the present invention provides a storage medium in which a plurality of instructions are stored. The instructions can be loaded by a processor to execute the steps of the communication method between a host computer and an ECU provided in the embodiment of the present invention.
[0061] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0062] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A communication method between a host computer and an ECU, characterized in that: include: The host computer broadcasts CAN data frames for handshake on the CAN bus; Each ECU on the CAN bus that needs to shake hands with the host computer, after receiving the CAN data frame for handshake, replies to the host computer with a CAN data frame carrying the ID information of the ECU; The host computer, when receiving the CAN data frames replied by at least two ECUs, determines whether there is an ID conflict problem between the ECUs, and if so, reconfigures the ID of the ECU with the ID conflict and notifies the corresponding ECU to complete the handshake between the host computer and the at least two ECUs; After the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands.
2. The communication method between the host computer and the ECU according to claim 1, characterized in that: The step of reconfiguring the ID of the ECU having the ID conflict and notifying the corresponding ECU includes: For ECUs with ID conflicts, set new IDs automatically or manually; The host computer sends the new ID to the corresponding ECU where the ID conflict occurs, and the ECU saves the new ID as its own CAN transmission ID after receiving it.
3. The communication method between the host computer and the ECU according to claim 1, characterized in that: The communication method further comprises: While broadcasting the CAN data frame for handshake on the CAN bus, the host computer starts a timer; When the timer times out, the host computer counts the CAN data frames replied by each ECU and saves the ID of the ECU carried therein, thereby determining whether there is an ID conflict problem between multiple ECUs.
4. The communication method between the host computer and the ECU according to claim 1, characterized in that: After receiving the CAN data frame for handshake, each ECU that needs to shake hands with the host computer randomly waits for a preset time length and then replies to the host computer with a CAN data frame carrying the ID information of the ECU itself.
5. The communication method between the host computer and the ECU according to claim 4, characterized in that: The preset duration ranges from 0ms to 1020ms.
6. The communication method between the host computer and the ECU according to claim 1, characterized in that: The communication method further includes: the host computer, when receiving only a CAN data frame replied by a single ECU, executes a single-machine handshake process.
7. A communication system between a host computer and an ECU, characterized in that: include: The host computer is used to broadcast CAN data frames for handshake on the CAN bus; It is also used to determine whether there is an ID conflict between the ECUs when receiving CAN data frames replied by at least two ECUs. If so, reconfigure the ID of the ECU with the ID conflict and notify the corresponding ECU to complete the handshake between the host computer and at least two ECUs; After the handshake is completed, the host computer monitors and / or controls each ECU that has shaken hands; At least one ECU is located on the CAN bus and is used to reply to the host computer with a CAN data frame carrying the ID information of the ECU after receiving the CAN data frame for handshake.
8. The communication system between the host computer and the ECU according to claim 1, characterized in that: The host computer, in terms of reconfiguring the ID of the ECU having the ID conflict and notifying the corresponding ECU, is specifically used to: For the ECU with ID conflict, a new ID is automatically or manually set; the new ID is sent to the corresponding ECU with ID conflict, and the ECU saves the new ID as its own CAN transmission ID after receiving it.
9. The communication system between the host computer and the ECU according to claim 1, characterized in that: The host computer is also used for: While broadcasting the CAN data frame for handshake on the CAN bus, a timer is started; when the timer times out, the CAN data frames replied by each ECU are counted and the ID of the ECU carried therein is saved, thereby determining whether there is an ID conflict problem between multiple ECUs.
10. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the communication method between a host computer and an ECU as described in any one of claims 1 to 6.
