CPU flash memory and software updating system and method of new energy automobile motor controller

By introducing the division of BT, A, B, and DFLASH in the CPU flash memory system of the new energy vehicle motor controller, and the corresponding module collaboration work, the application of the application of the application in the MCU software update process caused the application to lose the application. The problem realizes the writing of dumbfounding and application backup and recovery, ensuring the stability of the vehicle and the accuracy of software updates.

CN119356707APending Publication Date: 2025-01-24ZHIXIN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411391438.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

Existing new energy vehicles are prone to the loss of applications due to failure in flashing during the MCU software update process, and when selecting the wrong flashing file, it is difficult to restore the correct application software, resulting in the vehicle breaking down.

Method used

A CPU flash memory system for a new energy vehicle motor controller is designed, which is divided into BT area, A area, B area and DFLASH area, and introduces a boot loader module, a programming request processing module, an application adaptability check module and an application program. The update module, through the collaborative work of these modules, realizes the anti-fool function of flashing and the backup and recovery of applications.

Benefits of technology

When the MCU updates the application software, a backup function is added to ensure that there is always a valid application when flashing fails to avoid vehicle breakdown. At the same time, the controller’s target vehicle model identification verification ensures the accuracy and safety of software updates, reducing manual intervention and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356707A_ABST
    Figure CN119356707A_ABST
Patent Text Reader

Abstract

The invention discloses a CPU flash memory of a new energy automobile motor controller, the CPU flash memory comprises a BT area, an A area, a B area and a DFLASH area, the BT area, the A area, the B area and the DFLASH area all have independent memory addresses, the BT area is used for storing bootloader programs for executing boot loading and realizing application program updating based on a UDS protocol, the A area is used for storing application program codes for controlling MCU operation, and the DFLASH area is used for storing application program codes for controlling MCU operation. The B area is used for storing the application program received when the application program is updated, and the DFLASH area is used for storing bootloader program execution parameters. According to the invention, the flash fool-proof function is realized when the MCU application software is updated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a CPU flash memory and software update system and method for a motor controller of a new energy vehicle. Background Art

[0002] Existing new energy vehicles use diagnostic equipment to send diagnostic requests based on the UDS protocol to the CAN bus to complete data interaction with the MCU. The bootloader program inside the MCU processes the received data and burns it into the flash memory of the MCU to achieve the purpose of updating the MCU application software. After the existing MCU fails to update the application software, especially when it fails during the OTA upgrade process, the data originally stored in the flash memory is lost, causing the vehicle to break down. In addition, when there are multiple flash files for an MCU, there is a situation where the wrong flash file is selected when selecting the flash file, such as flashing the wrong controller file, such as similar controller software for the same model, the same controller software for different models, and other controller software. After the flash is completed, the diagnostic ID of the wrong application software based on the UDS (Unified Diagnostic Services) protocol is different from the diagnostic ID of the bootloader program and the original application is lost, resulting in the inability to update the correct application software through the bootloader program. At this time, it is necessary to re-edit the CPU flash memory through the serial interface. In this case, it is usually necessary to disassemble the controller protective shell to complete it. Summary of the invention

[0003] The purpose of the present invention is to provide a CPU flash memory and software update system and method for a new energy vehicle motor controller. The present invention realizes a fool-proof flashing function when updating MCU application software. When an incorrect flashing file is selected and the flashing process is executed, the correct application program can be identified and retained.

[0004] To achieve this purpose, the CPU flash memory of the new energy vehicle motor controller designed by the present invention: the CPU flash memory includes a BT area, an A area, a B area, and a DFLASH area; the BT area, the A area, the B area, and the DFLASH area all have independent memory addresses, wherein the BT area is used to store the bootloader program for executing boot loading and implementing application updates based on the UDS protocol, the A area is used to store the application code for controlling the operation of the MCU, the B area is used to store the application received when updating the application, and the DFLASH area stores the bootloader program execution parameters.

[0005] A software update system based on the CPU flash memory, comprising:

[0006] The bootloader module is used to read the valid identification of the application in area A in the DFLASH area through the bootloader program. If the valid identification of the application in area A is FALSE, the valid identification of the application in area B is detected. If the valid identification of the application in area A is TRUE, the CAN bus is detected to see if there is an external programming request.

[0007] The programming request processing module is used to process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area;

[0008] The application adaptability check module is used to access the content of the fixed address of each data packet in area B and compare the content of the fixed address of each data packet with the target vehicle model identification of the controller stored in the DFLASH area;

[0009] The application update module is used to set the valid flag of the application in area B to TRUE when the content of the fixed address of all data packets is consistent with the comparison result of the target vehicle identification of the controller stored in the DFLASH area, and detect whether there is a data activation instruction to activate area B on the CAN bus. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, set the valid flag of the application in area A in the DFLASH area to FALSE, erase the flash memory in area A, copy the data sent by the external programming request in area B to area A, set the valid flag of the application in area A to TRUE, and perform a CPU reset operation;

[0010] The jump execution module is used to not operate area A, retain the MCU application before the update, and perform a CPU reset operation when the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area.

[0011] A software update method based on the CPU flash memory comprises the following steps:

[0012] Read the valid identification of the application in area A in the DFLASH area through the bootloader program. If the valid identification of the application in area A is FALSE, check the valid identification of the application in area B. If the valid identification of the application in area A is TRUE, check whether there is an external programming request on the CAN bus;

[0013] Process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area;

[0014] Access the content of the fixed address of each data packet in area B, and compare the content of the fixed address of each data packet with the target vehicle model identification of the controller stored in the DFLASH area;

[0015] When the contents of the fixed addresses of all data packets are consistent with the target vehicle identification of the controller stored in the DFLASH area, the valid identification of the application in area B is set to TRUE, and the CAN bus is checked to see if there is a data activation instruction to activate area B. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, the valid identification of the application in area A in the DFLASH area is set to FALSE, the flash memory in area A is erased, the data sent by the external programming request in area B is copied to area A, the valid identification of the application in area A is set to TRUE, and the CPU reset operation is performed;

[0016] When the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area, area A is not operated, the MCU application before the update is retained, and a CPU reset operation is performed.

[0017] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the operation of the above-mentioned flash memory and method is realized.

[0018] Beneficial effects of the present invention:

[0019] The present invention adds a backup function when the MCU updates the application software. When the flashing fails, it can ensure that there is always a valid application in the MCU, and ensure that the vehicle will not break down due to the flashing failure; in the bootloader program, a controller target vehicle model identification check is added to the flashed file, especially for a single controller that needs to flash multiple application data packets. This ensures that during the development and mass production stages, the MCU software cannot be re-flashed due to the wrong controller software being selected during the flashing, and the controller protection shell needs to be opened to burn the flash memory through the serial interface, thereby reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a structural schematic diagram of the present invention;

[0021] Figure 2 This is a schematic diagram of the CPU flash memory layout;

[0022] Figure 3 It is the relationship diagram of MCU application software data packet;

[0023] Figure 4 The working principle diagram is as follows;

[0024] Figure 5It is a flow chart of the present invention. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0026] Example 1

[0027] A CPU flash memory of a new energy vehicle motor controller includes a BT area (boot loader running area), an A area (application running area), a B area (application backup area), and a DFLASH area (boot loader running data storage area). Figure 2 As shown, the BT area, A area, B area, and DFLASH area all have independent memory addresses, wherein the BT area is used to store the bootloader program for executing boot loading and implementing application updates based on the UDS protocol, the A area is used to store the application code for controlling the operation of the MCU, the B area is used to store the application received when the application is updated (the received application refers to the software for controlling the motor to drive the vehicle, the motor controller, as a node of the vehicle CAN bus, participates in the CAN bus communication, and the program is received from the message of the CAN bus), and the DFLASH area stores the bootloader program execution parameters. The above design improves the operation reliability, flexibility, security and user experience through reasonable memory area division and parameter management.

[0028] In the above technical solution, the bootloader program execution parameters include the valid identification of the application in area A, the valid identification of the application in area B, and the target vehicle identification of the controller. The above design is used to check the valid identification of the application in area A, the valid identification of the application in area B, and the target vehicle identification of the controller when the bootloader is started, to ensure that only valid applications are loaded and executed, and to prevent startup failure caused by damaged or invalid applications.

[0029] Example 2

[0030] A CPU flash memory and software update system for a new energy vehicle motor controller, such as Figure 1 , 2 As shown in , 3 and 4, it includes:

[0031] The bootloader module is used to read the valid identification of the application in area A in the DFLASH area through the bootloader program (bootloader). If the valid identification of the application in area A is FALSE (no), the valid identification of the application in area B is detected. If the valid identification of the application in area A is TRUE (yes), it is detected whether there is an external programming request on the CAN bus. By introducing a dual-area backup mechanism of area A and area B, the system can maintain high reliability during the update process. If the application in area A is running and valid (that is, the valid identification of the application in area A is TRUE), the CAN bus will be checked before receiving an external programming request to ensure that the update is triggered externally and intentionally, avoiding problems that may be caused by inadvertently triggered updates;

[0032] The programming request processing module is used to process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area. During the update process, this design sets the valid flag of the B area application to FALSE to ensure that the application of the B area will not be accidentally executed during the update. Erasing the flash memory of the B area can prevent old data or residual programs from interfering with the update process, thereby ensuring the security and stability of the software update.

[0033] The application adaptability check module is used to access the content of the fixed address of each data packet in area B, and compare the content of the fixed address of each data packet with the controller target vehicle model identification stored in the DFLASH area. This design ensures that the software to be loaded into the motor controller (i.e., the application in area B) is compatible with the specific vehicle model (i.e., the controller target vehicle model), avoiding failures or performance degradation caused by software and hardware mismatch;

[0034] The application update module is used to set the valid flag of the application in area B to TRUE when the content of the fixed address of all data packets is consistent with the comparison result of the target vehicle identification of the controller stored in the DFLASH area, and detect whether the CAN bus has a data activation instruction to activate area B. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, set the valid flag of the application in area A in the DFLASH area to FALSE, erase the flash memory in area A, copy the data sent by the external programming request in area B to area A, and after the copying is completed, set the valid flag of the application in area A to TRUE, end the flash writing process, and execute the CPU reset operation. This design is used to automatically update and switch the application when the comparison results are consistent, without manual intervention, thereby improving the update efficiency;

[0035] The jump execution module is used to not operate area A, retain the MCU application before the update, and perform a CPU reset operation when the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area. This design can avoid erroneous updates caused by data mismatch.

[0036] In the above technical solution, the boot loading module is used to enter the bootloader program to perform boot loading after the CPU is powered on and reset. The above design is helpful to load the operating application and improve the startup efficiency.

[0037] In the above technical solution, the boot loading module is used to enter the low power consumption mode of BOOT (BOOT stands for Boot Software, generally referred to as bootloader, and its Chinese name is boot loader) when the valid identification detection result of the application in zone B is FALSE. The above design helps to save energy, protect operation safety, provide recovery mechanism, flexibility and compatibility, and also helps to carry out debugging and testing work.

[0038] In the above technical solution, the boot loading module is used to detect whether the CAN bus has a data activation instruction to activate area B when the result of the effective identification detection of area B application is TRUE. When there is no data activation instruction to activate area B, the low power consumption mode of BOOT is entered. When there is a data activation instruction to activate area B, the effective identification of area A application in the DFLASH area is set to FALSE. The above design can effectively manage applications and ensure data security and stability.

[0039] In the above technical solution, the programming request processing module is used to jump to area A to execute the application normally when no external programming request is received. The above design is used to improve the response speed.

[0040] In the above technical solution, when the application update module successfully copies the data sent by the external programming request in area B to area A, the application valid flag of area A is set to TRUE; when the data sent by the external programming request in area B is unsuccessful to be copied to area A, the application valid flag of area A is written to FALSE and a CPU reset operation is performed. The above design can ensure the validity of the application, support seamless application updates, simplify error handling and recovery processes, and can more flexibly respond to external programming requests and internal state changes, thereby improving user experience.

[0041] In the above technical solution, if Figure 3As shown, the controller target vehicle identification defines its specific value in the code project of the application, and defines its storage address in the CPU executable data packet through the Linker file. These two parameters will not change with the iteration of the application software. The vehicle identification is written into the DFLASH of the CPU in the Bootloader program. The address defined in the application Linker file is within the range of area A. When the Bootloader compares the data transmitted to area B through the diagnostic device, the vehicle identification address stored in the Linker file plus the fixed value of the memory address offset of areas A and B can be read in area B to see whether the vehicle identification carried in the flashed application data is the controller target vehicle identification.

[0042] Example 3

[0043] A CPU flash memory and software update method for a new energy vehicle motor controller, such as Figure 5 As shown, read the valid identification of the application in area A as FALSE or TRUE to determine whether to detect the valid identification of the application in area B or to detect whether there is an external programming request on the CAN bus; process the received external programming request, set the valid identification of the application in area B to FALSE, and store the data in area B; access the content of the fixed address of each data packet in area B, and compare it with the target vehicle identification of the controller; when the comparison results are consistent, set the valid identification of the application in area B to TRUE, and detect whether the CAN bus has a data activation instruction to activate area B; when the comparison results are inconsistent, retain the MCU application before the update and perform a CPU reset operation.

[0044] The specific method of software update includes the following steps:

[0045] Through bootloader r The program reads the valid identification of the application program in area A in the DFLASH area. If the valid identification of the application program in area A is FALSE, the program checks the valid identification of the application program in area B. If the valid identification of the application program in area A is TRUE, the program checks whether there is an external programming request on the CAN bus.

[0046] Process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area;

[0047] Access the content of the fixed address of each data packet in area B, and compare the content of the fixed address of each data packet with the target vehicle model identification of the controller stored in the DFLASH area;

[0048] When the contents of the fixed addresses of all data packets are consistent with the target vehicle identification of the controller stored in the DFLASH area, the valid identification of the application in area B is set to TRUE, and the CAN bus is checked to see if there is a data activation instruction to activate area B. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, the valid identification of the application in area A in the DFLASH area is set to FALSE, the flash memory in area A is erased, the data sent by the external programming request in area B is copied to area A, the valid identification of the application in area A is set to TRUE, and the CPU reset operation is performed;

[0049] When the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area, area A is not operated, the MCU application before the update is retained, and a CPU reset operation is performed.

[0050] Example 4

[0051] A computer program product includes a computer program, wherein the computer program implements the operations described in Example 1 or 3 when executed by a processor.

[0052] Those skilled in the art will appreciate 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. Moreover, 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.

[0053] 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 block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or boxes.

[0054] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0055] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0056] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.

Claims

1. A CPU flash memory for a new energy vehicle motor controller, characterized in that: The CPU flash memory includes a BT area, an A area, a B area, and a DFLASH area. The BT area, the A area, the B area, and the DFLASH area all have independent memory addresses. The BT area is used to store a bootloader program for executing boot loading and implementing application updates based on the UDS protocol. The A area is used to store application code for controlling the operation of the MCU. The B area is used to store applications received when updating applications. The DFLASH area stores bootloader program execution parameters.

2. The CPU flash memory of the new energy vehicle motor controller according to claim 1 is characterized in that: The bootloader program execution parameters include the valid identification of the application program in area A, the valid identification of the application program in area B, and the target vehicle type identification of the controller.

3. A software update system based on the CPU flash memory of claim 1, characterized in that it include: The bootloader module is used to read the valid identification of the application in area A in the DFLASH area through the bootloader program. If the valid identification of the application in area A is FALSE, the valid identification of the application in area B is detected. If the valid identification of the application in area A is TRUE, the CAN bus is detected to see if there is an external programming request. The programming request processing module is used to process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area; The application adaptability check module is used to access the content of the fixed address of each data packet in area B and compare the content of the fixed address of each data packet with the target vehicle model identification of the controller stored in the DFLASH area; The application update module is used to set the valid flag of the application in area B to TRUE when the content of the fixed address of all data packets is consistent with the comparison result of the target vehicle type identification of the controller stored in the DFLASH area, and detect whether there is a data activation instruction to activate area B on the CAN bus. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, set the valid flag of the application in area A in the DFLASH area to FALSE, erase the flash memory in area A, copy the data sent by the external programming request in area B to area A, set the valid flag of the application in area A to TRUE, and perform a CPU reset operation; The jump execution module is used to not operate area A, retain the MCU application before the update, and perform a CPU reset operation when the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area.

4. The software updating system according to claim 3, characterized in that: The bootloader module is used to enter the bootloader program to perform bootloading after the CPU is powered on and reset.

5. The software updating system according to claim 3, characterized in that: The boot loading module is used to enter the low power consumption mode of BOOT when the valid identification detection result of the application program in area B is FALSE.

6. The software updating system according to claim 3, characterized in that: The boot loading module is used to detect whether the CAN bus has a data activation instruction to activate area B when the result of the effective identification detection of area B application is TRUE. When there is no data activation instruction to activate area B, it enters the low power consumption mode of BOOT. When there is a data activation instruction to activate area B, the effective identification of area A application in the DFLASH area is set to FALSE.

7. The software updating system according to claim 3, characterized in that: The programming request processing module is used to jump to area A to execute the application program normally when no external programming request is received.

8. The software updating system according to claim 7, characterized in that: When the application update module successfully copies the data sent by the external programming request in area B to area A, the valid flag of the application in area A is set to TRUE. When the data sent by the external programming request in area B is unsuccessful, the valid flag of the application in area A is set to FALSE and a CPU reset operation is performed.

9. A software update method based on the CPU flash memory of claim 1, characterized in that: It includes the following steps: Read the valid identification of the application in area A in the DFLASH area through the bootloader program. If the valid identification of the application in area A is FALSE, check the valid identification of the application in area B. If the valid identification of the application in area A is TRUE, check whether there is an external programming request on the CAN bus; Process the received external programming request, set the valid flag of the B area application in the DFLASH area to FALSE, erase the flash memory of the B area, and store the data sent by the external programming request in the B area; Access the content of the fixed address of each data packet in area B, and compare the content of the fixed address of each data packet with the target vehicle model identification of the controller stored in the DFLASH area; When the contents of the fixed addresses of all data packets are consistent with the target vehicle identification of the controller stored in the DFLASH area, the valid identification of the application in area B is set to TRUE, and the CAN bus is checked to see if there is a data activation instruction to activate area B. When there is no data activation instruction to activate area B, jump to area A to execute the application normally. When there is a data activation instruction to activate area B, the valid identification of the application in area A in the DFLASH area is set to FALSE, the flash memory in area A is erased, the data sent by the external programming request in area B is copied to area A, the valid identification of the application in area A is set to TRUE, and the CPU reset operation is performed; When the content of a fixed address of a data packet is inconsistent with the comparison result of the controller target vehicle model identification stored in the DFLASH area, area A is not operated, the MCU application before the update is retained, and a CPU reset operation is performed.

10. A computer program product, comprising a computer program, characterized in that The computer program implements the operations in claim 1 or 9 when executed by a processor.