Controller software upgrading method and device, electronic equipment and storage medium
By upgrading the communication between the upper computer and the motor controller, and automatically synchronously flashing the boot loader and application, the complex problems of traditional upgrade methods are solved and efficient and automated software upgrades are achieved.
Patent Information
- Application Number
- CN202410915929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-12
AI Technical Summary
The traditional motor controller software upgrade method requires dismantling the entire vehicle and connecting the debugger, which is complicated and affects the efficiency of software upgrade.
By upgrading the upper computer to communicate with the motor controller, obtain the target bootloader and application to be flashed, send an erase request, erase the current program, download and synchronize the new program, and obtain the software version number to verify that the upgrade is successful.
It realizes automated software upgrade without disassembling the motor controller, improves upgrade efficiency and reliability, and reduces user operation burden.
Smart Images

Figure CN118939288A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power supply testing, and in particular to a controller software upgrading method, device, electronic equipment and storage medium. Background Art
[0002] With the rapid development of electrification and intelligent technology of new energy vehicles, the number of motor controllers (electronic control unit, ECU) in vehicles is increasing. The bootloader is an indispensable software module in the ECU, and the bootloader is used to update and upgrade the application software.
[0003] At present, the boot loader of the motor controller is fixed in the Flash by the supplier when the controller leaves the factory for upgrading the application program, and it usually cannot be changed at will. As the functions of new energy vehicles continue to increase, the iteration cycle of their software is also getting faster and faster. Therefore, the boot loader needs to be upgraded synchronously. However, the traditional upgrade method requires removing the motor controller from the vehicle and connecting the debugger to upgrade the boot loader first, and then upgrading the application program through the CAN device. The upgrade process is complicated, which affects the software upgrade efficiency of the motor controller. Summary of the invention
[0004] In view of this, the present invention aims to propose a controller software upgrade method, device, electronic device and storage medium to solve the problem of removing the motor controller of the whole vehicle to upgrade the boot loader and application program respectively, so as to realize automatic and efficient controller software upgrade.
[0005] According to a first aspect of the present invention, a controller software upgrade method is provided, which is applied to upgrade a host computer, wherein the upgrade host computer is communicatively connected to a motor controller, and the method comprises:
[0006] Get the target bootloader and target application to be flashed;
[0007] Sending an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program;
[0008] In response to completion of erasing the current program of the motor controller, sending the target boot loader and the target application program to the motor controller;
[0009] Sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application;
[0010] The current software version numbers of the motor controller bootloader and application are obtained, and the current software version numbers are used to determine whether the motor controller is successfully upgraded.
[0011] Optionally, obtaining a target boot loader and a target application to be flashed includes:
[0012] Obtaining a program information file from a server; wherein the program information file includes a program storage address corresponding to a target boot loader and a target application program;
[0013] Parsing the program information file to obtain the program storage address;
[0014] The target boot loader and the target application program are extracted respectively using the program storage address.
[0015] Optionally, in response to the completion of erasing the current program of the motor controller, sending the target boot loader and the target application to the motor controller comprises:
[0016] Sending a data download request for a boot loader and an application to the motor controller, and controlling the motor controller to load an upgrade service; wherein the upgrade service includes requesting a program download service, a data transmission service, and exiting a transmission service;
[0017] In response to the request program download service of the motor controller, the target boot loader and the target application are sent to the motor controller, so that the motor controller downloads the target boot loader and the target application using the data transmission service.
[0018] Optionally, sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application, includes:
[0019] Sending a data integrity check request to the motor controller; wherein the data integrity check request is used to perform a data integrity check on the target boot loader and target application data downloaded in the motor controller;
[0020] If the data integrity check passes, an upgrade request is sent to the motor controller to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application.
[0021] Optionally, if the data integrity check passes, sending an upgrade request to the motor controller, controlling the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application, further comprising:
[0022] Sending a data compatibility check request and a data dependency check request to the motor controller;
[0023] Based on the data compatibility check request and the data dependency check request, checking the boot loader and the application in the motor controller;
[0024] Determine the target boot loader and the target application and flash them to the boot loader and the application.
[0025] Optionally, obtaining current software version numbers of the motor controller boot loader and application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded, includes:
[0026] Monitoring the flashing status of the bootloader and the application in the motor controller;
[0027] In response to the boot loader and the application program being flashed, obtaining current software version numbers of the boot loader and the application program;
[0028] The current software version number is compared with the target software version number to determine whether the motor controller is successfully upgraded.
[0029] Optionally, after obtaining the current software version numbers of the motor controller boot loader and the application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded, the method further includes:
[0030] If it is determined that the motor controller fails to be upgraded, the motor controller is controlled to be reset, and a secondary upgrade request is sent to the motor controller.
[0031] According to a second aspect of the present invention, a controller software upgrade device is provided, which is applied to upgrade a host computer, wherein the upgrade host computer is communicatively connected with a motor controller, and the device comprises:
[0032] A data acquisition module is used to acquire the target bootloader and target application to be flashed;
[0033] An erase request module is used to send an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program;
[0034] A data sending module, configured to send the target boot loader and the target application program to the motor controller in response to completion of erasing the current program of the motor controller;
[0035] An upgrade request module, used for sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application;
[0036] An upgrade module is determined, which is used to obtain the current software version numbers of the motor controller boot loader and application program, and use the current software version numbers to determine whether the motor controller has been successfully upgraded.
[0037] According to another aspect of the present invention, there is also provided an electronic device, comprising:
[0038] processor;
[0039] a memory for storing instructions executable by the processor;
[0040] The processor is configured to execute the instructions to implement the controller software upgrade method as described above.
[0041] According to another aspect of the present invention, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the controller software upgrade method described above are implemented.
[0042] The controller software upgrade method provided by the embodiment of the present invention obtains the target boot loader and target application to be written, sends an erase request to the motor controller, and the erase request is used to control the motor controller to erase the current program of the boot loader and the application, responds to the completion of the erasure of the current program of the motor controller, sends the target boot loader and the target application to the motor controller, sends an upgrade request to the motor controller, and the upgrade request is used to control the motor controller to use the target boot loader and the target application, synchronously write the boot loader and the application, obtain the current software version number of the motor controller boot loader and the application, and use the current software version number to determine whether the motor controller is successfully upgraded. The embodiment of the present invention adopts an upgrade host computer to communicate with the motor controller, initiates an upgrade request through the upgrade host computer, and the motor controller automatically executes the erasing, downloading and writing process, reducing the user's operating burden, erasing the current program before writing the new program, ensuring that the new program can be written without conflict, and realizing the software writing upgrade without disassembling the motor controller, reducing manual operation, and further improving the upgrade efficiency by synchronously writing the boot loader and the application, and improving the upgrade efficiency and reliability through automation, parallel processing and version verification.
[0043] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0045] Figure 1 is a flowchart of the steps of a controller software upgrade method provided by an embodiment of the present invention;
[0046] Figure 2 yes Figure 1 A flowchart of step 101 in the controller software upgrade method provided in an embodiment of the present invention;
[0047] Figure 3 yes Figure 1 A flowchart of step 103 in the controller software upgrade method provided in an embodiment of the present invention;
[0048] Figure 4 yes Figure 1A flowchart of step 104 in the controller software upgrade method provided in an embodiment of the present invention;
[0049] Figure 5 yes Figure 1 A flowchart of step 105 in the controller software upgrade method provided in an embodiment of the present invention;
[0050] Figure 6 is a flowchart of another controller software upgrade method provided by an embodiment of the present invention;
[0051] Figure 7 is a flow chart of a controller software upgrade method provided by an embodiment of the present invention;
[0052] Figure 8 It is a structural schematic diagram of a controller software upgrading device provided by an embodiment of the present invention;
[0053] Fig. 9 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0055] Reference Figure 1 , shows a flowchart of the controller software upgrade method provided by an embodiment of the present invention, which is applied to upgrade a host computer, the upgrade host computer is communicatively connected with a motor controller, and the method may include:
[0056] Step 101, obtaining a target boot loader and a target application to be flashed.
[0057] In an embodiment of the present invention, in order to solve the problem that the traditional upgrade method requires removing the motor controller of the whole vehicle and connecting the debugger to first upgrade the boot loader, and then upgrading the application through the CAN device, the upgrade process is complicated, which affects the software upgrade efficiency of the motor controller, the VN1640 interface is used to realize the communication connection and program data transmission between the upgrade host computer and the motor controller, so as to realize the simultaneous upgrade of the boot loader and the application, simplify the control upgrade process, and improve the upgrade efficiency. When the boot loader of the motor controller of the whole vehicle needs to be upgraded, the VN1640 is connected to the motor controller through the CAN bus to realize communication, and the HEX program package with the boot loader and the application is obtained by the upgrade host computer. The boot loader and the application are identified according to the memory address area of the program in the Flash, and the data of the corresponding program is saved, and an upgrade request is sent to the motor controller, so that the motor controller automatically and synchronously upgrades the boot loader and the application according to the upgrade process.
[0058] Specifically, in an embodiment of the present invention, the upgraded host computer obtains a program information file from a server; wherein the program information file includes program storage addresses corresponding to a target boot loader and a target application, the program information file is parsed, the program storage addresses are obtained, and the target boot loader and the target application are extracted respectively using the program storage addresses, wherein the target boot loader and the target application are program codes of the boot loader and the application that need to be updated, which can be cached into a HEX file, and the HEX file, i.e., the program information file, contains new program codes and program storage addresses corresponding to the target boot loader and the target application.
[0059] It should be noted that the motor controller uses the VN1640 interface to communicate with the upgrade host computer. The upgrade host computer communicates with the motor controller through the UDS protocol, connects to the VN1640 device through the UDS (Unified Diagnostic Services) protocol, and sends a controller upgrade request. UDS is a standard protocol for motor controller (ECU) diagnosis and programming. The motor controller is pre-integrated with the Start_Up program. The Start_Up program is an initialization program that runs when the motor controller starts. It is responsible for preparing the environment for upgrading the boot loader and application program. I will not go into details here.
[0060] Step 102 : Send an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current programs of the boot loader and the application program.
[0061] In an embodiment of the present invention, the upgrade host computer sends an erase request to the motor controller, and the erase request is used to control the motor controller to erase the current program of the boot loader and the application. The erase request is sent to clear the old boot loader and the application in the motor controller to ensure that the new program can be written without conflict.
[0062] Step 103 , in response to the completion of erasing the current program of the motor controller, sending a target boot loader and a target application program to the motor controller.
[0063] In this embodiment, specifically, the upgrade host computer sends a data download request for the boot loader and the application to the motor controller, controls the motor controller to load the upgrade service, the upgrade service includes requesting the program download service, the data transmission service and exiting the transmission service, the upgrade host computer responds to the request for the program download service of the motor controller, and sends the target boot loader and the target application to the motor controller, so that the motor controller uses the data transmission service to download the target boot loader and the target application.
[0064] It should be noted that, in some embodiments, the upgrade host computer can monitor the software erasure status and flashing preparation status of the motor controller, and send the target boot loader and target application to the motor controller through the VN1640 interface. This embodiment does not specifically limit this.
[0065] Step 104 : sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application.
[0066] In an embodiment of the present invention, during a software upgrade of a motor controller, an upgrade host computer sends an upgrade request to the controller. The upgrade request includes information of a target boot loader and a target application, and is used to instruct the controller to perform a synchronous flashing operation. Specifically, it is used to control the motor controller to adopt a target boot loader and a target application, and synchronously flash the boot loader and the application. The target boot loader specifies detailed information of a new boot loader to be flashed into the controller, including a version number, a checksum, a data size, etc. The target application specifies detailed information of a new application to be flashed into the controller, also including a version number, a checksum, a data size, etc.
[0067] It should be noted that the control motor controller adopts the target boot loader and the target application, and flashes the boot loader and the application synchronously, that is, the flashing process of the boot loader and the application is carried out at the same time, which can reduce the total upgrade time and improve efficiency. The synchronous flashing ensures that the boot loader and the application are up to date at the same time, avoiding compatibility issues that may be caused by asynchronous updates.
[0068] Specifically, the upgrade request is usually sent to the motor controller through a specific communication protocol (such as UDS, CAN, LIN, etc.), which contains the necessary commands and parameters to instruct the controller to perform specific operations, such as erasing old programs, downloading new programs, verifying data integrity, etc. After receiving the upgrade request, the motor controller will perform the corresponding operations according to the instructions in the request, including erasing the current program, downloading a new boot loader and application, and performing data verification. During the upgrade operation, the motor controller will feedback the current status information to the device that sent the request, such as the operation progress and whether it is successful.
[0069] Step 105 , obtaining the current software version numbers of the motor controller bootloader and application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded.
[0070] Specifically, in this embodiment, the upgraded host computer monitors the flashing status of the boot loader and the application in the motor controller. In response to the completion of the flashing of the boot loader and the application, the current software version numbers of the boot loader and the application are obtained, and the current software version numbers are compared with the target software version number. Based on whether the version numbers are consistent, it is determined whether the motor controller is successfully upgraded.
[0071] The controller software upgrade method provided by the embodiment of the present invention obtains the target boot loader and target application to be written, sends an erase request to the motor controller, and the erase request is used to control the motor controller to erase the current program of the boot loader and the application, responds to the completion of the erasure of the current program of the motor controller, sends the target boot loader and the target application to the motor controller, sends an upgrade request to the motor controller, and the upgrade request is used to control the motor controller to use the target boot loader and the target application, synchronously write the boot loader and the application, obtain the current software version number of the motor controller boot loader and the application, and use the current software version number to determine whether the motor controller is successfully upgraded. The embodiment of the present invention adopts an upgrade host computer to communicate with the motor controller, initiates an upgrade request through the upgrade host computer, and the motor controller automatically executes the erasing, downloading and writing process, reducing the user's operating burden, erasing the current program before writing the new program, ensuring that the new program can be written without conflict, and realizing the software writing upgrade without disassembling the motor controller, reducing manual operation, and further improving the upgrade efficiency by synchronously writing the boot loader and the application, and improving the upgrade efficiency and reliability through automation, parallel processing and version verification.
[0072] Further, see Figure 2 , showing Figure 1 A flowchart of step 101 in a controller software upgrade method is provided. The method is substantially the same as the controller software upgrade method provided in the first embodiment of the present invention. Step 101 may include:
[0073] Step 201, obtaining a program information file from a server; wherein the program information file includes a program storage address corresponding to a target boot loader and a target application program.
[0074] Step 202: parse the program information file to obtain the program storage address.
[0075] Step 203: Use the program storage address to extract the target boot loader and the target application program respectively.
[0076] It should be noted that, in the embodiment of the present invention, the upgrade host computer obtains a program information file containing the storage address of the target boot loader and the target application from the server, parses the program information file, extracts the storage address of the target boot loader and the target application, and extracts the binary files of the target boot loader and the target application from the server or local storage according to the parsed storage address. By automatically obtaining and parsing the program information file, the steps of manually searching and inputting the storage address are reduced, and the program information file is quickly obtained and parsed, so that the new program can be quickly deployed to the motor controller, simplifying the operation process and improving the upgrade efficiency.
[0077] Further, see Figure 3 , showing Figure 1 A flowchart of step 103 in a controller software upgrade method is provided. The method is substantially the same as the controller software upgrade method provided in the first embodiment of the present invention. Step 103 may include:
[0078] Step 301, sending a data download request for a boot loader and an application program to a motor controller, and controlling the motor controller to load an upgrade service; wherein the upgrade service includes requesting a program download service, a data transmission service, and exiting a transmission service.
[0079] In this embodiment, the upgrade host computer sends a data download request for the boot loader and the application to the motor controller, and controls the motor controller to load the upgrade service. The motor controller can use the 34 (RequestDownload), 36 (TransferData) and 37 (RequestTransferExit) services of the UDS protocol to download new boot loader and application data. The upgrade service includes request program download service, data transmission service and exit transmission service. The size of each data packet is 0xFFF bytes.
[0080] Step 302 : In response to a request for program download service from the motor controller, a target boot loader and a target application are sent to the motor controller, so that the motor controller downloads the target boot loader and the target application using a data transmission service.
[0081] It should be noted that, in the embodiment of the present invention, when the motor controller is preparing for software upgrade, the upgrade host computer will send a signal requesting program download service. The purpose of the request is to obtain a new boot loader and application program for upgrading. The data packet of the target boot loader and the target application program is sent to the motor controller. The data packet is usually in binary format and contains the program code and data. Among them, the data transmission service refers to the use of a specific communication protocol (such as UDS, CAN, LIN, etc.) to transmit data. During the data transmission process, the system will send the data packet in the format and order specified by the protocol to ensure that the data can be transmitted to the motor controller correctly. After receiving the data packet, the motor controller will perform receiving and storage operations.
[0082] Further, see Figure 4 , showing Figure 1 A flowchart of step 104 in a controller software upgrade method is provided. The method is substantially the same as the controller software upgrade method provided in the first embodiment of the present invention. Step 104 may include:
[0083] Step 401, sending a data integrity check request to the motor controller; wherein the data integrity check request is used to perform a data integrity check on the target boot loader and target application data downloaded into the motor controller.
[0084] Step 402: If the data integrity check passes, an upgrade request is sent to the motor controller, and the motor controller is controlled to use the target boot loader and the target application to synchronously flash the boot loader and the application.
[0085] It should be noted that, in an embodiment of the present invention, the upgrade host computer sends a data integrity check request to the motor controller. The data integrity check request is used to perform data integrity check on the target boot loader and target application data downloaded in the motor controller. Usually, CRC32 (cyclic redundancy check) or other check algorithms are used to calculate the check value of the data and compare it with a pre-provided reference value. If the calculated check value is consistent with the reference value, it indicates that no error occurred during the data transmission process and the data is complete. Only when the data integrity check passes, an upgrade request is sent to the motor controller. The upgrade request is used to instruct the motor controller to adopt the new target boot loader and target application, and perform the flash operation synchronously to improve the upgrade efficiency.
[0086] Specifically, if the data integrity check passes in step 402, an upgrade request is sent to the motor controller, and the motor controller is controlled to use the target boot loader and the target application to synchronously flash the boot loader and the application, and the following may also be included:
[0087] First, a data compatibility check request and a data dependency check request are sent to the motor controller;
[0088] Secondly, based on the data compatibility check request and the data dependency check request, the boot loader and the application in the motor controller are checked;
[0089] Secondly, the target boot loader and the target application are determined and flashed to the boot loader and the application.
[0090] It should be noted that in the above steps, a data compatibility check request and a data dependency check request are sent to the motor controller to verify whether the target boot loader and the target application are compatible with the hardware and other software components of the controller and whether all necessary dependencies are met. These requests may include checks on the processor architecture, operating system version, memory size, other software component versions, etc. After receiving these requests, the motor controller will perform compatibility and dependency checks on the boot loader and the application according to the instructions in the request. If the check passes, it indicates that the new program can run in the current hardware and software environment; if the check fails, measures may need to be taken, such as updating other software components or replacing hardware. Only when the compatibility and dependency checks pass, will it be determined to flash the target boot loader and the target application to the controller. After confirming the flashing, the motor controller is instructed to perform the actual flashing operation to write the new boot loader and application to the non-volatile memory.
[0091] This embodiment ensures that the new program can run correctly on the controller through compatibility and dependency checks, avoiding system failures caused by incompatibility or dependency issues. Flashing is only performed after all checks are passed, reducing errors caused by compatibility or dependency issues. Compatibility and dependency checks enhance the security of the system and ensure the stability and reliability of the upgrade process.
[0092] Further, see Figure 5 , showing Figure 1 A flowchart of step 105 in a controller software upgrade method is provided. The method is substantially the same as the controller software upgrade method provided in the first embodiment of the present invention. Step 105 may include:
[0093] Step 501 , monitoring the flashing status of the bootloader and the application program in the motor controller.
[0094] Step 502: in response to the boot loader and the application program being flashed, the current software version numbers of the boot loader and the application program are obtained.
[0095] Step 503, compare the current software version number with the target software version number to determine whether the motor controller is upgraded successfully.
[0096] It should be noted that, in the embodiment of the present invention, the upgrade host computer monitors the flashing status of the boot loader and the application in the motor controller in real time to ensure that the flashing process proceeds smoothly, checks and displays the flashing progress regularly or in real time, and provides feedback information to the user or maintenance personnel, such as the percentage of the flashing progress, whether an error is encountered, etc. After the boot loader and the application are flashed, the current software version number in the motor controller will be obtained, which is achieved by reading a specific register or storage area in the motor controller that stores the software version information. The current software version number obtained is compared with the target software version number to determine whether the upgrade is successful. If the current version number is consistent with the target version number, it indicates that the upgrade is successful; if not, it may be necessary to re-upgrade or check whether there are problems in the upgrade process.
[0097] This embodiment ensures the reliability and accuracy of the upgrade process by monitoring the flashing status and comparing software version numbers, confirms that the upgrade is successful when the version numbers are consistent, and reduces errors caused by flashing errors or version mismatches. Monitoring the flashing status and version comparison enhances the security of the system and ensures the stability and reliability of the upgrade process.
[0098] Reference Figure 6 , shows a flowchart of the steps of another controller software upgrade method provided by an embodiment of the present invention, which method is basically the same as the controller software upgrade method provided by the first embodiment of the present invention, except that the method may further include:
[0099] Step 101, obtaining a target boot loader and a target application to be flashed.
[0100] Step 102 : Send an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current programs of the boot loader and the application program.
[0101] Step 103 , in response to the completion of erasing the current program of the motor controller, sending a target boot loader and a target application program to the motor controller.
[0102] Step 104 : sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application.
[0103] Step 105 , obtaining the current software version numbers of the motor controller bootloader and application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded.
[0104] Step 106: If it is determined that the motor controller upgrade fails, the motor controller is controlled to reset, and a secondary upgrade request is sent to the motor controller.
[0105] In an embodiment of the present invention, the upgrade host computer uses the current software version number to determine whether the motor controller has been successfully upgraded. If the current software version number is inconsistent with the target software version number, it is determined that the motor controller upgrade has failed. If it is determined that the motor controller upgrade has failed, the motor controller is controlled to reset and a secondary upgrade request is sent to the motor controller. Automatic re-upgrade can be achieved when the upgrade fails.
[0106] In accordance with the embodiment of the present invention, based on the beneficial effects of the first embodiment, if the first upgrade fails during the motor controller software upgrade, a reset is performed and a secondary upgrade request is sent. By retrying the reset and secondary upgrade request, the probability of successful controller software upgrade is increased, especially when the first upgrade fails due to a transient error or interference, thereby improving the reliability and success rate of the software upgrade.
[0107] In order to facilitate those skilled in the art to fully understand the above controller software upgrade method, refer to Figure 7 , Figure 7 It is a flow chart of a controller software upgrade method provided by an embodiment of the present invention, which shows the overall process of controller software upgrade provided by an embodiment of the present invention, specifically including: pre-integrating the Start_Up program in the motor controller to upgrade the boot loader and the application program, the upgrade host computer obtaining the HEX file including the boot loader and the application program to be upgraded, identifying the boot loader and the application program according to the memory address where the program is located, and extracting the corresponding data content and data length from the HEX file. It should be noted that before the upgrade, it is determined whether the upgrade host computer is connected to the motor controller through the VN1640 interface, so as to facilitate sending the controller upgrade request through the UDS protocol. After confirming the connection, the upgrade host computer sends a controller soft reset request. After the reset, the upgrade host computer sends Send a request to erase the boot loader and application memory area to erase the corresponding old program in the controller from the memory; the upgrade host computer sends a request to download the boot loader and application data, including the program download service, data transmission service and exit transmission service of the UDS protocol. After confirming that the controller has downloaded the program data, the upgrade host computer sends a request to verify the integrity of the flash data to verify the downloaded boot loader and application data, verify the integrity of the program, and send a request to verify the compatibility and dependency of the flash data to complete the compatibility and dependency verification according to the address corresponding to the data. After the verification passes, the upgrade host computer sends a controller hard reset request and requests to read the software version number of the motor controller boot loader and application to confirm whether the motor controller has been upgraded successfully.
[0108] Reference Figure 8, shows a schematic diagram of the structure of a controller software upgrade device provided by an embodiment of the present invention, which is applied to upgrade a host computer, the upgrade host computer is communicatively connected with a motor controller, and the device comprises:
[0109] The data acquisition module 601 is used to acquire the target boot loader and target application program to be flashed;
[0110] The erase request module 602 is used to send an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program;
[0111] A data sending module 603 is used for sending the target boot loader and the target application program to the motor controller in response to the completion of erasing the current program of the motor controller;
[0112] An upgrade request module 604 is used to send an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application;
[0113] The upgrade determination module 605 is used to obtain the current software version numbers of the motor controller boot loader and application program, and use the current software version numbers to determine whether the motor controller is successfully upgraded.
[0114] Furthermore, the data acquisition module 601 includes:
[0115] A first acquisition submodule is used to acquire a program information file from a server; wherein the program information file includes a program storage address corresponding to a target boot loader and a target application program;
[0116] A second acquisition submodule is used to parse the program information file to obtain the program storage address;
[0117] The extraction submodule is used to respectively extract the target boot loader and the target application program using the program storage address.
[0118] Optionally, the data sending module 603 includes:
[0119] A first sending submodule is used to send a data download request for a boot loader and an application program to the motor controller, and control the motor controller to load an upgrade service; wherein the upgrade service includes a request program download service, a data transmission service, and an exit transmission service;
[0120] The second sending submodule is used for sending the target boot loader and the target application to the motor controller in response to the request program download service of the motor controller, so that the motor controller adopts the data transmission service to download the target boot loader and the target application.
[0121] Optionally, the upgrade request module 604 includes:
[0122] A third sending submodule is used to send a data integrity check request to the motor controller; wherein the data integrity check request is used to perform a data integrity check on the target boot loader and target application data downloaded in the motor controller;
[0123] The fourth sending submodule is used to send an upgrade request to the motor controller if the data integrity check passes, and control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application.
[0124] Optionally, the upgrade request module 604 further includes:
[0125] a fifth sending submodule, configured to send a data compatibility check request and a data dependency check request to the motor controller;
[0126] A check submodule, configured to check the boot loader and the application program in the motor controller based on the data compatibility check request and the data dependency check request;
[0127] The determination submodule is used to determine the target boot loader and the target application to be flashed to the boot loader and the application.
[0128] Optionally, the upgrade determination module 605 includes:
[0129] A monitoring submodule, used for monitoring the flashing status of the bootloader and the application program in the motor controller;
[0130] A third acquisition submodule, configured to acquire current software version numbers of the boot loader and the application in response to completion of flashing the boot loader and the application;
[0131] The comparison submodule is used to compare the current software version number with the target software version number to determine whether the motor controller is successfully upgraded.
[0132] Optionally, the device further comprises:
[0133] The secondary upgrade request module is used to control the motor controller to reset if it is determined that the motor controller fails to be upgraded, and to send a secondary upgrade request to the motor controller.
[0134] The controller software upgrade device provided by the embodiment of the present invention obtains the target boot loader and target application to be written, sends an erase request to the motor controller, and the erase request is used to control the motor controller to erase the current program of the boot loader and the application, responds to the completion of the erasure of the current program of the motor controller, sends the target boot loader and the target application to the motor controller, sends an upgrade request to the motor controller, and the upgrade request is used to control the motor controller to use the target boot loader and the target application, synchronously write the boot loader and the application, obtain the current software version number of the motor controller boot loader and the application, and use the current software version number to determine whether the motor controller is successfully upgraded. The embodiment of the present invention adopts an upgrade host computer to communicate with the motor controller, initiates an upgrade request through the upgrade host computer, and the motor controller automatically executes the erasing, downloading and writing process, thereby reducing the user's operating burden, erasing the current program before writing a new program, ensuring that the new program can be written without conflict, and realizing the software writing upgrade without disassembling the motor controller, thereby reducing manual operation, and further improving the upgrade efficiency by synchronously writing the boot loader and the application, and improving the upgrade efficiency and reliability through automation, parallel processing and version verification.
[0135] Reference Fig. 9 , an embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0136] Memory 703, used for storing computer programs;
[0137] The processor 701 is used to execute the program stored in the memory 703 to implement the following steps:
[0138] Get the target bootloader and target application to be flashed;
[0139] Sending an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program;
[0140] In response to completion of erasing the current program of the motor controller, sending the target boot loader and the target application program to the motor controller;
[0141] Sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application;
[0142] The current software version numbers of the motor controller bootloader and application are obtained, and the current software version numbers are used to determine whether the motor controller is successfully upgraded.
[0143] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0144] The communication interface is used for communication between the above terminal and other devices.
[0145] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0146] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0147] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the controller software upgrade method described in any of the above embodiments.
[0148] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0149] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0150] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0151] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A controller software upgrade method, It is characterized in that Applied to upgrading a host computer, the upgraded host computer is communicatively connected with a motor controller, and the method comprises: Get the target bootloader and target application to be flashed; Sending an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program; In response to completion of erasing the current program of the motor controller, sending the target boot loader and the target application program to the motor controller; Sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application; The current software version numbers of the motor controller bootloader and application are obtained, and the current software version numbers are used to determine whether the motor controller is successfully upgraded.
2. The method according to claim 1, It is characterized in that The step of obtaining the target boot loader and target application to be flashed includes: Obtaining a program information file from a server; wherein the program information file includes a program storage address corresponding to a target boot loader and a target application program; Parsing the program information file to obtain the program storage address; The target boot loader and the target application program are extracted respectively using the program storage address.
3. The method according to claim 1, It is characterized in that In response to the completion of erasing the current program of the motor controller, sending the target boot loader and the target application program to the motor controller comprises: Sending a data download request for a boot loader and an application to the motor controller, and controlling the motor controller to load an upgrade service; wherein the upgrade service includes requesting a program download service, a data transmission service, and exiting a transmission service; In response to the request program download service of the motor controller, the target boot loader and the target application are sent to the motor controller, so that the motor controller downloads the target boot loader and the target application using the data transmission service.
4. The method according to claim 1, It is characterized in that The step of sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to use the target boot loader and the target application to synchronously flash the boot loader and the application, includes: Sending a data integrity check request to the motor controller; wherein the data integrity check request is used to perform a data integrity check on the target boot loader and target application data downloaded in the motor controller; If the data integrity check passes, an upgrade request is sent to the motor controller to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application.
5. The method according to claim 4, It is characterized in that If the data integrity check passes, an upgrade request is sent to the motor controller, and the motor controller is controlled to use the target boot loader and the target application to synchronously flash the boot loader and the application, and further includes: Sending a data compatibility check request and a data dependency check request to the motor controller; Based on the data compatibility check request and the data dependency check request, checking the boot loader and the application in the motor controller; Determine the target boot loader and the target application and flash them to the boot loader and the application.
6. The method according to claim 1, It is characterized in that The obtaining of the current software version numbers of the motor controller bootloader and the application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded, includes: Monitoring the flashing status of the bootloader and the application in the motor controller; In response to the boot loader and the application program being flashed, obtaining current software version numbers of the boot loader and the application program; The current software version number is compared with the target software version number to determine whether the motor controller is successfully upgraded.
7. The method according to claim 1, It is characterized in that After obtaining the current software version numbers of the motor controller bootloader and the application program, and using the current software version numbers to determine whether the motor controller is successfully upgraded, the method further includes: If it is determined that the motor controller fails to be upgraded, the motor controller is controlled to be reset, and a secondary upgrade request is sent to the motor controller.
8. A controller software upgrade device, It is characterized in that Applied to upgrading a host computer, the upgraded host computer is communicatively connected with a motor controller, and the device comprises: A data acquisition module is used to acquire the target bootloader and target application to be flashed; An erase request module is used to send an erase request to the motor controller; wherein the erase request is used to control the motor controller to erase the current program of the boot loader and the application program; A data sending module, configured to send the target boot loader and the target application program to the motor controller in response to completion of erasing the current program of the motor controller; An upgrade request module, used for sending an upgrade request to the motor controller, wherein the upgrade request is used to control the motor controller to adopt the target boot loader and the target application to synchronously flash the boot loader and the application; An upgrade module is determined, which is used to obtain the current software version numbers of the motor controller boot loader and application program, and use the current software version numbers to determine whether the motor controller has been successfully upgraded.
9. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the instructions to implement the controller software upgrade method according to any one of claims 1 to 7.
10. A readable storage medium, It is characterized in that The readable storage medium stores a computer program, and when the computer program is executed by a processor, the controller software upgrade method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Onboard software online upgrading method compatible with different bus interfaces
CN120950108A
An on-board software online upgrading method compatible with different bus interfaces
CN120950108B
Multi-software dynamic loading and upgrading method and device, equipment and storage medium
CN121523758A
