Xcp calibration method, system, electronic device, and computer-readable storage medium
By setting working pages and reference pages in RAM and switching working modes in real time, the problem of limited calibration area in existing technologies is solved, realizing an independent software calibration method that is suitable for the software calibration needs of domestically produced chips.
Patent Information
- Application Number
- CN202211714880.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Existing calibration schemes rely on hardware support, with a maximum calibration area limited to 64k that cannot be expanded, and require the support of the A1 register.
By setting working pages and reference pages in RAM and switching working modes in real time, an independent calibration method for software is achieved, including reprocessing of Hex source files and backup and write-back of data in RAM.
It enables unlimited expansion of the calibration area, ensuring data consistency and security, and is suitable for the software calibration needs of domestically produced chips.
Smart Images

Figure CN116009446B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronic control technology, and in particular to an XCP calibration method, system, electronic device, and computer-readable storage medium. Background Technology
[0002] Existing calibration schemes rely on overlay functionality or the use of the A1 register. Therefore, existing calibration schemes depend on hardware support. The chip needs to support overlay functionality, and the use of the A1 register limits the maximum calibration area to 64k, making further expansion impossible. Summary of the Invention
[0003] In order to overcome the above-mentioned technical defects, the purpose of this invention is to provide an XCP calibration method, system, electronic device and computer-readable storage medium for the parameters of an automotive motor controller that is implemented entirely in software without chip hardware support and whose calibration area is not limited.
[0004] This invention discloses an XCP calibration method for parameters of an automotive motor controller, comprising the following steps: reprocessing the compiled Hex source file used for calibration to obtain a post-Hex file; loading calibration data from Flash into RAM, and backing up the calibration data from the working page of RAM to a reference page; in the calibration host computer, loading the calibration parameter file and the post-Hex file into the working page of RAM, and switching to the working page for real-time calibration; after calibration is completed, writing the calibration data from the reference page in RAM back to the working page.
[0005] Preferably, the step of reprocessing the compiled Hex source file used for calibration to obtain the Hex file includes: copying the initial values of the working page to the working page, so that the data in the working page before calibration begins corresponds to the data in the working page of RAM.
[0006] Preferably, the working page and the reference page are the same size.
[0007] Preferably, the number of the working page and the reference page is greater than or equal to one.
[0008] Preferably, the calibration parameter file is an A2L file that includes the physical memory address, length, physical unit, and conversion formula of the calibration parameters.
[0009] This invention also discloses an XCP calibration system, comprising: a script tool and at least one ECU, each ECU including its own CAN communication module equipped with the XCP protocol; the script tool reprocesses the compiled Hex source file used for calibration to obtain a post-Hex file; calibration data in Flash is loaded into RAM, and the calibration data is backed up to a reference page in the working page of RAM; in the ECU, the calibration parameter file and the post-Hex file are loaded into the working page of RAM, and the ECU issues an instruction to switch to the working page for real-time calibration; after calibration is completed, the ECU issues an instruction to write back the calibration data in the reference page of RAM to the working page.
[0010] The present invention discloses an electronic device including a processor and a memory communicatively connected to the processor, the memory storing instructions executable by the processor, and the processor being configured to execute the instructions in the memory to implement the method described above.
[0011] The present invention discloses a computer-readable storage medium storing computer-executable instructions configured to perform the above-described method when executed.
[0012] Compared with existing technologies, the above technical solution has the following advantages:
[0013] 1. The Hex source file is compiled to obtain the Hex output file, which can pass the verification and be used for calibration. By setting the working page and reference page in RAM, the working mode of the working page and reference page is switched back and forth under the command of the ECU during real-time calibration, so that the size of the calibration area can be freely expanded in principle. Attached Figure Description
[0014] Figure 1 A flowchart of the XCP calibration method for the parameters of the automotive motor controller provided by the present invention;
[0015] Figure 2 A schematic diagram of the module for step S100 provided by the present invention;
[0016] Figure 3 A schematic diagram of the module for step S200 provided by the present invention;
[0017] Figure 4 A schematic diagram of the module for step S300 provided by the present invention;
[0018] Figure 5 The schematic diagram of step S400 provided by the present invention. Detailed Implementation
[0019] The advantages of the present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments.
[0020] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0021] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0022] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0023] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0024] In the description of this invention, unless otherwise specified and limited, it should be noted that the terms "installation", "connection" and "linking" should be interpreted broadly. For example, they can refer to mechanical or electrical connections, or internal connections between two components. They can be direct connections or indirect connections through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms according to the specific circumstances.
[0025] In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the convenience of the description of the invention and have no specific meaning in themselves. Therefore, "module" and "part" can be used interchangeably.
[0026] See appendix Figure 1 To meet the real-time calibration requirements during the software development cycle of motor controller products, this invention discloses an XCP calibration method for automotive motor controller parameters. During the bench testing phase of the motor controller software and the vehicle debugging phase, calibration personnel perform online calibration via the CAN port, including the following steps:
[0027] S100. The Hex source file used for calibration is reprocessed using a script to obtain a calibration-ready Hex file: the initial values of the working page are copied to the working page so that the data in the working page before calibration begins corresponds to the data in the working page of RAM.
[0028] S200, after the code is written and powered on, the calibration area is initialized: the calibration data in Flash is loaded into RAM, and the calibration data in the working page of RAM is backed up to the reference page;
[0029] S300: After power-on, the host computer (ECU) is connected to perform real-time calibration: In the calibration host computer, the calibration parameter file and the Hex file are loaded into the working page of RAM. The ECU issues an instruction to switch to the working page for real-time calibration. At this time, the calibration instruction issued through the XCP protocol is responded to in the working page of RAM.
[0030] S400, calibration complete. The ECU issues a command to write back the calibration data from the reference page in RAM to the working page.
[0031] For step S100, the calibration data is usually verified during the burning and reading of calibration data. Copying the initial value of the working page to the working page allows the calibration data to pass the verification. Specific verification may include:
[0032] First, read the valid flag bit from the specified address in the Flash area to determine if its status is valid.
[0033] If invalid, it means that the calibration data in the Flash area is unavailable and the verification fails;
[0034] If valid, the CRC value of the calibration data in the Flash area is calculated (used to verify the calibration data when freezing and reading the calibration data), and the calculation result is compared with the CRC value stored in the Flash area. If they match, the verification passes; if they do not match, the verification fails.
[0035] Preferably, the working pages and reference pages of RAM are the same size. And preferably, there are one or more working pages and reference pages.
[0036] The calibration parameter file is an A2L file, which includes the physical memory address, length, physical unit, and conversion formula of the calibration parameters. The A2L file is automatically generated from the map file using a script tool.
[0037] This invention first performs post-processing (recompilation) on the compiled Hex file to match the host computer (ECU); secondly, it backs up the calibration data during power-on initialization and writes it back after calibration to ensure data consistency in the working page and restore the default values of software parameters within the current power-on / off cycle; and it applies different processing mechanisms to the calibration data in the working page based on the host computer (ECU) switching between the working page and the reference page. This meets the calibration requirements of domestically produced chip software during bench and vehicle debugging, avoids the problem of data not being restored after calibration, and makes the calibration process safer.
[0038] This invention also discloses an XCP calibration system, comprising: a script tool and at least one ECU, each ECU including its own CAN communication module equipped with the XCP protocol; the script tool reprocesses the compiled Hex source file used for calibration to obtain a post-Hex file; the calibration data in Flash is loaded into RAM, and the calibration data is backed up to a reference page in the working page of RAM; in the ECU, the calibration parameter file and the post-Hex file are loaded into the working page of RAM, and the ECU issues an instruction to switch to the working page for real-time calibration; after calibration is completed, the ECU issues an instruction to write back the calibration data in the reference page of RAM to the working page.
[0039] The present invention discloses an electronic device, including a processor and a memory communicatively connected to the processor. The memory stores instructions executable by the processor, and the processor is configured to execute the instructions in the memory to implement the method described above.
[0040] The present invention discloses a computer-readable storage medium storing computer-executable instructions configured to perform the above-described method when executed.
[0041] It should be noted that the embodiments of the present invention have better implementability and are not intended to limit the present invention in any way. Any person skilled in the art may use the above-disclosed technical content to change or modify it into equivalent effective embodiments. However, any modifications or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of the technical solution of the present invention.
Claims
1. A method for XCP calibration of parameters of an automotive motor controller, characterized in that, Includes the following steps: The Hex source file used for calibration is reprocessed to obtain the Hex file; The calibration data in Flash is loaded into RAM, and the calibration data is backed up to the reference page in the working page of RAM; In the calibration host computer, the calibration parameter file and the Hex file are loaded into the working page of RAM, and the computer is switched to the working page for real-time calibration. After calibration is completed, the calibration data in the reference page in RAM is written back to the working page.
2. The XCP calibration method according to claim 1, characterized in that, The process of reprocessing the compiled Hex source file used for calibration to obtain the post-Hex file includes: Copy the initial value of the working page to the working page so that the data in the initial value of the working page mentioned before calibration begins corresponds to the data in the working page of RAM.
3. The XCP calibration method according to claim 1, characterized in that, The working page and the reference page are the same size.
4. The XCP calibration method according to claim 1, characterized in that, The number of the work page and the reference page is greater than or equal to one.
5. The XCP calibration method according to claim 1, characterized in that, The calibration parameter file is an A2L file, which includes the physical memory address, length, physical unit, and conversion formula of the calibration parameters.
6. An XCP calibration system, characterized in that, include: The scripting tool and at least one ECU, each ECU including its own CAN communication module with XCP protocol; A script tool is used to reprocess the compiled Hex source file used for calibration to obtain the Hex file; The calibration data in Flash is loaded into RAM, and the calibration data is backed up to the reference page in the working page of RAM; In the ECU, the calibration parameter file and the Hex file are loaded into the working page of RAM, and the ECU issues a command to switch to the working page for real-time calibration; After calibration is completed, the ECU issues a command to write back the calibration data from the reference page in RAM to the working page.
7. An electronic device, characterized in that, The method includes a processor and a memory communicatively connected to the processor, the memory storing instructions executable by the processor, the processor being configured to execute the instructions in the memory to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions configured to, when executed, perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
CCP (CAN calibration protocol) calibration device in ECU (electronic control unit)
CN102023633A
Calibration method, device and apparatus and storage medium
CN109359061A