A power down hold method for a communication device
By acquiring backup power supply current in real time and dynamically filtering data items, dividing atomic write units, terminating write tasks, and combining with a low-power locking strategy, the write interruption problem when communication equipment loses power is solved, improving data integrity and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN WENJIAN ELECTRONIC TECHNOLOGY CO LTD
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies lack dynamic perception and assessment of backup power supply capabilities when communication equipment loses power, resulting in ineffective matching of write tasks, which can easily lead to write interruptions and data loss. Existing write control strategies fail to adjust in real time according to the voltage change trend of backup power supplies.
By acquiring the maximum instantaneous current of the backup power supply in real time, data items are dynamically filtered, divided into multiple atomic write units, and the write task is terminated when the voltage approaches the safe threshold. Combined with a low-power lockout strategy, data integrity and system stability are ensured.
It improves the reliability of data writing and the fault recovery capability of communication equipment, reduces the probability of write failure, and enhances the robustness and stability of the system.
Smart Images

Figure CN122111753A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication data protection technology, and more specifically, to a method for power-off retention of communication equipment. Background Technology
[0002] With the widespread application of communication equipment in industrial control, remote monitoring, and IoT terminals, the communication status data, transaction progress information, and system context data generated during operation often play a crucial supporting role in restoring the equipment's state after a restart and ensuring business continuity. In various complex application scenarios, communication equipment may experience a sudden loss of main power supply due to unplanned factors such as sudden power outages, external power interruptions, or abnormal resets. If critical data cannot be written to storage completely and securely in a timely manner, it can easily lead to a series of serious problems such as communication logic corruption, business process interruption, and loss of data consistency.
[0003] To ensure data integrity in communication equipment during power outages, existing technologies commonly employ auxiliary power supply schemes, such as integrated supercapacitors or lithium batteries, to provide temporary power to the equipment after the main power supply fails, enabling it to complete the data writing process. However, such solutions still face significant technical bottlenecks in practical applications: Write tasks after a power outage often require immediate access to non-volatile memory (such as Flash memory), which typically experiences high instantaneous current demands during the write initiation phase. If this current exceeds the output capacity of the backup power supply, it will directly cause a sharp drop in the backup power supply voltage, or even a complete power outage, leading to an interruption in the write operation, preventing the completion of the data structure writing process, and resulting in incomplete "dirty data." Existing technologies lack a dynamic sensing and evaluation mechanism for the actual power supply capacity of backup power during the power failure response phase. Most write control strategies employ static configuration, failing to effectively match and schedule write tasks based on the actual remaining power, output current capacity, and voltage change trends of the backup power supply. This makes it impossible to dynamically tailor write tasks according to instantaneous load conditions, easily leading to excessive power consumption or data loss. Furthermore, existing technologies often use fixed thresholds as triggering mechanisms for determining the termination timing of data writing, failing to dynamically adjust in real-time according to the voltage drop trend of the backup power supply. This results in trigger delays or premature triggering, affecting write integrity and state consistency. Therefore, this invention proposes a power failure retention method for communication equipment to address the aforementioned problems. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides the following technical solution: A method for power-off retention in communication equipment includes the following steps: When the communication equipment detects a power failure signal from the main power supply, the power control circuit obtains the maximum instantaneous current currently provided by the backup power supply in real time and transmits this maximum instantaneous current to the data writing control process. The data write control process performs data filtering, determines the data items to be written by preset write priority, and forms the minimum data set to be written under the current current conditions. The minimum data set is divided into multiple atomic write units, each atomic write unit is assigned a unique state record tag, and write address verification and pre-charging preparation of the target area are completed in non-volatile memory. During the period when the backup power supply provides energy, the data writing operations of the atomic writing units are executed sequentially according to a predetermined order. After each atomic writing unit is completed, the corresponding status record flag is immediately updated, and the changing trend of the backup power supply output voltage is continuously monitored. When the backup power supply output voltage approaches the preset voltage safety threshold, the unfinished write tasks are stopped, and the status record mark of the completed atomic write unit and the integrity verification information are written to the independent storage area.
[0005] In a preferred embodiment, when the backup power supply voltage drops to the shutdown critical point, the power-down recovery control circuit puts the communication equipment into a low-power lockout state, shuts down unnecessary functional components, maintains stable status information, and provides data support for subsequent communication recovery.
[0006] In a preferred embodiment, the maximum instantaneous power supply capacity of the backup power supply is pre-assessed by the communication equipment during normal operation, specifically including the following steps: After the communication equipment completes initialization, a pulse load of fixed amplitude is periodically applied to the backup power supply through the power control circuit. During each test, the maximum drop value of the backup power supply output voltage and the corresponding voltage recovery time are recorded. The voltage drop value and voltage recovery time are compared with the preset standard reference value. When the voltage drop is less than the reference drop threshold and the recovery time is less than the reference recovery time threshold, it is recorded as a stable output event, and the current value applied in this test is recorded. After collecting multiple stable output events, the average value of the current values in all tests is calculated, and the 95% confidence lower limit of this average value is taken as the maximum instantaneous power supply capacity parameter of the backup power supply, i.e., the maximum instantaneous current.
[0007] In a preferred embodiment, the following operations are performed before data filtering: During the design phase of communication equipment, the output voltage-time curve and corresponding current change curve of the backup power supply under the communication write load are obtained through power-down discharge test, and a usable energy model of the backup power supply from the initial operating voltage to the minimum allowable operating voltage is established accordingly. The total effective energy provided by the backup power supply during the power supply phase is calculated based on the available energy model. Based on the average energy consumption per byte written by the communication equipment during the design phase, the total effective energy of the backup power supply is converted into the theoretical maximum total number of writable bytes, which is used to evaluate the upper limit of the data writing capacity. Based on the capacity limit, a fixed proportion of redundant energy is reserved as buffer space, and the maximum write byte limit is modified as a constraint for data filtering.
[0008] In a preferred embodiment, the total effective energy provided by the backup power source during the power supply phase, calculated based on the available energy model, refers to: Under the condition of known initial operating voltage and minimum allowable operating voltage, the discharge process of the backup power supply under simulated write load is recorded to obtain voltage change curves and current change curves. The product of the instantaneous voltage value and the corresponding current value within the corresponding time period is taken as the instantaneous power. The total effective energy output by the backup power supply within the power outage window is estimated by performing an integral approximation process over the entire test time period.
[0009] In a preferred embodiment, the minimum data set refers to: All data to be written is categorized according to data type, including communication status data, incomplete transaction data, and system runtime context data, and a fixed writing priority order is set for different categories; Based on the maximum write byte limit corrected by the backup power supply, data entries are selected sequentially from the high priority category according to the preset priority order until the cumulative write capacity reaches the data filtering constraint. A compression strategy is applied to the selected data entries. Based on the actual structural characteristics of each data entry, a structural optimization or field pruning method is selected to reduce the write volume of a single data entry, ultimately forming the smallest data set to be written under the current conditions.
[0010] In a preferred embodiment, dividing the minimum data set into multiple atomic write units means: The smallest set of data is divided into independent data blocks according to the logical boundaries of the data. Each data block is an atomic write unit, and each atomic write unit is allocated an independent contiguous storage address to avoid logical inconsistencies caused by cross-area writes. Each atomic write unit is assigned a unique status record tag, which includes the atomic write unit number, write completion flag and integrity check code, and is used for data consistency verification and fault recovery location after the write is completed; Before writing, the address validity of the target write region in the non-volatile memory is checked according to the preset verification standard to confirm that the write address is within the legal write range and does not overlap with the address of the current write task. At the same time, a pre-charge operation is performed on the target region to improve the write success rate and reduce the initial load impact. Finally, the target write region that has passed the verification is bound to the corresponding atomic write unit.
[0011] In a preferred embodiment, the backup power supply output voltage approaching a preset voltage safety threshold means: Calculate the difference between the current backup power supply output voltage and the preset voltage safety threshold, and determine the acquisition time window length of the voltage change sequence based on the difference through a linear mapping method. The smaller the difference, the longer the acquisition time window, which is used to enhance the accuracy of the judgment of voltage change trend. Within the data collection window, the maximum voltage drop and the average rate of voltage drop are statistically analyzed, and the two are combined according to a preset weighting coefficient to form an intensity index of the current voltage change. Based on the interval where the intensity index is located, the corresponding adjustment factor is obtained from the preset mapping table, the original preset termination write trigger difference is incrementally adjusted, and the current voltage difference is compared with the dynamically adjusted trigger difference. If the former is less than the latter, the incomplete write task is terminated, and the status record mark and integrity verification information of the completed atomic write unit are written to the independent storage area.
[0012] In a preferred embodiment, estimating the peak write current of each data block in a single write operation during the process of dividing the smallest data set into multiple atomic write units specifically includes the following steps: The standard write current value per unit page is obtained by looking up a table based on the type of non-volatile memory used. The length of the target data block is divided by the length of the unit page and rounded up to obtain the theoretical number of pages to be written. Multiply the theoretical number of pages written by the unit page write current value to obtain the theoretical total current value of the data block under the condition of no boundary correction. Determine whether the first write address of the data block is aligned with the starting address of the target memory page. If not aligned, increase the theoretical number of pages to be written by 1, and multiply the increased number of pages by the unit page write current value to obtain the total current value after boundary alignment correction. Based on the number of parallel write channels, the total current value after boundary correction is adjusted by the number of channels. The adjustment method is as follows: the total current value is scaled by using the reciprocal of the square root of the number of parallel channels as a reference factor to obtain the peak value of the write current of the data block. Only when the peak value of the write current does not exceed the maximum instantaneous power supply capacity parameter of the backup power supply is the data block regarded as an atomic write unit. Otherwise, it is split into multiple data blocks to reconstruct the atomic write unit.
[0013] The technical effects and advantages of this invention are as follows: This invention, upon detecting a main power failure signal in the communication device, immediately invokes the power control circuit to obtain the maximum instantaneous current currently available from the backup power supply in real time. This current parameter is then transmitted to the data write control process, enabling accurate perception of the current power supply capability before writing. This avoids blind writing under insufficient power conditions, especially during the initial stage of writing to non-volatile memory where large current surges may occur. This feature significantly reduces the probability of write failures due to power supply mismatch, facilitating the safe initiation of the write task within the limited time of the power failure response. It is a key guarantee for improving the electrical safety of power-down write operations.
[0014] This invention employs a priority-based filtering process in its data write control flow to select data to be saved, retaining only data items that can be written under the current power supply conditions and generating a minimal data set. This set is further divided into multiple atomic write units, each with a unique status record marker and a mapping relationship bound to a non-volatile memory address. The write process follows a strict sequential execution and status update mechanism. This structure offers high traceability and recoverability. In the event of an unexpected interruption, the completion status can be quickly determined through the status record, allowing for selective rewriting or recovery, significantly improving the reliability of the data write process and the fault recovery capability of communication equipment.
[0015] This invention continuously monitors the changing trend of the backup power supply output voltage during the execution of the atomic write unit, and uses the voltage approaching a preset voltage safety threshold as the criterion for terminating incomplete write tasks. Compared to traditional mechanisms based on timed or fixed page count completion, this method dynamically adjusts the write process according to the actual remaining energy of the backup power supply, ensuring that writing actively stops before the voltage enters the critical region. It then saves the status record markers and integrity verification information of completed atomic write units to an independent storage area, thereby guaranteeing the integrity and subsequent recoverability of the written data. This approach effectively prevents the risk of an "incomplete write" state being mistaken for a completed state, reduces the probability of data corruption during communication device restarts or communication recovery, and significantly enhances the robustness of the power-down retention mechanism and system stability. Attached Figure Description
[0016] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings; Figure 1 This is a schematic diagram of a power-off retention method for communication equipment according to the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0018] Reference Figure 1 The following examples were obtained: Example 1: A method for power-off retention in communication equipment, comprising the following steps: When the communication equipment detects a main power failure signal, the power control circuit obtains the maximum instantaneous current currently provided by the backup power supply in real time and transmits this maximum instantaneous current to the data write control process. The first trigger mechanism for power failure response is established. The power control circuit realizes real-time perception of the backup power supply capability and obtains the maximum instantaneous current parameter as the basic indicator for write behavior decision-making. This enables the synchronization and matching between subsequent write actions and power supply capability, prevents the write process from being interrupted due to insufficient current, and improves the data write success rate under power failure conditions.
[0019] The data write control process performs data filtering, determines the data items to be written based on preset write priorities, and forms the minimum data set to be written under the current current conditions. Considering the limited backup power supply capacity in the event of a main power failure, the most critical data items are dynamically filtered. Based on the preset write priority strategy, data content that is crucial to communication status recovery and system restart is retained first. The current maximum instantaneous current is used as a constraint to control the minimum data set selected to be within the range that can be written, ensuring maximum resource utilization and system recovery stability.
[0020] The minimum data set is divided into multiple atomic write units, each with a unique status record tag. Write address verification and target region pre-charge preparation are performed in non-volatile memory. By using an atomic partitioning strategy, the minimum data set is divided into data units with independent write boundaries, ensuring integrity and verifiability in each write operation. The status record tag of each atomic write unit is used to indicate the write completion status and consistency verification information. At the same time, the validity verification of the target address and pre-charge preparation are performed before the actual write, which can improve the write success rate and avoid write failures caused by address conflicts and initial load shocks.
[0021] During the period when the backup power supply provides energy, the data writing operations of the atomic writing units are executed sequentially according to a predetermined order. After the writing task of each atomic writing unit is completed, the corresponding status record flag is updated immediately, and the change trend of the backup power supply output voltage is continuously monitored. Within the backup power supply time window, time and power resources are used efficiently to execute the data saving operation of the atomic writing units one by one, and the writing progress is recorded by updating the status record flag in real time, which facilitates subsequent recovery. At the same time, the change trend of the backup power supply output voltage is monitored in real time to provide a dynamic basis for determining whether the writing needs to be stopped, preventing incomplete writing due to sudden voltage drops and ensuring data integrity.
[0022] When the backup power supply output voltage approaches the preset voltage safety threshold, unfinished write tasks are stopped, and the status record markers and integrity verification information of completed atomic write units are written to an independent storage area. Before the backup power supply reaches its critical power supply capacity, write tasks that may not be completed are proactively terminated to avoid data corruption caused by "partial writes." At the same time, the status record markers and integrity verification information of all completed atomic write units are centrally written to an independent storage area, which facilitates accurate determination of which data has been successfully written and which needs to be rolled back or rewritten after the device restarts, thereby achieving a highly reliable power failure recovery mechanism.
[0023] To ensure system protection is completed before the remaining power provided by the backup power supply is completely depleted, a low-power latching strategy based on a shutdown threshold is designed. This strategy is triggered when the backup power supply voltage drops to the shutdown threshold. A series of progressive energy consumption convergence control procedures are executed through the power-down recovery control circuit to ensure that the stored state of completed data is not destroyed and to provide complete data support for the initialization and state recovery of the communication equipment after power failure. The specific process is as follows: After the backup power supply output voltage gradually decreases to a preset voltage safety threshold, the communication equipment initiates a high-frequency sampling process of the backup power supply voltage through the power-down recovery control circuit. Based on the changing trend in the sampling sequence, it determines whether it is close to the shutdown threshold. The shutdown threshold differs from the preset voltage safety threshold; it is defined as the minimum operating voltage required for the backup power supply to maintain extreme energy consumption functions (such as writing metadata, maintaining latch states, etc.), and is typically 0.1V to 0.2V lower than the preset voltage safety threshold. For example, when the preset voltage safety threshold is 2.9V, the shutdown threshold can be set to 2.7V. At this stage, although the unfinished write tasks have been aborted, some functions in the communication device are still active. To prevent these functions from continuing to consume energy and affecting the integrity of the metadata, further energy compression operations are required.
[0024] When the backup power supply output voltage drops to near the shutdown threshold, the communication equipment immediately triggers a functional component compression process. Through the power-down recovery control circuit, it sequentially shuts down non-essential functional components, including RF transmitters, external interface communication, timer clock sources, and high-power logic units. This compression process aims to minimize continuous power consumption, retaining only essential units capable of maintaining critical static data, such as read-only memory interfaces, power-down protection register access paths, and control state latching mechanisms. For example, in a certain type of communication module, the system standby power consumption before compression was 23mW, which can be reduced to below 5mW after functional compression, effectively delaying the backup power supply's discharge time window and providing sufficient time for the final data locking operation.
[0025] After all non-essential functional components are successfully shut down, the communication device enters a low-power lock-up preparation state. At this point, the power-down recovery control circuit executes a state information preservation mechanism. This mechanism includes reloading and writing the state record tags and integrity verification information of completed atomic write units to a mirror area in an independent storage region, and locking the current write state through a control register. This process ensures that after a complete power loss, the confirmation state of the last write can be restored in read-only mode upon restart, avoiding metadata corruption or loss due to unexpected write interruptions. For example, by setting a 32-bit lock tag area, using 4-bit verification logic to generate independent check values and appending them to each group of state record tags, data consistency verification after recovery can be achieved.
[0026] When the backup power supply output voltage drops below the shutdown critical point, the communication equipment automatically enters a low-power lockout state. All logic timing stops, write channels are closed, and the processor core stops instruction parsing, retaining only the latch state hold function within the power domain. This lockout state persists until the backup power supply is completely depleted, and is automatically released from the lockout state by the reserved register during the next main power supply restart and initialization, rebuilding the interrupt vector and task execution queue. Through this design, even if the backup power supply voltage eventually drops to only 2.5V, metadata can be held for more than 200ms, ensuring sufficient recovery accuracy and reliability of the system.
[0027] By introducing a dual voltage threshold mechanism of "preset voltage safety threshold" and "shutdown critical point," this implementation achieves decoupled control between the data writing phase and the system state maintenance phase. The former dynamically determines whether the writing task should be aborted, avoiding the inconsistency risk caused by incomplete data; the latter controls the power consumption capping and state locking of the communication equipment to support data integrity maintenance and recovery environment construction. This hierarchical voltage control strategy not only improves the utilization efficiency of backup power but also significantly enhances the system's survivability in power outage scenarios.
[0028] When the communication equipment is in normal operation, the maximum instantaneous power supply capacity of the backup power supply is pre-assessed through an active measurement mechanism. This embodiment proposes a periodic pulse load assessment method to dynamically capture the actual power supply capacity of the backup power supply and extract the lower limit constraint. The specific process is as follows: After the communication equipment completes initialization, the communication power supply control circuit enters the pulse test mode. This mode is periodically triggered during the idle period of the communication equipment, applying a pulse load of fixed amplitude to the backup power supply, for example, set to 120% of the rated write current, to simulate the current peak that may occur during the non-volatile memory start-up write phase. During each pulse test, the voltage change curve at the output terminal of the backup power supply is acquired through a high-precision analog-to-digital conversion circuit, focusing on recording the maximum voltage drop value after the pulse load is activated, and the voltage recovery time after the pulse ends. Taking a typical lithium-ion battery as an example, when a 30mA pulse load is applied, its voltage may drop from 3.3V to 3.05V, with a recovery time of 28ms. This type of data will be used for subsequent output stability determination.
[0029] After each round of pulse testing, the recorded voltage drop and voltage recovery time are compared with preset standard reference values. These preset standard reference values are based on the minimum power stability requirements of the communication equipment's write behavior, for example, setting the voltage drop to no more than 0.3V and the voltage recovery time to no more than 30ms. When both conditions are met, the pulse loading is considered a stable output event, and the applied pulse current value is recorded. If multiple stable output events are obtained consecutively within a test cycle, the current backup power supply can be considered to have a certain short-term peak load capacity.
[0030] After accumulating a certain number of stable output events during long-term operation, the communication equipment performs statistical analysis on all recorded applied current values, calculates the average value of the sample set, and further constructs its confidence interval. Selecting multiple stable output events closest to the current time allows for a better dynamic reflection of changes in power supply capacity as the power supply ages and its self-discharge characteristics change. To improve safety margins, without sacrificing evaluation accuracy, the 95% lower confidence limit of this average value is selected as the maximum instantaneous power supply capacity parameter of the backup power supply. Taking 20 test samples as an example, if the average applied current is 28mA and the standard deviation is 1.2mA, the 95% lower confidence limit obtained after statistical calculation is approximately 26.5mA. The communication equipment defines this value as the maximum instantaneous current that the backup power supply can bear and uses it as a constraint condition in the data writing control process, passing it to subsequent screening and partitioning steps. This maximum instantaneous current parameter is used as a key basis for determining the writable data capacity and partitioning the atomic writing unit size in power-down scenarios. Its accuracy directly affects the executability of the entire power-down retention process and the effectiveness of data integrity assurance. Compared to the traditional fixed threshold setting method, this implementation method constructs an evaluation closed loop by the communication equipment itself, which can track the performance fluctuation of the backup power supply in real time without relying on external testing instruments, and can dynamically adjust the power supply capacity parameters as the power supply ages and changes in self-discharge characteristics, thus having stronger adaptability and robustness.
[0031] Before performing data filtering, the following steps are performed: During the communication equipment design phase, a dynamic discharge response model of the backup power supply under communication write loads is constructed. This process is implemented through power-down discharge testing, which simulates real power-down scenarios. Under a set load (e.g., continuous EEPROM data streaming), the entire process of the backup power supply gradually discharging from its initial operating voltage (e.g., 3.3V) to the minimum allowable operating voltage (e.g., 2.4V) is recorded, and the output voltage-time curve and current change curve are recorded simultaneously. This test needs to cover multiple load intensity levels to generate multiple sets of response data to adapt to data write requirements under different scenarios. For example, under a 1.5A load, the discharge time is 180ms, the voltage change range is from 3.3V to 2.5V, and the current shows a high initial value followed by a gradual decrease.
[0032] Based on the voltage and current curves obtained above, a model of the available energy of the backup power supply from the initial operating voltage to the minimum allowable operating voltage is established. This model uses time as the integration variable, accumulating the instantaneous power at each moment. Specifically, it multiplies the voltage and corresponding current value at each sampling point to obtain the instantaneous power, and then performs an integral approximation over the time interval. For example, with a sampling period of 1 ms, the voltage and current products within each ms are summed, divided by the total time to obtain the average power, and then multiplied by the continuous discharge duration to estimate the total effective energy value. Tests show that the total output energy of a certain specification supercapacitor under specified conditions is 0.56 joules.
[0033] The total effective energy provided by the backup power supply during the power supply phase is converted into the theoretical maximum writable bytes. This conversion is based on the average energy consumption per byte written, as evaluated during the design phase of the communication equipment under different write load conditions. For example, for a typical Flash device, the average energy consumption per byte written is 2.8 μJ, so the total energy of 0.56 joules theoretically supports a maximum of 200KB of data writing. However, considering the potential additional overhead during writing, this upper limit should be adjusted for safety.
[0034] Based on the theoretical maximum writable bytes, a fixed proportion of redundant energy is set as a buffer to absorb the impact of sudden write surges or power shifts caused by uneven voltage drops. Under normal settings, this redundancy ratio can be between 15% and 25%. Taking the previous example, 25% redundancy is retained in the 200KB upper limit data, meaning the final write capacity limit is set to 150KB. This correction value will serve as a constraint in the data write control process, guiding the subsequent data filtering module to prioritize high-priority critical data when generating the minimum data set, and keeping the overall write task operating within a controllable energy range, significantly improving write success rate and communication recovery capability under power failure conditions.
[0035] The minimum data set refers to the classification of all data to be written according to functional attributes before the communication device enters the power-down response phase. This primarily includes three dimensions: communication status data, incomplete transaction data, and system runtime context data. Communication status data includes current link status, heartbeat statistics, and access authentication status; incomplete transaction data includes buffered data frames to be sent or partially received but not yet processed transaction structures; and system runtime context data includes task scheduling queue status, register snapshots, and exception trigger flags. Based on this classification, a fixed write priority is preset for each category. For example, communication status data has the highest priority (Level 1), incomplete transaction data has a medium priority (Level 2), and system runtime context data has a low priority (Level 3). This priority setting is based on the importance of real-time recovery of communication tasks and the difficulty of data reconstruction, providing a basis for subsequent filtering decisions.
[0036] After data classification and priority settings are completed, capacity constraints are allocated based on the maximum write byte limit adjusted by the backup power supply. The write control process selects specific data entries sequentially from the highest priority data category according to the preset priority order, until the cumulative write capacity reaches the data filtering constraint. For example, if the maximum write byte limit is 80KB, and the total data in Level 1 category is 20KB, Level 2 is 30KB, and Level 3 is 50KB, then all Level 1 and Level 2 data entries are prioritized to be included in the minimum data set, and high-density data entries within 30KB of Level 3 are selected to fill the remaining capacity. This selection process is based on the complexity of the entry structure and recovery cost, avoiding situations where core data is not written due to redundant data occupying critical space.
[0037] After selecting the target data entries, a structure-level compression operation is performed on each selected data entry to improve write efficiency and reduce energy consumption. The compression strategy is determined based on the actual structural characteristics of the data entry. For example, for fixed-length structure fields, structural optimization is performed by removing invalid placeholders and merging identifier fields; for variable-length data fields (such as logs, paths, and configuration parameters), field pruning is used to retain only the latest data or core fields. For instance, a system task stack snapshot data that originally occupied 1KB can be compressed to 240 bytes containing only critical call paths under the field pruning strategy, thereby significantly reducing the write volume and freeing up write space.
[0038] The compressed data entries are recombined to form the minimum data set that can be actually written under the current power conditions. This set not only meets the minimum requirement for complete writing of critical data, but also has the advantages of compact structure, high data density, and low redundancy, effectively improving the success rate of power-down writing and the accuracy of information recovery. This minimum data set serves as the input basis for the subsequent atomic writing unit partitioning, running through the entire power-down data retention process, ensuring that the link from data screening to data writing maintains logical consistency and optimal resource allocation under energy-constrained conditions.
[0039] Dividing the minimum data set into multiple atomic write units refers to dividing the minimum data set into independent data blocks according to the logical boundaries of the data, with each data block serving as an atomic write unit. During partitioning, the natural boundaries of data entries are prioritized, such as field combinations for communication status data, incomplete transaction data, and system runtime context data, without interrupting field groups or structure definitions, ensuring that each atomic write unit maintains minimum semantic integrity after partitioning. Furthermore, to avoid logical overlap and address out-of-bounds errors, each atomic write unit is allocated to an independent and contiguous memory address range in non-volatile memory. For example, if communication status data occupies 64 bytes and incomplete transaction data consists of two groups of 128 bytes each, the minimum data set can be divided into three atomic write units, each allocated to a contiguous but independent address segment to avoid address pointer corruption caused by cross-segment writes.
[0040] Each atomic write unit is assigned a unique status record tag, which contains at least three fields: atomic write unit number, write completion flag, and integrity check code. The atomic write unit number distinguishes the logical order and position of each write unit; the write completion flag promptly identifies the write status after writing is completed; and the integrity check code (such as CRC or a hash value) verifies whether the written data of the atomic write unit was accidentally truncated or corrupted during the power outage after the communication device is powered off and restarted. For example, after writing 64 bytes of data, the atomic write unit numbered A3 will have its status record tag set to "Number A3, Complete 1, Check FF3C". Upon the next power-on, the validity of the data can be quickly determined by reading the tag.
[0041] Before writing, the address validity of the target write region in the non-volatile memory is checked according to a preset verification standard. This verification standard includes logical conditions such as: determining whether the write start address falls within the allowed write address space, whether the target address range overlaps with areas currently being used by other tasks, and whether the address is aligned to the memory page boundary. The validity of the target address segment for each atomic write unit is verified; only when all conditions are met is the write preparation operation allowed to continue. For example, in NOR Flash, if a page start address requires alignment to a 256-byte boundary, and the address of the atomic write unit is 0x1005, it is considered invalid, and the write start position needs to be adjusted to 0x1100.
[0042] After confirming the address validity, a pre-charge operation is performed on the target region. Pre-charge refers to providing a short, low-voltage pulse to the target non-volatile memory address segment before the actual write operation begins. This activates the charge state of the memory cells and reduces the start-up delay of subsequent main write pulses, effectively improving the write success rate and reducing initial load impact. This operation can be implemented at the hardware level through power control pin adjustments, or at the software level by initiating a no-write command for warm-up. After the pre-charge process is complete, the verified and pre-processed target write region is bound to the corresponding atomic write cell and registered in the write schedule table, ready for scheduling and invocation in subsequent execution phases.
[0043] During the backup power supply period, data writing operations of atomic write units are executed sequentially according to a predetermined order. Upon completion of the write task for each atomic write unit, the corresponding status record flag is immediately updated, and the trend of the backup power supply output voltage is continuously monitored. This can be performed as follows: After confirming the backup power supply status is correct, the scheduling process calls each data block in the atomic write unit one by one in the pre-set order to initiate the data writing operation. The order is determined based on the address arrangement of the atomic write units during the partitioning phase and the number field contained in their status record flags, ensuring the predictability of the execution process and error localization capabilities. Upon initiation of the write operation, all data bits of the target data block are completely written to the corresponding non-volatile memory address segment. Page alignment and one-time write methods are used to reduce latency caused by page switching. For example, in an SPI-NAND device, writing 256 bytes at once to atomic write unit A1 takes approximately 1.8 milliseconds.
[0044] After the atomic write unit completes the write operation, its status record flag is immediately updated. The flag area containing the status record flag is initialized before writing. This update mainly involves setting the "write completion flag" bit from an incomplete state to a completed state and updating the new integrity check code for the atomic write unit. This process uses a page space separate from the data write operation to avoid the risk of overwriting already written data due to status updates. For example, after completing the write task numbered A1, the third bit of the status record flag area is updated from 0 to 1, and the CRC value corresponding to A1 is recalculated and overwritten. After the atomic write unit completes the execution of the status flag update, the trend detection process of the backup power supply output voltage immediately begins.
[0045] The statement that the backup power supply output voltage is close to the preset voltage safety threshold refers to calculating the difference between the current backup power supply output voltage and the preset voltage safety threshold, and then determining the sampling time window length for the voltage change sequence based on this difference using a linear mapping method. In practice, the preset voltage safety threshold can be set to 2.8 volts. If the currently detected backup power supply voltage is 2.95 volts, then the voltage difference is 0.15 volts. For example, if the linear mapping relationship is set to "for every 0.05 volt decrease in voltage difference, the time window is extended by 5 milliseconds," then the sampling time window length is set to 15 milliseconds. The smaller the difference, the closer the voltage is to the critical dangerous region. The system needs to obtain a more refined trend of change; therefore, a longer sampling window is used to enhance the accuracy of voltage change trend judgment.
[0046] Within the sampling time window, the maximum voltage drop and average rate of voltage drop are calculated. For example, in a 15-millisecond sampling window, a voltage point is sampled every 2 milliseconds, resulting in 8 voltage values. The maximum voltage drop is the difference between the maximum and minimum values within this interval, and the average rate of voltage drop is the voltage difference divided by the sampling time span. If the voltage drops from 2.95 volts to 2.81 volts within this period, the maximum voltage drop is 0.14 volts, and the average rate of voltage drop is 0.0093 volts per millisecond. To enhance the evaluation dimensions, these two parameters are combined according to preset weighting coefficients. The preset weighting coefficients are set based on the degree of influence of the two parameters on the instability of the backup power supply voltage. For example, the maximum voltage drop has a weight of 0.6, and the rate of voltage drop has a weight of 0.4. This calculates the intensity index of the current voltage change, which is used to dynamically reflect the instability of the backup power supply voltage.
[0047] Based on the intensity index's range, the corresponding adjustment factor is retrieved from a preset mapping table. The mapping table pre-sets the adjustment factor to 0.8 if the intensity index is less than 0.05; 1.0 if it's between 0.05 and 0.1; and 1.2 if it's greater than 0.1. Assuming the current intensity index is 0.11, the corresponding adjustment factor is 1.2. Multiplying the original preset termination write trigger difference of 0.1 volts by the adjustment factor 1.2 yields a dynamically adjusted trigger difference of 0.12 volts. The purpose of introducing the adjustment factor is to give the termination write judgment a trend-response capability, dynamically advancing or delaying the termination timing based on the instability intensity of the backup power supply voltage, thus enhancing the robustness of the power outage response.
[0048] The current voltage difference is compared with the dynamically adjusted trigger difference. If the current voltage difference is less than the dynamically adjusted trigger difference, the condition that "the backup power supply output voltage is close to the preset voltage safety threshold" is met. At this point, the incomplete write task is immediately terminated, and the status record of the completed atomic write unit and integrity verification information are written to an independent storage area. This ensures that a complete recovery process can be performed based on this status data when the communication device restarts. This strategy avoids the write process being interrupted in the incomplete state due to delayed voltage drop detection, thereby improving data consistency and device operational stability.
[0049] Dividing the minimum data set into multiple atomic write units involves the following four sub-steps to meet the backup power supply constraints while ensuring semantic integrity: First, look up the standard write current value per unit page based on the type of non-volatile memory used. For example, for a typical SPI-NAND memory with a unit page length of 2048 bytes, the standard write current is 20 mA. When the target data block length is determined to be 4600 bytes, first divide this length by the unit page length and round up to obtain a theoretical number of 3 pages to be written; thus, the theoretical total write current for this data block under ideal write conditions is 60 mA.
[0050] Perform a write address boundary alignment check on the data block. Using the target non-volatile memory page boundary as a reference, check if the starting address of the data block is the starting address of the memory page. For example, if the current write address is the page start offset + 512 bytes, it is an unaligned write. In this case, according to the write mechanism, one more page needs to be written, and the theoretical number of pages to be written is corrected to 4 pages. The total current is re-estimated to 80 mA. This process ensures that page write operations will not cause write anomalies due to page crossings, enhancing the integrity of the write process.
[0051] The total current is scaled and adjusted based on the number of parallel write channels in the target memory. Taking four-channel parallel write as an example, the preset channel adjustment factor is the reciprocal of the square root of the number of parallel channels, i.e., 1 divided by the square root of 2 is approximately equal to 0.5. Based on this, the adjusted total current of 80 mA is multiplied by 0.5, resulting in a peak write current of 40 mA for this data block. This adjustment process is used to reflect the effect of multi-channel parallelism on the current load of a single channel, and to reasonably compress the peak current evaluation result.
[0052] The peak write current is compared with the maximum instantaneous power supply capacity of the backup power supply. If the estimated peak current does not exceed the limit threshold, such as 50 mA, the current data block is retained as an atomic write unit. If it exceeds the limit, such as an estimated 65 mA, the data block will be further divided into two logically contiguous sub-blocks, with the write current of each block controlled within the upper limit, forming new atomic write units. During the reconstruction process, the structural boundaries are maintained to preserve the minimum integrity of the data semantics, ensuring that the original data structure can be completely reconstructed during the power outage recovery phase.
[0053] It's important to note that minimum semantic integrity is the core objective when initially partitioning data blocks, such as using complete field groups or structures as units to avoid logical loss due to artificial segmentation. However, when a single structure or data field combination is too large (e.g., a communication status data block exceeds 8KB, exceeding the Flash page write capacity, or its peak write current exceeds the maximum instantaneous power supply capacity of the backup power supply), physical partitioning must be performed while maintaining semantic boundaries. The strategy used here, "split into multiple data blocks to reconstruct atomic write units," is as follows: for logically continuous structures or field groups, internal partitioning is performed only at the page level, without destroying the field structure itself; each sub-block retains a "semantic tag" and "structural boundary identifier," which are then re-aggregated into complete original data blocks during recovery using status record markers. This ensures that "semantics are not destroyed and structure is reconstructible," while also satisfying current constraints.
[0054] The above algorithms or formulas are all dimensionless and numerical calculations, and the results are obtained by software simulation based on a large amount of collected data to obtain the most recent real-world results. The preset parameters are set by those skilled in the art according to the actual situation.
[0055] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0056] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0057] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0058] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for power-off retention in communication equipment, characterized in that, Includes the following steps: When the communication equipment detects a power failure signal from the main power supply, the power control circuit obtains the maximum instantaneous current currently provided by the backup power supply in real time and transmits this maximum instantaneous current to the data writing control process. The data write control process performs data filtering, determines the data items to be written by preset write priority, and forms the minimum data set to be written under the current current conditions. The minimum data set is divided into multiple atomic write units, each atomic write unit is assigned a unique state record tag, and write address verification and pre-charging preparation of the target area are completed in non-volatile memory. During the period when the backup power supply provides energy, the data writing operations of the atomic writing units are executed sequentially according to a predetermined order. After each atomic writing unit is completed, the corresponding status record flag is immediately updated, and the changing trend of the backup power supply output voltage is continuously monitored. When the backup power supply output voltage approaches the preset voltage safety threshold, the unfinished write tasks are stopped, and the status record mark of the completed atomic write unit and the integrity verification information are written to the independent storage area.
2. The power-off retention method for communication equipment according to claim 1, characterized in that, When the backup power supply voltage drops to the shutdown critical point, the communication equipment enters a low-power lockout state through the power failure recovery control circuit.
3. The power-off retention method for communication equipment according to claim 2, characterized in that, The maximum instantaneous power supply capacity of the backup power supply is pre-assessed by the communication equipment during normal operation, and specifically includes the following steps: After the communication equipment completes initialization, a pulse load of fixed amplitude is periodically applied to the backup power supply through the power control circuit. During each test, the maximum drop value of the backup power supply output voltage and the corresponding voltage recovery time are recorded. The voltage drop value and voltage recovery time are compared with the preset standard reference value. When the voltage drop is less than the reference drop threshold and the recovery time is less than the reference recovery time threshold, it is recorded as a stable output event, and the current value applied in this test is recorded. After collecting multiple stable output events, the average value of the current values in all tests is calculated, and the 95% confidence lower limit of this average value is taken as the maximum instantaneous power supply capacity parameter of the backup power supply, i.e., the maximum instantaneous current.
4. The power-off retention method for communication equipment according to claim 3, characterized in that, Perform the following operations before performing data filtering: During the design phase of communication equipment, the output voltage-time curve and corresponding current change curve of the backup power supply under the communication write load are obtained through power-down discharge test, and a usable energy model of the backup power supply from the initial operating voltage to the minimum allowable operating voltage is established accordingly. The total effective energy provided by the backup power supply during the power supply phase is calculated based on the available energy model. Based on the average energy consumption per byte written by the communication equipment during the design phase, the total effective energy of the backup power supply is converted into the theoretical maximum total number of writable bytes, which is used to evaluate the upper limit of the data writing capacity. Based on the capacity limit, a fixed proportion of redundant energy is reserved as buffer space, and the maximum write byte limit is modified as a constraint for data filtering.
5. A power-off retention method for communication equipment according to claim 4, characterized in that, The total effective energy provided by backup power during the power supply phase, calculated based on the available energy model, refers to: Under the condition of known initial operating voltage and minimum allowable operating voltage, the discharge process of the backup power supply under simulated write load is recorded to obtain voltage change curves and current change curves. The product of the instantaneous voltage value and the corresponding current value within the corresponding time period is taken as the instantaneous power. The total effective energy output by the backup power supply within the power outage window is estimated by performing an integral approximation process over the entire test time period.
6. A method for power-off retention in communication equipment according to claim 5, characterized in that, The minimum data set refers to: All data to be written is categorized according to data type, including communication status data, incomplete transaction data, and system runtime context data, and a fixed writing priority order is set for different categories; Based on the maximum write byte limit corrected by the backup power supply, data entries are selected sequentially from the high priority category according to the preset priority order until the cumulative write capacity reaches the data filtering constraint. A compression strategy is applied to the selected data entries. Based on the actual structural characteristics of each data entry, a structural optimization or field pruning method is selected to reduce the write volume of a single data entry, ultimately forming the smallest data set to be written under the current conditions.
7. A method for power-off retention in communication equipment according to claim 6, characterized in that, Dividing the smallest data set into multiple atomic write units means: The smallest set of data is divided into independent data blocks according to the logical boundaries of the data. Each data block is an atomic write unit, and each atomic write unit is allocated an independent contiguous storage address. Each atomic write unit is assigned a unique status record tag, which includes the atomic write unit number, write completion flag and integrity check code; Before writing, the address validity of the target write region in the non-volatile memory is checked according to the preset verification standard to confirm that the write address is within the legal write range and does not overlap with the address of the current write task. At the same time, a pre-charge operation is performed on the target region. Finally, the target write region that has passed the verification is bound to the corresponding atomic write unit.
8. A method for power-off retention in communication equipment according to claim 7, characterized in that, The backup power supply output voltage approaching the preset voltage safety threshold means: Calculate the difference between the current backup power supply output voltage and the preset voltage safety threshold, and determine the acquisition time window length of the voltage change sequence based on the difference using a linear mapping method; Within the data collection window, the maximum voltage drop and the average rate of voltage drop are statistically analyzed, and the two are combined according to a preset weighting coefficient to form an intensity index of the current voltage change. Based on the interval where the intensity index is located, the corresponding adjustment factor is obtained from the preset mapping table, the original preset termination write trigger difference is incrementally adjusted, and the current voltage difference is compared with the dynamically adjusted trigger difference. If the former is less than the latter, the incomplete write task is terminated, and the status record mark and integrity verification information of the completed atomic write unit are written to the independent storage area.
9. A method for power-off retention in communication equipment according to claim 8, characterized in that, In the process of dividing the smallest data set into multiple atomic write units, estimating the peak write current of each data block in a single write operation includes the following steps: The standard write current value per unit page is obtained by looking up a table based on the type of non-volatile memory used. The length of the target data block is divided by the length of the unit page and rounded up to obtain the theoretical number of pages to be written. Multiply the theoretical number of pages written by the unit page write current value to obtain the theoretical total current value of the data block under the condition of no boundary correction. Determine whether the first write address of the data block is aligned with the starting address of the target memory page. If not aligned, increase the theoretical number of pages to be written by 1, and multiply the increased number of pages by the unit page write current value to obtain the total current value after boundary alignment correction. Based on the number of parallel write channels, the total current value after boundary correction is adjusted by the number of channels. The adjustment method is as follows: the total current value is scaled by using the reciprocal of the square root of the number of parallel channels as a reference factor to obtain the peak value of the write current of the data block. Only when the peak value of the write current does not exceed the maximum instantaneous power supply capacity parameter of the backup power supply is the data block regarded as an atomic write unit. Otherwise, it is split into multiple data blocks to reconstruct the atomic write unit.