A terminal randomization wakeup method and apparatus, an electronic terminal, and a storage medium

CN123035531APending Publication Date: 2026-11-03广州莲雾科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611552022.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-09
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

同频段多终端同时唤醒造成广播碰撞与信道拥塞

Benefits of technology

[0015]上述终端随机化唤醒方法、装置、电子终端及存储介质,通过当终端被配置为随机化调度模式,在终端唤醒的情况下,获取下一唤醒窗口对应的第一随机唤醒相位;基于第一随机唤醒相位、当前唤醒窗口对应的第二随机唤醒相位以及唤醒窗口周期参数,确定下一次唤醒前的第一目标睡眠时长;本次唤醒周期结束后,在目标睡眠时长后唤醒终端,以使终端在唤醒的情况下执行广播,并确定下一次唤醒前的第二目标睡眠时长,能够实现批量终端唤醒时刻的自然错峰的有益效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123035531A_ABST
    Figure CN123035531A_ABST
Patent Text Reader

Abstract

The application relates to a terminal randomization wakeup method, a device, an electronic terminal and a storage medium. The terminal randomization wakeup method comprises the following steps: when a terminal is configured to be in a randomization scheduling mode, a first random wakeup phase corresponding to a next wakeup window is acquired when the terminal is woken up; a first target sleep duration before next wakeup is determined based on the first random wakeup phase, a second random wakeup phase corresponding to a current wakeup window and a wakeup window period parameter; and the terminal is woken up after the target sleep duration after the end of the current wakeup period, so that the terminal performs broadcasting in the woken-up state, and a second target sleep duration before next wakeup is determined. The terminal randomization wakeup method has the advantages that batch terminal wakeup time can be naturally peak-shaved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of short-range wireless communication, and in particular relates to a terminal randomized wake-up method, device, electronic terminal and storage medium. Background Technology

[0002] Low-power electronic terminals (such as employee ID cards, asset tags, and battery box controllers) are typically battery-powered and require battery life of several months or even years. Therefore, they generally employ a duty cycle operating mode of "deep sleep + periodic wake-up broadcast + receiving gateway (AP / access point) connection and interaction + sleep again." With the advancement of the power Internet of Things (IoT) construction and industry digital transformation, the localization of terminals and the development of independently controllable operating systems have become clear trends. SparkLink SLE, as a new generation of short-range wireless communication technology, possesses advantages such as low latency, high reliability, anti-interference, multi-connectivity, and link security, making it highly suitable as a bridge between terminals and gateways.

[0003] The existing technology has the following drawbacks: Simultaneous wake-up of multiple terminals on the same frequency band causes broadcast collisions and channel congestion. If all terminals use the same fixed wake-up period and fixed phase, in batch deployment scenarios (e.g., hundreds or thousands of terminals in a workshop / building), a large number of terminals will wake up and broadcast at the same time, leading to instantaneous congestion of the wireless channel, broadcast packet collisions, a sharp drop in scanning / connection success rate, a surge in gateway-side connection timeouts and retransmissions, and a severe decrease in overall system throughput and reliability. Current practices often involve burning different fixed offsets to each terminal, but this method requires differentiated configuration for each terminal, is difficult to manage in batches and dynamically adjust, and the fixed offsets will gradually overlap after the device clock drifts. Summary of the Invention

[0004] Therefore, it is necessary to provide a terminal randomization wake-up method, device, electronic terminal, and storage medium that can achieve natural peak-shifting of wake-up times for batch terminals, addressing the aforementioned technical problems.

[0005] Firstly, this application provides a terminal randomized wake-up method, including: When the terminal is configured to randomized scheduling mode, the first random wake-up phase corresponding to the next wake-up window is obtained when the terminal is woken up. Based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter, the first target sleep duration before the next wake-up is determined; After this wake-up cycle ends, the terminal is woken up after the target sleep duration so that the terminal can perform a broadcast while awake and determine the second target sleep duration before the next wake-up.

[0006] In one embodiment, both the first random wake-up phase and the second random wake-up phase are obtained using the following method: A pseudo-random seed is generated based on the inherent identifier of the node corresponding to the terminal. Based on the pseudo-random seed, random values ​​that follow a uniform distribution are generated, and these random values ​​are used sequentially as the random wake-up phases corresponding to each wake-up window. Among them, the random wake-up phase is greater than or equal to the preset minimum offset threshold.

[0007] In one embodiment, a pseudo-random seed is generated based on the node's inherent identifier corresponding to the terminal, including: The node's intrinsic identifier is split into bytes using the following formula, and a pseudo-random seed is generated through byte-by-byte multiplication and addition operations: seed = seed×31 + mac[i](i=0,1,…,5) Where seed is the pseudo-random seed, and i is the first byte of the node's inherent identifier.

[0008] In one embodiment, the node's inherent identifier is determined by the following method: In response to the MAC address modification command, the parameters corresponding to the new MAC address are written to the terminal's non-volatile storage; During power-on initialization, the new MAC address is read from non-volatile memory and used as the node's inherent identifier.

[0009] In one embodiment, when the terminal performs a broadcast while awake, the method further includes: Receive control commands from network-side devices within the current wake-up window; Based on the instruction identifier and command word of the control instruction, duplicate instructions are removed from the control instruction to obtain the instruction to be executed; Each pending instruction is processed according to the sequence of first sending back the execution result, then executing the time-consuming action, and finally returning to sleep.

[0010] In one embodiment, each instruction to be executed is processed according to the sequence of first returning the execution result, then executing the time-consuming action, and then returning to sleep, including: Before falling back to sleep, the power supply pins of the control module are switched from the general purpose input / output domain to the low power normally open domain to maintain the pin's level state during deep sleep. When the terminal is woken up, the pin is switched from the low-power normally open domain back to the general-purpose input / output domain.

[0011] In one embodiment, the randomized scheduling mode is determined by the following method: Obtain the terminal's MAC address; If the MAC address is a personalized MAC address, then the terminal is determined to enter the randomized scheduling mode.

[0012] Secondly, this application also provides a terminal randomized wake-up device, comprising: The phase generation module is used to obtain the first random wake-up phase corresponding to the next wake-up window when the terminal is configured to randomized scheduling mode and the terminal is woken up. The duration determination module is used to determine the first target sleep duration before the next wake-up based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter. The wake-up module is used to wake up the terminal after the target sleep duration after the current wake-up cycle ends, so that the terminal can perform broadcasts while awake and determine the second target sleep duration before the next wake-up.

[0013] Thirdly, this application also provides an electronic terminal, including a memory and a controller, wherein the memory stores a computer program, and the controller executes the computer program to implement the method described in the first aspect of this application.

[0014] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect of this application.

[0015] The aforementioned terminal randomized wake-up method, apparatus, electronic terminal, and storage medium, when the terminal is configured in randomized scheduling mode, obtain the first random wake-up phase corresponding to the next wake-up window when the terminal is woken up; determine the first target sleep duration before the next wake-up based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter; after the current wake-up cycle ends, wake up the terminal after the target sleep duration so that the terminal can perform broadcasting when awake and determine the second target sleep duration before the next wake-up, thus achieving the beneficial effect of natural staggering of the wake-up times of batch terminals. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a terminal randomization wake-up method provided in this application; Figure 2This is a schematic diagram of a terminal randomization wake-up device provided in this application. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0019] It should be understood that the described embodiments are merely some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0020] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the embodiments of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0021] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0022] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0023] The terminal randomization wake-up method provided in this application embodiment can be applied to the SparkLink terminal described below. The SparkLink terminal (BS21E, SLE Server) consists of an SLE (SparkLink Low Energy) communication module, a main control MCU (Micro-Controller Unit), non-volatile memory (NV), power-gated GPIO (General Purpose Input / Output), and a controlled module (such as the SIM218 communication module). The SparkLink terminal may also be referred to below as a tag, electronic tag, tag terminal, terminal, or electronic terminal. The SLE communication module is responsible for periodically waking up the broadcast, accepting connections from SparkLink Access Points (APs), and sending and receiving commands and results via the SSAP (SparkLink Service Access Protocol) channel. The main control MCU is responsible for wake-up scheduling, command parsing and execution, low-power state transitions, and watchdog timer. The NV stores the local MAC (Media Access Control Address) and wake-up cycle parameters. The power-gated GPIO controls the power supply of the controlled module through dual-domain switching between the ordinary GPIO domain and the ULP (Ultra-Low Power) normally open domain. The main control MCU also interacts with the controlled module (sending service commands, reading operating status and service data) via an on-board UART (Universal Asynchronous Receiver / Transmitter). The relationship between the terminal, the StarSpark AP, and the cloud platform (hereinafter referred to as the platform) is as follows: The platform issues commands via MQTT (Message Queuing Telemetry Transport) through the StarSpark AP. The AP forwards the scan / connection / SSAP write requests to the terminal via SLE. After execution, the terminal sends back the results via the SLE notification / instruction channel, and the AP reports to the platform. The terminal is in deep sleep during normal operation and wakes up periodically to broadcast, ensuring "every window must wake up and batch staggered peaks." This, combined with the AP's scheduling mechanism of "if it can be scanned, it can be built; if it can be built, it can be deactivated; if it can be deactivated, it can be retrieved" forms a complete closed loop.

[0024] In one exemplary embodiment, such as Figure 1 As shown, a terminal randomization wake-up method is provided. Taking the application of this method to the main control MCU (or controller) of the aforementioned StarFlash terminal as an example, the method includes the following steps 102 to 106. Wherein: Step 102: When the terminal is configured to randomized scheduling mode, in the case of terminal wake-up, obtain the first random wake-up phase corresponding to the next wake-up window.

[0025] The randomized scheduling mode refers to a scheduling mode where the terminal deviates from the default timed wake-up mode and enters a "randomized" wake-up time mode, thus achieving staggered wake-up times for multiple terminals. The wake-up window refers to the period within which a terminal can be woken up, rather than at a fixed time; this period is determined by the period parameter in non-volatile memory (NV). The random wake-up phase refers to the offset of the terminal's wake-up time relative to the fixed wake-up time, or a random offset from the start time of the wake-up window. The actual wake-up time is determined based on this random offset to avoid all terminals waking up simultaneously.

[0026] Specifically, when the controller detects that the terminal is in randomized scheduling mode, it obtains the first random wake-up phase corresponding to the next wake-up window when the terminal is woken up.

[0027] Step 104: Based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter, determine the first target sleep duration before the next wake-up.

[0028] The first target sleep duration can be the sleep duration between the current sleep state and the next wake-up. The wake-up window period parameter, or simply window period, is determined by the period parameter in non-volatile memory (NV) and can be remotely modified by the gateway. The controller determines the first target sleep duration before the next wake-up based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter.

[0029] Step 106: After the current wake-up cycle ends, wake up the terminal after the target sleep duration so that the target terminal can perform a broadcast while awake and determine the second target sleep duration before the next wake-up.

[0030] The broadcast is a communication broadcast sent by the terminal to the StarShine AP to transmit preset information, such as the terminal's unique identifier and the operating status and service data of the controlled device (e.g., module network access status, signal strength, battery level, sensor readings, etc.). Each time the StarShine terminal wakes up, it transmits the corresponding information to the AP via a broadcast. The second sleep duration is the time from entering sleep mode after the current wake-up to the next wake-up, determined in the same way as the first sleep duration.

[0031] Specifically, after the current wake-up cycle ends, the terminal's controller wakes the terminal after the target sleep duration, so that the target terminal performs a broadcast while awake and determines the second target sleep duration before the next wake-up. Further, the terminal repeats steps 102 to 106 to achieve randomized wake-up within multiple cycles.

[0032] In the aforementioned terminal randomized wake-up method, when a terminal is configured in randomized scheduling mode, upon wakeup, the first random wake-up phase corresponding to the next wake-up window is obtained; based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter, a first target sleep duration before the next wake-up is determined; after the current wake-up cycle ends, the terminal is woken up after the target sleep duration, so that the terminal performs broadcasting while awake and determines a second target sleep duration before the next wake-up. This method can achieve the beneficial effect of naturally staggering the wake-up times of batch terminals.

[0033] In one embodiment, the randomized scheduling mode is determined by the following method: Obtain the terminal's MAC address; If the MAC address is a personalized MAC address, then the terminal is determined to enter the randomized scheduling mode.

[0034] Specifically, the terminal can determine whether the terminal device is using the factory default address by comparing the local MAC address stored in the NV with the factory default MAC address (such as "LWTCSP"). If it is still the default address, it means that the device has not been customized, and a fixed short-cycle wake-up (1500 milliseconds) is used to enter the default mode; if it has been customized (the MAC address has been remotely rewritten), it enters the custom mode and performs randomized scheduling.

[0035] In one embodiment, both the first random wake-up phase and the second random wake-up phase are generated using the following method: A pseudo-random seed is generated based on the inherent identifier of the node corresponding to the terminal. Based on the pseudo-random seed, random values ​​that follow a uniform distribution are generated, and these random values ​​are used sequentially as the random wake-up phases corresponding to each wake-up window. Among them, the random wake-up phase is greater than or equal to the preset minimum offset threshold.

[0036] The node's unique identifier can be a unique device identifier corresponding to the terminal, such as a serial number (SN), chip UID, or MAC address. Since the node's unique identifier is non-repeating, the pseudo-random seeds generated based on this identifier are also different. Furthermore, based on the pseudo-random seeds, the random wake-up phase corresponding to each wake-up window is determined, ensuring that each random wake-up phase is different, allowing the terminal to wake up at different times, thus achieving the technical effect of staggered wake-up.

[0037] The pseudo-random seed is the initial value used to initialize the pseudo-random number generator (PRNG). Given the same random seed / pseudo-random seed, the pseudo-random number algorithm will consistently output the same sequence of random numbers; changing the seed will generate a different set of random sequences. Specifically, it refers to the wake-up phase of each terminal during each wake-up call.

[0038] Taking the MAC address of the StarFlash terminal as the inherent identifier of the node as an example, since the MAC is globally unique (or unique within the factory), the seeds of different terminals are different, and the generated pseudo-random sequences are unrelated to each other, which ensures that the wake-up phases of different terminals are naturally staggered from the root.

[0039] In one embodiment, a pseudo-random seed is generated based on the node's inherent identifier corresponding to the terminal, including: The node's intrinsic identifier is split into bytes using the following formula, and a pseudo-random seed is generated through byte-by-byte multiplication and addition operations: seed = seed×31 + mac[i](i=0,1,…,5) Where seed is the pseudo-random seed, and i is the first byte of the node's inherent identifier.

[0040] Specifically, taking the MAC address of the StarFlash terminal as the inherent identifier of the node as an example, the MAC of a certain StarFlash terminal has 6 bytes. The 6 bytes of MAC are hashed byte by byte according to "seed = seed×31 + mac[i] (i=0,1,…,5)" to obtain a random seed that corresponds one-to-one with the device, and the pseudo-random number generator is initialized with this seed.

[0041] The terminal randomization wake-up method provided in this application embodiment uses MAC derivation seeds and window boundary anchor points for recursion, so that the wake-up time of a batch of terminals is randomly staggered without the need for central scheduling, and the average wake-up period is always equal to the window period, and the gateway access delay has a definite upper bound.

[0042] In one embodiment, the node's inherent identifier is determined by the following method: In response to the MAC address modification command, the parameters corresponding to the new MAC address are written to the terminal's non-volatile storage; During power-on initialization, the new MAC address is read from non-volatile memory and used as the node's inherent identifier.

[0043] Taking the MAC address as the inherent identifier of a node as an example, specifically, the MAC address and wake-up cycle of the StarFlash terminal are both stored in NV non-volatile memory, which supports remote rewriting by the gateway: during writing, the new parameters are written to NV using preset key values ​​(MAC parameter key 0x0101, wake-up cycle key 0x0102); during power-on initialization, the parameters are read from NV and adopted; after rewriting, the chip is restarted, and after restarting, the new MAC address immediately participates in broadcast configuration as the local address, and the new wake-up cycle immediately participates in randomized scheduling. This enables personalized configuration and dynamic adjustment of devices after batch deployment, avoiding on-site burning of each device.

[0044] In actual production, the following problems still exist: The constant power supply to controlled modules (such as communication modules and sensors) in the StarFlash terminal leads to high power consumption. Terminals often integrate peripheral modules that need to operate on demand (such as the SIM218 communication module). If this module is constantly powered, even if the terminal is in sleep mode most of the time, the module's static power consumption is still significant; if it is completely powered off, it cannot be remotely woken up to execute tasks when needed. Current technology lacks a closed-loop mechanism of "gateway remote triggering, terminal on-demand gating of module power supply, and automatic power-off and sleep mode after task completion." Platform retransmission causes the terminal to repeatedly execute instructions. If the platform retransmits the same instruction without receiving a result, and the terminal has already executed it (e.g., the controlled module has been powered on, the address has been changed), it will execute it again, potentially causing the controlled module to be powered on repeatedly, parameters to be written repeatedly, or even the address to be incorrectly changed. Current technology lacks a reliable mechanism for deduplicating duplicate instructions and for returning "duplicate" results.

[0045] To address the aforementioned issues, in one embodiment, when the terminal performs a broadcast while awake, the method further includes: Receive control commands from network-side devices within the current wake-up window; Based on the instruction identifier and command word of the control instruction, duplicate instructions are removed from the control instruction to obtain the instruction to be executed; Each pending instruction is processed according to the sequence of first sending back the execution result, then executing the time-consuming action, and finally returning to sleep.

[0046] Specifically, after each wake-up, the terminal acts as an SLE Server, broadcasting and accepting gateway connections. The gateway sends instructions to the terminal via the SLE Service Access Protocol (SSAP) write request. After parsing and executing the instructions, the terminal sends back the results through the notify / indicate channel and then immediately falls back to sleep. The instruction frame format is: random instruction identifier (4 bytes) + command word (1 byte) + command parameters (variable). Typical instructions and execution logic are shown in Table 1 below: Table 1: Diagram of issued instructions and corresponding execution logic

[0047]

[0048] The terminal records the previously received "instruction identifier + command word" (first 5 bytes). If the newly received frame is completely identical to it, it is determined to be a duplicate instruction (the command word is rewritten to 0xFE). Only a "duplicate" prompt is sent back without repeated execution, thus avoiding repeated power-on of the module or repeated writing of parameters caused by gateway retransmission.

[0049] The terminal performs deduplication on duplicate instructions in the control commands to obtain the instructions to be executed.

[0050] In actual production, the following problems still exist: During deep sleep, the power supply pin levels of the controlled module cannot be maintained. When a microcontroller (MCU) enters deep sleep, the ordinary GPIO domains typically lose power, causing the GPIO pin levels controlling the module's power supply to be lost or left floating. This can lead to incorrect power-on or power-off of the module, or even damage. A switching mechanism is needed to maintain the power supply pin levels during sleep and restore normal GPIO control upon wake-up.

[0051] To address the aforementioned issues, in one embodiment, the method further includes: Before falling back to sleep, the power supply pins of the control module are switched from the general purpose input / output domain to the low power normally open domain to maintain the pin's level state during deep sleep. When the terminal is woken up, the pin is switched from the low-power normally open domain back to the general-purpose input / output domain.

[0052] Specifically, the power supply pins of the controlled module (e.g., the SIM218 communication module) of the terminal need to maintain the correct output level in both the "normal operation" and "deep sleep" power supply domains to prevent the module from malfunctioning due to pin power loss during MCU sleep. The solution is as follows: 1. Normal operating state: Configure the pin as an output and set the required level using a normal GPIO field.

[0053] 2. Before entering sleep mode: In the low-power state transition callback, first disable the normal GPIO field configuration of this pin, then enable the ULP (normally on / low power) GPIO field, and use the ULP GPIO to maintain the same level as before. The ULP field does not lose power during deep sleep, thus maintaining the module power pin level unchanged when the MCU is in deep sleep.

[0054] 3. After wake-up: In the reverse state transition callback, the ULP GPIO field is turned off and the normal GPIO field configuration is restored, and the output level control is restored.

[0055] This enables seamless switching between "sleep power preservation and wake-up recovery" domains, ensuring that the module's power supply status is not disrupted during the terminal's deep sleep.

[0056] In one specific embodiment, the terminal randomization wake-up method provided in this application includes the following steps: After powering on, the terminal completes watchdog timer and low-power state transition configuration, and SLE service initialization. It reads the local MAC address and wake-up window period parameters from non-volatile memory. The controller compares the local MAC address with the factory default MAC address: if it is still the factory default, it periodically broadcasts a wake-up call at a fixed short period (1500 milliseconds) (default mode); if it has been remotely customized, it enters custom mode—generating a random seed by multiplying and adding 6 bytes of MAC address and initializing a pseudo-random number generator, and uniformly and randomly selecting the first wake-up offset within the wake-up window (between 100 milliseconds and the window period minus 100 milliseconds). The main loop enters sleep mode: if there is a connection request, it skips sleep and directly enters the working window; if a remote power-on command has just been executed, the sleep duration is extended by approximately 3 minutes; otherwise, it sleeps for the corresponding duration according to the current wake-up offset. After the sleep ends, the watchdog is fed first, and then the next sleep duration is calculated by subtracting the current offset from the window period and adding the new random offset within the current window. Then, broadcasting begins, maintaining a broadcast / connection window of about 320 milliseconds. Depending on the connection and instruction processing status, it decides whether to continue working or fall back to sleep.

[0057] The advantages of this implementation are: by recursively using MAC derivation seeds and window boundary anchors, the wake-up times of a batch of terminals are randomly staggered without the need for central scheduling, and the average wake-up period is always equal to the window period, with a definite upper bound for gateway access latency.

[0058] The terminal, acting as an SLE server, accepts gateway connections within the broadcast / connection window. The gateway sends instruction frames via SSAP write requests; the frame format is 4 bytes of random instruction identifier + 1 byte of command word + command parameters. Upon receiving the frame, the terminal first performs length verification (5-20 bytes) and duplicate detection: If the first 5 bytes (instruction identifier + command word) are completely identical to the previously received frame, it is considered a duplicate instruction, and only a duplicate indication (0xFF) is returned; otherwise, it is processed according to the command word distribution: 0x01 Remote power-on—pull high the controlled module's power control pin to power on the module, set the extended sleep flag, immediately return the success status, delay for about 50 milliseconds to ensure that the response is sent and then fall back to sleep, and then keep the module powered on for about 2 seconds in sleep (during which time the watchdog is fed) before automatically pulling the power pin low to power off; 0x02 Remote address change—after verifying that the new address is different from the current address, write it to non-volatile memory, return the new address and status, and restart after a delay to take effect; 0x03 Remote wake-up cycle change—after verifying that the parameter is within the range of 10 to 60 seconds, write it to non-volatile memory, return the status, and restart after a delay to take effect; other command words return an illegal instruction indication. All responses are immediately sent back via the SLE notification / instruction channel, following the order of "send back first, then act, then sleep" to ensure that no response is lost within the short connection window.

[0059] The advantages of this implementation are: first, the data is sent back; then the action is performed; and then the device goes to sleep, ensuring that the response is not lost within the short connection window; the controlled module is powered on as needed and then automatically powered off after 2 seconds, and the terminal falls back to sleep, balancing task execution and low power consumption; repeated instructions only send back the repeated indication and are not executed.

[0060] The terminal registers an SSAP service (service identifier 0x2222) and a read-write notification attribute (attribute identifier 0x2323) as a channel for command issuance and result feedback. Broadcasts use the local address stored in non-volatile memory, and broadcast parameters are configured according to low-power requirements (broadcast interval 400, connection interval 100, supervisory timeout 0x1F4, delay 0x1F3). The terminal writes the result of the most recent command execution (maximum 15 bytes) to the vendor-defined data field of the scan response, allowing the gateway to read it during the scan phase. The terminal's power gating pin controls the power supply to the controlled module: in normal operation, the output level is displayed on the ordinary GPIO domain; before entering deep sleep, a low-power state transition callback switches the pin from the ordinary GPIO domain to the ULP normally open domain and maintains the level, ensuring the module's power supply is not disrupted during deep sleep; after waking up, a reverse transition callback switches back to the ordinary GPIO domain to resume control.

[0061] The advantages of this implementation are: instructions and results share the standard SSAP service channel; the previous execution result is carried with the broadcast and can be read by the gateway during the scanning phase; the module power pin level is maintained by the ULP domain during deep sleep, avoiding module malfunction.

[0062] After the platform issues a status query command (0x11), the terminal receives the command via an SLE write request within the wake-up window. First, it powers on the controlled module via the power gating pin, delaying for approximately 100 milliseconds until the module is ready for initialization. Then, it sends a query frame (frame header + length + query command + CRC checksum) to the controlled module via the onboard UART. The controlled module parses the frame and sends back a data frame containing the operating status and service data. After the terminal verifies the CRC, it packages the status and service data into a response frame of "command identifier + command word + status + service data," immediately sending it back to the gateway via the SLE notification / indication channel. The terminal then automatically pulls down the power gating pin and goes into sleep mode. If the UART response times out (e.g., 1 second) or the CRC check fails, it sends back an "execution failed" status. The process for issuing business instructions (0x13) is the same: the terminal transmits the platform parameters to the controlled module via UART, the module executes the instructions and sends the execution results back via UART, and the terminal then sends them back to the platform via SLE.

[0063] The advantages of this implementation are: the platform can complete the status query of the controlled device and issue business commands and obtain results within a single wake-up window of the terminal, realizing a two-way closed loop of "control + information"; the UART interaction and power gating timing are coordinated, and the power is immediately turned off after the interaction is completed, taking into account both task execution and low power consumption.

[0064] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0065] Based on the same inventive concept, this application also provides a terminal randomization wake-up device for implementing the terminal randomization wake-up method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more terminal randomization wake-up device embodiments provided below can be found in the limitations of the terminal randomization wake-up method described above, and will not be repeated here.

[0066] In one exemplary embodiment, such as Figure 2 As shown, a terminal randomized wake-up device is provided, comprising: The phase generation module is used to obtain the first random wake-up phase corresponding to the next wake-up window when the terminal is configured to randomized scheduling mode and the terminal is woken up. The duration determination module is used to determine the first target sleep duration before the next wake-up based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter. The wake-up module is used to wake up the terminal after the target sleep duration after the current wake-up cycle ends, so that the terminal can perform broadcasts while awake and determine the second target sleep duration before the next wake-up.

[0067] In one embodiment, the phase generation module is further configured to: A pseudo-random seed is generated based on the inherent identifier of the node corresponding to the terminal. Based on the pseudo-random seed, random values ​​that follow a uniform distribution are generated, and these random values ​​are used sequentially as the random wake-up phases corresponding to each wake-up window. Among them, the random wake-up phase is greater than or equal to the preset minimum offset threshold.

[0068] In one embodiment, the phase generation module is further configured to: The node's intrinsic identifier is split into bytes using the following formula, and a pseudo-random seed is generated through byte-by-byte multiplication and addition operations: seed = seed×31 + mac[i](i=0,1,…,5) Where seed is the pseudo-random seed, and i is the first byte of the node's inherent identifier.

[0069] In one embodiment, the node's inherent identifier is determined by the following method: In response to the MAC address modification command, the parameters corresponding to the new MAC address are written to the terminal's non-volatile storage; During power-on initialization, the new MAC address is read from non-volatile memory and used as the node's inherent identifier.

[0070] In one embodiment, when the terminal performs a broadcast while awake, the apparatus further includes: The receiving module is used to receive control commands issued by the network-side device within the current wake-up window; The deduplication module is used to deduplicat control instructions based on the instruction identifier and command word of the control instructions, so as to obtain the instructions to be executed. The execution module is used to process each instruction to be executed in the following sequence: first, return the execution result; then, execute the time-consuming action; and finally, fall back to sleep.

[0071] In one embodiment, each instruction to be executed is processed according to the sequence of first returning the execution result, then executing the time-consuming action, and then returning to sleep, including: Before falling back to sleep, the power supply pins of the control module are switched from the general purpose input / output domain to the low power normally open domain to maintain the pin's level state during deep sleep. When the terminal is woken up, the pin is switched from the low-power normally open domain back to the general-purpose input / output domain.

[0072] In one embodiment, the randomized scheduling mode is determined by the following method: Obtain the terminal's MAC address; If the MAC address is a personalized MAC address, then the terminal is determined to enter the randomized scheduling mode.

[0073] In one embodiment, an electronic terminal is provided, including a memory and a controller, wherein the memory stores a computer program, and the controller executes the computer program to implement the steps in the above-described method embodiments.

[0074] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0075] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0076] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A terminal randomized wake-up method, characterized in that, The method includes: When the terminal is configured to randomized scheduling mode, in the event that the terminal is woken up, the first random wake-up phase corresponding to the next wake-up window is obtained; Based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter, the first target sleep duration before the next wake-up is determined. After the current wake-up cycle ends, the terminal is woken up after the target sleep duration, so that the terminal can perform a broadcast while awake and determine the second target sleep duration before the next wake-up. The first random wake-up phase and the second random wake-up phase are both obtained using the following method: A pseudo-random seed is generated based on the inherent identifier of the node corresponding to the terminal. Based on the pseudo-random seed, random values ​​that follow a uniform distribution are generated, and these random values ​​are sequentially used as the random wake-up phases corresponding to each wake-up window. Wherein, the random wake-up phase is greater than or equal to a preset minimum offset threshold.

2. The method according to claim 1, characterized in that, The generation of a pseudo-random seed based on the inherent identifier of the node corresponding to the terminal includes: The node's inherent identifier is split into bytes using the following formula, and the pseudo-random seed is generated through byte-by-byte multiplication and addition operations: seed = seed×31 + mac[i](i=0,1,…,5) Where seed is the pseudo-random seed, and i is the i-th byte of the node's inherent identifier.

3. The method according to claim 2, characterized in that, The node's unique identifier is determined using the following method: In response to the MAC address modification instruction, the parameters corresponding to the new MAC address are written into the non-volatile storage of the terminal; During power-on initialization, a new MAC address is read from the non-volatile memory and used as the inherent identifier of the node.

4. The method according to claim 1, characterized in that, When the terminal performs a broadcast while awake, the method further includes: Receive control commands issued by the network-side device within the current wake-up window; Based on the instruction identifier and command word of the control instruction, duplicate instructions are removed from the control instruction to obtain the instruction to be executed; The instructions to be executed are processed according to the following sequence: first, the execution result is returned; then, the time-consuming action is executed; and finally, the process returns to sleep.

5. The method according to claim 4, characterized in that, The method further includes: Before falling back to sleep, the power supply pins of the control module are switched from the general purpose input / output domain to the low power normally open domain to maintain the level state of the pins during deep sleep. When the terminal is woken up, the pin is switched from the low-power normally open domain back to the general-purpose input / output domain.

6. The method according to any one of claims 1 to 5, characterized in that, The randomized scheduling mode is determined by the following method: Obtain the MAC address of the terminal; If the MAC address is a personalized MAC address, then the terminal is determined to enter the randomized scheduling mode.

7. A terminal randomized wake-up device, characterized in that, The device includes: The phase generation module is used to obtain the first random wake-up phase corresponding to the next wake-up window when the terminal is configured to randomized scheduling mode and the terminal is woken up. The duration determination module is used to determine the first target sleep duration before the next wake-up based on the first random wake-up phase, the second random wake-up phase corresponding to the current wake-up window, and the wake-up window period parameter; The wake-up module is used to wake up the terminal after the target sleep duration after the current wake-up cycle ends, so that the terminal can perform a broadcast while awake and determine the second target sleep duration before the next wake-up.

8. An electronic terminal, comprising a memory and a controller, wherein the memory stores a computer program, characterized in that, When the controller executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.