Method capable of controlling Internet of Things equipment to actively exit cyclic reset and intelligent gas meter

By realizing cyclic reset threshold value judgment and corresponding startup strategy in IoT devices, the problem of the device being unable to exit independently under cyclic reset state is solved, the stability and reliability of the device are improved, and maintenance costs are reduced.

CN120017491AActive Publication Date: 2025-05-16QIANWEI KROMSCHRODER METERS CHONGQING
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510479810.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-05-16
Estimated Expiration
2045-04-17

AI Technical Summary

Technical Problem

Low-power IoT devices cannot exit independently under cyclic reset state, resulting in the device being unable to work normally and communicate with the upper computer, and manual intervention is required to restore normality.

Method used

By realizing the cyclic reset threshold value judgment in the Internet of Things device, obtaining the cause of the last cyclic reset and adopting corresponding startup strategies, such as not loading the dead cycle risk software module, blocking the reset risk hardware module or rolling back operation commands, in order to try to actively exit the cyclic reset state.

Benefits of technology

It effectively solves the problem of autonomous recovery of IoT devices under cyclic reset state, improves the stability and reliability of the devices, and reduces maintenance costs and user impact.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120017491A_ABST
    Figure CN120017491A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of Internet of Things equipment, and discloses a method capable of controlling the Internet of Things equipment to actively exit cyclic reset and an intelligent gas meter, and the method comprises the following steps: A, after the software of the Internet of Things equipment is reset and started each time, obtaining a cyclic reset threshold value, step B, judging whether a loop reset state is entered or not according to a set loop reset threshold value, and if the loop reset state is entered, entering step B; otherwise, entering a normal working mode of the Internet of Things equipment; b, obtaining the reason of the last cycle reset, and adopting a corresponding starting strategy according to the reason to try to actively quit the cycle reset state; c, judging whether the starting strategy can enable the Internet of Things equipment software to quit the cyclic reset or not: if yes, entering a stable working mode of the Internet of Things equipment; and if not, entering a safe starting mode. According to the invention, after the Internet of Things equipment is repeatedly and circularly reset, measures can be taken to actively exit from the circular reset state, and stable work is recovered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things devices, and in particular relates to a method and an intelligent gas meter capable of controlling Internet of Things devices to actively exit a cycle reset. Background Art

[0002] Today, low-power IoT devices are becoming increasingly popular, especially devices such as smart gas meters and water meters, which often use low-power communication methods such as NB-IoT, and only have the ability to initiate communication between the device and the host computer, but not vice versa. Only when the device works normally can the interaction between it and the host computer be normal. Once the device enters a dead state or repeatedly resets, the host computer will lose contact with it forever and cannot monitor or manage it. Therefore, the software working stability of such IoT devices becomes an important indicator to measure their performance. However, due to software program design defects, sudden hardware failures, or even software programs executing undefined instructions or parameters, the device will fall into a repeated cycle reset state, resulting in failure to work normally and unable to communicate with the host computer. At this time, manual intervention must be carried out at the door to restore normality, including replacing equipment, upgrading software programs, etc. This method is inefficient, has huge maintenance costs, and also affects users' normal life or production.

[0003] The defect of the prior art is that there is a lack of an innovative method that can take measures to actively exit the cyclic reset state and resume stable operation after the IoT device undergoes repeated cyclic reset. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is: how to provide a method that can control the Internet of Things device to actively exit the cyclic reset state, after the Internet of Things device undergoes repeated cyclic reset, measures can be taken to actively exit the cyclic reset state and restore stable operation, providing opportunities and means for repairing its defects or problems.

[0005] In order to solve the above technical problems, the present invention adopts the following technical solution: a method for controlling an IoT device to actively exit a cyclic reset, comprising the following steps: Step A: After each reset and startup of the IoT device software, the cyclic reset threshold value is obtained, and whether the cyclic reset state has been entered is determined according to the set cyclic reset threshold value. If the cyclic reset state has been entered, step B is entered; otherwise, the IoT device enters the normal working mode; end; Step B: Obtain the reason for the last cycle reset, and adopt a corresponding startup strategy based on the reason to try to actively exit the cycle reset state; Step C: Determine whether the startup strategy can make the IoT device software exit the loop reset: if it can, enter the stable working mode of the IoT device; if not, enter the safe startup mode, and the IoT device enters the safe working mode; end.

[0006] The step A includes counting the number of resets in the most recent set time period after each reset is started, that is, determining the number of resets within the time length of entering the cyclic reset state, and if the number of resets exceeds the specified cyclic reset threshold value, it is determined that the software has entered the cyclic reset state. If the number of resets does not exceed the specified cyclic reset threshold value, the normal working mode is entered.

[0007] In step B, the reasons for the cyclic reset include watchdog reset, software active reset and software abnormal reset, and the corresponding startup strategy adopted is: do not load software modules with dead loop risks, shield hardware modules or resources with reset risks, and roll back operation commands.

[0008] When the IoT device enters the stable working mode, the IoT device works under the corresponding startup strategy, including not loading software modules with infinite loop risks; or shielding hardware modules or resources with reset risks; or rolling back operation commands and overwriting the most recent command words and parameters with previous command words and parameters.

[0009] Before executing step A, initial preparation work is also included, which includes the following steps: step1, start strategy 1 data table Save the number of software modules that can be loaded and initialized; Save the list of software modules that can be loaded and initialized, sorted in descending order of priority; step2, start strategy 2 data table Save the number of hardware modules or resources that can be loaded and initialized; Save the list of names of hardware modules or resources that may not be loaded and initialized, sorted in descending order of priority; Software or hardware modules that can be unloaded refer to certain functional modules that will not affect the operation of other functional modules when they are not loaded (not initialized and not used). The priority of unloading these modules is determined according to the degree of impact on the product's business implementation and the possibility of error. The smaller the impact of unloading and the higher the probability of error, the higher the priority of unloading the module, and it is ranked in the front; it is determined according to the specific situation of the device.

[0010] step3, start strategy 3 data table Save the number of commands that can be rolled back; Save a list of command names that can be rolled back, sorted in descending order of priority. The command with the smaller impact after rollback and the higher error probability has a higher priority. The priority is determined based on the specific situation of the device.

[0011] Step 4, loop reset status flag Set the software status flag to indicate that the device software has entered a cyclic reset state. This status flag can be permanently saved after the IoT device loses power. Step 5, start the strategy flag Set the startup policy flag to identify the startup policy that needs to be executed after the device software enters the loop reset state, including four values: startup policy 1, startup policy 2, startup policy 3, and startup policy 4. This flag can be permanently saved after the device is powered off; startup policy 1 is to not load the software module with dead loop risk, startup policy 2 is to shield the hardware module or resource with reset risk, startup policy 3 is to roll back the operation command; startup policy 4 is to enter the safe startup mode; if the corresponding startup policy 1, startup policy 2, and startup policy 3 cannot make the device exit the loop reset state, it will enter the safe startup mode and enter startup policy 4.

[0012] Step 6. Judgment index of software loop reset state Determine the reset times threshold value for entering the cyclic reset state; Determine the length of time to enter the loop reset state; step7, software reset reason flag Set the device software reset reason flag to identify the reason for the software reset, including software active reset, software abnormal reset, watchdog reset, and power-on reset. This flag can be permanently saved after the IoT device loses power. step8. Software startup times counter Set a global software startup counter. When the software is restarted for any reason other than power-on reset, the counter will automatically increase by 1 at the startup entry, and the counter will be permanently saved after the IoT device loses power. step9, operate the command word storage stack The operation command word storage stack is used to store the executed operation command words, which can be permanently stored after the IoT device loses power. When the operation command word storage stack is full, if the cycle reset state flag shows that it is not in the cycle reset state, the operation command word storage stack is immediately cleared. step10, historical operation command information storage The historical operation command information storage is used to save the operation command words and command parameters of each command that were executed twice in the past, and can be permanently saved after the IoT device loses power.

[0013] The key to the method of controlling the IoT device to actively exit the loop reset is: when an operation command needs to be rolled back, according to the startup strategy 3 data table, the corresponding command word that was most recently executed is taken out from the operation command word storage stack, and then the corresponding command word and its parameters that were last executed are found from the historical operation command information storage, and are re-executed to overwrite the latest executed parameters.

[0014] The key to the method of controlling the IoT device to actively exit the cyclic reset is that in the safe working mode, the most basic business functions and communication interaction functions of the IoT device are available, ensuring that maintenance personnel can upgrade the software of the IoT device remotely or on-site.

[0015] A smart gas meter includes the method for controlling an Internet of Things device to actively exit a cyclic reset. The key lies in that the Internet of Things device is a smart gas meter. When the smart gas meter is in a cyclic reset state, the method is used to actively exit the cyclic reset.

[0016] The smart gas meter, in the safe working mode, has the most basic business functions and communication interaction functions including the ability to ensure that the trade measurement or settlement of the gas meter is not affected, and the basic management capabilities of the local infrared serial port and the Internet of Things aerial remote communication, including software upgrades and restoration to the default factory configuration.

[0017] Significant effect: The present invention provides a method and a smart gas meter that can control the Internet of Things device to actively exit the cyclic reset. After the Internet of Things device undergoes repeated cyclic reset, measures can be taken to actively exit the cyclic reset state and restore stable operation, providing opportunities and means to repair its defects or problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a flow chart of the main method of the present invention; Figure 2 It is a detailed process flow chart of the present invention. DETAILED DESCRIPTION

[0019] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0020] like Figure 1-Figure 2 As shown, the present invention discloses a method for controlling an IoT device to actively exit a cyclic reset, and the specific implementation scheme is as follows: 1. Initial Preparation step1, start strategy 1 data table Save the number of software modules that can be loaded and initialized; Save the list of software modules that can be loaded and initialized, sorted from high to low; step2, start strategy 2 data table Save the number of hardware modules or resources that can be loaded and initialized; Save the list of names of hardware modules or resources that may not be loaded and initialized, sorted in descending order; step3, start strategy 3 data table Save the number of commands that can be rolled back; Save the list of command names that can be rolled back, sorted from high to low; Step 4, loop reset status flag Set the software status flag to indicate that the device software has entered a cyclic reset state. This status flag can be permanently saved after the device loses power. Step 5, start the strategy flag Set the startup strategy flag to identify the startup strategy to be executed after entering the cyclic reset state, including strategy 1, strategy 2, strategy 3, and strategy 4. This flag can be permanently saved after the device is powered off; Step 6. Judgment index of software loop reset state Determine the reset times threshold for entering the cyclic reset state; Determine the length of time to enter the loop reset state; step7, software reset reason flag Set the device software reset reason flag to identify the reason for the software reset, including active reset, software abnormal reset, watchdog reset, power-on reset, etc. This flag can be permanently saved after the device is powered off; step8. Software startup times counter Set a global software startup counter. When the software is restarted for any reason other than power-on reset, the counter will automatically increase by 1 at the startup entry, and the counter will be permanently saved after the device is powered off. step9, operate the command word storage stack Establish a stack data structure to save the executed operation command words. This data structure can be permanently saved after the device is powered off. When the stack is full, if the loop reset status flag shows that it is not in the loop reset state, the stack is immediately cleared.

[0021] step10, historical operation command information storage Establish a data structure to save the operation command words and command parameters of each command executed twice in the past. This data structure can be permanently saved after the device loses power. When an operation command needs to be rolled back, the most recently executed command word is taken out from the operation command word storage stack, and then the corresponding last executed command word and its parameters are found from the historical operation command information storage, and re-executed to overwrite the most recently executed parameters.

[0022] 2. How to judge whether the device software enters the judgment loop reset state After each reset is started, the number of resets in the most recent time period (i.e., the length of time for determining the cyclic reset state, such as 0.5 or 1 hour) is counted. If the number of resets exceeds the specified cyclic reset threshold (i.e., the reset number threshold for determining the cyclic reset state, such as 10 times), it is determined that the software has entered the cyclic reset state.

[0023] 3. Implementation plan After each reset and startup of the device software, it determines whether it has entered the cyclic reset state based on the set value.

[0024] If it is determined that the device has entered a loop reset state, the device will further try to actively exit the loop reset state based on the cause of the last reset, and adopt strategies such as rolling back the most recent operation command, not loading software modules with a risk of dead loops, and not loading hardware modules that may cause the software to not work properly, so that the device software can work stably. If the above startup strategies still cannot restore the device software to normal, the device will finally enter the safe mode startup, that is, to ensure that the most basic business functions and communication interaction functions are available, so that maintenance personnel have the opportunity to upgrade the device software remotely or on-site, thereby repairing the original software defects.

[0025] The detailed process flow of the scheme is as follows: Figure 2 As shown, the following steps are included: 1. Reset and start; 2. Determine whether it is a power-on reset. If not, go to step 3; if yes, go to step 4; 3. The number of reset starts is increased by 1; 4. Determine whether it is in the loop reset state. If not, go to step 5; if yes, go to step 11; 5. Count the number of startups within the set time; 6. Check whether the loop reset condition is met; if not, initialize and run normally and end; if yes, go to step 7; 7. Set the flag to enter the cycle reset state; Determine whether the watchdog is reset. If not, go to step 8. If yes, set the flag for executing startup strategy 1 and go to step 11. 8. Determine whether the software actively resets. If not, go to step 9; if yes, set the flag for executing startup strategy 2 and go to step 11; 9. Determine whether the software is reset abnormally. If not, go to step 10; if yes, set the flag for executing startup strategy 3 and go to step 11; 10. Set the execution startup strategy 4 flag; 11. Determine whether to execute strategy 1. If yes, go to step 12; if no, go to step 16; 12. Determine whether the device software still cannot be restored to normal after executing strategy 1. If yes, go to step 22; if not, unload the software modules with the risk of dead loop in sequence; 13. Execute the initialization of startup; 14. Start the timer; 15. When the timing is up, determine whether the number of reset starts within the set time is less than the threshold. If so, clear the cyclic reset state and the start strategy flag, and end; if not, perform no operation, and end; When a risky module is cancelled, such as module 5, the device resumes normal operation and no longer performs cyclic reset, then the cyclic reset state and the startup strategy flag are cleared; otherwise, the next time module 6 is cancelled, other modules can still be loaded normally.

[0026] 16. Determine whether to execute strategy 2. If yes, go to step 17; if no, go to step 19; 17. Determine whether the device software still cannot be restored to normal after executing strategy 2. If so, go to step 22; if not, shield the hardware modules or resources with reset risks in turn; 18. Perform startup initialization; go to step 14; 19. Determine whether to execute strategy 3. If yes, go to step 20; if no, go to step 23; 20. Determine whether the device software still cannot be restored to normal after executing strategy 3. If yes, go to step 22; if not, roll back the most recently executed operation commands in sequence; 21. Perform startup initialization; go to step 14; 22. Set the startup strategy flag to 4, and go to step 24; 23. Determine whether to execute strategy 4. If not, perform no operation; if yes, go to step 24; 24. Execution strategy 4 starts; 25. Load each module in the safe working mode and perform startup initialization; 26. Start the timer; 27. When the timing is up, determine whether the number of reset starts within the set time is less than the threshold. If so, clear the cyclic reset state and the start strategy flag and end; if not, perform no operation and end.

[0027] In the above program steps, steps 14 and 15 start the timer to determine whether the device can work stably and continuously after the corresponding software module, hardware module or rollback command is canceled. If the number of reset starts within the set time is less than the threshold value, the device can work normally and the cyclic reset state is cleared, indicating that the device can continue to work.

[0028] Step 27 starts a timer to determine whether the IoT device can work normally after starting the safe working mode. If the number of reset starts within the set time is less than the threshold, the cyclic reset state is cleared, indicating that the device can continue to work in the safe working mode.

[0029] A no-op does nothing.

[0030] IV. Innovations and Features 1. Built-in local and remote adjustable startup strategy tables. When the device software is started, the current initialization startup strategy is controlled according to the previously recorded reset information and this table.

[0031] 2. Supports two modes: normal working mode and safe working mode. The safe working mode defines the minimum function set (module set) that can ensure reliable startup and maintain normal operation. In this mode, it can ensure that the trade measurement or settlement of the gas meter is not affected, and can ensure the basic management capabilities of the local infrared serial port and the Internet of Things air remote, including upgrading software and restoring to the default factory configuration.

[0032] When the device falls into a cyclic reset, the software will automatically enter safe mode if it still cannot return to normal after processing according to the preset algorithm, providing maintenance personnel with the opportunity and means to manually intervene to exit the abnormal state of the device.

[0033] 3. Set up historical storage for the instructions sent by the host computer, record the command words, parameters and execution time points. Used to control the device software to roll back the execution results of specific instructions. To eliminate the software loop reset state caused by the execution of these instructions.

[0034] 4. Every time the MCU or single-chip microcomputer is reset, record the reason for the reset and the time of occurrence, including software abnormal reset, hardware watchdog reset, active reset, etc.

[0035] 5. Each time the software program is started, the startup time and the cumulative number of startup times are recorded.

[0036] By judging whether the number of reset starts in the recent period of time reaches the specified value, it is determined that the cyclic reset state has been entered.

[0037] 6. After the software program determines that it has entered the loop reset state, it will try to actively exit the loop reset state one by one according to the methods in the preset or set startup strategy table until it finally enters the safe mode startup.

[0038] 7. After returning to a stable working state, the IoT device sends a cyclic reset error report to the host computer; after receiving the cyclic reset report, the host computer can update the corresponding software or notify maintenance personnel to come to the site for repair.

[0039] V. Benefits and advantages of this innovative solution 1. Significantly improve device stability: Through intelligent reset processing and flexible startup strategies, the probability of the device falling into a cyclic reset state is effectively reduced, and the device's ability to maintain continuous normal operation is improved.

[0040] 2. Reduce maintenance costs: By maintaining remote communication capabilities and key functions, time and means are provided for equipment to recover from a faulty state, so that equipment can be quickly restored remotely when problems occur, avoiding the cost of maintenance personnel visiting the site or even having to directly replace the equipment.

[0041] 3. Improve user experience: Gas meters and other devices are distributed in thousands of households. Faulty meters can be quickly repaired without users being aware of or disturbed.

[0042] In summary, this innovative method effectively solves the problem that low-power IoT devices cannot actively exit in a cyclic reset state through a series of intelligent processing mechanisms and flexible methods, thereby enabling maintenance personnel to quickly and cost-effectively repair device software anomalies, shortening the average failure time of the equipment, and providing a strong guarantee for the working stability and reliability of IoT devices during their life cycle.

[0043] The above are only preferred implementations of the present invention. It should be pointed out that a number of modifications and improved technical solutions made by those skilled in the art without departing from the technical solution should also be deemed to fall within the scope of protection required by the claims.

Claims

1. A method for controlling an IoT device to actively exit a cyclic reset, characterized in that: The steps include: Step A: After each reset and startup of the IoT device software, the cyclic reset threshold value is obtained, and whether the cyclic reset state has been entered is determined according to the set cyclic reset threshold value. If the cyclic reset state has been entered, step B is entered; otherwise, the IoT device enters the normal working mode; Step B: Obtain the reason for the last cycle reset, and adopt a corresponding startup strategy according to the reason to try to actively exit the cycle reset state; Step C: Determine whether the startup strategy can make the IoT device software exit the loop reset: if it can, enter the stable working mode of the IoT device; if not, enter the safe startup mode, and the IoT device enters the safe working mode.

2. The method for controlling an IoT device to actively exit a cyclic reset according to claim 1, characterized in that: The step A includes counting the number of resets in the most recent set time period after each reset is started, and if the number of resets exceeds a specified cyclic reset threshold, it is determined that the software has entered a cyclic reset state.

3. The method for controlling an IoT device to actively exit a cyclic reset according to claim 1, characterized in that: In step B, the reasons for the cyclic reset include watchdog reset, software active reset and software abnormal reset, and the corresponding startup strategy adopted is: do not load software modules with dead loop risks, shield hardware modules or resources with reset risks, and roll back operation commands.

4. The method for controlling an IoT device to actively exit a cyclic reset according to claim 3, characterized in that: Before executing step A, initial preparation work is also included, which includes the following steps: step1, start strategy 1 data table; Save the number of software modules that can be loaded and initialized; Save the list of software modules that can be loaded and initialized, sorted in descending order of priority; step2, start strategy 2 data table; Save the number of hardware modules or resources that can be loaded and initialized; Save the list of names of hardware modules or resources that may not be loaded and initialized, sorted in descending order of priority; step3, start strategy 3 data table; Save the number of commands that can be rolled back; Save a list of command names that can be rolled back, sorted in descending order of priority; Step 4, loop reset status flag; Set the software status flag to indicate that the device software has entered a cyclic reset state. This status flag can be permanently saved after the IoT device loses power. step5, start the strategy flag; Set the startup strategy flag to identify the startup strategy that needs to be executed after the device software enters the cyclic reset state, including startup strategy 1, startup strategy 2, startup strategy 3, and startup strategy 4. This flag can be permanently saved after the IoT device loses power; Startup strategy 1 is to not load software modules with dead loop risk, startup strategy 2 is to shield hardware modules or resources with reset risk, and startup strategy 3 is to roll back operation commands; Startup strategy 4 is to enter the safe startup mode; step6, judgment index of software loop reset state; Determine the reset times threshold value for entering the cyclic reset state; Determine the length of time to enter the loop reset state; step7, software reset reason flag; Set the device software reset reason flag to identify the reason for the software reset, including software active reset, software abnormal reset, watchdog reset, and power-on reset. This flag can be permanently saved after the IoT device loses power. step8, software startup times counter; Set a global software startup counter. When the software is restarted for any reason other than power-on reset, the counter will automatically increase by 1 at the startup entry, and the counter will be permanently saved after the IoT device loses power. step9, operate the command word storage stack; The operation command word storage stack is used to store the executed operation command words, which can be permanently stored after the IoT device loses power. When the operation command word storage stack is full, if the cycle reset state flag shows that it is not in the cycle reset state, the operation command word storage stack is immediately cleared. step10, historical operation command information storage; The historical operation command information storage is used to save the operation command words and command parameters of each command that were executed twice in the past, and can be permanently saved after the IoT device loses power.

5. The method for controlling an IoT device to actively exit a cyclic reset according to claim 4, characterized in that: When an operation command needs to be rolled back, according to the startup strategy 3 data table, the corresponding command word that was most recently executed is taken out from the operation command word storage stack, and then the corresponding command word and its parameters that were last executed are found from the historical operation command information storage, and re-executed to overwrite the latest executed parameters.

6. The method for controlling an IoT device to actively exit a cyclic reset according to claim 1, characterized in that: In the secure working mode, the business functions and communication interaction functions of the IoT device are available, enabling the software of the IoT device to be upgraded remotely or on-site.

7. A smart gas meter, using the method for controlling an Internet of Things device to actively exit a cycle reset as described in any one of claims 1 to 6, characterized in that: The Internet of Things device is a smart gas meter. When the smart gas meter is in a cyclic reset state, the described method is used to actively exit the cyclic reset.

8. The smart gas meter according to claim 7, characterized in that: In the safe working mode, the business functions and communication interaction functions include the following functional modules: trade measurement or settlement, local infrared serial port and IoT air remote communication, software upgrade and restoration to the default factory configuration.

Citation Information

Patent Citations

  • Method and device for improving reliability of communication equipment

    CN101247615A

  • Method and device for controlling frequent resetting of embedded software

    CN101751330A

  • Method and device for diagnosing abnormal reset of main control module and main control module

    CN111813590A

  • Base station software version rollback control method and device, base station and readable storage medium

    CN112702183A

  • Embedded platform executable file on-line loading software

    CN113064667A