BMS program remote upgrading method and device
By using the Bootloader program to upgrade wireless networks in the BMS system, the problems of low efficiency, insufficient reliability and poor security in the prior art BMS program upgrade are solved, and the remote upgrade of the BMS program is realized, improving the system maintenance efficiency and reliability.
Patent Information
- Application Number
- CN202510006140.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-29
AI Technical Summary
In the existing energy storage system, BMS program upgrade requires manual on-site operation, which is low efficiency, insufficient reliability, poor safety, and lacks the ability to remotely upgrade the Bootloader program.
The Bootloader program receives the upgrade instructions sent by the host computer in the wireless network, determines whether to upgrade the App program or Bootloader program, and stores and copy new program data in the corresponding backup area to complete the remote upgrade operation.
Remote upgrade of BMS programs is realized, the system maintenance efficiency and reliability are improved, and the security of the upgrade process and data integrity are ensured.
Smart Images

Figure CN119902787A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of energy storage systems, and in particular to a method and device for remotely upgrading a BMS program. Background Art
[0002] With the continuous growth of energy demand and the widespread application of renewable energy, energy storage systems play an increasingly important role in power systems. The battery management system (BMS) is a core component of the energy storage system, responsible for the monitoring, protection, management and optimization of the battery. In the existing energy storage BMS system, due to the wide distribution of equipment and complex environment, the traditional firmware update method often requires manual intervention, which is time-consuming, labor-intensive, costly, and has great safety risks. Therefore, it is particularly important to develop a system that can achieve remote upgrades. In the prior art, although there are a variety of implementation solutions, most of them only support remote upgrades of application programs and lack the ability to remotely upgrade the system itself.
[0003] In current energy storage systems, the program upgrade of the battery management system (BMS) usually requires on-site operation, which is not only time-consuming and labor-intensive, but also costly. In addition, on-site upgrades may also be restricted by environmental conditions, resulting in a complex upgrade process and greater risks. Therefore, the following major problems exist in the prior art:
[0004] (1) Low upgrade efficiency: Traditional BMS firmware upgrades require manual on-site operations, which are complex and time-consuming, and cannot meet the rapid maintenance requirements of large-scale energy storage systems.
[0005] (2) Insufficient reliability: The on-site upgrade process is susceptible to environmental interference, which may cause upgrade failure or system damage.
[0006] (3) Security issues: Traditional upgrade methods lack effective security mechanisms and are easily interfered with by the external environment, resulting in data tampering and program abnormalities.
[0007] (4) Recovery difficulties: Once problems occur during the upgrade process, the existing technology lacks an effective backup and recovery mechanism, which makes system recovery difficult and affects the normal operation of the system.
[0008] (5) Does not support self-upgrade: The existing upgrade solution only supports the upgrade of App programs, and does not support remote upgrade of Bootloader programs. Summary of the invention
[0009] In view of this, an embodiment of the present application provides a BMS program remote upgrade method. One or more embodiments of the present application also relate to a BMS program remote upgrade device, a computing device, a computer-readable storage medium and a computer program to solve the technical defects existing in the prior art.
[0010] According to a first aspect of an embodiment of the present application, a method for remotely upgrading a BMS program is provided, comprising:
[0011] After the Bootloader program in the battery management system BMS receives the upgrade instruction containing the upgrade identifier sent by the host computer through the wireless network, it determines whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction;
[0012] When it is determined that the App program is to be upgraded, the Bootloader program stores the new App program data for the App program upgrade sent by the host computer through the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program;
[0013] When it is determined that the Bootloader program is to be upgraded, the Bootloader program stores the new Bootloader program data for upgrading the Bootloader program sent by the host computer via the wireless network into the Bootloader backup area, and then jumps to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program.
[0014] Preferably, it also includes:
[0015] Get the storage space of the Flash memory in the BMS;
[0016] Divide the storage space of the Flash memory into four partitions according to the storage space of the Flash memory, the space occupied by the App program, and the space occupied by the Bootloader program in the BMS;
[0017] Wherein, the four partitions include:
[0018] App area for storing BMS App program data;
[0019] App backup area for storing new App program data for BMS App program upgrade;
[0020] Bootloader area for storing BMS Bootloader program data; and
[0021] Bootloader backup area for storing new Bootloader program data for BMS Bootloader program upgrade.
[0022] Preferably, it also includes:
[0023] The host computer obtains a new App program data packet, and obtains multiple frames of new App program data by segmenting the new App program data packet, and configures a packet header for identifying an App program upgrade data frame for each frame of new App program data;
[0024] The host computer determines the data frame number of each frame of new App program data according to the position information of each frame of new App program data in the new App program data packet;
[0025] The host computer encrypts each frame of new App program data according to the encryption protocol to obtain encrypted new App program data;
[0026] The host computer calculates the CRC check value and program data length of each frame of new App program data;
[0027] The host computer packages the packet header, data frame number, encrypted new App program data, CRC check value and program data length of each frame of new App program data to obtain each complete new App program data frame, and sends each complete new App program data frame to the Bootloader program in sequence through the wireless network.
[0028] Preferably, it also includes:
[0029] The host computer obtains a new Bootloader program data packet, and obtains multiple frames of new Bootloader program data by segmenting the new Bootloader program data packet, and configures a packet header for identifying a Bootloader program upgrade data frame for each frame of new Bootloader program data;
[0030] The host computer determines the data frame number of each frame of new Bootloader program data according to the position information of each frame of new Bootloader program data in the new Bootloader program data packet;
[0031] The host computer encrypts each frame of new Bootloader program data according to the encryption protocol to obtain encrypted new Bootloader program data;
[0032] The host computer calculates the CRC check value and program data length of each frame of new Bootloader program data;
[0033] The host computer packages the packet header, data frame number, encrypted new Bootloader program data, CRC check value and program data length of each frame of new Bootloader program data to obtain each complete new Bootloader program data frame, and sends each complete new Bootloader program data frame to the Bootloader program in sequence through the wireless network.
[0034] Preferably, the Bootloader program stores the new App program data for App program upgrade sent by the host computer via the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the App program remote upgrade operation, including:
[0035] After receiving each complete frame of new App program data frame sent by the host computer through the wireless network, the Bootloader program parses and verifies each complete frame of new App program data frame, and after each complete frame of new App program data frame passes the verification, stores the verified new App program data frame in the App backup area in a certain order;
[0036] After the Bootloader program stores all new App program data frames in the App backup area, all new App program data frames in the App backup area are verified, and after the verification passes, the original App program data in the App area is erased, and all new App program data frames in the App backup area are copied to the App area;
[0037] The Bootloader program verifies all new App program data frames in the copied App area again, and after the verification passes, erases all data in the App backup area and enters the jump mode to complete the remote upgrade operation of the App program.
[0038] Preferably, after the Bootloader program stores the new Bootloader program for upgrading the Bootloader program sent by the host computer through the wireless network into the Bootloader backup area, the Bootloader program jumps to the App program of the BMS, so that the App program erases the original Bootloader program in the Bootloader area and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including:
[0039] After the Bootloader program receives each complete new Bootloader program data frame sent by the host computer through the wireless network, it parses and verifies each complete new Bootloader program data frame, and after each complete new Bootloader program data frame passes the verification, stores the verified new Bootloader program data frame in the Bootloader backup area in a certain order;
[0040] After the Bootloader program stores all new Bootloader program data frames into the Bootloader backup area, it jumps to the BMS App program;
[0041] After the App program is successfully initialized, determine whether the Bootloader program needs to be upgraded;
[0042] When it is determined that the Bootloader program needs to be upgraded, the App program erases the original Bootloader program in the Bootloader area, and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program;
[0043] When it is determined that the Bootloader program does not need to be upgraded, the App program executes normal tasks in the App program.
[0044] Preferably, after the App program erases the original Bootloader program in the Bootloader area, the new Bootloader program in the Bootloader backup area is copied to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including:
[0045] The App program verifies all new Bootloader program data frames in the Bootloader backup area, and after the verification passes, erases the original Bootloader program data in the Bootloader area, and copies all new Bootloader program data frames in the Bootloader backup area to the Bootloader area;
[0046] The App program verifies all new Bootloader program data frames in the copied Bootloader area again, and after the verification passes, erases all the data in the Bootloader backup area and enters the jump mode to complete the remote upgrade operation of the Bootloader program.
[0047] According to a second aspect of an embodiment of the present application, a BMS program remote upgrade device is provided, comprising:
[0048] The judgment module is configured to determine whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction after receiving the upgrade instruction containing the upgrade identifier sent by the host computer through the wireless network;
[0049] The App program upgrade module is configured to store the new App program data for App program upgrade sent by the host computer through the wireless network into the App backup area when it is determined that the App program is to be upgraded, and after erasing the original App program data in the App area, copy the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program;
[0050] The Bootloader program upgrade module is configured to, when it is determined that the Bootloader program is to be upgraded, cause the Bootloader program to store the new Bootloader program data for Bootloader program upgrade sent by the host computer via the wireless network into the Bootloader backup area, and then jump to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area, so as to complete the remote upgrade operation of the Bootloader program.
[0051] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0052] Memory and processor;
[0053] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to implement any step of the BMS program remote upgrade method.
[0054] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of any one of the methods for remotely upgrading a BMS program are implemented.
[0055] According to a fifth aspect of an embodiment of the present application, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned BMS program remote upgrade method.
[0056] The BMS program remote upgrade solution provided in the embodiment of the present application is that after the system is powered on, the Bootloader runs first and waits for the upgrade command from the host computer. If it is an App program upgrade, the Bootloader writes the upgrade package to the App backup area and verifies it after the writing is completed. After confirmation, the data in the App area is erased, and the data in the App backup area is copied to the App area; if it is an Boot program upgrade, the Bootloader writes the upgrade package to the Boot backup area and verifies it after the writing is completed. After confirmation, jump to the App program, erase the data in the Bootloader area, and copy the data in the Bootloader backup area to the Bootloader area; after the upgrade is completed, the Bootloader restarts the system to ensure that the upgraded program can run normally. The BMS program remote upgrade solution provided in the embodiment of the present application can realize the remote upgrade of the BMS App program and Bootloader program, and improve the maintenance efficiency and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is a flow chart of a BMS program remote upgrade method provided by an embodiment of the present application;
[0058] Figure 2 It is a schematic diagram of a BMS program remote upgrade device provided by an embodiment of the present application;
[0059] Figure 3 It is a multi-region partition diagram of MCU Flash provided by an embodiment of the present application;
[0060] Figure 4 This is a flowchart of a remote upgrade Bootloader program operation provided by an embodiment of the present application;
[0061] Figure 5 This is a flowchart of the remote upgrade App program operation provided by an embodiment of the present application;
[0062] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0063] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0064] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0065] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0066] In the present application, a BMS program remote upgrade method is provided. The present application also relates to a BMS program remote upgrade device, a computing device, a computer-readable storage medium, and a computer program, which are described in detail one by one in the following embodiments.
[0067] Figure 1 A flowchart of a BMS program remote upgrade method provided according to an embodiment of the present application is shown, which specifically includes the following steps.
[0068] Step S101: After the Bootloader program in the battery management system BMS receives an upgrade instruction including an upgrade identifier sent by a host computer through a wireless network, it determines whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction;
[0069] Step S102: When it is determined that the App program is to be upgraded, the Bootloader program stores the new App program data for the App program upgrade sent by the host computer through the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program;
[0070] Step S103: When it is determined that the Bootloader program is to be upgraded, the Bootloader program stores the new Bootloader program data for upgrading the Bootloader program sent by the host computer via the wireless network into the Bootloader backup area, and then jumps to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program.
[0071] In the embodiment of the present application, it also includes:
[0072] Get the storage space of Flash memory in BMS;
[0073] Divide the storage space of the Flash memory into four partitions according to the storage space of the Flash memory, the occupied space of the App program, and the occupied space of the Bootloader program in the BMS;
[0074] Wherein, the four partitions include:
[0075] App area for storing BMS App program data;
[0076] App backup area for storing new App program data for BMS App program upgrade;
[0077] Bootloader area for storing BMS Bootloader program data; and
[0078] Bootloader backup area for storing new Bootloader program data for BMS Bootloader program upgrade.
[0079] In the embodiment of the present application, it also includes:
[0080] The host computer obtains a new App program data packet, and obtains multiple frames of new App program data by segmenting the new App program data packet, and configures a packet header for identifying an App program upgrade data frame for each frame of new App program data;
[0081] The host computer determines the data frame number of each frame of new App program data according to the position information of each frame of new App program data in the new App program data packet;
[0082] The host computer encrypts each frame of new App program data according to the encryption protocol to obtain encrypted new App program data;
[0083] The host computer calculates the CRC check value and program data length of each frame of new App program data;
[0084] The host computer packages the packet header, data frame number, encrypted new App program data, CRC check value and program data length of each frame of new App program data to obtain each complete new App program data frame, and sends each complete new App program data frame to the Bootloader program in sequence through the wireless network.
[0085] In the embodiment of the present application, it also includes:
[0086] The host computer obtains a new Bootloader program data packet, and obtains multiple frames of new Bootloader program data by segmenting the new Bootloader program data packet, and configures a packet header for identifying a Bootloader program upgrade data frame for each frame of new Bootloader program data;
[0087] The host computer determines the data frame number of each frame of new Bootloader program data according to the position information of each frame of new Bootloader program data in the new Bootloader program data packet;
[0088] The host computer encrypts each frame of new Bootloader program data according to the encryption protocol to obtain encrypted new Bootloader program data;
[0089] The host computer calculates the CRC check value and program data length of each frame of new Bootloader program data;
[0090] The host computer packages the packet header, data frame number, encrypted new Bootloader program data, CRC check value and program data length of each frame of new Bootloader program data to obtain each complete new Bootloader program data frame, and sends each complete new Bootloader program data frame to the Bootloader program in sequence through the wireless network.
[0091] In the embodiment of the present application, the Bootloader program stores the new App program data for App program upgrade sent by the host computer via the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the App program remote upgrade operation, including:
[0092] After receiving each complete frame of new App program data frame sent by the host computer through the wireless network, the Bootloader program parses and verifies each complete frame of new App program data frame, and after each complete frame of new App program data frame passes the verification, stores the verified new App program data frame in the App backup area in a certain order;
[0093] After the Bootloader program stores all new App program data frames in the App backup area, all new App program data frames in the App backup area are verified, and after the verification passes, the original App program data in the App area is erased, and all new App program data frames in the App backup area are copied to the App area;
[0094] The Bootloader program verifies all new App program data frames in the copied App area again, and after the verification passes, erases all data in the App backup area and enters the jump mode to complete the remote upgrade operation of the App program.
[0095] In the embodiment of the present application, after the Bootloader program stores the new Bootloader program for upgrading the Bootloader program sent by the host computer through the wireless network into the Bootloader backup area, it jumps to the App program of the BMS, so that the App program erases the original Bootloader program in the Bootloader area, and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including:
[0096] After the Bootloader program receives each complete new Bootloader program data frame sent by the host computer through the wireless network, it parses and verifies each complete new Bootloader program data frame, and after each complete new Bootloader program data frame passes the verification, stores the verified new Bootloader program data frame in the Bootloader backup area in a certain order;
[0097] After the Bootloader program stores all new Bootloader program data frames into the Bootloader backup area, it jumps to the BMS App program;
[0098] After the App program is successfully initialized, determine whether the Bootloader program needs to be upgraded;
[0099] When it is determined that the Bootloader program needs to be upgraded, the App program erases the original Bootloader program in the Bootloader area, and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program;
[0100] When it is determined that the Bootloader program does not need to be upgraded, the App program executes normal tasks in the App program.
[0101] In the embodiment of the present application, after the App program erases the original Bootloader program in the Bootloader area, the new Bootloader program in the Bootloader backup area is copied to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including:
[0102] The App program verifies all new Bootloader program data frames in the Bootloader backup area, and after the verification passes, erases the original Bootloader program data in the Bootloader area, and copies all new Bootloader program data frames in the Bootloader backup area to the Bootloader area;
[0103] The App program verifies all new Bootloader program data frames in the copied Bootloader area again, and after the verification passes, erases all the data in the Bootloader backup area and enters the jump mode to complete the remote upgrade operation of the Bootloader program.
[0104] The BMS program remote upgrade solution provided in the embodiment of the present application can realize the remote upgrade of the BMS App program and Bootloader program, improve the maintenance efficiency and reliability of the system, and ensure the security of the upgrade process and the integrity of the data.
[0105] The following combination Figure 3Taking the application of the MCU Flash multi-area partition map provided in this application as an example, the Flash memory of the MCU (microcontroller) is divided into four parts: Bootloader area, App area, App backup area and Bootloader backup area. The specific size of the partition can be allocated according to the size of the Flash and the size of the Bootloader and App programs.
[0106] The Bootloader area is used to store the Bootloader program, which is responsible for system startup and upgrade management.
[0107] The App area is used to store the main BMS applications.
[0108] The App backup area and the Bootloader backup area are used to store backups of the App program and the Bootloader program respectively, so that when problems occur during the upgrade process, the original program will not be affected.
[0109] Specific remote upgrade process:
[0110] Step 301, Bootloader starts: After the system is powered on, the Bootloader runs first, waiting for the upgrade instruction from the host computer. If an upgrade is required, the Bootloader will guide the system into the upgrade mode.
[0111] Step 302: Remote upgrade request: The host computer sends an upgrade request and upgrade package to the BMS through the network.
[0112] Step 303, upgrade package verification: After receiving the upgrade package, the Bootloader first performs decryption and integrity verification to ensure the reliability and security of the upgrade package during transmission.
[0113] Step 304: If the upgrade is for an App program, the Bootloader writes the upgrade package to the App backup area and verifies it after writing. After confirmation, the data in the App area is erased and the data in the App backup area is copied to the App area.
[0114] Step 305: If the Boot program is upgraded, the Bootloader writes the upgrade package to the Boot backup area and verifies it after writing. After confirmation, jump to the App program, erase the data in the Bootloader area, and copy the data in the Bootloader backup area to the Bootloader area.
[0115] Step 306, system restart: After the upgrade is completed, the Bootloader restarts the system to ensure that the upgraded program can run normally.
[0116] Furthermore, the present application also adds security mechanisms during the implementation process: 1. Encrypted transmission: The transmission process of the upgrade package adopts an encryption protocol to prevent data tampering or theft. 2. Multiple verification: During the upgrade process, the upgrade package is verified multiple times to ensure the integrity and correctness of the data. 3. Multi-region backup: By storing data backups in different regions, the reliability and availability of data are improved. 4. Communication timeout monitoring: Real-time monitoring of communication status, rapid response to timeout events, and ensuring the continuity of data transmission.
[0117] The following combination Figure 4 , taking the application of the remote upgrade Bootloader program operation flow chart provided in this application as an example, before the remote upgrade Bootloader program is performed, the host computer will split the program data packet to be transmitted, and then when each frame of program data is transmitted, it will first calculate and determine the position of the frame data in the program data packet and convert it into a data frame number, and calculate the CRC check value and length of the original program data of the frame, and then encrypt the original data of the frame according to the encryption protocol, and finally package these data together into a complete data frame and send it out. The remote upgrade Bootloader program specifically includes:
[0118] Step 401: After the microcontroller (MCU) is powered on, the Bootloader program is first started, and then the command to upgrade the App is received from the host computer.
[0119] Step 402: If the upgrade command sent by the host computer is not received within a certain period of time, the Bootloader program enters the jump mode and checks whether the App area program is normal. If the App area program is normal, the App program is started to execute; if the App area program is not normal, the Bootloader program continues to wait for the upgrade command from the host computer.
[0120] Step 403: If the upgrade instruction sent by the host computer is received within a certain period of time, the Bootloader program enters the upgrade mode, and further determines whether to upgrade the App program or the Bootloader program.
[0121] Furthermore, the host computer will send different instructions to the bootloader program according to the different programs that need to be upgraded. The bootloader distinguishes which program to upgrade based on the instructions. For example, if the instruction sent by the host computer is 0xAA, it means upgrading the app program, and sending the instruction 0xBB means upgrading the bootloader program.
[0122] Furthermore, the communication timeout monitoring mechanism: when the Bootloader program receives the upgrade instruction, it will start a timer specifically used to determine whether the communication has timed out. When a frame of data is received, the timer will be cleared. If no new data frame is received, the timer will not be cleared. If the maximum time set for communication is exceeded, the timer will issue a communication timeout alarm. When the system detects a communication timeout alarm, it will erase the data in the corresponding program backup area and enter the jump mode.
[0123] Furthermore, the Bootloader program will first disassemble each frame of data sent by the host computer into a packet header, a data frame number, program data, program data length, and a CRC check value. The packet header can be used to determine whether the frame data is a data frame. If it is a data frame, the program data in the frame data is decrypted according to the decryption protocol to obtain the original program data before encryption.
[0124] Step 404, if it is to upgrade the App program, the host computer sends the new App program to the Bootloader program through the communication interface according to the communication protocol, and then decodes and verifies each frame of data. If the decoding and verification are successful, each frame of data is stored in the App backup area in a certain order, and the host computer is replied that the frame of data is normal, otherwise the host computer is replied that the frame of data is abnormal and requests to resend the data. If the number of failures of a frame of data reaches a certain value, the host computer is replied that the upgrade has failed.
[0125] The specific processing process is as follows: first, the Bootloader program disassembles each received data packet and decomposes it into a packet header, data frame number, program data, program data length, and CRC check value; then the disassembled program data is decrypted according to the encryption and decryption protocol to obtain the original program data, and the decrypted program data (original program data) is CRC calculated and compared with the CRC check value in the disassembled packet to determine whether the data transmission of this frame is correct.
[0126] Furthermore, decoding is to decrypt the disassembled program data according to the encryption and decryption protocol to obtain the original program data before encryption. Verification is to perform CRC calculation on the decoded program data (original program data) and compare it with the CRC check value in the disassembled package to determine whether the data transmission of this frame is correct.
[0127] Furthermore, each frame of data is stored in the App backup area in a certain order, including: each data packet is divided into a packet header, a data frame number, program data, program data length, and a CRC check value. The data frame number can be used to determine which position of the data in the program is located, so that the storage position of this frame of data in the Flash can be obtained. For example: if the data frame number in the data packet is 10, it should be the tenth frame of data in the program. If the decryption verification is successful, it will be stored in the location where the tenth frame of the App program should be stored in the Flash.
[0128] Step 405, when all the data of the new App program is sent, all the data in the App backup area is verified. If the verification fails, the program in the App backup area is marked as abnormal and the host computer is informed that the upgrade has failed. If the verification succeeds, the next step is entered, that is, the program in the App backup area is copied to the App area.
[0129] Furthermore, the completion of sending all data of the new App program means that the host computer will send a frame of end frame data after sending all data. When the Bootloader program receives the end frame data, it means that all data of the program has been sent. The end frame data packet contains the CRC check value of the entire program and the size of the entire program.
[0130] Furthermore, verifying all data in the App backup area includes: calculating the App backup area program CRC check value based on the size of the program in the end frame, and comparing it with the original program CRC check value in the end frame. If they are the same, the verification is successful, otherwise the verification fails.
[0131] Step 406: After the copying is completed, the copied App area data is verified. If the verification passes, the jump mode is entered and all the data in the App backup area is erased. If the verification fails, the App backup area program is copied to the App area again. If the verification still fails after a certain number of operations, the App area program is marked as incomplete and a reply is given to the host computer indicating that the upgrade failed and the App area program is abnormal.
[0132] Furthermore, verifying the copied App area data includes: comparing the value after CRC calculation of the copied App area data with the value after CRC calculation of the App backup area data, if they are the same, the verification passes, otherwise the verification fails.
[0133] Step 407, if the Bootloader program is upgraded, the new Bootloader program is sent to the program through the communication interface according to the communication protocol, and then each frame of data is decoded and verified. After the decoding and verification are successful, each frame of data is stored in the Bootloader backup area in a certain order, and the host computer is replied that the frame of data is normal, otherwise the host computer is replied that the frame of data is abnormal and the data is requested to be resent. If the number of failures of a frame of data reaches a certain value, the host computer is replied that the upgrade has failed.
[0134] Step 408: After all data of the new Bootloader program is sent, all data in the Bootloader backup area are verified. If the verification fails, all data in the Bootloader backup area are erased and the host computer is notified that the upgrade has failed. If the verification succeeds, the jump mode is entered.
[0135] Step 409: After entering the jump mode, jump to the App program, and the App program starts to execute.
[0136] The following combination Figure 5 , taking the application of the remote upgrade App program operation flow chart provided in this application as an example, it specifically includes:
[0137] Step 501: After the App is successfully initialized, first determine whether the Bootloader program needs to be upgraded.
[0138] Specifically, whether the bootloader backup area needs to be upgraded is determined by determining whether there is data. If there is data, it means that the upgrade is needed, and if there is no data, it means that the upgrade is not needed.
[0139] Step 502: If the Bootloader program needs to be upgraded, copy the Bootloader backup area program to the Bootloader area. After the copy is completed, verify the copied Bootloader area data. If the verification passes, erase all the data in the Bootloader backup area and send a successful upgrade message to the host computer and start executing normal tasks in the App program. If the first verification fails, copy the Bootloader backup area program to the Bootloader area again. If the verification still fails after a certain number of operations, mark the Bootloader area program as incomplete and reply to the host computer that the upgrade failed and the Bootloader area program is abnormal.
[0140] Step 503: If the Bootloader program does not need to be upgraded, normal tasks in the App program begin to be executed.
[0141] Step 504: If an upgrade instruction is received while the App is running normally, first determine the state in which the App is running. If the upgrade is not allowed, reply to the host computer to temporarily not allow the upgrade operation and terminate the upgrade; if the upgrade is allowed, turn off the relevant peripherals and interrupts and perform a reset operation, and then enter the Bootloader program to perform the upgrade operation.
[0142] The BMS program remote upgrade solution provided in the embodiment of the present application can realize the remote upgrade of the BMS App program and Bootloader program, improve the maintenance efficiency and reliability of the system, and ensure the security of the upgrade process and the integrity of the data.
[0143] This application also provides an embodiment of a BMS program remote upgrade device, Figure 2 A schematic diagram of the structure of a BMS program remote upgrade device provided by an embodiment of the present application is shown. Figure 2 As shown, the device comprises:
[0144] The judgment module 201 is configured to determine whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction after receiving the upgrade instruction containing the upgrade identifier sent by the host computer through the wireless network;
[0145] The App program upgrade module 202 is configured to store the new App program data for App program upgrade sent by the host computer through the wireless network into the App backup area when it is determined that the App program is to be upgraded, and after erasing the original App program data in the App area, copy the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program;
[0146] The Bootloader program upgrade module 203 is configured to, when it is determined that the Bootloader program is to be upgraded, cause the Bootloader program to store the new Bootloader program data for Bootloader program upgrade sent by the host computer via the wireless network into the Bootloader backup area, and then jump to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area, so as to complete the remote upgrade operation of the Bootloader program.
[0147] The BMS program remote upgrade solution provided in the embodiment of the present application can realize the remote upgrade of the BMS App program and Bootloader program, improve the maintenance efficiency and reliability of the system, and ensure the security of the upgrade process and the integrity of the data.
[0148] The above is a schematic scheme of a BMS program remote upgrade device of this embodiment. It should be noted that the technical scheme of the BMS program remote upgrade device and the technical scheme of the BMS program remote upgrade method described above belong to the same concept, and the details not described in detail in the technical scheme of the BMS program remote upgrade device can be found in the description of the technical scheme of the BMS program remote upgrade method described above.
[0149] Figure 6 The block diagram of a computing device 400 according to an embodiment of the present application is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
[0150] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0151] In one embodiment of the present application, the above components of the computing device 400 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0152] Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.
[0153] The processor 420 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned BMS program remote upgrade method.
[0154] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned BMS program remote upgrade method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned BMS program remote upgrade method.
[0155] An embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned BMS program remote upgrade method.
[0156] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned BMS program remote upgrade method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned BMS program remote upgrade method.
[0157] An embodiment of the present application further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned BMS program remote upgrade method.
[0158] The above is a schematic scheme of a computer program of this embodiment. It should be noted that the technical scheme of the computer program and the technical scheme of the BMS program remote upgrade method described above are of the same concept, and the details not described in detail in the technical scheme of the computer program can be found in the description of the technical scheme of the BMS program remote upgrade method described above.
[0159] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0160] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0161] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present application.
[0162] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0163] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. A BMS program remote upgrade method, characterized in that: include: After the Bootloader program in the battery management system BMS receives the upgrade instruction containing the upgrade identifier sent by the host computer through the wireless network, it determines whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction; When it is determined that the App program is to be upgraded, the Bootloader program stores the new App program data for the App program upgrade sent by the host computer through the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program; When it is determined that the Bootloader program is to be upgraded, the Bootloader program stores the new Bootloader program data for upgrading the Bootloader program sent by the host computer via the wireless network into the Bootloader backup area, and then jumps to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program.
2. The method according to claim 1, characterized in that Also includes: Get the storage space of the Flash memory in the BMS; According to the storage space of the Flash memory in the BMS, the space occupied by the App program and the space occupied by the Bootloader program, the storage space of the Flash memory is divided into four partitions; Wherein, the four partitions include: App area for storing BMS App program data; App backup area for storing new App program data for BMS App program upgrade; Bootloader area for storing BMS Bootloader program data; and Bootloader backup area for storing new Bootloader program data for BMS Bootloader program upgrade.
3. The method according to claim 1 or 2, characterized in that: Also includes: The host computer obtains a new App program data packet, and obtains multiple frames of new App program data by segmenting the new App program data packet, and configures a packet header for identifying an App program upgrade data frame for each frame of new App program data; The host computer determines the data frame number of each frame of new App program data according to the position information of each frame of new App program data in the new App program data packet; The host computer encrypts each frame of new App program data according to the encryption protocol to obtain encrypted new App program data; The host computer calculates the CRC check value and program data length of each frame of new App program data; The host computer packages the packet header, data frame number, encrypted new App program data, CRC check value and program data length of each frame of new App program data to obtain each complete new App program data frame, and sends each complete new App program data frame to the Bootloader program in sequence through the wireless network.
4. The method according to claim 1 or 2, characterized in that: Also includes: The host computer obtains a new Bootloader program data packet, and obtains multiple frames of new Bootloader program data by segmenting the new Bootloader program data packet, and configures a packet header for identifying a Bootloader program upgrade data frame for each frame of new Bootloader program data; The host computer determines the data frame number of each frame of new Bootloader program data according to the position information of each frame of new Bootloader program data in the new Bootloader program data packet; The host computer encrypts each frame of new Bootloader program data according to the encryption protocol to obtain encrypted new Bootloader program data; The host computer calculates the CRC check value and program data length of each frame of new Bootloader program data; The host computer packages the packet header, data frame number, encrypted new Bootloader program data, CRC check value and program data length of each frame of new Bootloader program data to obtain each complete new Bootloader program data frame, and sends each complete new Bootloader program data frame to the Bootloader program in sequence through the wireless network.
5. The method according to claim 3, characterized in that: The Bootloader program stores the new App program data for App program upgrade sent by the host computer through the wireless network into the App backup area, and after erasing the original App program data in the App area, copies the new App program data in the App backup area to the App area to complete the App program remote upgrade operation, including: After receiving each complete frame of new App program data frame sent by the host computer through the wireless network, the Bootloader program parses and verifies each complete frame of new App program data frame, and after each complete frame of new App program data frame passes the verification, stores the verified new App program data frame in the App backup area in a certain order; After the Bootloader program stores all new App program data frames in the App backup area, all new App program data frames in the App backup area are verified, and after the verification passes, the original App program data in the App area is erased, and all new App program data frames in the App backup area are copied to the App area; The Bootloader program verifies all new App program data frames in the copied App area again, and after the verification passes, erases all data in the App backup area and enters the jump mode to complete the remote upgrade operation of the App program.
6. The method according to claim 4, characterized in that After the Bootloader program stores the new Bootloader program for upgrading the Bootloader program sent by the host computer through the wireless network into the Bootloader backup area, it jumps to the App program of the BMS, so that the App program erases the original Bootloader program in the Bootloader area, and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including: After the Bootloader program receives each complete new Bootloader program data frame sent by the host computer through the wireless network, it parses and verifies each complete new Bootloader program data frame, and after each complete new Bootloader program data frame passes the verification, stores the verified new Bootloader program data frame in the Bootloader backup area in a certain order; After the Bootloader program stores all new Bootloader program data frames into the Bootloader backup area, it jumps to the BMS App program; After the App program is successfully initialized, determine whether the Bootloader program needs to be upgraded; When it is determined that the Bootloader program needs to be upgraded, the App program erases the original Bootloader program in the Bootloader area, and then copies the new Bootloader program in the Bootloader backup area to the Bootloader area to complete the remote upgrade operation of the Bootloader program; When it is determined that the Bootloader program does not need to be upgraded, the App program executes normal tasks in the App program.
7. The method according to claim 6, characterized in that After the App program erases the original Bootloader program in the Bootloader area, the new Bootloader program in the Bootloader backup area is copied to the Bootloader area to complete the remote upgrade operation of the Bootloader program, including: The App program verifies all new Bootloader program data frames in the Bootloader backup area, and after the verification passes, erases the original Bootloader program data in the Bootloader area, and copies all new Bootloader program data frames in the Bootloader backup area to the Bootloader area; The App program verifies all new Bootloader program data frames in the copied Bootloader area again, and after the verification passes, erases all the data in the Bootloader backup area and enters the jump mode to complete the remote upgrade operation of the Bootloader program.
8. A BMS program remote upgrade device, characterized in that: include: The judgment module is configured to determine whether to upgrade the App program or the Bootloader program according to the upgrade identifier in the upgrade instruction after receiving the upgrade instruction containing the upgrade identifier sent by the host computer through the wireless network; The App program upgrade module is configured to store the new App program data for App program upgrade sent by the host computer through the wireless network into the App backup area when it is determined that the App program is to be upgraded, and after erasing the original App program data in the App area, copy the new App program data in the App backup area to the App area to complete the remote upgrade operation of the App program; The Bootloader program upgrade module is configured to, when it is determined that the Bootloader program is to be upgraded, cause the Bootloader program to store the new Bootloader program data for Bootloader program upgrade sent by the host computer via the wireless network into the Bootloader backup area, and then jump to the App program of the BMS, so that the App program erases the original Bootloader program data in the Bootloader area, and then copies the new Bootloader program data in the Bootloader backup area to the Bootloader area, so as to complete the remote upgrade operation of the Bootloader program.
9. A computing device comprising: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the BMS program remote upgrade method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the BMS program remote upgrade method according to any one of claims 1 to 7.
Citation Information
Cited By
Boot and App upgrading method of electronic equipment, electronic equipment and storage medium
CN120780334A