ECU upgrade method, device, equipment and medium based on UDS protocol
By numbering and parsing the upgrade process of ECU services based on the UDS protocol, combining the state machine to complete the ECU upgrade, and building multiple security algorithms into the upgrade device, it solves the problem of software redevelopment and high cloud costs caused by differences in the upgrade processes of different ECU manufacturers. , achieving the effect of reducing maintenance difficulty and cost.
Patent Information
- Application Number
- CN202311458532.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-11-03
AI Technical Summary
Existing technologies need to face different upgrade processes from different manufacturers during the ECU upgrade process, resulting in the need to re-develop the software, which is time-consuming, labor-intensive and costly. In particular, the distribution of configuration files in the cloud requires maintenance of servers and communications, which increases system maintenance. Difficulty and cost.
By numbering the services based on the UDS protocol, parsing the upgrade process messages, forming and saving the upgrade process, selecting the appropriate upgrade process and sending the upgrade messages, completing the ECU upgrade based on the state machine, and building multiple security algorithms into the upgrade device to reduce the risk of Maintenance costs.
It reduces the difficulty and cost of system maintenance, solves the problem of rewriting or compiling upgrade control software caused by different ECU manufacturers using different upgrade processes, and improves the efficiency and cost-effectiveness of ECU upgrades.
Smart Images

Figure CN117675970B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to vehicle networking technology, and specifically provides an ECU upgrade method, device, equipment and medium based on the UDS protocol. Background Art
[0002] The unified diagnostic service UDS protocol is the ISO-14229 protocol. The communication process defined by the protocol is in the form of a question and answer. The UDS protocol can be used to communicate with the electronic control unit ECU to control the ECU. For example, the combination of 34 services and 36 services can be used to transmit a large amount of data to the ECU.
[0003] ECU software can be upgraded through a pre-set communication process based on the UDS protocol. The upgrade process of ECUs from different manufacturers is different. Therefore, when making host computer tools and upgrade tools with a fixed process, the software needs to be redeveloped for different ECUs, which is time-consuming and labor-intensive. If the upgrade configuration file is sent from the cloud, the upgrade tool receives and parses the upgrade configuration file to upgrade the ECU, but due to the existence of the cloud, it is necessary to maintain the server and the communication between the server and the upgrade tool, resulting in high costs. Summary of the invention
[0004] In order to overcome the above-mentioned defects, the present invention is proposed to provide an ECU upgrade method, device, equipment and medium based on the UDS protocol to solve the technical problem of how to avoid the time-consuming, labor-intensive and costly redevelopment of different ECU upgrade processes.
[0005] In a first aspect, the present invention provides an ECU upgrade method based on the UDS protocol, which is applied to an upgrade device, comprising:
[0006] Number each service established by the UDS protocol;
[0007] In response to the upgrade process message received from the host computer or communication software, the upgrade process message is parsed, and the number and specific message format corresponding to the service in the upgrade process message are recorded in sequence to form an upgrade process;
[0008] Select the corresponding upgrade process according to the EUC upgrade package obtained;
[0009] According to the service number of the selected upgrade process, the upgrade EUC message is sent to the EUC in sequence to complete the ECU upgrade.
[0010] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0011] The upgrade device has an upgrade control software built in, and the upgrade device is configured to set the upgrade control software to an upgrade process production mode when receiving an upgrade process message from a host computer or communication software.
[0012] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0013] The method further comprises saving the upgrade process after forming the upgrade process, wherein the upgrade device stores a plurality of different upgrade processes simultaneously.
[0014] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0015] The step of selecting a corresponding upgrade process according to the obtained EUC upgrade package includes:
[0016] Get the EUC upgrade package by reading the SD card, connect to the ECU, and select the upgrade process corresponding to the EUC upgrade package.
[0017] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0018] The method further includes: completing the sending and response identification of each service message through a state machine when upgrading the ECU.
[0019] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0020] The method further comprises:
[0021] Based on the host computer, the security algorithm in the upgrade device is updated and saved in the upgrade device;
[0022] The security algorithm is selected to be bound to a certain saved upgrade process, so that the security algorithm is used simultaneously when the upgrade process is selected for upgrade, wherein the upgrade device can save multiple security algorithms at the same time.
[0023] In a technical solution of the above-mentioned ECU upgrade method based on the UDS protocol,
[0024] The upgrade device has a built-in default security algorithm. If the upgrade process is not bound to the updated and saved security algorithm, the upgrade process uses the default security algorithm.
[0025] In a second aspect, the present invention provides an ECU upgrade device, comprising a memory, one or more processors, and one or more applications, wherein the one or more applications are stored in the memory, and when the one or more applications are configured to be called by the one or more processors, the one or more processors execute a method as described in any one of the first aspects.
[0026] In a third aspect, the present invention provides an electronic device, comprising the apparatus as described in the second aspect.
[0027] In a fourth aspect, the present invention provides a computer-readable storage medium, comprising a memory, one or more processors, and one or more applications, wherein the one or more applications are stored in the memory, and when the one or more applications are configured to be called by the one or more processors, the one or more processors execute a method as described in any one of the first aspects.
[0028] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:
[0029] In the technical solution of the present invention, the present invention numbers each service based on the UDS protocol, sends the upgrade process message through the host computer or communication software, and the upgrade device records it, thereby reducing the maintenance difficulty and maintenance cost of the entire system, and at the same time solves the problem of rewriting or recompiling the upgrade control software caused by different ECU manufacturers using different upgrade processes. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:
[0031] Figure 1 It is a flowchart of main steps of a method for upgrading an ECU based on the UDS protocol according to an embodiment of the present invention;
[0032] Figure 2 is a schematic diagram of an application scenario according to an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of the principle structure of a service call disconnection and degradation device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0035] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.
[0036] At present, there are basically two ways to upgrade ECU based on the UDS protocol:
[0037] 1. Use the host computer tool with the pre-set upgrade process. When upgrading the ECU, use the CAN communication tool to connect the ECU to the computer. Select the upgrade file in the host computer tool for upgrading; or use the microcontroller to make an upgrade tool, burn the compiled upgrade process software into the microcontroller, and the upgrade tool obtains the upgrade file through the SD card or other methods, and then upgrades;
[0038] 2. Use the cloud and upgrade tool to upgrade. The cloud generates a configuration file containing the upgrade process and safety algorithm, and then sends it to the upgrade tool. The upgrade tool parses the configuration file, obtains the upgrade process and safety algorithm, and then upgrades the ECU.
[0039] Since the upgrade process of ECUs from different manufacturers may be different. As described in the background technology, the upgrade tool produced by the fixed process may need to be redeveloped each time, and the cloud cost is high. Based on this, the present invention provides an ECU upgrade method based on the UDS protocol to solve the server maintenance cost and the communication maintenance cost between the cloud and the upgrade device caused by using the cloud to send the configuration file, and also solves the problem of needing to rewrite the compiled software when facing different upgrade processes.
[0040] See attached Figure 1 , Figure 1 The figure is a flow chart of the main steps of the ECU upgrade method based on the UDS protocol according to an embodiment of the present invention. The present invention is applied to an upgrade device, which can be a storage medium with built-in control software or a processor that can burn programs, etc., which is not limited in the present invention. Figure 1 As shown, the ECU upgrade method based on the UDS protocol in the embodiment of the present invention mainly includes the following steps S101 to S104.
[0041] Step S101: numbering each service established by the UDS protocol;
[0042] In one implementation, the ECU upgrade process can be established based on the UDS protocol. Therefore, the ECU upgrade process can be defined by the UDS protocol. First, the services established by the DS protocol can be numbered. For example, the SID (service number) of each service is used as the number, such as the 0x10sessionControl service, then 0x10 is used as the number of the service.
[0043] Step S102: in response to the upgrade process message received from the host computer or the communication software, the upgrade process message is parsed, and the numbers and specific message formats corresponding to the services in the upgrade process message are recorded in sequence to form an upgrade process;
[0044] In one implementation, the upgrade control software is set to the upgrade process production mode, and then the host computer or communication software is used to send a complete upgrade process message to the upgrade device. The upgrade control software parses the received message, and records the number corresponding to the service and the specific format of the message in order to form an upgrade process. After the process is completed, the upgrade process will be saved in the upgrade device. The upgrade device can store multiple different upgrade processes at the same time to meet the needs of different upgrade processes. In the present invention, the host computer or communication software is a device or storage medium that can control the content of the message to be sent, and is not specifically limited in the present invention.
[0045] Specifically, when the upgrade process is formed, the data structure used to store the process in the upgrade device is:
[0046] typedef struct Recuest
[0047] {Uint16 MessageLength;
[0048] Uint8 SID;
[0049] Uint8 SubID;
[0050] Uint8 Data
[100] ;
[0051] }MessageRequest;
[0052] typedef struct Answer
[0053] {Uint16 MessageLength;
[0054] Uint8 sID;
[0055] Uint8 subID;
[0056] Uint8 Data
[100] ;
[0057] }MessageAnswer;
[0058] typedef struct
[0059] {MessageRequest stRequest;
[0060] MessageAnswer stAnswer;
[0061] }Message;
[0062] typedef struct
[0063] {Message stMessage
[10000] ;
[0064] Uint32 securityAlgorithm;
[0065] }UpgradeProcess;
[0066] UpgradeProcess stUpgradeProcess[2];
[0067] In the above, the MessageRequest structure is used to store the diagnostic request data, and the MessageAnswer structure is used to store the diagnostic response. The elements in the MessageRequest structure and the MessageAnswer structure are the same, namely, the MessageLength data length, the SID service number, the SubID sub-service number (Note: some services do not have sub-services, in which case this element is used to store data and has the same function as Data
[100] ), and Data
[100] is used to store the array of data. The Message structure contains only two elements of the MessageRequest type and the MessageAnswer type. A Message type of data contains a request and a response.
[0068] When making the upgrade process, the request and response are stored in the array stMessage in sequence.
[0069] In addition, when making the upgrade process, the data sent by the 36 service will not be stored. Only the length of the data will be stored, and this length is the maximum value of the request length in all 36 service requests.
[0070] Taking service 10 as an example, the storage of other messages is the same as follows:
[0071] The diagnostic request is: 02 10 01 00 00 00 00 00
[0072] The diagnostic response is: 06 50 01 00 32 00c8 ff
[0073] Assuming that this pair of request and response is the beginning of the upgrade process, the pair of data will be stored in stMessage[0].
[0074] At this time, the data stored in the stRequest element of stMessgae[0] are:
[0075] stRequest.MessageLength=0x02;
[0076] stRequest.SID = 0x10;
[0077] stRequest.SubID = 0x01;
[0078] Since the message length is only 2, no data is stored in stRequest.Data.
[0079] At this time, the data stored in the stAnswer element of stMessgae[0] are:
[0080] stAnswer.MessageLength=0x06;
[0081] stAnswer.SID = 0x50;
[0082] stAnswer.SubID = 0x01;
[0083] stAnswer.Data
[100] ={0x00,0x32,0x00,0xc8}.
[0084] Step S103: Select a corresponding upgrade process according to the obtained EUC upgrade package;
[0085] In one embodiment, the EUC upgrade package (ie, the upgrade software of the ECU) can be obtained by reading an SD card or other methods through the built-in upgrade control software. The ECU is connected to the upgrade device, and the upgrade process stored in step S102 is selected.
[0086] Step S104: Send upgrade EUC messages to EUC in sequence according to the service number of the selected upgrade process to complete the ECU upgrade.
[0087] In this embodiment, when upgrading the ECU, the state machine is used to complete the sending and response identification of each service message. The upgrade control software uses the state machine to control the upgrade process according to the service number of the selected upgrade process, sends messages in sequence, and completes the ECU upgrade.
[0088] In one implementation, as shown in the data structure example of the specific storage process in step S102, when using the upgrade process, the stMessage array is traversed to send the data or compare it with the received diagnosis response to confirm whether the response is correct. That is, when the upgrade process sends a diagnosis request, stRequest.SID is put into the state machine, the corresponding data sending process is called, and when the response is received, it is compared with the element data in stAnswer to confirm whether the response is correct.
[0089] In one embodiment, if Figure 2 As shown in the figure, after making the upgrade process, use the host computer tool to update the security algorithm in the upgrade control software and save it to the upgrade device. The refresh process is still based on the UDS protocol, and the algorithm is selected to be bound to a saved upgrade process. The upgrade device can save multiple security algorithms at the same time. Furthermore, the upgrade control algorithm contains a default security algorithm. When the upgrade process is not bound to the security algorithm, the upgrade process security algorithm uses the default one.
[0090] Specifically, as shown in the data structure example of the specific storage process in step S102, the upgrade process includes the security algorithm securityAlgorithm in addition to the stMessage array. Due to the performance limitation of the single-chip microcomputer, the security algorithm needs to be compiled in the corresponding chip project to generate a bin format file. And the algorithm needs to be in the specified location of the Flash. When writing the upgrade tool, a part of the space in the Flash is allocated specifically for storing the security algorithm, and this part of the space is divided into multiple small spaces again. The security algorithm must be stored starting from the starting position of the small space. For example:
[0091] Assume that a total of 1K bytes of space from 0x10000000 to 0x10000400 in Flash is used to store security algorithms. Then the space is divided into two small spaces of 512 bytes with starting addresses of 0x10000000 and 0x10000200. When storing security algorithms, it must start from 0x10000000 or 0x10000200. When binding the security algorithm, store the starting address of the small space in the SecurityAlgorithm element of the stUpgradeProcess variable in Figure 1.
[0092] Based on the above steps S101 to S104, the embodiment of the present invention numbers each service based on the UDS protocol, sends the upgrade process message through the host computer or communication software, and the upgrade device records it, which reduces the maintenance difficulty and maintenance cost of the entire system, and solves the problem of rewriting and recompiling the upgrade control software caused by different ECU manufacturers using different upgrade processes.
[0093] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.
[0094] Furthermore, the present invention also provides an EUC upgrading device, comprising a memory, one or more processors, and one or more applications, wherein the one or more applications are stored in the memory, and when the one or more applications are configured to be called by the one or more processors, the one or more processors execute the method described in the technical solution of steps S101-S104 above.
[0095] The device in the embodiment of the present invention mainly includes a memory and a processor. The memory can be configured to store a program for executing the ECU upgrade method based on the UDS protocol of the above method embodiment, and the processor can be configured to execute the program in the memory, which includes but is not limited to the program for executing the ECU upgrade method based on the UDS protocol of the above method embodiment. For the convenience of explanation, only the part related to the embodiment of the present invention is shown. For the specific technical details not disclosed, please refer to the method part of the embodiment of the present invention.
[0096] In the embodiment of the present invention, the EUC upgrade device may be a control device formed by various electronic devices. In some possible implementations, the device may include multiple storage devices and multiple processors. The program for executing the ECU upgrade method based on the UDS protocol of the above method embodiment can be divided into multiple subprograms, and each subprogram can be loaded and run by the processor to execute different steps of the ECU upgrade method based on the UDS protocol of the above method embodiment. Specifically, each subprogram can be stored in different memories, and each processor can be configured to execute programs in one or more memories to jointly implement the ECU upgrade method based on the UDS protocol of the above method embodiment, that is, each processor executes different steps of the ECU upgrade method based on the UDS protocol of the above method embodiment to jointly implement the ECU upgrade method based on the UDS protocol of the above method embodiment.
[0097] The above-mentioned multiple processors may be processors deployed on the same device. For example, the above-mentioned computer device may be a high-performance device composed of multiple processors, and the above-mentioned multiple processors may be processors configured on the high-performance device.
[0098] In one embodiment, the EUC upgrading device, such as Figure 3 As shown, it may include:
[0099] The acquisition module receives the upgrade process message from the host computer or communication software;
[0100] The processing module parses the upgrade process message, and records the numbers and specific message formats corresponding to the services in the upgrade process message in order to form an upgrade process;
[0101] Read the module and select the corresponding upgrade process according to the EUC upgrade package obtained;
[0102] The sending module sends the upgrade EUC message to the EUC in sequence according to the service number of the selected upgrade process to complete the ECU upgrade.
[0103] Furthermore, a storage module is included for storing the formed upgrade process.
[0104] The EUC upgrade device is used to perform Figure 1 The embodiment of the ECU upgrade method based on the UDS protocol shown in the figure has similar technical principles, technical problems solved and technical effects produced. Technicians in this technical field can clearly understand that for the convenience and conciseness of description, the specific working process and related instructions of the EUC upgrade device can refer to the contents described in the embodiment of the ECU upgrade method based on the UDS protocol, which will not be repeated here.
[0105] Furthermore, the present invention also provides an electronic device, including the EUC upgrading device of the above embodiment. For the convenience of description, only the parts related to the embodiment of the present invention are shown. For the specific technical details not disclosed, please refer to the method part of the embodiment of the present invention.
[0106] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.
[0107] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the ECU upgrade method based on the UDS protocol of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned ECU upgrade method based on the UDS protocol. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.
[0108] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.
[0109] Those skilled in the art will appreciate that the modules in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present invention, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present invention.
[0110] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. An ECU upgrade method based on the UDS protocol, applied to an upgrade device, is characterized in that: include: Number each service established by the UDS protocol; In response to the upgrade process message received from the host computer or communication software, the upgrade process message is parsed, and the number and specific message format corresponding to the service in the upgrade process message are recorded in sequence to form an upgrade process; Select the corresponding upgrade process according to the obtained ECU upgrade package; According to the service number of the selected upgrade process, send the upgrade ECU message to the ECU in sequence to complete the ECU upgrade; The upgrade device has an upgrade control software built in, and the upgrade device is configured to set the upgrade control software to an upgrade process production mode when receiving an upgrade process message from a host computer or communication software.
2. The ECU upgrade method based on the UDS protocol according to claim 1, characterized in that: The method further comprises saving the upgrade process after forming the upgrade process, wherein the upgrade device stores a plurality of different upgrade processes simultaneously.
3. The ECU upgrade method based on the UDS protocol according to claim 1, characterized in that: The step of selecting a corresponding upgrade process according to the acquired ECU upgrade package includes: Get the ECU upgrade package by reading the SD card, connect to the ECU, and select the upgrade process corresponding to the ECU upgrade package.
4. The ECU upgrade method based on the UDS protocol according to claim 1, characterized in that: The method further includes: completing the sending and response identification of each service message through a state machine when upgrading the ECU.
5. The ECU upgrade method based on the UDS protocol according to claim 1, characterized in that: The method further comprises: Based on the host computer, the security algorithm in the upgrade device is updated and saved in the upgrade device; The security algorithm is selected to be bound to a certain saved upgrade process, so that the security algorithm is used simultaneously when the upgrade process is selected for upgrade, wherein the upgrade device can save multiple security algorithms at the same time.
6. The ECU upgrade method based on the UDS protocol according to claim 5, characterized in that: The upgrade device has a built-in default security algorithm. If the upgrade process is not bound to the updated and saved security algorithm, the upgrade process uses the default security algorithm.
7. An upgrading device, characterized in that: The method comprises a memory, one or more processors, and one or more applications, wherein the one or more applications are stored in the memory, and when the one or more applications are configured to be called by the one or more processors, the one or more processors execute the method as described in any one of claims 1 to 6.
8. An electronic device, characterized in that: The device comprises an apparatus as claimed in claim 7.
9. A computer-readable storage medium, characterized in that: The method comprises a memory, one or more processors, and one or more applications, wherein the one or more applications are stored in the memory, and when the one or more applications are configured to be called by the one or more processors, the one or more processors execute the method as described in any one of claims 1 to 6.
