Software upgrading method and device, chip and energy storage equipment
By setting up a software backup area in the energy storage device chip, the correctness and consistency of the upgrade program are ensured, and the problems of downtime errors and time-consuming during the upgrade of the energy storage device software are solved, and the system's operating efficiency and reliability are improved.
Patent Information
- Application Number
- CN202411096012.9
- 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
During the upgrade of existing energy storage equipment software, downtime errors are prone to occur, which causes the equipment to be unable to resume operation for a long time, and the upgrade process takes a long time, affecting system efficiency.
Set up a software backup area in the chip, write the program to the backup area after receiving the upgrade instructions, and write it to the run area after passing the verification to ensure the correctness and consistency of the upgrade program, avoid downtime, and realize online upgrades.
It greatly reduces the downtime caused by software upgrades, improves the operating efficiency and reliability of the energy storage system, and avoids equipment damage caused by upgrade failure.
Smart Images

Figure CN119225773A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and more specifically, to a software upgrade method, device, chip and energy storage device. Background Art
[0002] With the development of home energy storage systems, due to the different requirements of different households for energy storage backup capacity, photovoltaic power generation and economy, home energy storage products often adopt modular design to expand in parallel, and mount communication devices of multiple energy storage devices on the communication bus of the energy storage system.
[0003] In the prior art, the energy storage device needs to be shut down during the software upgrade. If an error occurs during the upgrade, the device will remain in a shut down state and cannot be restored. However, many types of energy storage devices are used in special scenarios such as homes, industry and commerce, so long-term shutdown for upgrades is not allowed. Summary of the invention
[0004] The present application proposes a software upgrade method, device, chip and energy storage device to improve the above-mentioned defects.
[0005] In a first aspect, an embodiment of the present application provides a software upgrade method, which is applied to a chip, and the method comprises: based on a received upgrade instruction, writing an upgrade program sent by a host computer into a software backup area of the chip, wherein the software backup area is located in a fixed storage area of the chip; comparing the consistency of the upgrade program in the software backup area with the software program stored in a software running area of the chip, wherein the software running area is located in a fixed storage area of the chip; if the upgrade program in the software backup area is inconsistent with the software program, writing the upgrade program in the software backup area into the software running area, and running the upgrade program in the software running area.
[0006] In a second aspect, an embodiment of the present application also provides a software upgrade device, which is applied to a chip, and the device includes: a first writing module, which is used to write the upgrade program sent by the host computer into the software backup area of the chip based on the received upgrade instruction, wherein the software backup area is arranged in a fixed storage area of the chip; a comparison module, which is used to compare the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is arranged in a fixed storage area of the chip; a second writing module, which is used to write the upgrade program in the software backup area into the software running area if the upgrade program in the software backup area is inconsistent with the software program, and run the upgrade program in the software running area.
[0007] In a third aspect, an embodiment of the present application further provides a chip, comprising a burning program area, a software running area and a software backup area, wherein the burning software area, the software running area and the software backup area are all arranged in a fixed storage area of the chip, the burning program area is used to store the burning program, the software running area is used to store the software program, and the software backup area is used to store the upgrade program; wherein the burning program is used to execute the above-mentioned software upgrade method.
[0008] In a fourth aspect, an embodiment of the present application further provides an energy storage device, the energy storage device comprising one or more chips, the chips being used to execute the software upgrade method as described above to perform online software upgrade.
[0009] Therefore, the present application provides a software upgrade method, device, chip and energy storage device, the method comprising: based on the received upgrade instruction, writing the upgrade program sent by the host computer into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip; comparing the consistency of the upgrade program with the software program stored in the software running area of the chip, wherein the software running area is set in the fixed storage area of the chip; if the upgrade program is inconsistent with the software program, writing the upgrade program into the software running area, and running the upgrade program. By setting a software backup area in the chip, when a software upgrade is required, the upgrade program is first written into the software backup area, and then after confirming that the upgrade program is a new program for the originally stored software program, the upgrade program is written into the software running area and run, which greatly reduces the time when the chip is interrupted due to the upgrade and improves the operating efficiency of the energy storage system.
[0010] 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
[0011] 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.
[0012] Figure 1 A flowchart of a software upgrade method proposed in an embodiment of the present application is shown.
[0013] Figure 2 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown.
[0014] Figure 3 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown.
[0015] Figure 4 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown.
[0016] Figure 5 A structural block diagram of a chip proposed in an embodiment of the present application is shown.
[0017] Figure 6 A structural block diagram of a software upgrading device proposed in an embodiment of the present application is shown.
[0018] Figure 7 A structural block diagram of an energy storage device proposed in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0019] 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.
[0020] 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.
[0021] 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.
[0022] Generally, a chip is used in an energy storage device to control or perform a specific task. For example, the chip can be a microcontroller unit (MCU) or a system on chip (SOC). When the software program in the chip is upgraded, it is necessary to obtain the upgrade program from the host computer and burn it into the storage module of the chip. Generally speaking, the operation of burning the upgrade program into the inside of the chip is performed by the burning program, and during the burning process, the software program to be upgraded cannot run. In other words, after the chip receives the upgrade command, it will jump to the burning program to perform the upgrade operation, and in the execution of the upgrade operation, the following problems may occur: if the communication between the chip and the host computer is accidentally interrupted during the burning, then after the chip is restarted, it will stay in the burning program; if the chip receives an erroneous burning instruction and jumps to the burning program, it does not receive the upgrade program sent by the host computer, and it will continue to wait in the burning program. It should be understood that if the above situations occur during the software upgrade process, the chip will continue to shut down and wait until the upgrade is completed.
[0023] In this application, the inventors found that in many application scenarios where chips are used in energy storage devices, energy storage devices are not allowed to be shut down for long periods of time for upgrades. However, for multi-device scenarios mounted on a bus, the bus occupancy rate is high, the packet loss rate is high, and the transmission environment is complex, resulting in a large amount of time required for software upgrades. The upgrade program often fails to download and needs to be re-upgraded. Therefore, how to reduce the downtime of energy storage devices waiting for upgrades is an important issue that needs to be solved urgently.
[0024] Problems that arise in any process may cause damage to the MCU chip and, in turn, damage to the equipment. If a failure occurs during the upgrade process of one of the energy storage devices, it may cause abnormalities or damage to other energy storage devices, seriously affecting the normal operation of the energy storage system.
[0025] See also 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 chip 500 shown in the figure can be used as a hardware device in various energy storage devices included in the energy storage system. Specifically, the method includes the following steps:
[0026] S110: Based on the received upgrade instruction, receiving the upgrade program sent by the host computer and writing it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip.
[0027] As an implementation method, the energy storage system may include a host computer and multiple slave computers, and the host computer and the multiple slave computers realize data exchange and control through a controller area network (CAN) bus. Exemplarily, the slave computer may be a chip. In this embodiment, the host computer may send an upgrade instruction and an upgrade program to the chip through the CAN bus, and the upgrade instruction is used to instruct the chip to jump to the burning program to perform a software upgrade operation. The upgrade program is used to upgrade the software program stored in the fixed storage area (Read-Only Memory, ROM) of the chip. The burning program may be a Bootloader, which is mainly used for communication and burning programs. In this embodiment, the chip jumps to the burning program based on the received upgrade instruction, so that the burning program writes the upgrade program sent by the host computer into the software backup area of the chip.
[0028] As an implementation method, after receiving the upgrade program and before burning, the received upgrade program can be first checked for transmission correctness. For example, a cyclic redundancy check (CRC) method can be used to check whether the second CRC check code corresponding to the received upgrade program is consistent with the first CRC check code corresponding to the upgrade program sent by the host computer, so as to ensure the transmission correctness during the communication process. If the second CRC check code corresponding to the received upgrade program is consistent with the first CRC check code corresponding to the upgrade program sent by the host computer, it is considered that the upgrade program transmission correctness check has passed, and the operation of writing the upgrade program sent by the host computer into the software backup area of the chip will continue.
[0029] S120: Compare the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in a fixed storage area of the chip.
[0030] In this embodiment, different from the upgrade program written in the software backup area, the original software program in the chip is stored in the software running area. As an implementation method, the method of comparing the consistency of the upgrade program in the software backup area with the software program can be, based on the upgrade program written in the software backup area and the software program in the software running area, generating corresponding check codes for both by the same check code rule. If the check code corresponding to the upgrade program is consistent with the check code corresponding to the software program, it means that the upgrade program is consistent with the software program. If the check code corresponding to the upgrade program is inconsistent with the check code corresponding to the software program, it means that the upgrade program is inconsistent with the software program. Exemplarily, the check code rule used can be any one of a variety of check methods such as cyclic redundancy check, Hamming check, Reed-Solomon code and low-density parity check.
[0031] S130: If the upgrade program in the software backup area is inconsistent with the software program, write the upgrade program in the software backup area into the software running area, and run the upgrade program in the software running area.
[0032] In this embodiment, if the upgrade program in the software backup area is inconsistent with the software program, it means that the upgrade program in the software backup area is a new and different program for the software program. Therefore, the upgrade program in the software backup area can be written into the software running area to realize the upgrade of the original software program, and the upgrade program can be started to run as the upgraded program.
[0033] As an implementation method, if the upgrade program in the software backup area is inconsistent with the software program, the upgrade program in the software backup area can continue to be checked for consistency. If the consistency check passes, it is considered that the upgrade program in the software backup area is correct, and then the upgrade program in the software backup area is written into the software running area. Specifically, the consistency check is used to check the consistency between the upgrade program written into the chip software backup area and the upgrade program received by the chip, so as to avoid the problem of the upgrade program written into the software backup area being incorrect due to a burning error in the process of writing the received upgrade program into the software backup area. Exemplarily, the third CRC check code corresponding to the upgrade program written into the software backup area can be checked by a cyclic redundancy check method to see if it is consistent with the second CRC check code corresponding to the received upgrade program. If the third CRC check code is consistent with the second CRC check code, it is considered that the consistency check of the upgrade program written into the software backup area has passed. If and only if the upgrade program is reliable, the upgrade program in the software backup area is written into the software running area, thereby avoiding the situation where the upgrade program content in the software backup area is incorrect and the wrong upgrade program content is written into the software running area, resulting in the failure of the upgrade process.
[0034] As an implementation method, if the upgrade program in the software backup area is inconsistent with the software program, the consistency check of the upgrade program continues. If the consistency check fails, that is, the upgrade program is wrong, then the software program is checked for reliability. If the software program is reliable, the software program is run. It can be understood that if the consistency check of the upgrade program in the software backup area fails, it means that the upgrade program in the software backup area is not completely consistent with the upgrade program sent by the host computer, that is, some errors occur during the burning process, resulting in errors in the upgrade program written to the software backup area. At this time, if the operation of writing the upgrade program in the software backup area into the software running area is continued, the upgrade process will fail, which will not only delay the upgrade process, but also may cause the chip to wait in the burning program and shut down, seriously affecting the operation efficiency of the energy storage system. Therefore, in this implementation method, if the consistency check of the upgrade program in the software backup area fails, the reliability check of the software program originally stored in the software running area is selected. The purpose of the reliability check of the software program is to check whether the software program has a problem of program file damage. If the software program is intact, it means that the software program is reliable, then the software program can be run to ensure that the chip is always in operation without shutting down.
[0035] According to the above analysis, the operation after receiving the upgrade instruction is to burn the upgrade program to the software backup area, and the software running area will not be used. Therefore, during the burning process, other software programs stored in the software running area can still continue to run. In other words, during the upgrade process, the chip can continue to run without program disorder. Only after the upgrade program has been burned to the software backup area, the chip needs to be shut down in the process of burning the upgrade program from the software backup area to the software running area. The burning speed is very fast, which greatly reduces the unnecessary downtime caused by software upgrades. At the same time, even if a failure occurs during the burning process, as long as the upgrade program has not started to be written to the software running area, the original old version of the software program can still be run after the chip is restarted. There will be no situation where the upgrade failure causes no available program, which improves the reliability of the chip.
[0036] Therefore, the present application provides a software upgrade method, which is applied to a chip, and the method includes: based on the received upgrade instruction, receiving the upgrade program sent by the host computer and writing it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip; comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in the fixed storage area of the chip; if the upgrade program in the software backup area is inconsistent with the software program, the upgrade program in the software backup area is written into the software running area, and the upgrade program in the software running area is run. By setting a software backup area in the chip, when a software upgrade is required, the upgrade program is first written into the software backup area, and then after confirming that the upgrade program is a new program for the original stored software program, the upgrade program is written into the software running area and run, which greatly reduces the time when the chip is interrupted due to the upgrade and improves the operating efficiency of the energy storage system.
[0037] See also Figure 2 , Figure 2 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown, and the method is applied to Figure 5 The chip 500 shown in the figure can be used as a hardware device in various energy storage devices included in the energy storage system. Specifically, the method includes the following steps:
[0038] S210: Based on the received upgrade instruction, receive multiple program blocks split out by the host computer based on the upgrade program, write the multiple program blocks into the software backup area in the order of reception and verify them; combine the multiple program blocks that pass the verification into the upgrade program.
[0039] In this embodiment, the chip jumps to the burning program based on the received upgrade instruction, so that the burning program performs the burning operation. Specifically, in the burning process of general software upgrade, the content of the upgrade program sent by the host computer is first written into the random access memory (RAM) of the chip, and then written into the fixed storage area ROM of the chip. Since the storage space of the chip RAM area is much smaller than the storage space of the chip ROM area, for the upgrade program with a large file, the upgrade program can be split into multiple program blocks, and then the multiple program blocks are burned to achieve the writing of the upgrade program.
[0040] As an implementation method, after the upper computer splits the upgrade program into multiple program blocks, it can sort the multiple program blocks according to the positions of the program blocks in the upgrade program, and send them to the chip one by one in the sorted order. Therefore, when the chip receives the multiple program blocks split by the upper computer based on the upgrade program, it also has a corresponding receiving order. Therefore, the received multiple program blocks can be written into the software backup area one by one according to the receiving order.
[0041] In this embodiment, while writing multiple program blocks into the software backup area, the program blocks written into the software backup area are verified to ensure that each program block written into the software backup area has passed the verification. It should be understood that in the process from receiving the program blocks to burning the program blocks into the software backup area, a burning error may occur, resulting in the program content in the software backup area being inconsistent with the received program content. If the wrong program content is used for upgrading, the upgrade will fail, the device will be interrupted, and the system operation will be seriously affected. Therefore, in this embodiment, after writing multiple program blocks into the software backup area, the program blocks are verified to ensure the correctness of the burning process and the program block content.
[0042] As an implementation method, a method for writing multiple program blocks into a software backup area in the order of receipt and performing verification may be: generating a first verification code corresponding to the program block written into the software backup area, wherein the first verification code may be a cyclic redundancy check (CRC) verification code, and then obtaining a second verification code corresponding to the program block when the user terminal sends the program block, and comparing 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 program block written into the software backup area by the chip is consistent with the program block sent by the user terminal, and so on, until all program blocks are verified.
[0043] As an implementation method, a method for writing multiple program blocks into a software backup area in a receiving order and verifying them may be: according to the receiving order, determining a target program block from the multiple program blocks received, then writing the target program block into the software backup area, and generating a verification code corresponding to the target program block based on the target program block in the software backup area, then verifying the target program block in the software backup area based on the corresponding verification code, and if the verification passes, determining the next program block of the target program block from the multiple program blocks received, writing the next program block into the software backup area, then generating a verification code corresponding to the next program block based on the next program block in the software backup area and the verification code corresponding to the target program block, and finally, taking the next program block as the target program block, returning to execute the step of verifying the target program block in the software backup area based on the corresponding verification code and subsequent steps until the target program block is the last program block among the multiple program blocks.
[0044] Specifically, the target program block may be the first program block among multiple program blocks determined according to the receiving order. Thus, after the target program block is written into the software backup area, a corresponding check code may be generated based on the written target program block. Exemplarily, the check code is a CRC check code. It can be understood that the CRC check code corresponding to the target program block when the target program block is sent is obtained from the user end, and the two are compared. If the generated CRC check code is consistent with the obtained CRC check code, it can be explained that the target program block written into the software backup area is consistent with the target program block sent by the user end, that is, the check is passed.
[0045] Then, if the verification is passed, the next program block of the target program block is determined from the received multiple program blocks according to the receiving order, the next program block is continued to be written into the software backup area, and a CRC check code corresponding to the next program block is generated. Specifically, when the CRC check code corresponding to the next program block is generated, the next program block and the CRC check code corresponding to the target program block are combined. Exemplarily, the CRC check code corresponding to the target program block can be used as the initial value used when generating the CRC check code corresponding to the next program block. That is to say, the CRC check code generated by the next program block will contain the CRC check information of the target program block. Then, the next program block is used as the new target program block, and the step of verifying the target program block based on the corresponding check code and the subsequent steps are returned until the target program block is the last program block among the multiple program blocks. It is worth noting that the check code used in the step of returning to execution is the check code corresponding to the new target program block.
[0046] According to the above analysis, it can be known that when checking multiple program blocks arranged in sequence one by one, the check code of the latter program block is generated based on the check code of the previous program block, that is, when the target program block is the last program block among multiple program blocks, its corresponding check code contains the CRC check information of all previous program blocks. Therefore, when this program block check method is used, after all program blocks are written into the software backup area, the CRC check information corresponding to the last program block can be used to reflect the check information of the combined upgrade program. That is to say, the CRC check information corresponding to the last program block can be saved, and when the upgrade program in the software backup area needs to be checked for consistency later, the CRC check code corresponding to the last program block is directly read as the CRC check code of the upgrade program, and there is no need to re-read the entire upgrade program to generate a check code corresponding to the complete upgrade program. For the upgrade process using a large upgrade program, the response time occupied by re-reading the entire program for CRC check is saved, and the communication timeout caused by too long response time is avoided, and the download failure is judged by the user end, thereby improving the user experience.
[0047] S220: Compare the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in a fixed storage area of the chip.
[0048] The specific implementation of step S220 may refer to the specific implementation of step S120 in the above embodiment, which will not be described in detail here.
[0049] S230: If the upgrade program in the software backup area is inconsistent with the software program, write the upgrade program in the software backup area into the software running area, and run the upgrade program in the software running area.
[0050] Among them, some specific implementations of step S230 can refer to the specific implementations of step S130 in the above embodiment, which will not be repeated here. However, it is worth noting that in this embodiment, when it is necessary to perform consistency check on the upgrade program, it can be inferred based on the specific implementation in step S110 that the software upgrade method provided in this embodiment will no longer need to re-read the entire upgrade program to generate its corresponding third CRC check code, but can directly read the check code generated for the last program block in the previous program block check process for verification. For the upgrade process using a large upgrade program, it saves the response time occupied by re-reading the entire program for CRC verification, avoids the situation where the communication timeout caused by the long response time is judged as a download failure by the user end, and improves the user experience.
[0051] See also Figure 3 , Figure 3 A flowchart of another software upgrade method proposed in an embodiment of the present application is shown, and the method is applied to Figure 5 The chip 500 shown in the figure can be used as a hardware device in various energy storage devices included in the energy storage system. Specifically, the method includes the following steps:
[0052] S310: Based on the received upgrade instruction, receive the upgrade program sent by the host computer and write it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip.
[0053] S320: Compare the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in a fixed storage area of the chip.
[0054] Specifically, the specific implementation of steps S310 - S320 may refer to the specific implementation of steps S110 - S120 in the above embodiment, which will not be repeated here.
[0055] S330: If the upgrade program in the software backup area is consistent with the software program, perform reliability check on the software program.
[0056] In this embodiment, if the upgrade program is consistent with the software program, it means that the upgrade program and the software program are the same version, that is, the upgrade program is not an upgraded version corresponding to the software program. In this case, the subsequent upgrade operation will no longer be performed, but the software program stored in the chip can be directly run. Furthermore, the software program can be reliability tested first. The purpose of reliability testing the software program is to check whether there is a problem of program file corruption in the software program, that is, to verify whether the program file can run normally. If the software program can run normally, it means that the software program is reliable, and then the software program can be run to ensure that the chip is always in operation.
[0057] S341: If the software program is reliable, run the software program.
[0058] In this embodiment, if the software program is reliable, the software program is run to ensure that the chip is always in operation. It can be understood that through step S230 and step S241, the time-consuming repeated update of the same version of the software program is avoided, and the operating efficiency of the energy storage device can be improved.
[0059] S342: If the software program is unreliable, enter the waiting state for upgrading.
[0060] In this embodiment, if the software program is unreliable, it means that there is no available program in the chip. At this time, it enters the waiting upgrade state to wait for the host computer to send new upgrade instructions and upgrade programs, so as to re-execute the above steps based on the new upgrade program until the software upgrade is completed.
[0061] Therefore, a software upgrade method provided in this embodiment includes: based on the received upgrade instruction, receiving the upgrade program sent by the host computer and writing it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip; comparing the consistency of the upgrade program with the software program stored in the software running area of the chip, wherein the software running area is set in the fixed storage area of the chip; if the upgrade program is consistent with the software program, performing a reliability check on the software program in the software running area; if the software program is reliable, running the software program; if the software program is unreliable, entering a waiting state for upgrade. By running the software program that has passed the reliability verification when the upgrade program and the software program are of the same version, the time-consuming repeated update of the same version of the software program is avoided, and the operating efficiency of the energy storage device can be improved.
[0062] See also Figure 4 , Figure 4A flowchart of another software upgrade method proposed in an embodiment of the present application is shown, and the method is applied to Figure 5 The chip 500 shown in the figure can be used as a hardware device in various energy storage devices included in the energy storage system. Specifically, the method includes the following steps:
[0063] S410: Based on the received upgrade instruction, receive the upgrade program sent by the host computer and write it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip.
[0064] The specific implementation of step S410 may refer to the specific implementation of step S110 in the above embodiment, which will not be described in detail here.
[0065] S420: writing an upgrade key; if the upgrade key authentication is passed, comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in a fixed storage area of the chip.
[0066] In this embodiment, the upgrade key is a special program used to authenticate whether the chip that receives the upgrade instruction is a legitimate device, that is, the upgrade key can be used to authenticate whether the upgrade instruction is sent to the wrong target chip. As an implementation method, the upgrade key is sent from the host computer to the chip via the CAN bus. After the chip writes the upgrade key, the key authentication is performed. If and only if the upgrade key authentication is passed, it means that the host computer has sent the correct upgrade instruction to the correct target device via the CAN bus, and then executes the subsequent software process. Compared with the traditional burning process, the software upgrade process is jumped to the software upgrade process as soon as the upgrade instruction is received, which avoids the impact of the CAN bus sending the wrong command on the device.
[0067] Further, it should be understood that after adding the upgrade key, the upgrade instruction will no longer be the startup instruction for the chip to enter the software upgrade process, but can only instruct the chip to receive the upgrade program sent by the host computer and write it into the software backup area, which means that compared with the traditional burning process, the software upgrade method provided in this embodiment can receive the upgrade program sent by the host computer and write it into the chip while the chip is running the original software program, and only jump to the burning program to execute the software upgrade process described in other embodiments of the present application after the upgrade key is written and authenticated, which greatly improves the software upgrade speed and greatly reduces the time overhead caused by the software upgrade. In addition, since in the process of receiving the upgrade program, in the process of writing the upgrade program into the software backup area, and in the process of writing the upgrade program in the software backup area into the software running area, the upgrade program is subjected to corresponding verification steps, the reliability of the upgrade program is ensured throughout the process, thereby avoiding the upgrade failure caused by errors in the upgrade program during the upgrade process.
[0068] S431: If the upgrade program in the software backup area is inconsistent with the software program, write the upgrade program in the software backup area into the software running area, and run the upgrade program in the software running area.
[0069] The specific implementation of step S431 may refer to the specific implementation of step S130 in the above embodiment, which will not be described in detail here.
[0070] S432: If the upgrade program in the software backup area is consistent with the software program, perform reliability check on the software program.
[0071] S441: If the software program is reliable, run the software program.
[0072] S442: If the software program is unreliable, enter a waiting state for upgrading.
[0073] The specific implementations of step S432, step S441 and step S442 may refer to the specific implementations of step S330, step S341 and step S342 in the above embodiment, which will not be described in detail here.
[0074] Therefore, a software upgrade method provided in this embodiment adds a process of writing and authenticating an upgrade key after writing the upgrade program sent by the host computer into the software backup area of the chip based on the received upgrade instruction. When the upgrade key authentication is passed, the consistency of the upgrade program and the software program stored in the software running area of the chip is compared. Then, if the upgrade program is inconsistent with the software program, the upgrade program is written into the software running area, and the upgrade program is run to implement the software upgrade. Therefore, before executing the operation of writing the upgrade program into the software running area, this embodiment not only needs to receive the upgrade instruction sent by the host computer, but also needs to authenticate the correctness of the upgrade key, thereby avoiding the situation where the communication CAN bus mistakenly sends an erroneous command. Even if the CAN bus sends an erroneous upgrade instruction, it can avoid entering an unnecessary software upgrade process by authenticating the upgrade key again. In addition, if the upgrade program is consistent with the software program, the present application performs a reliability check on the software program in the software running area. If the software program is reliable, the software program is run; if the software program is unreliable, the software program enters a waiting state for upgrade. By running the software program that has passed the reliability verification when the upgrade program and the software program are of the same version, the time-consuming repeated updating of the same version of the software program is avoided, thereby improving the operating efficiency of the energy storage device.
[0075] See also Figure 5 , Figure 5The structure block diagram of a chip 500 proposed in an embodiment of the present application is shown, and the chip 500 can be used as a hardware device in various energy storage devices included in the energy storage system. Specifically, the chip 500 includes: a burning program area 501, a software running area 502, and a software backup area 503, and the burning program area 501, the software running area 502, and the software backup area 503 are all arranged in the fixed storage area ROM of the chip 500, wherein the burning program area 501 is used to store the burning program, the software running area 502 is used to store the software program, and the software backup area 503 is used to store the upgrade program.
[0076] Further, the burning program stored in the burning program area 501 is used to write the upgrade program sent by the host computer into the software backup area 503 of the chip based on the received upgrade instruction, and then the burning program reads the software program stored in the software running area 502 again, so as to compare the consistency of the upgrade program and the software program, and when the upgrade program and the software program are inconsistent, the upgrade program is written into the software running area 502, and the upgrade program is run to complete the upgrade process. It can be understood that, since the software running area 502 and the software backup area 503 are set in the chip 500 provided in the embodiment of the present application, the software program being run can be stored separately from the upgrade program for upgrading, so that when the chip software is upgraded, the upgrade program is actually written into the software backup area 503, and during the writing process, the software program in the software running area 502 can still be continuously run, until the upgrade program after writing passes the verification, then based on the upgrade key of the secondary confirmation upgrade operation, the system is reset to write the upgrade program in the software backup area 503 into the software running area 502, and the upgrade is realized. Since the correctness of the upgrade instructions sent by the communication bus and the upgrade program have been confirmed before the upgrade program is written into the software running area 502, the possibility of failure due to program or command errors in the process of writing the upgrade program into the software running area 502 is avoided. In the complete software upgrade process, it is only necessary to stop the operation when writing the upgrade program into the software running area 502, thereby greatly reducing the time overhead required for software upgrades and improving the efficiency of the energy storage system.
[0077] See also Figure 6 , Figure 6 The structure block diagram of a software upgrade device 600 proposed in an embodiment of the present application is shown. The device 600 is applied to Figure 5 The chip shown in the figure can be used as a hardware device in various energy storage devices included in the energy storage system, including:
[0078] The first writing module 601 is used to receive the upgrade program sent by the host computer and write it into the software backup area of the chip based on the received upgrade instruction, wherein the software backup area is set in the fixed storage area of the chip.
[0079] The comparison module 602 is used to compare the consistency between the upgrade program in the software backup area and the software program stored in the software running area of the chip, wherein the software running area is set in the fixed storage area of the chip.
[0080] The second writing module 603 is used to write the upgrading program in the software backup area into the software running area if the upgrading program in the software backup area is inconsistent with the software program, and run the upgrading program in the software running area.
[0081] Optionally, the first writing module 601 is also used to receive multiple program blocks split by the host computer based on the upgrade program based on the received upgrade instruction, write the multiple program blocks into the software backup area in the order of receipt and verify them; and combine the multiple program blocks that have passed the verification into the upgrade program.
[0082] Optionally, the first writing module 601 is also used to determine a target program block from the multiple program blocks received according to the receiving order; write the target program block into the software backup area, and generate a verification code corresponding to the target program block based on the target program block in the software backup area; verify the target program block in the software backup area based on the corresponding verification code, and if the verification passes, determine the next program block of the target program block from the multiple program blocks received, and write the next program block into the software backup area; generate a verification code corresponding to the next program block based on the next program block in the software backup area and the verification code corresponding to the target program block; take the next program block as the target program block, and return to execute the step of verifying the target program block in the software backup area based on the corresponding verification code and subsequent steps until the target program block is the last program block among the multiple program blocks.
[0083] Optionally, the second writing module 603 is also used to perform a consistency check on the upgrade program in the software backup area if the upgrade program in the software backup area is inconsistent with the software program, and the consistency check is used to check the consistency between the upgrade program in the software backup area and the received upgrade program; if the upgrade program in the software backup area passes the consistency check, the upgrade program in the software backup area is written into the software running area; if the upgrade program in the software backup area fails the consistency check, the software program is performed a reliability check; if the software program is reliable, the software program is run.
[0084] Optionally, the second writing module 603 is further configured to, after comparing the upgrade program in the software backup area with the software program, if the upgrade program in the software backup area is consistent with the software program, perform reliability check on the software program; if the software program is reliable, run the software program;
[0085] Optionally, the second writing module 603 is further configured to, after performing reliability check on the software program, enter a waiting state for upgrading if the software program is unreliable;
[0086] Optionally, the first reading module 601 is also used to write an upgrade key after writing the upgrade program sent by the host computer into the software backup area of the chip based on the received upgrade instruction; the comparison of the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip includes: if the upgrade key authentication is passed, comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip.
[0087] 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.
[0088] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0089] 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.
[0090] See also Figure 7 , which shows a structural block diagram of an energy storage device provided in an embodiment of the present application. Specifically, the energy storage device 700 includes one or more chips 701, and the chip 701 is used to execute the software upgrade method in any of the above embodiments. According to the above analysis, the software upgrade method provided in other embodiments of the present application reduces the possibility of upgrade failure due to factors such as erroneous receipt of upgrade instructions and errors in the upgrade program during the online software upgrade process, and by setting up a software backup area, the energy storage device can continue to run the original old version of the software during the process of writing the upgrade program to the energy storage device, and the device is reset to execute the upgrade process until the upgrade program is verified. This greatly reduces the time when the energy storage device is interrupted due to software upgrades, and improves the operating efficiency of the energy storage system.
[0091] In some embodiments, the energy storage device 700 also includes an inverter and at least one battery pack, wherein the inverter is used to convert the electric energy stored in the battery pack into alternating current and output it to an external load, the inverter is also used to store the electric energy converted by the solar panel through photoelectric conversion into the battery pack, and the inverter is also used to convert the AC power into direct current and store it in the battery pack.
[0092] As an implementation manner, an embodiment of the present application further provides a computer-readable medium, in which a program code is stored. The program code can be called by a processor to execute the method described in the above method embodiment.
[0093] The computer-readable storage medium 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 includes a non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for program codes that execute any of the 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 can be compressed, for example, in an appropriate form.
[0094] As an implementation mode, the present application also provides a computer program product. The computer program product includes a computer program / instruction, and the computer program / instruction implements the steps of the above method when executed by a processor.
[0095] 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 a chip, the method comprises: Based on the received upgrade instruction, receiving the upgrade program sent by the host computer and writing it into the software backup area of the chip, wherein the software backup area is set in the fixed storage area of the chip; Comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in a fixed storage area of the chip; If the upgrade program in the software backup area is inconsistent with the software program, the upgrade program in the software backup area is written into the software running area, and the upgrade program in the software running area is run.
2. The method according to claim 1, characterized in that The step of writing the upgrade program sent by the host computer into the software backup area of the chip based on the received upgrade instruction includes: Based on the received upgrade instruction, receiving multiple program blocks split out by the host computer based on the upgrade program, writing the multiple program blocks into the software backup area in the order of receiving and verifying them; The plurality of program blocks that have passed verification are combined into the upgrade program.
3. The method according to claim 2, characterized in that The step of writing the plurality of program blocks into the software backup area in the order in which they are received and performing verification comprises: Determining a target program block from the received multiple program blocks according to the receiving order; Writing the target program block into the software backup area, and generating a check code corresponding to the target program block based on the target program block in the software backup area; Verifying the target program block in the software backup area based on the corresponding verification code, and if the verification passes, determining the next program block of the target program block from the received multiple program blocks, and writing the next program block into the software backup area; Based on the next program block in the software backup area and the verification code corresponding to the target program block, generating a verification code corresponding to the next program block; The next program block is used as the target program block, and the step of verifying the target program block in the software backup area based on the corresponding verification code and subsequent steps are returned to execute until the target program block is the last program block among the multiple program blocks.
4. The method according to claim 1, characterized in that If the upgrade program in the software backup area is inconsistent with the software program, writing the upgrade program in the software backup area into the software running area comprises: If the upgrade program in the software backup area is inconsistent with the software program, a consistency check is performed on the upgrade program in the software backup area, wherein the consistency check is used to check the consistency between the upgrade program in the software backup area and the received upgrade program; If the upgrade program in the software backup area passes the consistency check, writing the upgrade program in the software backup area into the software running area; If the upgrade program in the software backup area fails the consistency check, performing a reliability check on the software program; If the software program is reliable, run the software program.
5. The method according to claim 1, characterized in that: After comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, the method further includes: If the upgrade program in the software backup area is consistent with the software program, performing reliability inspection on the software program; If the software program is reliable, run the software program.
6. The method according to claim 4 or 5, characterized in that: After the reliability test of the software program is performed, the method further includes: If the software program is unreliable, the system enters a waiting state for upgrading.
7. The method according to claim 1, characterized in that After writing the upgrade program sent by the host computer into the software backup area of the chip based on the received upgrade instruction, the method further includes: Write the upgrade key; The comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip includes: If the upgrade key authentication is passed, the upgrade program in the software backup area is compared with the software program stored in the software running area of the chip for consistency.
8. A software upgrade device, characterized in that: Applied to a chip, the device comprises: A first writing module, used for receiving the upgrade program sent by the host computer and writing it into the software backup area of the chip based on the received upgrade instruction, wherein the software backup area is set in the fixed storage area of the chip; A comparison module, used for comparing the consistency of the upgrade program in the software backup area with the software program stored in the software running area of the chip, wherein the software running area is set in the fixed storage area of the chip; The second writing module is used for writing the upgrading program in the software backup area into the software running area if the upgrading program in the software backup area is inconsistent with the software program, and running the upgrading program in the software running area.
9. A chip, characterized in that: It includes a burning program area, a software running area and a software backup area, wherein the burning software area, the software running area and the software backup area are all arranged in a fixed storage area of the chip, the burning program area is used to store the burning program, the software running area is used to store the software program, and the software backup area is used to store the upgrade program; Wherein, the burning program is used to execute the method as described in any one of claims 1-7.
10. An energy storage device, characterized in that: The energy storage device comprises one or more chips, and the chips are used to execute the software upgrade method according to any one of claims 1 to 7 to perform online software upgrade.
