METHOD OF UPDATING POWER FIRMWARE AND POWER SUPPLY

A method of updating power firmware is applied to update power firmware when a power supply is powered. The method is executed by a microcontroller of the power supply, and the method includes steps of: planning a memory space in the microcontroller as a first space and a second space, wherein the first space stores a first program currently executing the power supply required by the power supply, emptying the second space before the power firmware is updated, writing a second program stored in a management system into the second space, switching the second space to the first space to complete updating the power firmware after the second program is completely written into the second space, and continuously outputting working power.

BACKGROUND

Technical Field

The present disclosure relates to a method of updating power firmware and a power supply, and more particularly to a method of updating power firmware and a power supply without restarting and rebooting the system.

Description of Related Art

The method of online updating power firmware is often used in the field of notebook computers, mobile phones, or power supplies. Compared with the updating of power firmware of notebook computers and mobile phones, since the power supply needs to continuously supply power to the load, when the power firmware is completely updated, it is not allowed to restart and reboot the system. In other words, it will have a great impact on the operation of the entire system once the power firmware is updated and then the system is restarted and rebooted.

SUMMARY

An objective of the present disclosure is to provide a method of updating power firmware to solve the problems of existing technology.

In order to achieve the above-mentioned objective, the method of updating power firmware is applied to update power firmware when a power supply is powered. The method is executed by a microcontroller of the power supply, and the method includes steps of: a planning step: planning a memory space in the microcontroller as a first space and a second space, wherein the first space stores a first program currently executing the power supply required by the power supply; an emptying step: emptying the second space before the power firmware is updated; a writing step: writing a second program stored in a management system into the second space; a switching step: switching the second space to the first space to complete updating the power firmware after the second program is completely written into the second space; and a supplying step: continuously outputting working power.

In one embodiment, in the writing step, when the management system continuously executes a regular communication with the power supply, a plurality of bytes of the second program are transmitted to the second space in batches.

In one embodiment, commands of the regular communication and the plurality of bytes of the second program are interleavedly transmitted.

In one embodiment, when transmission of the commands of the regular communication is idle, the plurality of bytes of the second program are transmitted to the second space.

In one embodiment, in the writing step, when the management system stops a regular communication with the power supply, a plurality of bytes of the second program are continuously transmitted to the second space.

In one embodiment, in the switching step, a start location of the second space is addressed as a start location of the first space.

In one embodiment, a size of the second space is equal to a size of the first space.

In one embodiment, in the switching step, after executing the first program stored in the first space for the last time, switching the second space to the first space.

In one embodiment, the management system executes a regular communication with the first space and the second space through an integrated circuit bus.

In one embodiment, in the switching step, checking the transmission integrity of a plurality of bytes of the second program through an error detection mechanism.

In one embodiment, the error detection mechanism comprises checksums, Hamming codes, hash functions, modulus algorithm, or parity checking.

Accordingly, the method of updating power firmware is used to realize the advantage of updating power firmware without restarting and rebooting the system.

Another objective of the present disclosure is to provide a power supply to solve the problems of existing technology.

In order to achieve the above-mentioned objective, the power supply is applied to update power firmware when the power supply is powered. The power supply includes a microcontroller and a power-supplying module. The microcontroller includes a communication unit, a memory unit, and an operation unit. The communication unit executes a regular communication with a management system. The memory unit includes a first space and a second space, and the first space stores a first program. The operation unit executes the first program, empties the second space before the power firmware is updated, and writes a second program stored in the management system into the second space. When the second program is completely written into the second space, the operation unit switches the second space to the first space to complete updating the power firmware. The power-supplying module is connected to the microcontroller, and the power-supplying continuously outputs working power according to the first program or the second program stored in the first space. In one embodiment, when the management system continuously executes the regular communication with the communication unit, a plurality of bytes of the second program are transmitted to the second space in batches.

In one embodiment, commands of the regular communication and the plurality of bytes of the second program are interleavedly transmitted.

In one embodiment, when transmission of the commands of the regular communication is idle, the plurality of bytes of the second program are transmitted to the second space.

In one embodiment, when the management system stops the regular communication with the communication unit, the plurality of bytes of the second program are continuously transmitted to the second space.

In one embodiment, the operation unit addresses a start location of the second space as a start location of the first space.

In one embodiment, a size of the second space is equal to a size of the first space.

In one embodiment, the operation unit switches the second space to the first space after executing the first program stored in the first space for the last time.

In one embodiment, the management system executes the regular communication with the first space and the second space through an integrated circuit bus.

In one embodiment, the communication unit checks the transmission integrity of a plurality of bytes of the second program through an error detection mechanism.

In one embodiment, the error detection mechanism comprises checksums, Hamming codes, hash functions, modulus algorithm, or parity checking.

Accordingly, the power supply is used to realize the advantage of updating power firmware without restarting and rebooting the system.

DETAILED DESCRIPTION

Reference will now be made to the drawing figures to describe the present disclosure in detail. It will be understood that the drawing figures and exemplified embodiments of present disclosure are not limited to the details thereof.

Please refer toFIG.1, which shows a flowchart of a method of updating power firmware according to the present disclosure. The method of updating power firmware is applied to update power firmware when a power supply100is powered. Please refer toFIG.5, which shows a schematic block diagram of operations between the power supply100and the management system200according to the present disclosure. The power supply100shown inFIG.5is applied to update power firmware when the power supply100is powered. The power supply100includes a microcontroller10and a power-supplying module20. In particular, the aforementioned “to update power firmware when the power supply100is powered” means that the power supply will continue to supply normal working power no matter before, during, or after the power firmware is updated.

The microcontroller10includes a communication unit102, a memory unit104, and an operation unit106. The communication unit102has wireless and/or wired communication functions, and is used to execute a regular communication with the management system200. In the present disclosure, the regular communication refers to, for example, but not limited to, the operations of continuously communicating information such as voltage, current, power, etc. of a power source.

The memory unit104may be a digital signal process (DSP) or a microcontroller (MCU), and for its memory planning, the program inside is mainly divided into two parts: one part is bootloader code, which is the underlying program, and this part cannot be updated; the other part is the firmware that actually runs, which is the user application, and this part is based on the bootloader code and can be updated. The memory unit104has a first space S1and a second space S2, and the first space S1is used to store a first program P1.

A corresponding planning step of the method of updating power firmware is: planning a memory space (corresponding to the memory unit104) in the microcontroller10as a first space S1and a second space S2(S10). In particular, the first space S1stores the first program P1currently executing the power supply required by the power supply100. In one embodiment, a size of the second space S2is, for example, but not limited to, equal to a size of the first space S1.

The operation unit106is used to execute the first program P1, and the operation unit106empties the second space S2before the power firmware is updated. A corresponding emptying step of the method of updating power firmware is: emptying the second space S2before the power firmware is updated (S20).

The operation unit106writes a second program P2stored in the management system200into the second space S2. A corresponding writing step of the method of updating power firmware is: writing a second program P2stored in the management system200into the second space S2(S30).

After the operation unit106completely writes the second program P2into the second space S2, the operation unit106switches the second space S2to the first space S1to complete updating the power firmware. A corresponding switching step of the method of updating power firmware is: switching the second space S2to the first space S1to complete updating the power firmware after the second program P2is completely written into the second space S2(S40).

The power-supplying module20is connected to the microcontroller10. The power-supplying module20continuously outputs working power according to the first program P1or the second program P2stored in the first space S1. A corresponding supplying step of the method of updating power firmware is: continuously outputting working power (S50). In particular, the aforementioned “continuously outputs working power” means that no matter before, during, or after the power firmware is updated, the power-supplying module20continues to operate, and the power supply100does not need to be restarted or rebooted. In other words, the power supply100can continue to supply power normally, and can continue to perform updating the power firmware in next time.

Please refer toFIG.2, which shows a flowchart of a writing step in the method of updating power firmware according to the present disclosure. In the writing step (S30), that is the method of writing the second program P2stored in the management system200into the second space S2is related to whether the management system200is in regular communication with the power supply100. Specifically, in step (S31), determining whether the management system200is in regular communication with the power supply100. When the determination result of step (S31) is “YES”, that is, when the management system200is continuously in regular communication with the power supply100, a plurality of bytes of the second program P2are transmitted to the second space S2in batches (S32).

Corresponding to the determination result of “YES” in step (S31), that is, when the management system200is continuously in regular communication with the power supply100, for example, information such as voltage, current, power, etc. of a power source is continuously communicated, and therefore it indicates that the communication between the management system200and the first program P1(which is the program required to execute the power supply of the power supply100) cannot be interrupted. In one embodiment, commands of the regular communication and the plurality of bytes of the second program P2(which is the program stored in the management system200) are interleavedly transmitted. Please refer toFIG.3, which shows a schematic diagram of interleavedly transmitting commands and a plurality of bytes to a second space during regular communication according to the present disclosure. In this condition, the management system200still communicates through a communication bus, such as but not limited to, integrated circuit bus (I2C) communication, to start the bootloader code function of the power supply100and communicate with the second program P2. That is, the management system200communicates with the first space S1and the second space S2through the integrated circuit bus (I2C).

At this time, the firmware update will change to the segment update method, that is, if the first program P1is communicating, the system will receive that the second program P2is busy and will be executed on the next serial clock. On the contrary, if the second program P2is writing data, the system will receive that the first program P1is busy and will wait until the next serial clock to respond the information.

TakeFIG.3as an example, when the management system200continuously executes the regular communication with the power supply100, the plurality of bytes of the second program P2are transmitted to the second space S2in batches. In particular, commands (such as a command of reading voltage, a command of reading current, a command of reading power, etc.) of the regular communication and the plurality of bytes of the second program P2are interleavedly transmitted. Therefore, when the command of reading voltage is transmitted, the bytes of the second program P2will be executed at the next serial clock. When the plurality of bytes of the second program P2are executed, if the regular communication of the command of reading current is required, the command of reading current is changed, and the subsequent byte of the second program P2will be executed at the next serial clock. Similarly, when the plurality of bytes of the second program P2are executed, if the regular communication of the command of reading power is required, the command of reading power is changed, and the subsequent byte of the second program P2will be executed at the next serial clock. Therefore, the commands of the regular communication and the plurality of bytes of the second program P2are interleavedly transmitted until the plurality of bytes of the second program P2are completely written into the second space S2, and then the second space S2is switched to the first space S1to complete updating the power firmware.

In particular, in the switching step, a start location of the second space S2is addressed as a start location of the first space S1to complete the switching from the second space S2to the first space S1. In order to completely switch the information of the original first space S1to the second space S2, after the first program P1stored in the first space S1is executed for the last time, the second space S2will be switched to the first space S1. In particular, when transmission of the commands of the regular communication is idle, the plurality of bytes of the second program P2are transmitted to the second space S2.

On the contrary, when the determination result of step (S31) is “NO”, that is, when the management system200stops the regular communication with the power supply100, the plurality of bytes of the second program P2are continuously transmitted to the second space S2(S33). Corresponding to the determination result of “NO” in step (S31), that is, when the management system200stops the regular communication with the power supply100, the plurality of bytes of the second program P2are continuously transmitted to the second space S2. TakeFIG.4as an example, when the command (that is, the command of reading power) of the regular communication ends, that is the regular communication between the management system200and the power supply100is stopped, the plurality of bytes of the second program P2are continuously and uninterruptedly transmitted to second space S2. Until the plurality of bytes of the second program P2are completely written into the second space S2, the second space S2is switched to the first space S1to complete updating the power firmware.

Incidentally, in the switching step, in order to ensure the sequence and integrity of data transmission, an error detection mechanism is provided to check the transmission integrity of the plurality of bytes of the second program P2. In one embodiment, the error detection mechanism includes checksums, Hamming codes, hash functions, modulus algorithm, or parity checking. The error detection operation (behavior) at this time will not affect other functions of the power supply, and the power supply still keeps the first program P1running without any influence.

Accordingly, the power supply is used to realize the advantage of updating power firmware without restarting and rebooting the system.