Firmware updating method for storing updating state and preventing power-down program from being unable to run and method thereof

By designing a firmware update method that saves the update status, using custom communication protocols or switch triggering methods, the problem that the device may be damaged or unable to start during the firmware update process in the prior art due to communication interruption or power failure, improving the universality of the update and the reliability of the device.

CN119961058APending Publication Date: 2025-05-09SHENZHEN RTELLIGENT MECHANICAL ELECTRICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510050980.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

Existing firmware update technologies rely on dedicated programming software or tools, and communication interruptions or power failures during firmware updates may result in damage to the device or fail to start.

Method used

Design a firmware update method that saves the update status, and update firmware through custom communication protocols or switch triggering methods to ensure that the device directly enters the update program after the power is restored, and avoids the device entering the unstartable state.

Benefits of technology

Improves the versatility of firmware updates, reduces dependence on dedicated software, prevents equipment from being damaged or unable to start due to communication interruptions or power failures, and reduces the use of program storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961058A_ABST
    Figure CN119961058A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of automation industry, in particular to a firmware updating method for storing an updating state and preventing a power-down program from being unable to run, which comprises the following steps of: S1, electrifying; s2, judging whether the equipment belongs to an updating state or not; s3, running the firmware; s4, judging whether to start and trigger firmware update; s5, setting the state as an update state; s6, waiting for the serial port to send firmware data; s7, setting an updating state; s8, checking whether the data are correct or not; according to the method, two modes are used for triggering, one mode is a user-defined communication protocol, the other mode is a mode of triggering by continuously shifting a device switch, the firmware updating method runs on the user-defined communication protocol of a serial port and is compatible with most serial port debugging tools on the market, so that special programming software or tools are not needed, and the firmware updating efficiency is greatly improved. Through a mode of storing the updating state, the equipment directly enters the firmware updating program after being electrified again, so that the equipment is prevented from entering a state which cannot be started, and the occupation of the program storage space is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automation industry technology, and in particular to a firmware update method and method thereof for saving update status and preventing a program from failing to run due to power failure. Background Art

[0002] At present, firmware update technology in the automation industry has been widely integrated into various types of automation equipment, such as PLC (programmable logic controller), HMI (human-machine interface), drives, etc. Firmware update technology is mainly used to ensure the optimal performance and security of device software. Firmware updates can repair security vulnerabilities in the device and ensure the security of data transmission and communication in industrial environments. Updating firmware can repair errors found during use, while introducing new functions and features to help devices better adapt to new task requirements. Through firmware updates, the response speed, efficiency and energy consumption of the device can be improved, and the overall work efficiency can be improved. Firmware can ensure compatibility between the device and other systems or software, thereby improving the overall availability and flexibility of the system. Firmware update technology allows update operations to be performed remotely, reducing the need for physical contact and improving management efficiency. By regularly updating the firmware, it can be ensured that the device meets the latest industry standards and regulatory requirements, reducing the risks caused by non-compliance.

[0003] Existing firmware update technology usually relies on dedicated programming software or tools, which provides a one-stop service from device connection, firmware version check, firmware download to update confirmation. However, this technology has disadvantages. Because it needs to rely on dedicated programming software or tools, not only will the corresponding development cost increase, but it is also not very universal. If communication interruption or power failure occurs during the firmware update process, it may cause device damage or enter an unbootable state. The general solution is to back up the program before the firmware update, but this will waste most of the storage space for executable programs, limiting the subsequent expansion of device functions.

[0004] Therefore, in order to address the above-mentioned reliance on dedicated programming software or tools, if communication interruption or power failure occurs during the firmware update process, it may cause device damage or enter an unbootable state. A firmware update method and method can be designed to save the update status and prevent the program from being unable to run due to power failure. Summary of the invention

[0005] To overcome the reliance on dedicated programming software or tools, if communication interruption or power failure occurs during the firmware update process, it may cause the device to be damaged or enter an unbootable state.

[0006] The technical solution of the present invention is: a firmware update method for saving the update status to prevent the program from failing to run due to power failure, the steps of which are as follows: S1: Power on; S2: Determine whether the device is in the update state, if not, go to S3, if yes, go to S6; S3: Set to running state and run the firmware; S4: Determine whether the firmware update is triggered by a switch or a serial port command. If so, go to S5. If not, go back to S4. S5: set to update state; S6: Wait for the serial port to send firmware data; S7: After receiving data, set to update state; S8: Check whether the data is correct. If so, return to S3; if not, return to S6.

[0007] Furthermore, the specific steps of powering on in S1 include: S11: Confirm whether the device is in a safe state; S12: Power on the device. According to the power indicator of the device, the power indicator of the device will light up after the power is passed; S13: Check the connection status of the device by logging into the control terminal of the device or using software to confirm that the device can communicate with the update tool through the network or serial port.

[0008] Furthermore, in S2, whether the device is in the update state may be determined by any of the following methods: (1) Check the device log: Check the device log file to determine whether the device is currently undergoing a firmware update; (2) Using API or interface: By calling the corresponding API, query the current status of the device, including whether the firmware update is in progress; (3) Detecting network connections: During a firmware update, if the device is downloading update files from a remote server, its network transmission activity will increase significantly. The device status can be inferred by detecting the device’s network activity, such as data transmission rate. (4) Query the firmware version information: Determine whether the firmware update is in progress by querying the current firmware version information; (5) Hardware status monitoring: If the device has a hardware indicator light related to firmware update, you can determine whether the device is undergoing firmware update by observing the indicator light status; (6) Configuration file check: During device startup or operation, check whether there is an "update running" sign in the configuration file to identify whether the device is in the update state.

[0009] Furthermore, S3 is set to the running state, and the specific steps of running the firmware are: S31: Get the latest firmware: Visit the device manufacturer's official website or dedicated forum to download the latest firmware version related to your device model; S32: The update tool uses the serial port debugging assistant on the market; S33: Turn off the device's anti-virus and anti-virus software; S34: Disconnect the device from the network: The device is disconnected from the Internet before using the update tool; S35: Turn off the power.

[0010] Furthermore, the method of triggering the switch is: toggling the switch 5 times continuously.

[0011] Furthermore, the method of triggering the serial port command is: sending a specific data frame twice (02 7F6A 5F 4A 03) through the serial port software.

[0012] Furthermore, the steps of waiting for the serial port to send firmware data in S6 are: S61: Ensure that the device is safely powered off or enters firmware flash mode (such as SWD / UART mode) through hardware methods; S62: prepare firmware files; S63: Make sure the debugging tool is correctly connected and the correct driver is installed; S64: Configure serial port communication: Open the serial port communication tool and configure the serial port parameters to match the requirements of the device.

[0013] Furthermore, the data received in S7 includes a corresponding firmware check code or summary information.

[0014] Furthermore, the steps of verifying whether the data is correct in S8 are: S81: disassembling the firmware file received on the device during the receiving process, calculating the checksum or summary information of the file using a method corresponding to the algorithm specified by the device manufacturer, and obtaining the checksum or summary information of the firmware file; S82: Compare the calculated checksum or summary information with the checksum or summary information of the firmware file. If the two are consistent, it proves that the firmware file has not been damaged or tampered with during the transmission process.

[0015] Furthermore, after a power outage during the firmware update communication process, the device enters the firmware update state after it is powered on again.

[0016] The beneficial effects of the present invention are as follows: two triggering methods are used, one is a custom communication protocol, which sends a specific data frame to the device serial port for triggering, and the other is triggered by continuously toggling the device switch. The custom communication protocol triggering enables technicians who understand the communication protocol to update the device remotely, and the switch triggering method is convenient for customers who do not understand the communication protocol to update the device. At the same time, because there are two triggering methods, it is also compatible with different devices with switches and without switches. The firmware update method runs on the custom communication protocol of the serial port and is compatible with most serial port debugging tools on the market, so no special programming software or tools are required. The versatility of the firmware update method is greatly improved. In addition, in the event of communication interruption or power failure during the firmware update process, the update status is saved, so that the device can directly enter the firmware update program after powering on again and re-update to prevent the device from entering an unbootable state. At the same time, because the update status of the device is saved instead of program backup, the program storage space is greatly reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Shown is a flowchart of a firmware update method for saving update status to prevent power failure and program from being unable to run according to the present invention; Figure 2 What is presented is a firmware update method of the present invention for saving the update status and preventing the program from failing to run due to power failure, and entering the firmware update state; Figure 3 The firmware update is completed and automatically started in a firmware update method of the present invention that saves the update status to prevent the program from being unable to run due to power failure. DETAILED DESCRIPTION

[0018] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0019] Example 1: Firmware update using sscom5.13.1 serial port debugging assistant See also Figure 1-3 The present invention provides an embodiment: a firmware update method for saving the update status to prevent the power-off program from failing to run, the steps of which are as follows: S1: Power on; S11: Confirm whether the device is in a safe state; S12: Power on the device. According to the power indicator of the device, the power indicator of the device will light up after the power is passed; S13: Check the connection status of the device by logging into the control terminal of the device or using software to confirm that the device can communicate with the update tool through the network or serial port; S2: Determine whether the device is in the update state, if not, go to S3, if yes, go to S6; To determine whether the device is in the update state, use any of the following methods: (1) Check the device log: Check the device log file to determine whether the device is currently undergoing a firmware update; (2) Using API or interface: By calling the corresponding API, query the current status of the device, including whether the firmware update is in progress; (3) Detecting network connections: During a firmware update, if the device is downloading update files from a remote server, its network transmission activity will increase significantly. The device status can be inferred by detecting the device’s network activity, such as data transmission rate. (4) Query the firmware version information: Determine whether the firmware update is in progress by querying the current firmware version information; (5) Hardware status monitoring: If the device has a hardware indicator light related to firmware update, you can determine whether the device is undergoing firmware update by observing the indicator light status; (6) Configuration file check: During device startup or operation, check whether there is an "update in progress" sign in the configuration file to identify whether the device is in the update state; S3: Set to running state and run the firmware; S31: Get the latest firmware: Visit the device manufacturer's official website or dedicated forum to download the latest firmware version related to your device model; S32: The update tool uses the serial port debugging assistant on the market; S33: Turn off the device's anti-virus and anti-virus software; S34: Disconnect the device from the network: The device is disconnected from the Internet before using the update tool; S35: Turn off the power; S4: Toggle the switch 5 times continuously to determine whether a firmware update is triggered. If so, enter S5; if not, return to S4; S5: set to update state; S6: Wait for the serial port to send firmware data; S61: Ensure that the device is safely powered off or enters firmware flash mode (such as SWD / UART mode) through hardware methods; S62: prepare firmware files; S63: Make sure the debugging tool is correctly connected and the correct driver is installed; S64: Configure serial port communication: Open the serial port communication tool and configure the serial port parameters to match the requirements of the device; S7: receiving data, setting to update state, the received data includes corresponding firmware verification code or summary information; S8: Check whether the data is correct. If so, return to S3; if not, return to S6; S81: disassembling the firmware file received on the device during the receiving process, calculating the checksum or summary information of the file using a method corresponding to the algorithm specified by the device manufacturer, and obtaining the checksum or summary information of the firmware file; S82: Compare the calculated checksum or summary information with the checksum or summary information of the firmware file. If the two are consistent, it proves that the firmware file has not been damaged or tampered with during the transmission process.

[0020] Example 2: Firmware update using sscom5.13.1 serial port debugging assistant See also Figure 1-3 The present invention provides an embodiment: a firmware update method for saving the update status to prevent the power-off program from failing to run, the steps of which are as follows: S1: Power on; S11: Confirm whether the device is in a safe state; S12: Power on the device. According to the power indicator of the device, the power indicator of the device will light up after the power is passed; S13: Check the connection status of the device by logging into the control terminal of the device or using software to confirm that the device can communicate with the update tool through the network or serial port; S2: Determine whether the device is in the update state, if not, go to S3, if yes, go to S6; To determine whether the device is in the update state, use any of the following methods: (1) Check the device log: Check the device log file to determine whether the device is currently undergoing a firmware update; (2) Using API or interface: By calling the corresponding API, query the current status of the device, including whether the firmware update is in progress; (3) Detecting network connections: During a firmware update, if the device is downloading update files from a remote server, its network transmission activity will increase significantly. The device status can be inferred by detecting the device’s network activity, such as data transmission rate. (4) Query the firmware version information: Determine whether the firmware update is in progress by querying the current firmware version information; (5) Hardware status monitoring: If the device has a hardware indicator light related to firmware update, you can determine whether the device is undergoing firmware update by observing the indicator light status; (6) Configuration file check: During device startup or operation, check whether there is an "update in progress" sign in the configuration file to identify whether the device is in the update state; S3: Set to running state and run the firmware; S31: Get the latest firmware: Visit the device manufacturer's official website or dedicated forum to download the latest firmware version related to your device model; S32: The update tool uses the serial port debugging assistant on the market; S33: Turn off the device's anti-virus and anti-virus software; S34: Disconnect the device from the network: The device is disconnected from the Internet before using the update tool; S35: Turn off the power; S4: Send a specific data frame twice (02 7F 6A 5F 4A 03) through the serial port software to determine whether to trigger the firmware update. If so, enter S5, if not, return to S4; S5: set to update state; S6: Wait for the serial port to send firmware data; S61: Ensure that the device is safely powered off or enters firmware flash mode (such as SWD / UART mode) through hardware methods; S62: prepare firmware files; S63: Make sure the debugging tool is correctly connected and the correct driver is installed; S64: Configure serial port communication: Open the serial port communication tool and configure the serial port parameters to match the requirements of the device; S7: receiving data, setting to update state, the received data includes corresponding firmware verification code or summary information; S8: Check whether the data is correct. If so, return to S3; if not, return to S6; S81: disassembling the firmware file received on the device during the receiving process, calculating the checksum or summary information of the file using a method corresponding to the algorithm specified by the device manufacturer, and obtaining the checksum or summary information of the firmware file; S82: Compare the calculated checksum or summary information with the checksum or summary information of the firmware file. If the two are consistent, it proves that the firmware file has not been damaged or tampered with during the transmission process.

[0021] Example 3: Simulating a power outage during firmware update communication See also Figure 1 The present invention provides an embodiment: a firmware update method for saving the update status to prevent the power-off program from failing to run, the steps of which are as follows: S1: Power on; S11: Confirm whether the device is in a safe state; S12: Power on the device. According to the power indicator of the device, the power indicator of the device will light up after the power is passed; S13: Check the connection status of the device by logging into the control terminal of the device or using software to confirm that the device can communicate with the update tool through the network or serial port; S2: Determine whether the device is in the update state, if not, go to S3, if yes, go to S6; To determine whether the device is in the update state, use any of the following methods: (1) Check the device log: Check the device log file to determine whether the device is currently undergoing a firmware update; (2) Using API or interface: By calling the corresponding API, query the current status of the device, including whether the firmware update is in progress; (3) Detecting network connections: During a firmware update, if the device is downloading update files from a remote server, its network transmission activity will increase significantly. The device status can be inferred by detecting the device’s network activity, such as data transmission rate. (4) Query the firmware version information: Determine whether the firmware update is in progress by querying the current firmware version information; (5) Hardware status monitoring: If the device has a hardware indicator light related to firmware update, you can determine whether the device is undergoing firmware update by observing the indicator light status; (6) Configuration file check: During device startup or operation, check whether there is an "update in progress" sign in the configuration file to identify whether the device is in the update state; S3: Set to running state and run the firmware; S31: Get the latest firmware: Visit the device manufacturer's official website or dedicated forum to download the latest firmware version related to your device model; S32: The update tool uses the serial port debugging assistant on the market; S33: Turn off the device's anti-virus and anti-virus software; S34: Disconnect the device from the network: The device is disconnected from the Internet before using the update tool; S35: Turn off the power; S4: Toggle the switch 5 times continuously to determine whether a firmware update is triggered. If so, enter S5; if not, return to S4; S5: set to update state; S6: Wait for the serial port to send firmware data; S61: Ensure that the device is safely powered off or enters firmware flash mode (such as SWD / UART mode) through hardware methods; S62: prepare firmware files; S63: Make sure the debugging tool is correctly connected and the correct driver is installed; S64: Configure serial port communication: Open the serial port communication tool and configure the serial port parameters to match the requirements of the device; S7: After receiving data, the device is set to the update state. The received data contains the corresponding firmware verification code or summary information, simulating the scenario of power failure during the firmware update communication process. After the device is powered on again, it enters the firmware update state; S8: Check whether the data is correct. If so, return to S3; if not, return to S6; S81: disassembling the firmware file received on the device during the receiving process, calculating the checksum or summary information of the file using a method corresponding to the algorithm specified by the device manufacturer, and obtaining the checksum or summary information of the firmware file; S82: Compare the calculated checksum or summary information with the checksum or summary information of the firmware file. If the two are consistent, it proves that the firmware file has not been damaged or tampered with during the transmission process.

[0022] Through the above steps, two methods are used for triggering, one is a custom communication protocol, sending a specific data frame to the device serial port for triggering, and the other is to trigger by continuously toggling the device switch. This firmware update method runs on the custom communication protocol of the serial port and is compatible with most serial port debugging tools on the market, so there is no need for dedicated programming software or tools. The versatility of this firmware update method is greatly improved. In addition, in the event of communication interruption or power failure during the firmware update process, the device can directly enter the firmware update program and re-update after powering on again by saving the update status, preventing the device from entering an unbootable state to solve the problem of relying on dedicated programming software or tools. If communication interruption or power failure occurs during the firmware update process, the device may be damaged or enter an unbootable state.

[0023] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of those skilled in the art without departing from the spirit of the present invention.

Claims

1. A firmware update method for saving update status to prevent power failure and program from failing to run, characterized in that: The steps are as follows: S1: Power on; S2: Determine whether the device is in the update state, if not, go to S3, if yes, go to S6; S3: Set to running state and run the firmware; S4: Determine whether the firmware update is triggered by a switch or a serial port command. If so, go to S5. If not, go back to S4. S5: set to update state; S6: Wait for the serial port to send firmware data; S7: After receiving data, set to update state; S8: Check whether the data is correct. If so, return to S3; if not, return to S6.

2. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: The specific steps of powering on in S1 include: S11: Confirm whether the device is in a safe state; S12: Power on the device. According to the power indicator of the device, the power indicator of the device will light up after the power is passed; S13: Check the connection status of the device by logging into the control terminal of the device or using software to confirm that the device can communicate with the update tool through the network or serial port.

3. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: In S2, whether the device is in the update state can be determined by any of the following methods: (1) Check the device log: Check the device log file to determine whether the device is currently undergoing a firmware update; (2) Using API or interface: By calling the corresponding API, query the current status of the device, including whether the firmware update is in progress; (3) Detecting network connections: During a firmware update, if the device is downloading update files from a remote server, its network transmission activity will increase significantly. The device status can be inferred by detecting the device’s network activity, such as data transmission rate. (4) Query the firmware version information: Determine whether the firmware update is in progress by querying the current firmware version information; (5) Hardware status monitoring: If the device has a hardware indicator light related to firmware update, you can determine whether the device is undergoing firmware update by observing the indicator light status; (6) Configuration file check: During device startup or operation, check whether there is an "update running" sign in the configuration file to identify whether the device is in the update state.

4. The firmware update method for saving the update status and preventing the program from being unable to run according to claim 1, characterized in that: S3 is set to the running state. The specific steps for running the firmware are: S31: Get the latest firmware: Visit the device manufacturer's official website or dedicated forum to download the latest firmware version related to your device model; S32: The update tool uses the serial port debugging assistant on the market; S33: Turn off the device's anti-virus and anti-virus software; S34: Disconnect the device from the network: The device is disconnected from the Internet before using the update tool; S35: Turn off the power.

5. The firmware update method for saving update status and preventing the program from failing to run during power failure according to claim 1, characterized in that: The method to trigger the switch is: toggle the switch 5 times continuously.

6. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: The method of serial port command triggering is: send a specific data frame twice (02 7F 6A 5F 4A03) through the serial port software.

7. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: The steps in S6 to wait for the serial port to send firmware data are: S61: Ensure that the device is safely powered off or enters firmware flash mode (such as SWD / UART mode) through hardware methods; S62: prepare firmware files; S63: Make sure the debugging tool is correctly connected and the correct driver is installed; S64: Configure serial port communication: Open the serial port communication tool and configure the serial port parameters to match the requirements of the device.

8. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: The data received in S7 includes the corresponding firmware checksum or summary information.

9. The firmware update method for saving update status and preventing the program from failing to run during power failure according to claim 1, characterized in that: The steps to verify whether the data is correct in S8 are: S81: disassembling the firmware file received on the device during the receiving process, calculating the checksum or summary information of the file using a method corresponding to the algorithm specified by the device manufacturer, and obtaining the checksum or summary information of the firmware file; S82: Compare the calculated checksum or summary information with the checksum or summary information of the firmware file. If the two are consistent, it proves that the firmware file has not been damaged or tampered with during the transmission process.

10. The firmware update method for saving update status and preventing power failure from causing the program to fail to run according to claim 1, characterized in that: If the power is cut off during the firmware update communication process, the device will enter the firmware update state after it is powered on again.