Software upgrading method and device, energy storage equipment and storage medium

By receiving and verifying the program blocks sent by the user in the chip of the energy storage device, the correctness of the upgrade of the energy storage system software is ensured, and the problem of transmission and write errors during the upgrade of the energy storage device is solved, and the system security is improved Sex and stability.

CN119225774APending Publication Date: 2024-12-31SHENZHEN HELLO TECH STORED ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411096572.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In the home energy storage system, transmission errors or write errors are prone to occur during the upgrade of the energy storage equipment software, resulting in chip damage and thus affecting the normal operation of the system.

Method used

By receiving multiple program blocks sent by the user on the chip of the energy storage device, and verifying each program block, it is only written to the fixed storage area after the verification is passed. , thereby ensuring transmission correctness and avoiding operational errors.

Benefits of technology

It improves the safety and upgrade success rate of the energy storage system, avoids the possibility of chip damage, and ensures the accuracy of software upgrades and the stable operation of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225774A_ABST
    Figure CN119225774A_ABST
Patent Text Reader

Abstract

The invention discloses a software upgrading method and device, energy storage equipment and a storage medium, and relates to the technical field of electronics, and the method comprises a program block receiving step, a program block verification step, a program block receiving ending judgment step and a program upgrading step. The method comprises the following steps: receiving a plurality of program blocks which are sent by a user side and are split based on a first upgrading program, checking each program block, and writing the program blocks which pass the checking into a fixed storage area only after the program blocks pass the checking; therefore, the transmission correctness of transmitting the first upgrading program for upgrading from the user side to the chip of the energy storage equipment is ensured, the possibility of chip damage caused by running a wrong upgrading program is avoided, and the safety of an energy storage system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and more specifically, to a software upgrading method, apparatus, energy storage device and computer-readable storage medium. Background Art

[0002] With the development of home energy storage systems, due to the different requirements of different households for energy storage backup power, photovoltaic power generation and economy, home energy storage products often adopt modular design for parallel expansion, and mount communication devices of multiple energy storage devices on the communication bus of the energy storage system. As a result, when the software of the energy storage device is upgraded, if the upgrade process of one of the energy storage devices fails, it may cause abnormalities or damage to other energy storage devices, seriously affecting the normal operation of the energy storage system. Summary of the invention

[0003] The present application proposes a software upgrade method, apparatus, energy storage device and storage medium to improve the above-mentioned defects.

[0004] In a first aspect, an embodiment of the present application provides a software upgrade method, which is applied to an energy storage device, wherein the chip of the energy storage device includes a random storage area and a fixed storage area, and the method includes: a program block receiving step: receiving a current program block sent by a user end, and storing the current program block in the random storage area; the current program block is one of multiple program blocks split based on a first upgrade program; a program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; a program block reception end judgment step: judging whether the current program block is the last one of the multiple program blocks, if the current program block is not the last one of the multiple program blocks, continuing to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks; a program upgrade step: if the current program block is the last one of the multiple program blocks, combining the multiple program blocks written into the fixed storage area into a second upgrade program, and upgrading the original program stored in the fixed storage area according to the second upgrade program.

[0005] In a second aspect, an embodiment of the present application further provides a software upgrade device, which is applied to an energy storage device, wherein the chip of the energy storage device includes a random storage area and a fixed storage area, and the device includes: a receiving module, which is used to execute a program block receiving step: receiving a current program block sent by a user end, and storing the current program block in the random storage area; the current program block is one of multiple program blocks split based on a first upgrade program; a verification module, which is used to execute a program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; a loop module, which is used to execute a program block reception end judgment step: judging whether the current program block is the last one of the multiple program blocks, if the current program block is not the last one of the multiple program blocks, continuing to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks; an upgrade module, which is used to execute a program upgrade step: if the current program block is the last one of the multiple program blocks, then combining the multiple program blocks written into the fixed storage area into a second upgrade program, and upgrading the original program stored in the fixed storage area according to the second upgrade program.

[0006] In a third aspect, an embodiment of the present application further provides an energy storage device, comprising: one or more chips; one or more applications, wherein the one or more applications are stored in the chip and configured to be executed by the one or more chips, and the one or more applications are configured to execute the method as described above.

[0007] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the above method.

[0008] Therefore, the present application provides a software upgrade method, device, energy storage device and storage medium, the method is applied to the energy storage device, and includes: a program block receiving step: receiving the current program block sent by the user end, and storing the current program block in a random storage area, the current program block is one of the multiple program blocks split based on the first upgrade program; a program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; a program block reception end judgment step: judging whether the current program block is the last one of the multiple program blocks, if the current program block is not the last one of the multiple program blocks, continuing to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks; a program upgrade step: if the current program block is the last one of the multiple program blocks, combining the multiple program blocks written into the fixed storage area into a second upgrade program, and upgrading the original program stored in the fixed storage area according to the second upgrade program. The present application receives multiple program blocks split based on a first upgrade program sent by a user end during a software upgrade of a chip of an energy storage device, verifies each program block, and writes the verified program blocks into a fixed storage area only after the program blocks have passed the verification, thereby ensuring the correctness of the transmission of the first upgrade program for upgrading from the user end to the chip of the energy storage device, avoiding the possibility of chip damage due to running an erroneous upgrade program, and improving the safety of the energy storage system.

[0009] Other features and advantages of the embodiments of the present application will be described in the subsequent description, and partly become apparent from the description, or can be understood by practicing the embodiments of the present application. The purposes and other advantages of the embodiments of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0011] Figure 1 A flow chart of a software upgrade method proposed in an embodiment of the present application is shown.

[0012] Figure 2 A flow chart of another software upgrade method proposed in an embodiment of the present application is shown.

[0013] Figure 3 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown.

[0014] Figure 4 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown.

[0015] Figure 5 A structural block diagram of an energy storage system proposed in one embodiment of the present application is shown.

[0016] Figure 6 A structural block diagram of a software upgrading device proposed in an embodiment of the present application is shown.

[0017] Figure 7 A structural block diagram of a computer-readable storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0018] In order to make those skilled in the art better understand the present application scheme, the technical scheme in the present application embodiment will be clearly and completely described below in conjunction with the drawings in the present application embodiment. Obviously, the described embodiment is only a part of the present application embodiment, rather than all the embodiments. The components of the present application embodiment usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the present application for protection, but merely represents the selected embodiment of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0019] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0020] In multi-machine parallel energy storage systems, the Controller Area Network (CAN) is often used to achieve communication between devices. It is used for data monitoring and management, control and scheduling, fault diagnosis and protection, communication and coordination, system monitoring and remote management, data transmission and signal synchronization. It is an excellent bus solution with high real-time performance and anti-interference.

[0021] Generally, energy storage devices use chips such as microcontroller units (MCUs) to control or execute specific tasks. When upgrading the software program stored in the MCU, it is necessary to obtain the upgrade program from the manufacturer and burn it into the storage module of the MCU. Therefore, for traditional burning, file corruption may occur in the process of transferring the upgrade program from the manufacturer to the user, transmission errors may occur in the process of transmitting the upgrade program to the MCU device via CAN bus communication, and writing errors may occur in the process of writing the upgrade program into the storage area of ​​the MCU. Problems in any process may cause damage to the MCU chip and further damage to the device. If the upgrade process of one of the energy storage devices fails, it may cause abnormalities or damage to other energy storage devices, seriously affecting the normal operation of the energy storage system.

[0022] Therefore, please refer to Figure 1 , Figure 1 A flowchart of a software upgrade method proposed in an embodiment of the present application is shown. The method is applied to Figure 5 The energy storage device 500 shown includes one or more chips 501, wherein the chip 501 includes a random access memory (RAM) and a fixed storage area (ROM), and the chip can be a microcontroller unit (MCU) or a system on chip (SOC), etc. In the present application, the energy storage device is applied to a control management system in a power system, such as an energy management system (EMS), etc. Specifically, the method includes the following steps:

[0023] S110: Program block receiving step: receiving a current program block sent by a user terminal, and storing the current program block in the random storage area, wherein the current program block is one of a plurality of program blocks split out based on the first upgrade program.

[0024] In this embodiment, the first upgrade program corresponds to the original program stored in the fixed storage area of ​​the chip, and is used to upgrade the original program. As an implementation method, the user end may refer to a host computer (Supervisory Control and Data Acquisition System, SCADA) system connected to the energy storage device, and further, the chip of the energy storage device communicates with the user end via a CAN bus. Specifically, the chip receives the current program block sent by the user end, wherein the current program block is one of the multiple program blocks split by the user end according to the first upgrade program.

[0025] As an implementation method, the current program block can be a program block selected in sequence from multiple program blocks split out by the user end according to the first upgrade program. Furthermore, after the multiple program blocks are split out, the multiple program blocks can be sorted according to the splitting order to select the current program block according to the splitting order, so as to combine the multiple program blocks stored in the chip into a second upgrade program in the subsequent program upgrade step.

[0026] As an implementation method, a burning program Bootloader is stored in the chip. After the chip receives the upgrade command sent by the user end, the burning program is run to receive the current program block sent by the user end. Furthermore, the burning program is also used to write the received current program block into a random storage area, and in a subsequent step, the current program block that has passed the verification is written from the random storage area to the fixed storage area.

[0027] S120: Program block verification step: verifying the current program block, and if the verification passes, writing the current program block from the random storage area to the fixed storage area.

[0028] In this embodiment, after the chip stores the current program block in the random storage area of ​​the chip, the current program block in the random storage area will be verified. It should be understood that the purpose of verifying the current program block is to verify whether the current program block after being written into the random storage area is consistent with the current program block sent to the chip by the user end. Therefore, as an implementation method, the way to verify the current program block can be: perform consistency check on the current program block sent by the user end and the current program block in the random storage area of ​​the chip.

[0029] As an implementation method, the specific steps for verifying the current program block may be: obtaining a first verification code generated by the user end based on the current program block through preset rules, and then generating a second verification code through preset rules based on the current program block stored in the random storage area; if the first verification code and the second verification code are consistent, it is considered that the current program block has passed the verification.

[0030] Specifically, after the user end receives the first upgrade program from the manufacturer, it will split the first upgrade program into multiple program blocks, and generate a first check code based on each program block according to preset rules. Exemplarily, the first check code can be a cyclic redundancy check (CRC) check code, and the preset rule can be a rule for generating a CRC check code. For example, the preset rule refers to a generating polynomial G(x) agreed upon by the user end and the chip end. Commonly used generating polynomials include CRC-16, CRC-CCITT, CRC-32, etc. Therefore, the user end first obtains a long string of binary numbers corresponding to each program block, and then divides it by G(x). The remainder obtained is the redundant code R(x), and the redundant code R(x) is used as the first check code of the program block, attached to the corresponding program block to form a new frame of data, and then sent to the chip.

[0031] Specifically, the second check code is also a CRC check code. Similarly, the preset rule is also a rule for generating a CRC check code, that is, the generating polynomial G(x) agreed upon by the user terminal and the chip. The specific implementation method can refer to the above-mentioned related description. The difference is that the chip generates the corresponding CRC check code, that is, the second check code, based on the current program block stored in the random storage area, and the chip and the user terminal will use the same generating polynomial G(x) to generate the second check code and the first check code.

[0032] Specifically, the chip compares the second verification code with the first verification code. If the first verification code is consistent with the second verification code, it means that the current program block written by the chip to the random storage area is consistent with the current program block sent by the user end, that is, there is no error in the current program block during transmission from the user end to the chip. In this way, the chip writes the current program block that has passed the verification in the random storage area to the fixed storage area, which can avoid the problem of incorrect program block content due to transmission errors that may occur during the transmission process, thereby avoiding upgrade failures caused by program errors.

[0033] As an implementation method, if the first verification code is inconsistent with the second verification code, the chip returns information to the user end so that the user end resends the same current program block and its corresponding first verification code to the chip, and repeats the program block verification step until the verification of the current program block passes, and then the current program block is written into the fixed storage area.

[0034] S130: Program block receiving completion judgment step: judge whether the current program block is the last one of the multiple program blocks. If the current program block is not the last one of the multiple program blocks, continue to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks.

[0035] In this embodiment, after the chip writes the current program block into the fixed storage area, it determines whether the current program block is the last one of multiple program blocks split based on the first upgrade program. If the current program block is not the last one of the multiple program blocks, the program block receiving step and the program block verification step are continued for the next program block until the next program block is the last one of the multiple program blocks.

[0036] As an implementation method, the current program block can be a program block selected by the user terminal from multiple program blocks according to the splitting order. That is to say, the user terminal can determine whether the current program block is the last one of the multiple program blocks according to the splitting order. Therefore, the chip can obtain feedback from the user terminal whether the current program block is the last one. Furthermore, the user terminal can continue to select the next program block in sequence and send the next program block to the chip, so that the chip continues to execute the program block receiving step and the program block verification step for the next program block. It can be understood that the next program block can be regarded as the current program block during the process of executing the program block receiving step and the program block verification step. As an implementation method, the current program block can also be a program block arbitrarily selected by the user end from multiple program blocks. Then, the user end can filter out the program blocks that have been sent to the chip and the program blocks that have not been sent to the chip from the multiple program blocks, and determine whether the current program block is the last program block among the program blocks that have not been sent to the chip. If not, continue to select the next program block from the program blocks that have not been sent to the chip and send it to the chip. Thus, the chip can obtain feedback from the user end as to whether the current program block is the last one, and receive the next program block to continue to execute the program block receiving step and the program block verification step. It can be understood that the next program block can be regarded as the current program block during the process of executing the program block receiving step and the program block verification step.

[0037] In this embodiment, after writing the current program block into a fixed storage area and determining that the current program block is not the last one of multiple program blocks, the next program block continues to be received and returns to execute the program block receiving step and the program block verification step until all the program blocks sent by the user end are received. In other words, until all the program blocks split based on the first upgrade program are received, each program block passes the consistency check, thereby ensuring the transmission correctness of each program block in the process of transmitting it from the user end to the chip.

[0038] S140: Program upgrade step: if the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the original program stored in the fixed storage area is upgraded according to the second upgrade program.

[0039] As an implementation method, multiple program blocks in the fixed storage area can be combined into a second upgrade program according to the distribution order of each program block in the first upgrade program. Specifically, the multiple program blocks written into the fixed storage area can be integrated and organized by management tools such as a code editor or an integrated development environment to obtain the second upgrade program. It can be understood that each program block written into the fixed storage area corresponds to a program block sent by the user end, so the combined second upgrade program should also be consistent with the first upgrade program, that is, the accurate writing of the first upgrade program from the user end to the chip is realized.

[0040] As an implementation method, the original program stored in the fixed storage area can be replaced based on the second upgrade program to achieve program upgrade. When the energy storage device needs to use the functions corresponding to the original program during subsequent operation, the second upgrade program can be directly run.

[0041] In this embodiment, based on the above analysis, it can be known that by ensuring the transmission correctness of each program block from the user end to the chip, that is, ensuring the correctness of the program content of the second upgrade program obtained after the first upgrade program is written into the chip, the possibility of damaging the fixed storage area of ​​the chip due to running the wrong program is avoided, thereby ensuring the upgrade success rate and improving the system security.

[0042] Therefore, a software upgrade method provided in an embodiment of the present application is applied to an energy storage device, including: a program block receiving step: receiving a current program block sent by a user end, and storing the current program block in a random storage area, the current program block being one of multiple program blocks split out based on a first upgrade program; a program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; a program block reception end judgment step: judging whether the current program block is the last one of multiple program blocks, if the current program block is not the last one of multiple program blocks, continuing to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of multiple program blocks; a program upgrade step: if the current program block is the last one of multiple program blocks, combining the multiple program blocks written into the fixed storage area into a second upgrade program, and upgrading the original program stored in the fixed storage area according to the second upgrade program. The present application receives multiple program blocks split based on a first upgrade program sent by a user end during a software upgrade of a chip of an energy storage device, verifies each program block, and writes the verified program blocks into a fixed storage area only after the program blocks have passed the verification, thereby ensuring the correctness of the transmission of the first upgrade program for upgrading from the user end to the chip of the energy storage device, avoiding the possibility of chip damage due to running an erroneous upgrade program, and improving the safety of the energy storage system.

[0043] See also Figure 2 , Figure 2 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown. The method is applied to Figure 5 The energy storage device 500 shown includes one or more chips 501, wherein the chip 501 includes a random access memory area RAM and a fixed memory area ROM. Specifically, the method includes the following steps:

[0044] S210: Program block receiving step: receiving a current program block sent by the user terminal, and storing the current program block in the random storage area, wherein the current program block is one of a plurality of program blocks split out based on a first upgrade program, wherein the first upgrade program is received from a server based on the user terminal and verified at the user terminal.

[0045] Specifically, some implementation methods may refer to the specific implementation method of step S110 in the above embodiment. In this embodiment, the first upgrade program is received from the server based on the user terminal, and the first upgrade program is verified and passed at the user terminal.

[0046] As an implementation method, when the original program stored in the chip needs to be updated, the relevant first upgrade program is generally provided by the relevant software or hardware manufacturer, so that when the user terminal receives the push information sent by the manufacturer, it can download the first upgrade program from the server and write it to the internal storage system for use in the subsequent update process. Exemplarily, the user terminal can obtain the first upgrade program from the server through a communication method such as the Internet, email, or web page connection.

[0047] As an implementation method, the user terminal can perform a verification operation based on the first upgrade program file downloaded to the user terminal and the first upgrade program received by the user terminal from the server to verify the consistency of the downloaded first upgrade program and the received first upgrade program, so as to ensure that no error occurs in the process of pushing and downloading the first upgrade program. Further, when the downloaded first upgrade program is consistent with the received first upgrade program, it is considered that the first upgrade program has passed the verification. At this time, the user terminal sends a burning instruction to the chip to make the chip enter the burning state, so that the chip can receive the current program block split based on the first upgrade program sent by the user terminal and execute the program block receiving step and its subsequent steps; if the downloaded first upgrade program is inconsistent with the received first upgrade program, it is considered that the first upgrade program has failed the verification. At this time, the user terminal can re-execute the steps of receiving and downloading the first upgrade program until the first upgrade program is downloaded and the verification is successful. It can be understood that by making the first upgrade program be downloaded to the user terminal, a download consistency check is performed to ensure that there is no push error in the first upgrade program during the push process from the manufacturer to the user side through the server, the correctness of the first upgrade program downloaded to the user terminal is guaranteed, and the security of the software upgrade process is improved.

[0048] S220: Program block verification step: verifying the current program block, and if the verification passes, writing the current program block from the random storage area to the fixed storage area.

[0049] S230: Program block receiving completion judgment step: judge whether the current program block is the last one of the multiple program blocks. If the current program block is not the last one of the multiple program blocks, continue to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks.

[0050] The specific implementation of steps S220 - S230 may refer to the specific implementation of steps S120 - S130 in the above embodiment, which will not be described in detail here.

[0051] S240: Program upgrade step: If the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the consistency of the second upgrade program and the first upgrade program is verified. If the second upgrade program and the first upgrade program are verified to be consistent, the second upgrade program is run.

[0052] Specifically, some implementation methods may refer to the specific implementation method of step S140 of the above embodiment. In this embodiment, after obtaining the second upgrade program, the consistency of the second upgrade program and the first upgrade program is further verified, so that the second upgrade program is run when the second upgrade program and the first upgrade program are verified to be consistent. It should be understood that the process of upgrading the original program based on the second upgrade program is actually the process of replacing the original program with the second upgrade program. That is to say, after all program blocks are written into the fixed storage area and combined into the second upgrade program, the upgrade process can be regarded as completed. When the energy storage device needs to use the functions corresponding to the original program in the subsequent operation process, the second upgrade program can be directly run.

[0053] Therefore, the second upgrade program is verified, that is, the consistency of the second upgrade program and the first upgrade program is verified, and also to verify whether the second upgrade program written in the fixed storage area is consistent with the first upgrade program sent by the user end. If the second upgrade program and the first upgrade program are verified to be consistent, it means that the upgrade program written in the fixed storage area of ​​the chip is consistent with the upgrade program received by the chip from the user end, that is, there is no error in the software upgrade process of the chip, and the upgraded program can run normally.

[0054] As an implementation method, the consistency of the second upgrade program with the first upgrade program can be verified by obtaining a third verification code generated by the user end based on the first upgrade program according to a preset rule, and then comparing the third verification code with the fourth verification code generated according to the second upgrade program according to the preset rule. Specifically, the third verification code and the fourth verification code are both CRC verification codes. Further, the preset rule is also a rule for generating a CRC verification code, that is, the generating polynomial G(x) agreed upon by the user end and the chip end. The specific implementation method can refer to the relevant description in step S120. The difference is that the third verification code is generated based on the user end according to the first upgrade program in the user end, and the fourth verification code is generated by the chip based on the first upgrade program written in the fixed storage area. Exemplarily, the third verification code can be sent by the user end to the chip for verification in the chip, and after the chip generates the fourth verification code based on the second upgrade program, the fourth verification code can be written at the end of the file of the second upgrade program so that it can be directly read and used when the second upgrade program is subsequently verified.

[0055] Specifically, if the third check code and the fourth check code are consistent, it is considered that the second upgrade program and the first upgrade program are consistent in verification, that is, there is no error in the upgrade process, and the upgraded version program, that is, the second upgrade program can run normally. Therefore, when the third check code and the fourth check code are consistent, the second upgrade program can be run. Specifically, if the third check code and the fourth check code are inconsistent, it is considered that the second upgrade program and the first upgrade program are inconsistent in verification, that is, it indicates that there is an error in the software upgrade process. At this time, the chip issues an alarm and does not run the second upgrade program to avoid damaging the fixed storage area during the upgrade process.

[0056] As an implementation method, the method for verifying the consistency of the second upgrade program with the first upgrade program can also be: in the process of writing multiple program blocks from the random storage area to the fixed storage area in the order in which the chip receives them from the user end, a corresponding CRC check code is regenerated for each written program block, and the CRC check code corresponding to the previous program block is saved, so that when the next program block is written and a CRC check code is generated for the next program block, the CRC check code corresponding to the previous program block is used as the initial value used when generating the CRC check code corresponding to the next program block, to continue to generate the CRC check code corresponding to the next program block, that is, the CRC check code generated by the next program block will include the CRC check information of the previous program block, and so on, until all program blocks are received. According to the above analysis, when generating the corresponding CRC check code for the last program block among multiple program blocks, since the initial value used includes the CRC check information of all previous program blocks, the CRC check code of the last program block written to the fixed storage area can reflect the CRC check information of all program blocks, and can be used to verify the second upgrade program. It can be understood that the method of using the CRC check code of the last program block written to the fixed storage area as the CRC check code of the second upgrade program to verify the second upgrade program saves the response time occupied by re-reading the entire program for CRC verification for the upgrade process using a large upgrade program, avoids the communication timeout caused by too long response time and the download failure judged by the user end, and improves the user experience.

[0057] Therefore, a software upgrade method provided in an embodiment of the present application is applied to an energy storage device. The method obtains all program blocks for upgrading from the user end on the chip and obtains a complete second upgrade program based on the program blocks. Then, the second upgrade program is verified with the first program file sent by the user end. Only when the verification passes, it means that the second upgrade program is consistent with the first program file, and the first program file is also verified on the user end. This ensures that the user end has downloaded the correct first program file, and checks possible errors during the entire upgrade process to ensure that the upgraded program can run normally before running the second upgrade program, thereby improving system security.

[0058] See also Figure 3 , Figure 3 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown. The method is applied to Figure 5 The energy storage device 500 shown includes one or more chips 501, wherein the chip 501 includes a random access memory area RAM and a fixed memory area ROM. Specifically, the method includes the following steps:

[0059] S310: Program block receiving step: receiving a current program block sent by a user terminal, and storing the current program block in the random storage area, wherein the current program block is one of a plurality of program blocks split out based on the first upgrade program.

[0060] S320: Program block verification step: verify the current program block, and if the verification passes, write the current program block from the random storage area to the fixed storage area.

[0061] S330: Program block reception completion judgment step: judge whether the current program block is the last one of the multiple program blocks. If the current program block is not the last one of the multiple program blocks, continue to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks.

[0062] S340: Program upgrade step: If the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the original program stored in the fixed storage area is upgraded according to the second upgrade program.

[0063] The specific implementation of steps S310 - S340 may refer to the specific implementation of steps S110 - S140 in the above embodiment, which will not be described in detail here.

[0064] S350: After the energy storage device is powered on again, verify the consistency of the second upgrade program with the first upgrade program; if the second upgrade program and the first upgrade program are verified to be consistent, run the second upgrade program; if the second upgrade program and the first upgrade program are verified to be inconsistent, send fixed storage area damage information.

[0065] As an implementation mode, after the software program upgrade is completed, the third verification code generated by the corresponding first upgrade program through preset rules can be stored in a special mark area in the chip storage area, and the fourth verification code generated for the second upgrade program through the preset rules during the upgrade process is attached to the end of the file of the second upgrade program. That is to say, each time the energy storage device is restarted, the chip of the energy storage device can directly read the third verification code corresponding to the first upgrade program and the fourth verification code corresponding to the second upgrade program, so that each time the energy storage device is powered on again, the consistency of the second upgrade program and the first upgrade can be verified again based on the third verification code and the fourth verification code to verify the program integrity of the second upgrade program stored in the chip.

[0066] Specifically, each time the energy storage device is powered on again, the second upgrade program will be run only when the second upgrade program and the first upgrade program are verified to be consistent. If the second upgrade program and the first upgrade program are inconsistent, it means that the second upgrade program stored in the fixed storage area is damaged, that is, it means that the fixed storage area of ​​the chip is damaged. At this time, the fixed storage area damage information is sent out to remind relevant personnel to carry out timely maintenance of the energy storage device, and the energy storage device is not run to avoid operating errors that lead to more serious system failures, thereby ensuring the safety of the energy storage device and the system.

[0067] Therefore, a software upgrade method provided in an embodiment of the present application is applied to an energy storage device. The method performs a consistency check on the second upgrade program and the first upgrade program each time the energy storage device is powered on again after the program upgrade is completed, and only when the second upgrade program and the first upgrade program are verified to be consistent, the second upgrade program will be run. In the case of inconsistency, the program will not be run and an alarm will be issued to the outside, thereby ensuring the safety of the energy storage device and the system.

[0068] See also Figure 4 , Figure 4 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown. The method is applied to Figure 5 The energy storage device 500 shown includes one or more chips 501, wherein the chip 501 includes a random access memory area RAM and a fixed memory area ROM. Specifically, the method includes the following steps:

[0069] S410: Execute a self-check operation, wherein the self-check operation is used to verify whether the chip of the energy storage device and the original program stored in the fixed storage area are intact.

[0070] As an implementation method, the method of performing a self-check operation on the chip of the energy storage device may be: first, the registers, counters and clocks contained in the chip are checked. If the check passes, the random storage area and fixed storage area contained in the chip are checked. If the check passes, the interface contained in the chip end is checked. If and only if all the checks pass, the chip is considered to be in a normal operating state, otherwise it is considered to be in a damaged state.

[0071] As an implementation mode, the original program is a software program originally stored in the chip, and further, is the software to be upgraded corresponding to the first program file. In this embodiment, if the running state of the chip is normal, a program self-check operation is further performed on the original program to confirm whether the original program is intact.

[0072] S420: If the result of the self-check operation is that the chip of the energy storage device or the original program stored in the fixed storage area thereof is not intact, output the result to show that the chip is damaged.

[0073] In this embodiment, if the result of checking the chip is that the chip operating status is damaged, the result of chip damage is output externally so that the staff can quickly locate the damaged chip for repair or replacement to avoid the damaged chip affecting the normal operation of the entire energy storage system.

[0074] As an implementation method, if the result of the program self-check operation on the original program in the chip is that the original program cannot run normally, the chip end outputs the result that the original program cannot run normally, so that the staff can quickly locate the original software to update or revise it, or check whether the fixed storage area of ​​the chip is damaged to avoid affecting the system operation.

[0075] S430: If the result of the self-check operation is that the chip of the energy storage device and the original program stored in the fixed storage area are intact, run the original program or execute the program block receiving step and subsequent steps.

[0076] In this embodiment, if the result of verifying the chip is that the chip operation state is normal, and the result of the program self-check operation on the original program in the chip is that the original program can run normally, then the chip can enter the program running state to run the original program, and in the program running state, the chip end can enter the burning state based on the received burning instruction sent by the user end to execute the program block receiving step and its subsequent steps, so as to subsequently perform the software upgrade process for the original software. It can be understood that by verifying the chip itself and the program self-check operation of the original program, the operation safety of each chip after power-on can be guaranteed, and the safety of the upgrade process can be guaranteed when a software upgrade is required, and the operation safety of the original program can also be guaranteed when a software upgrade is not required.

[0077] Therefore, a software upgrade method provided in an embodiment of the present application is applied to an energy storage device. The method performs a self-check on the chip itself and the original program stored in the chip before starting to burn the upgrade program on the chip side. The upgrade process is entered only after the self-check passes to ensure the correctness of the chip side, thereby greatly reducing the risk of device failure due to chip upgrade or accidental damage to the chip.

[0078] See also Figure 5 , Figure 5 The structure block diagram of an energy storage device 500 proposed in one embodiment of the present application is shown. Specifically, the energy storage device 500 includes one or more chips 501, and further, each chip 501 may include one or more processors and memories.

[0079] Specifically, the processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts within the chip 501, and executes various functions of the chip and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and computer programs; the GPU is responsible for rendering and drawing display content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor, but implemented separately through a communication chip. Specifically, the method described in the above embodiment can be executed by one or more processors.

[0080] The memory may be used to store instructions, programs, codes, code sets or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the following various method embodiments, etc. The data storage area may also store data created by the chip 501 during use, etc.

[0081] In this embodiment, the user end 510 and the chip end 520 communicate via the CAN bus. After receiving the upgrade program file from the manufacturer, the user end 510 performs the first verification of the upgrade program file during the upgrade process. After the upgrade program file is verified, multiple program blocks and their corresponding first verification codes are obtained, and the multiple program blocks and their corresponding first verification codes are sent to the chip end 520 via the CAN bus. Thus, the chip end 520 performs the second verification of each program block during the upgrade process based on the multiple program blocks and the corresponding first verification codes. After each program block is verified, the program block is stored in the fixed storage module. Then, the chip 520 obtains the target upgrade program based on all the program blocks in the fixed storage module to perform the third verification of the upgrade process for the target upgrade program again. After the target upgrade program is verified, the upgrade is confirmed to be completed and the target upgrade program is run. As an implementation method, before receiving the target upgrade program block sent by the user end 510, the chip end 520 also includes a self-test operation on the chip. Only when the chip self-test operation passes, multiple program blocks and their corresponding first verification codes are received via the CAN bus. Therefore, the software upgrade system 500 ensures the correctness of the software upgrade and the safety requirements of program operation by setting up multi-step verification for the user end 510 and the chip end 520 during the software upgrade process.

[0082] See also Figure 6 , Figure 6 The structural block diagram of a software upgrade device 600 proposed in one embodiment of the present application is shown. The software upgrade device 600 is applied to Figure 5 The energy storage device 500 shown includes one or more chips 501, wherein the chip 501 includes a random access memory (RAM) and a fixed storage area (ROM), and the chip can be a microcontroller unit (MCU) or a system on chips (SOC), etc. In the present application, the energy storage device is applied to a control management system in a power system, such as an energy management system (EMS), etc. The device 600 includes:

[0083] The receiving module 601 is used to execute the program block receiving step: receiving the current program block sent by the user end, and storing the current program block in the random storage area, wherein the current program block is one of the multiple program blocks split out based on the first upgrade program.

[0084] The verification module 602 is used to execute a program block verification step: verify the current program block, and write the current program block from the random storage area to the fixed storage area if the verification passes.

[0085] The loop module 603 is used to execute the program block receiving end judgment step: judge whether the current program block is the last one of the multiple program blocks; if the current program block is not the last one of the multiple program blocks, continue to execute the program block receiving step and the program block verification step for the next program block until the next program block is the last one of the multiple program blocks.

[0086] The upgrade module 604 is used to execute the program upgrade step: if the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the original program stored in the fixed storage area is upgraded according to the second upgrade program.

[0087] Optionally, the upgrade module 604 is further used to verify the consistency of the second upgrade program with the first upgrade program; accordingly, when the second upgrade program is verified to be consistent with the first upgrade program, the second upgrade program is run.

[0088] Optionally, the upgrade module 604 is also used to verify the consistency of the second upgrade program with the first upgrade program after the energy storage device is powered on again; if the second upgrade program and the first upgrade program are verified to be consistent, run the second upgrade program; if the second upgrade program and the first upgrade program are verified to be inconsistent, send fixed storage area damage information.

[0089] Optionally, the first upgrade program is received from a server based on the user terminal and verified at the user terminal.

[0090] Optionally, the verification module 602 is also used to obtain a first verification code generated by the user terminal based on the current program block through preset rules; based on the current program block stored in the random storage area, generate a second verification code through the preset rules; if the first verification code and the second verification code are consistent, it is considered that the current program block has passed the verification.

[0091] Optionally, the verification module 602 is also used to obtain a third verification code generated by the user terminal based on the first upgrade program through preset rules; if the third verification code is consistent with the fourth verification code generated according to the second upgrade program through the preset rules, run the second upgrade program; if the third verification code is consistent with the fourth verification code, it is considered that the second upgrade program is consistent with the first upgrade program in verification; if the third verification code is inconsistent with the fourth verification code, it is considered that the second upgrade program is inconsistent with the first upgrade program in verification.

[0092] Optionally, the verification module 602 is also used to perform a self-check operation before the program block receiving step, and the self-check operation is used to verify whether the chip of the energy storage device or the original program stored in the fixed storage area thereof is intact; if the result of the self-check operation is that the chip of the energy storage device or the original program stored in the fixed storage area thereof is not intact, the result is output to show that the chip is damaged; if the result of the self-check operation is that the chip of the energy storage device and the original program stored in the fixed storage area thereof are intact, the original program is run or the program block receiving step and its subsequent steps are executed.

[0093] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0094] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.

[0095] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0096] See also Figure 7 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 700 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0097] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 710 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.

[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A software upgrade method, characterized in that: Applied to an energy storage device, the chip of the energy storage device includes a random storage area and a fixed storage area, and the method includes: A program block receiving step: receiving a current program block sent by a user terminal, and storing the current program block in the random storage area, wherein the current program block is one of a plurality of program blocks split out based on the first upgrade program; Program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; A program block receiving end judgment step: judging whether the current program block is the last one of the multiple program blocks, and if the current program block is not the last one of the multiple program blocks, continuing to perform the program block receiving step and the program block checking step for the next program block until the next program block is the last one of the multiple program blocks; Program upgrade step: if the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the original program stored in the fixed storage area is upgraded according to the second upgrade program.

2. The method according to claim 1, characterized in that Before upgrading the original program stored in the fixed storage area according to the second upgrading program, the method further includes: Verifying the consistency of the second upgrade program with the first upgrade program; Accordingly, the step of upgrading the original program stored in the fixed storage area according to the second upgrading program includes: When the second upgrade program is verified to be consistent with the first upgrade program, the second upgrade program is run.

3. The method according to claim 1, characterized in that After the program upgrade step, the method further includes: After the energy storage device is powered on again, verifying the consistency of the second upgrade program with the first upgrade program; When the second upgrade program and the first upgrade program are verified to be consistent, running the second upgrade program; When the second upgrade program and the first upgrade program are not consistent after verification, fixed storage area damage information is sent.

4. The method according to claim 1, characterized in that The first upgrade program is received from a server based on the user terminal and verified by the user terminal.

5. The method according to claim 1, characterized in that The checking of the current program block includes: Obtaining a first verification code generated by the user terminal according to a preset rule based on the current program block; Based on the current program block stored in the random storage area, generating a second verification code according to the preset rule; If the first verification code is consistent with the second verification code, it is considered that the current program block has passed the verification.

6. The method according to claim 2 or 3, characterized in that: The verifying the consistency of the second upgrade program with the first upgrade program includes: Obtaining a third verification code generated by the user terminal according to a preset rule based on the first upgrade program; Comparing the third verification code with a fourth verification code generated by the preset rule according to the second upgrade program; If the third verification code is consistent with the fourth verification code, it is considered that the second upgrade program is consistent with the first upgrade program; If the third verification code is inconsistent with the fourth verification code, it is considered that the second upgrade program is inconsistent with the first upgrade program.

7. The method according to claim 1, characterized in that Before the program block receiving step, the method further includes: Performing a self-check operation, the self-check operation is used to verify whether the chip of the energy storage device and the original program stored in the fixed storage area thereof are intact; If the result of the self-check operation is that the chip of the energy storage device or the original program stored in the fixed storage area thereof is not intact, outputting the result to show that the chip is damaged; If the result of the self-check operation is that the chip of the energy storage device and the original program stored in the fixed storage area are intact, the original program is run or the program block receiving step and subsequent steps are executed.

8. A software upgrade device, characterized in that: Applied to energy storage equipment, the chip of the energy storage equipment includes a random storage area and a fixed storage area, and the device includes: A receiving module, used to execute a program block receiving step: receiving a current program block sent by a user terminal, and storing the current program block in the random storage area, wherein the current program block is one of a plurality of program blocks split out based on the first upgrade program; A verification module, used for executing a program block verification step: verifying the current program block, and writing the current program block from the random storage area to the fixed storage area if the verification passes; a loop module, configured to execute a program block receiving end judgment step: judging whether the current program block is the last one of the multiple program blocks, and if the current program block is not the last one of the multiple program blocks, continuing to execute the program block receiving step and the program block checking step for a next program block until the next program block is the last one of the multiple program blocks; An upgrade module is used to execute a program upgrade step: if the current program block is the last one of the multiple program blocks, the multiple program blocks written into the fixed storage area are combined into a second upgrade program, and the original program stored in the fixed storage area is upgraded according to the second upgrade program.

9. An energy storage device, characterized in that: include: one or more chips; One or more applications, wherein the one or more applications are stored in the chip and configured to be executed by the one or more chips, and the one or more applications are configured to execute the method as described in any one of claims 1-6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the method according to any one of claims 1 to 6.