MESH information processing method and device and computer readable storage medium
By dynamically adjusting the storage step size of the MESH network, the problems of frequent erasure and writing of non-volatile memory and information storage under unstable voltage caused by fixed step size are solved. This enables timely storage of node information and consistency of SEQ values, thereby improving the reliability and stability of data transmission in the MESH network.
Patent Information
- Application Number
- CN202511106992.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-11-18
AI Technical Summary
In existing technologies, when MESH networks save node information, the fixed-step storage method leads to frequent erasure and rewriting of non-volatile memory or failure to save node information in a timely manner when the voltage is unstable, affecting the reliability and stability of data transmission.
By dynamically adjusting the saving step size value based on the change in SEQ value and voltage status, the node information can be saved in a timely manner in both stable and unstable states, and the SEQ value remains consistent when the chip is powered off.
This effectively avoids frequent erasure and rewriting of non-volatile memory, ensures timely preservation of node information and consistency of SEQ values, and improves the reliability and stability of data transmission in MESH networks.
Smart Images

Figure CN120979612A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of wireless communication, and in particular to a MESH information processing method and device, and a computer readable storage medium. BACKGROUND
[0002] A wireless mesh (MESH) network can create a large network containing dozens, hundreds or even more devices by virtue of multi-hop interconnection and mesh topology characteristics, combined with the wide application of Bluetooth Low Energy (BLE).
[0003] A MESH network is a flooding network, and to ensure the reliability of information, the same information usually needs to be sent multiple times. To ensure that only one processing is performed for one information transmission, and to avoid the replay attack behavior of an attacker, a Sequence number (SEQ) value with a length of 24 bits and strictly increasing is added in a MESH data packet, so as to ensure that the SEQ value of each new message sent by the same node is different.
[0004] After receiving the MESH information sent by a sending node in the MESH network, the receiving node caches the node information of the sending node using a retransmission protection list, and the node information of the sending node includes a Destination Address (DST), an Initialization Vector Index (IVI), and a SEQ value, etc. When the receiving node receives the MESH information sent by the same sending node again, the Source Address (SRC) of the sending node is obtained from the MESH information, and it is determined whether the SRC of the sending node is saved in the retransmission protection cache list, and whether the SEQ value in the received MESH information is greater than the SEQ value stored in the retransmission protection cache list. Only when both conditions are met, the MESH information is received, otherwise, the MESH information is discarded.
[0005] To ensure that the original SEQ value can still be maintained after power-off and re-powering, the DST and SEQ value of the node are usually saved in a non-volatile memory (such as FLASH) in the sending node.
[0006] In the prior art, a fixed step storage method is usually used to save node information. That is, a saving step value M is set, and when the SEQ value counts to an integer multiple of M, the node information is stored once. When the chip is powered off and then powered on, the stored data is loaded and the saving step M is added as the initial value of the SEQ value of the current message.
[0007] However, if the value of M is small, the non-volatile memory is frequently erased and written, which leads to the non-volatile memory being damaged early and the normal data transmission being affected; if the value of M is large, the node information cannot be saved in time when the working state is unstable (such as unstable voltage). SUMMARY
[0008] The present application aims at least to provide a MESH information processing method and device, which can dynamically adjust the saving step value, save the node information in time while avoiding the non-volatile memory being frequently erased and written, and save the node information in time when the chip is powered off.
[0009] In the first aspect, the present application provides a MESH information processing method, comprising: obtaining a SEQ value change amount in a current period; in response to a saving trigger condition being met, storing first node information and corresponding check information of the first node information to a target storage area, the saving trigger condition comprising any one of the following: the SEQ value change amount reaching a first saving step value corresponding to the current period, detecting that the voltage is lower than a preset low voltage detection threshold in the current period; the first node information comprising: node MESH information and the first saving step value; the node MESH information comprising: a SEQ value corresponding to when the trigger condition is met; reading the first node information and the corresponding check information of the first node information from the target storage area, checking the first node information; determining a second saving step value based on the checking result, the second saving step value being a saving step value of a next period; wherein, if the checking result is checking success, the second saving step value is greater than the first saving step value; if the checking result is checking failure, the second saving step value is less than the first saving step value.
[0010] In the current period, when the SEQ value change amount reaches the first saving step value is detected, or when the voltage lower than the preset low voltage detection threshold is detected in the current period, the first node information and the corresponding check information of the first node information are stored to the target storage area. The first node information and the check information are read from the target storage area, and the first node information is checked. If the first node information is checked and the checking is successful, the saving step value is increased in the next period; if the first node information is checked but the checking fails, the saving step value is decreased in the next period. Thus, the saving step value can be dynamically adjusted based on the working state of the chip, so that the non-volatile memory can be avoided from being frequently erased and written due to the small saving step value, and the node information can be saved in time under the condition that the working state of the chip is unstable. In addition, the node information can be saved in time when the chip is powered off, and the consistency of the SEQ values of the sending node and the receiving node can be ensured.
[0011] Optionally, the MESH information processing method further comprises: the current period is the first period after power-on or reset of the chip, and the first save step value is set as a preset save step initial value in response to detection that no historical node information is stored in the target storage area at the start time of the current period.
[0012] Optionally, the MESH information processing method further comprises: the current period is the first period after power-on or reset of the chip, and the first save step value is determined based on historical node information in response to detection that historical node information is stored in the target storage area at the start time of the current period.
[0013] Optionally, the determination of the first save step value based on the historical node information comprises: reading first historical node information from the target storage area, and verifying the first historical node information; if the first historical node information is verified and the verification is successful, increasing the save step value corresponding to the first historical node information as the first save step value; the first historical node information is node information stored in the target storage area last time.
[0014] Optionally, the MESH information processing method further comprises: taking the SEQ value in the first historical node information as an initial value of the SEQ value in the current period.
[0015] Optionally, after the verification of the first historical node information fails, the method further comprises: reading other historical node information from the target storage area in sequence according to storage time sequence and verifying the other historical node information; determining second historical node information, and reducing the save step value corresponding to the second historical node information as the first save step value; the second historical node information is node information stored in the target storage area last time among the historical node information which is verified and verified successfully.
[0016] Optionally, the MESH information processing method further comprises: determining the initial value of the SEQ value in the current period as SEQ initial = SEQ m + SEQ step_m + SEQ step_m+1 + … + SEQ step_n ; wherein, SEQ initial is the initial value of the SEQ value in the current period, SEQ m is the SEQ value in historical node information with index number m, SEQ step_m is the save step value in historical node information with index number m, and SEQ step_m+1SEQ is a saved step value in history node information with index number m+1 step_n SEQ is a saved step value in history node information with index number n; the history node information with index number m is the second history node information, and the history node information with index number n is the first history node information, n and m are positive integers and n>m.
[0017] Optionally, the MESH information processing method further comprises: in response to the target storage area storing history node information, acquiring an amount of stored data in the target storage area; and if the amount of stored data reaches a preset storage threshold, cleaning the data stored in the target storage area.
[0018] Optionally, after detecting that the voltage is lower than the preset low-voltage detection threshold at the first time in the current period, the method further comprises: controlling to close a circuit module in the chip irrelevant to the data write operation.
[0019] After detecting that the voltage is lower than the preset low-voltage detection threshold, the circuit module in the chip irrelevant to the data write operation can be closed, and the power consumption of the chip can be effectively saved.
[0020] Optionally, the first saved step value is smaller than a preset saved step maximum value and larger than a preset saved step minimum value; and the second saved step value is smaller than the saved step maximum value and larger than the saved step minimum value.
[0021] Optionally, the MESH information processing method further comprises: detecting that the duration for which the voltage is lower than the low-voltage detection threshold in the current period is smaller than a preset first duration, and determining that the saved trigger condition is not met; and the first duration is smaller than a minimum duration for data write of the non-volatile memory.
[0022] In a second aspect, the present application further provides a MESH information processing apparatus, comprising: an acquisition unit configured to acquire a SEQ value variation amount in a current period; a storage unit configured to store first node information and corresponding check information of the first node information to a target storage area when a saving trigger condition is met, the saving trigger condition comprising any one of: the SEQ value variation amount reaching a first saving step value corresponding to the current period, and detecting a voltage lower than a preset low voltage detection threshold in the current period; the first node information comprising: node MESH information and the first saving step value; the node MESH information comprising: a corresponding SEQ value when the trigger condition is met; a check unit configured to read the first node information and the corresponding check information of the first node information from the target storage area, and check the first node information; and a determination unit configured to determine a second saving step value based on a check result, the second saving step value being a saving step value of a next period; wherein, if the check result is check success, the second saving step value is greater than the first saving step value; and if the check result is check failure, the second saving step value is less than the first saving step value.
[0023] In a third aspect, the present application further provides a computer readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, and has stored thereon a computer program, which, when run on a processor, performs the steps of the MESH information processing method according to any one of the preceding aspects.
[0024] In a fourth aspect, the present application further provides another MESH information processing apparatus, comprising a memory and a processor, wherein the memory has stored thereon a computer program capable of running on the processor, and the processor, when running the computer program, performs the steps of the MESH information processing method according to any one of the preceding aspects. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 is a structure diagram of a BLE MESH data packet according to the prior art;
[0026] Figure 2 is a flowchart of a MESH information processing method according to an embodiment of the present application;
[0027] Figure 3 is a waveform diagram of a working voltage variation according to an embodiment of the present application;
[0028] Figure 4 is a flowchart of another MESH information processing method according to an embodiment of the present application;
[0029] Figure 5 is a structure diagram of a MESH information processing apparatus according to an embodiment of the present application. DETAILED DESCRIPTION
[0030] As shown in the following table, a structure diagram of a BLE MESH data packet in the prior art is given. Figure 1
[0031] As shown in the following table, a structure diagram of a BLE MESH data packet in the prior art is given. Figure 1 As shown in the following table, a structure diagram of a BLE MESH data packet in the prior art is given.
[0032] In a specific implementation, the length of the IVI field is 1 bit, which is used to store the lowest bit of the IVI of the authenticated and encrypted network PDU. The length of the NID field is 7 bits, which is used to store a value derived from a network key, determining which MESH network is used to transmit data. The length of the CTL field is 1 bit, which is used to determine whether an access message or a control message is included. The length of the TTL field is 7 bits, when its value corresponds to a binary value of 0 or a binary value of 1, it represents that the received information does not need to be relayed; when its value corresponds to a binary data of 127, it represents that the received information has not been relayed but can be relayed; when its value corresponds to a binary data of 2-126, it represents that the received information may have been relayed and can be relayed.
[0033] The length of the SEQ field is 24 bits, and the SEQ value is the sequence number of the node information. In the MESH network, each node that transmits MESH information has a one-to-one independent SEQ value. The length of the DST field is 16 bits, the length of the Transport PDU is 8 bits-128 bits, and the length of the NetMIC is 32 bits or 64 bits.
[0034] When the node is a sender, the SEQ value needs to be updated after each new message is sent, that is, the SEQ value is increased by 1, so as to avoid the receiver judging that the received information is early information.
[0035] When the node is as a receiver, after receiving the new information, it is judged whether the received information is valid based on the SEQ value in the data packet and the SEQ value corresponding to the SRC unicast address in the data packet. If the SEQ value in the data packet is greater than or equal to the SEQ value corresponding to the SRC unicast address, it is determined that the received information is valid. If the SEQ value in the data packet is less than the SEQ value corresponding to the SRC unicast address, it is determined that the received information is invalid.
[0036] In a specific implementation, the specific structure of the BLE MESH data packet, the specific length of each field and the information carried, etc. can be correspondingly referred to the related description in the existing BLE protocol.
[0037] In the prior art, a fixed step storage method is usually used to save node information. That is, a saving step value M is set, and when the SEQ value counts to an integer multiple of M, the node information is stored once. When the chip is powered off and powered on again, the stored data is loaded and added to the saving step M as the initial value of the SEQ value of the current message.
[0038] In the embodiment of the present application, when the SEQ value change amount in the current period reaches the first saving step value in the current period, or when the voltage is detected to be lower than the preset low voltage detection threshold in the current period, the first node information and the first node information corresponding to the check information are stored to the target storage area. The first node information and the check information are read from the target storage area, and the first node information is checked. If the first node information is checked and the check is successful, the saving step value is increased in the next period. If the first node information is checked but the check fails, the saving step value is decreased in the next period. Thus, the saving step value can be dynamically adjusted based on the working state of the chip. When the working state of the chip is stable, the saving step value is increased, which can avoid frequent erasing and writing of the non-volatile memory due to the small saving step value. When the working state of the chip is unstable, especially when the voltage of the chip fluctuates, the node information can also be saved in time. Moreover, while saving the node information in time when the chip is powered off, the consistency of the SEQ values of the sending node and the receiving node can be ensured.
[0039] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0040] The embodiment of the present application provides a MESH information processing method, which refers to Figure 2 , which will be described in detail through specific steps.
[0041] In the embodiment of the present application, the MESH information processing method provided by steps 201-204 can be executed by a node in the MESH network. Specifically, the MESH information processing method can be executed by a chip with data processing capability in the node or a chip module with data processing capability in the node.
[0042] In a specific implementation, the MESH network can be composed of several nodes. In some large MESH networks, the number of nodes can be dozens, hundreds or even more. The node can also be referred to as a communication device, a communication node, a transmission device, a transmission node, etc. When the node is used for information sending, the node can also be referred to as a sending node, a sender, a sending end, etc. When the node is used for information receiving, the node can also be referred to as a receiving node, a receiver, a receiving end, etc.
[0043] The following will be described taking the chip in the node executing the MESH information processing method as an example.
[0044] In step 201, the change amount of the SEQ value in the current period is obtained.
[0045] In a specific application, it can be known that after the node completes a new data sending, the corresponding SEQ value is updated once, that is, after completing a new data sending, the SEQ value is added by 1 as the updated SEQ value.
[0046] For example, in the current period, the initial value of the corresponding SEQ value is 0. When the chip completes the first new data sending, the SEQ value is updated to 1. When the chip completes the second new data sending, the SEQ value is updated to 2. And so on.
[0047] When the number of new data sent by the node reaches the saved step value, the node information corresponding to the node can be stored.
[0048] It can be seen that the node stores the node information periodically. The period can be divided by the number of new data sent. Specifically, the period can be divided by the saved step value. In the current period, when the new data sent reaches the saved step value, the next period is entered.
[0049] In the embodiment of the present application, the saved step value corresponding to different periods can be changed, not fixed. In the current period, the SEQ value can be updated once after each new data sending.
[0050] In step 202, in response to satisfying a saved trigger condition, the first node information and the check information corresponding to the first node information are stored in a target storage area.
[0051] In the embodiment of the present application, the saving trigger condition can include any one of the following: the SEQ value change amount reaches a first saving step value corresponding to the current period, and a voltage lower than a preset low voltage detection threshold is detected in the current period. The first node information includes: node MESH information and the first saving step value. The node MESH information can include the SEQ value corresponding to the time when the saving trigger condition is met.
[0052] In the embodiment of the present application, after the SEQ value is updated in the current period, it can be detected whether the SEQ value change amount in the current period reaches the first saving step value. The first saving step value is the saving step value corresponding to the current period. The SEQ value change amount in the current period is the number of times of sending new data in the current period, that is, how many times of data sending are performed in the current period.
[0053] In the specific implementation, when it is detected that the SEQ value change amount in the current period does not reach the first saving step value and the voltage of the chip is higher than the preset low voltage detection threshold, the first node information does not need to be stored.
[0054] After it is detected that the SEQ value change amount in the current period reaches the first saving step value, the first node information can be obtained, and the first node information includes: node MESH information of the current period and the first saving step value. The node MESH information of the current period includes the SEQ value at the end of the current period, the IVI value, and the DST value of the node.
[0055] For example, the first saving step value is 2000. When it is detected that the SEQ value change amount reaches 2000, the first node information is obtained, and the first node information includes: node MESH information of the current period and the first saving step value is 2000. The node MESH information includes: the IVI value, the SEQ value at the end of the current period is 2000, and the DST address of the node.
[0056] In the embodiment of the present application, the sending node can also monitor whether the voltage of the chip is lower than the low voltage detection threshold in real time in the current period. When it is detected that the voltage of the chip is lower than the low voltage detection threshold at a first time in the current period, it is determined that the saving trigger condition is met, and the first node information can be stored to the target storage area. In this scenario, the SEQ value corresponding to the node MESH information in the first node information is the SEQ value corresponding to the first time.
[0057] It can be seen that, if the voltage lower than the low voltage detection threshold is not detected in the current period, the node MESH information includes the SEQ value at the end of the current period. If the voltage lower than the low voltage detection threshold is detected in the current period, the node MESH information includes the SEQ value corresponding to the first time.
[0058] For example, the voltage is detected to be lower than the low voltage detection threshold at a first time, and the SEQ value is 2500 at the first time. The node MESH information includes the SEQ value of 2500.
[0059] In a specific implementation, when the chip detects that the operating voltage is less than the low voltage detection threshold, the fast programming mode can be used to store the node information to be stored to the target storage area.
[0060] In a specific implementation, after obtaining the first node information, the first node information can be stored to the target storage area in the non-volatile memory.
[0061] In the embodiments of the present application, after obtaining the first node information, the first node information can be verified, and the verification information corresponding to the first node information can be calculated. Then, the first node information and the verification information are stored in the target storage area.
[0062] In a specific implementation, the first node information and the corresponding verification information can be stored in adjacent positions in the target storage area. The verification method used for verifying the first node information can include cyclic redundancy check, parity check, etc. The target storage area is a storage area pre-set in the non-volatile memory, which can be used for storing node information and verification information corresponding to the node information.
[0063] In a specific implementation, the non-volatile memory can be FLASH, or Electrically Erasable Programmable Read Only Memory (EEPROM) and the like.
[0064] In some embodiments, the non-volatile memory is FLASH. For example, the storage capacity of the FLASH is 512KB, including 128 pages, and the storage capacity of each page is 4KB. Two pages of them are used as the target storage area, so the total storage capacity of the target storage area is 8KB.
[0065] It can be understood that the above is only described with the non-volatile memory as FLASH. Moreover, the total storage capacity of the target storage area is also not limited to the above 8KB.
[0066] Step 203, reading the first node information and the verification information corresponding to the first node information from the target storage area, and verifying the first node information.
[0067] In the embodiment of the present application, after the first node information is stored in the target storage area, the chip can also read the first node information from the target storage area and check the first node information. For the convenience of description, the check information corresponding to the first node information stored in the target storage area in step 202 is referred to as first check information in the following embodiment.
[0068] That is, after the first node information is stored in the target storage area, the first node information can also be read from the target storage area and rechecked to determine whether a data storage error occurs in the process of storing the first node information.
[0069] In some scenarios, such as in the process of storing the first node information, if the chip is disturbed, such as system voltage fluctuation, the stored first node information will be incorrect.
[0070] In the specific implementation, the chip reads the first node information from the target storage area, rechecks the first node information, and obtains a check result (hereinafter referred to as second check information).
[0071] The first check information is compared with the second check information. If the first check information is the same as the second check information, it is determined that the check result is a check success; otherwise, if the first check information is different from the second check information, it is determined that the check result is a check failure.
[0072] Step 204, determining a second save step value based on the check result.
[0073] In the embodiment of the present application, the second save step value is the save step value of the next period. The next period is adjacent to and after the current period in time sequence. In the current period, after the SEQ value changes by the first save step, the next period is entered.
[0074] In the specific implementation, if the first node information is checked and the check is successful, the second save step value is set to be greater than the first save step value; if the first node information is checked but the check fails, the second save step value is set to be less than the first save step value.
[0075] In the specific application, if the first node information is checked and the check is successful, it means that the current working state of the chip is relatively stable. In this scenario, the save step value can be appropriately increased to reduce the frequency of saving node information.
[0076] If the first node information is checked but the check fails, it means that the current working state of the chip is unstable. In this scenario, the save step value can be appropriately reduced to increase the frequency of saving node information, which can timely and effectively save node information.
[0077] In the embodiments of the present application, the second save step value can be obtained based on the first save step value. The first save step value is not greater than a preset maximum save step value and not less than a preset minimum save step value. The second save step value is not greater than the maximum save step value and not less than the minimum save step value.
[0078] In specific implementation, the maximum save step value and the minimum save step value can be preset. A save step initial value can also be preset, and the save step initial value can be a save step value corresponding to a first period after the chip is powered on for the first time.
[0079] In specific implementation, the maximum save step value and the minimum save step value can be set based on specific application scenarios, read-write characteristics of the non-volatile memory (such as FLASH), and the like.
[0080] In some embodiments, the maximum save step value is set to 65535, and the minimum save step value is set to 60. In other embodiments, the maximum save step value is set to 65535, and the minimum save step value is set to 100.
[0081] In specific implementation, when the second save step value is obtained based on the first save step value, the first save step value can be multiplied by a predetermined first multiple (the first multiple is greater than 1), or the first save step value can be added by a preset first step value (the first step value is a positive integer), to obtain the second save step value greater than the first save step value.
[0082] Correspondingly, when the second save step value is obtained based on the first save step value, the first save step value can be divided by a predetermined second multiple (the first multiple is greater than 1), or the first save step value can be subtracted by a preset second step value (the second step value is a positive integer), to obtain the second save step value less than the first save step value.
[0083] For example, the first save step value is multiplied by 4 to obtain the second save step value. Or, the first save step value is divided by 2 to obtain the second save step value.
[0084] For another example, the first save step value is added by 200 to obtain the second save step value. Or, the first save step value is subtracted by 100 to obtain the second save step value.
[0085] In a specific implementation, when the second save step value is obtained based on the first save step value, if the save step value obtained based on the first save step value is greater than the maximum save step value, the maximum save step value can be taken as the second save step value; if the save step value obtained based on the first save step value is less than the minimum save step value, the minimum save step value can be taken as the second save step value.
[0086] For example, the first save step value is 40000, and the maximum save step value is 65535. The first save step value is multiplied by 2. Since the current save step value multiplied by 2 is 80000, which is greater than 65535, the updated save step value is set to 65535.
[0087] For another example, the current save step value is 100, and the minimum save step value is 60. The save step value is updated by dividing the current save step value by 2. Since the current save step value divided by 2 is 50, which is less than the minimum save step value, the updated save step value is set to 60.
[0088] The first save step value of the current period and the initial value of the SEQ value of the current period are described in detail below.
[0089] Those skilled in the art can understand that when the chip is working normally, the SEQ value in the RAM variable will not be lost in the case that the chip is not powered on or reset in the previous period, so it is not necessary to obtain the initial value of the SEQ value of the current period. Therefore, the following scenario of obtaining the initial value of the SEQ value of the current period is for the first period after the chip is powered on or reset.
[0090] In other words, when the first save step value of the current period and the initial value of the SEQ value of the current period are determined based on the historical node information, the current period is the first period after the chip is powered on or reset.
[0091] In the embodiment of the application, the first save step value of the current period can be determined based on whether the historical node information is stored in the target storage area.
[0092] In a specific implementation, if it is detected that the target storage area does not store the historical node information at the start time of the current period, the preset save step initial value can be taken as the first save step value. The historical node information can refer to the node information generated in the historical period before the current period and stored in the target storage area.
[0093] In other words, the historical node information is the node information corresponding to the historical period. The historical period is before the current period in time sequence.
[0094] Specifically, when the chip is powered on for the first time, that is, when the chip is used for the first time, the target storage area does not store historical node information. In this scenario, the preset save step initial value is used as the first save step value.
[0095] For example, the save step initial value is set to 400. When the chip is powered on for the first time, the first save step value is 400 in the current period.
[0096] If the chip is powered on again or reset during operation, the target storage area may store historical node information.
[0097] In a specific implementation, if it is detected at the start of the current period that the target storage area stores historical node information, the first save step value can be determined based on the historical node information. Moreover, the SEQ value in the first historical node information is used as the initial value of the SEQ value in the current period.
[0098] Specifically, the chip can read the first historical node information from the target storage area and verify the first historical node information. If the first historical node information is verified and the verification is successful, the save step value in the first historical node information is increased to obtain the first save step value. The first historical node information is the node information stored in the target storage area last time.
[0099] The way in which the save step value in the first historical node information is increased can refer to the way in which the first save step value is increased to the second save step value described above.
[0100] For example, if the save step value in the first historical node information is 400, the first save step value is determined to be 400x2=800.
[0101] For example, if the save step value in the first historical node information is 400, the first save step value is determined to be 400+200=600.
[0102] The principle and process of verifying the first historical node information can refer to the principle and process of verifying the first node information described above.
[0103] Specifically, before storing the first historical node information to the target storage area, the first historical node information is calculated to obtain check information (referred to as first historical check information) of the first historical node information, and the first historical check information is stored to the target storage area. The first historical node information and the first historical check information are obtained from the target storage area, and the read first historical node information is rechecked to obtain second historical check information. If the first historical check information is the same as the second historical check information, it is determined that the first historical node information is checked and the checking is successful; otherwise, if the first historical check information is not the same as the second historical check information, it is determined that the first historical node information is checked but the checking fails.
[0104] In a specific implementation, if it is determined that the first historical node information is checked but the checking fails, other historical node information can be read from the target storage area in sequence according to a storage time sequence of the historical node information and checked. The second historical node information is determined, and a saving step value corresponding to the second historical node information is reduced to serve as the first saving step value. The second historical node information described above is the node information that is stored in the target storage area for the last time and checked successfully.
[0105] Specifically, historical node information before the first historical node information can be selected according to the storage time sequence, and the historical node information is checked. If the checking is successful, the historical node information is taken as the second historical node information; if the checking fails, historical node information before the historical node information is selected, and the selected historical node information is checked, and so on, until the historical node information with a checking result of checking success is found as the second historical node information.
[0106] For example, according to the time sequence, n historical node information is stored in the target storage area, and the index numbers of the n historical node information are 1-n in sequence. The smaller the index number of the historical node information, the earlier the corresponding historical node information is stored in the target storage area; on the contrary, the larger the index number of the historical node information, the later the corresponding historical node information is stored in the target storage area.
[0107] Specifically, the historical node information with the index number 1 is stored in the target storage area earliest, the historical node information with the index number 2 is stored in the target storage area later than the historical node information with the index number 1, and so on. The historical node information with the index number n is the historical node information stored in the target storage area for the last time (that is, the first historical node information).
[0108] If the historical node information with index number n is checked and fails, the historical node information with index number n-1 is checked. If the historical node information with index number n-1 is checked and succeeds, the historical node information with index number n-1 is the second historical node information; if the historical node information with index number n-1 is checked and fails, the historical node information with index number n-2 is checked. If the historical node information with index number n-2 is checked and succeeds, the historical node information with index number n-2 is taken as the second historical node information; otherwise, if the historical node information with index number n-2 is checked and fails, the historical node information with index number n-3 is checked, and so on.
[0109] The second historical node information is set as the historical node information with index number m. When the first saving step value of the current period is determined based on the second historical node information, the saving step value of the second historical node information is reduced to obtain the first saving step value.
[0110] Specifically, the saving step value of the second historical node information can be reduced by referring to the implementation manner of reducing the first saving step value to obtain the second saving step value in the above embodiment.
[0111] For example, n=8, m=5, and the saving step value of the second historical node information is 10000, and the first saving step value is 10000 / [2×(n-m+1)]=1250.
[0112] Further, the initial value of the SEQ value in the current period is determined as:
[0113] SEQ initial = SEQ m +SEQ step_m + SEQ step_m+1 +……+ SEQ step_n ;
[0114] wherein, SEQ initial is the initial value of the SEQ value in the current period, SEQ m is the SEQ value in the historical node information with index number m, SEQ step_m is the saving step value in the historical node information with index number m, SEQ step_m+1 is the saving step value in the historical node information with index number m+1, and SEQ step_n is the saving step value in the historical node information with index number n; the historical node information with index number m is the second historical node information, and the historical node information with index number n is the first historical node information.
[0115] In summary, the first saving step value of the current period and the initial value of the SEQ value are determined based on whether the historical node information is stored in the target storage area.
[0116] In the embodiment of the present application, when it is detected that the historical node information is stored in the target storage area, the amount of data stored in the target storage area can also be obtained. If it is detected that the amount of data stored in the target storage area reaches a preset storage threshold, the data stored in the target storage area can be cleaned up.
[0117] In a specific implementation, the storage threshold can be associated with the total storage amount of the target storage area. For example, the storage threshold is 80% of the total storage amount of the target storage area.
[0118] When the non-volatile memory is FLASH, cleaning up the data stored in the target storage area can mean that a page in which the amount of stored data reaches the preset storage threshold in the target storage area is erased, and new information is stored in a new storage page in the target storage area.
[0119] Referring to Figure 3 , a waveform diagram of a change in working voltage in the embodiment of the present application is given.
[0120] Figure 3 In the diagram, the abscissa is time t, and the ordinate is voltage V. V normal is the voltage when the chip is normally working, V0 is the low-voltage detection threshold, and V1 is the minimum voltage of the chip. The minimum voltage can be understood as the minimum voltage that enables the chip to store data. In other words, if the voltage is less than the minimum voltage, the chip cannot perform data storage operations. The voltage V normal is greater than the minimum detection threshold V0, and the minimum detection threshold V0 is greater than the minimum voltage V1.
[0121] In a specific implementation, when the low-voltage detection threshold is set, it needs to satisfy that Δt is greater than the minimum time length for data writing of the non-volatile memory, so as to ensure that when it is detected that the voltage is less than the low-voltage detection threshold, the first node information can be written to the target storage area.
[0122] In a specific implementation, the low-voltage detection threshold can be associated with the power-off rate and the programming time of the non-volatile memory. Specifically, the low-voltage detection threshold V0 needs to satisfy that V normal > V0 > V1 + R × T w ; wherein V normal is the working voltage when the chip is normally working, R is the power-off rate, and T w is the programming time of the non-volatile memory.
[0123] In some embodiments, the low-voltage detection threshold is set to 2.7V. It can be understood that the low-voltage detection threshold can also be set to other values, such as 2.6V, 2.8V, etc.
[0124] In a specific application, a suitable capacitance value can be selected based on the formula of energy stored in a capacitor E=CU 2 / 2 and the voltage formula of dynamic discharge to ensure that the power-off rate is greater than or equal to 10V / s. Wherein, E is the energy stored in the capacitor, C is the capacitance value of the capacitor, U is the potential difference between the upper plate and the lower plate of the capacitor; V t characterizes the voltage value of the capacitor at time t, and R is the equivalent resistance in the circuit.
[0125] In a specific implementation, a backup power source (such as a button cell) can also be added in the chip to ensure that in the case of sudden power failure, the backup power source can be switched to work, and the normal write operation of the first node information can be realized.
[0126] In the embodiment of the application, when the chip detects that the voltage is lower than the low-voltage detection threshold, the circuit module irrelevant to the data write operation can also be turned off to reduce the power consumption of the chip.
[0127] In a specific implementation, the voltage may fall temporarily. The above-mentioned temporary voltage drop can refer to that the voltage is less than the low-voltage detection threshold at the first time, and greater than the low-voltage detection threshold at the second time, and the time length between the first time and the second time is less than the preset first time length. In this scenario, the first node information does not need to be stored to further reduce the write frequency.
[0128] In a specific implementation, the above-mentioned first time length can be less than the minimum time length of data write of the non-volatile memory. The specific value of the first time length can be set according to the specific application scenario. In some embodiments, the first time length can be one-tenth or one-hundredth of the minimum time length of data write of the non-volatile memory.
[0129] As Figure 3 shown, the change time length of the voltage is judged to determine whether the voltage temporarily drops, and it is determined that the voltage temporarily drops when the detected △ts is less than the preset first time length, and the non-volatile memory is not written to further reduce the write frequency.
[0130] The MESH information processing method provided in the above-mentioned embodiments of the application will be described in detail below. Referring to Figure 4 , a flowchart of another MESH information processing method in the embodiment of the application is given. The non-volatile memory is FLASH. The target storage area is a plurality of pages preset in the FLASH.
[0131] Step 401, the chip is powered on.
[0132] Step 402, initialization setting is performed.
[0133] In a specific implementation, when the chip is powered on, initialization setting can be performed, a low voltage protection threshold is set, an initial value of a save step is saved, a maximum value of the save step is saved, and a minimum value of the save step is saved.
[0134] In some embodiments, the low voltage protection threshold can be set to 2.5V-2.7V, the initial value of the save step is set to 200, the minimum value of the save step is set to 60, and the maximum value of the save step is set to 65535.
[0135] Step 403, it is judged whether historical node information is stored in a target storage area.
[0136] In a specific implementation, if it is determined that the historical node information is not stored in the target storage area, step 404 is performed; if it is determined that the historical node information is stored in the target storage area, step 405 is performed.
[0137] Step 404, the save step value is set to the initial value of the save step.
[0138] After step 404 is executed, step 411 can be performed.
[0139] Step 405, the first historical node information is verified.
[0140] Step 406, it is judged whether the verification is successful.
[0141] In a specific implementation, the first historical node information is verified, if the verification result is that the verification is successful, step 407 is performed; if the verification fails, step 408 is performed.
[0142] Step 407, the first historical node information is loaded to a RAM variable.
[0143] In a specific implementation, the first historical node information is loaded to the RAM variable, which is used to determine an initial value of the first save step value and the SEQ value of the current period.
[0144] Step 408, the second historical node information is determined, and the second historical node information is loaded to the RAM variable.
[0145] In a specific implementation, the second historical node information is loaded to the RAM variable, which is used to determine an initial value of the first save step value and the SEQ value of the current period.
[0146] Step 409, it is judged whether the amount of stored data reaches a storage threshold.
[0147] In an embodiment, if it is determined that the amount of stored data reaches the storage threshold, step 410 is performed; otherwise, step 411 is performed.
[0148] In step 410, the target storage area is arranged.
[0149] In step 411, it is determined whether the voltage is lower than the low-voltage detection threshold.
[0150] In an embodiment, if it is determined that the voltage is lower than the low-voltage detection threshold, step 412 is performed; otherwise, step 413 is performed.
[0151] In step 412, the first node information and the check information are stored.
[0152] In an embodiment, if it is detected at the first time point of the current period that the voltage is lower than the low-voltage detection threshold, the node MESH information and the first save step value are stored in the target storage area. The node MESH information includes the SEQ value corresponding to the first time point.
[0153] In an embodiment, after it is detected that the operating voltage of the chip is lower than the low-voltage detection threshold, other circuits unrelated to the data saving operation can also be turned off.
[0154] In step 413, it is determined whether the SEQ value change amount of the current period reaches the first save step value.
[0155] In an embodiment, if the chip determines that the SEQ value change amount of the current period reaches the first save step value, step 414 is performed; otherwise, step 411 is performed.
[0156] In step 414, the first node information and the check information are stored.
[0157] In an embodiment, after it is detected that the SEQ value change amount of the current period reaches the save step value, the node MESH information of the current period and the save step value are stored as the first node information, and a check code corresponding to the first node information is generated, and the check code and the first node information are stored in the target storage area.
[0158] In step 415, it is determined whether the check result of the check information is check success.
[0159] In an embodiment, the first node information can be read from the target storage area, and the first node information is checked. If the check result is check success, step 416 is performed; otherwise, if the check result is check failure, step 417 is performed.
[0160] In step 416, the first save step value is increased.
[0161] In the embodiment of the present application, after the first save step value is increased to obtain the second save step value, step 411 can be re-executed.
[0162] Step 417, decrease the first save step value.
[0163] In the embodiment of the present application, after the first save step value is decreased to obtain the second save step value, step 411 can be re-executed.
[0164] From the above, in the embodiment of the present application, when the SEQ value change amount reaches the first save step value in the current period, or when the voltage is lower than the preset low voltage detection threshold in the current period, the first node information and the check information are stored to the target storage area. The first node information and the check information are read from the target storage area, and the first node information is checked. If the check result of checking the first node information is check success, the save step value is increased in the next period; if the check result of checking the first node information is check failure, the save step value is decreased in the next period. Thus, based on the working state of the chip, the save step value can be dynamically adjusted, so that frequent erasing and writing of the non-volatile memory caused by a small save step value can be avoided, and the node information can be timely saved in the case that the working state of the chip is unstable. Moreover, the SEQ values of the sending node and the receiving node can be ensured to be consistent while the node information is timely saved when the chip is powered off.
[0165] Referring to Figure 5 , a MESH information processing device 50 in the embodiment of the present application is given, which comprises an acquisition unit 501, a storage unit 502, a check unit 503 and a determination unit 504, wherein:
[0166] The acquisition unit 501 is configured to acquire the SEQ value change amount in the current period;
[0167] The storage unit 502 is configured to store the first node information and the check information corresponding to the first node information to a target storage area in response to that a save trigger condition is met, the save trigger condition comprising any one of the following: the SEQ value change amount reaches the first save step value corresponding to the current period, the voltage is detected to be lower than a preset low voltage detection threshold in the current period; the first node information comprises node MESH information and the first save step value; the node MESH information comprises the SEQ value corresponding to when the trigger condition is met;
[0168] The check unit 503 is configured to read the first node information and the check information corresponding to the first node information from the target storage area, and check the first node information;
[0169] The determining unit 504 is configured to determine a second save step value based on the check result, the second save step value being a save step value of a next period; wherein if the check result is a check success, the second save step value is greater than the first save step value; and if the check result is a check failure, the second save step value is less than the first save step value.
[0170] Optionally, the storage unit 502 is further adapted to store first node information to the target storage area when detecting that the voltage is lower than a preset low-voltage detection threshold at a first time point in the current period; the first node information comprises a SEQ value corresponding to the first time point.
[0171] In a specific implementation, the specific execution processes of the above-described obtaining unit 501, the storage unit 502, the check unit 503 and the determining unit 504 can be correspondingly referred to steps 201 to 204, and details are not described herein.
[0172] In a specific implementation, each module / unit contained in each device / product described in the above embodiments can be a software module / unit, or a hardware module / unit, or part of the software module / unit and part of the hardware module / unit.
[0173] For example, for each device / product applied to or integrated in a chip, each module / unit contained therein can be realized in the form of hardware such as a circuit, or at least part of the modules / units can be realized in the form of a software program running on a processor integrated in the chip, and the remaining (if any) modules / units can be realized in the form of hardware such as a circuit; for each device / product applied to or integrated in a chip module, each module / unit contained therein can be realized in the form of hardware such as a circuit, and different modules / units can be located in the same component (for example, a chip, a circuit module, etc.) or different components of the chip module, or at least part of the modules / units can be realized in the form of a software program running on a processor integrated in the chip module, and the remaining (if any) modules / units can be realized in the form of hardware such as a circuit; for each device / product applied to or integrated in a terminal, each module / unit contained therein can be realized in the form of hardware such as a circuit, and different modules / units can be located in the same component (for example, a chip, a circuit module, etc.) or different components of the terminal, or at least part of the modules / units can be realized in the form of a software program running on a processor integrated in the terminal, and the remaining (if any) modules / units can be realized in the form of hardware such as a circuit.
[0174] The embodiment of the present application further provides a computer readable storage medium, which is a nonvolatile storage medium or a non-transitory storage medium, and has stored thereon a computer program, which, when executed by a processor, performs the steps of the MESH information processing method provided by any of the above embodiments.
[0175] The embodiment of the present application further provides another MESH information processing device, which comprises a memory and a processor, and the memory has stored thereon a computer program capable of being executed on the processor, and the processor executes the steps of the MESH information processing method provided by any of the above embodiments when executing the computer program.
[0176] Those skilled in the art can understand that all or part of the steps in the above-mentioned various methods of the embodiments can be completed by a program instructing related hardware, and the program can be stored in a computer readable storage medium, which can include ROM, RAM, magnetic or optical disk, FLASH, etc.
[0177] Although the present application is disclosed as above, the present application is not limited to this. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application, and the protection scope of the present application should be subject to the scope defined by the claims.
Claims
1. A MESH information processing method, characterized by, The method comprises: acquiring a SEQ value change amount in a current period; in response to a saving trigger condition being met, storing first node information and check information corresponding to the first node information in a target storage area, the saving trigger condition comprising any one of the following: the SEQ value change amount reaching a first saving step value corresponding to the current period, detecting that a voltage is lower than a preset low voltage detection threshold in the current period; the first node information comprising: node MESH information and the first saving step value; the node MESH information comprising: a SEQ value corresponding to when the trigger condition is met; reading the first node information and the check information corresponding to the first node information from the target storage area, and checking the first node information; determining a second saving step value based on a check result, the second saving step value being a saving step value of a next period; wherein, if the check result is a check success, the second saving step value is greater than the first saving step value; and if the check result is a check failure, the second saving step value is less than the first saving step value.
2. The MESH information processing method of claim 1, wherein, Further comprising: the current period being a first period after a chip is powered on or reset, and detecting that no historical node information is stored in the target storage area, setting the first saving step value as a preset saving step initial value.
3. The MESH information processing method of claim 1, wherein, Further comprising: the current period being a first period after a chip is powered on or reset, and detecting that historical node information is stored in the target storage area, determining the first saving step value based on the historical node information.
4. The MESH information processing method of claim 3, wherein, The determination of the first saving step value based on the historical node information comprises: reading first historical node information from the target storage area, and checking the first historical node information; if the first historical node information is checked and the check is successful, increasing a saving step value corresponding to the first historical node information as the first saving step value; the first historical node information being node information stored in the target storage area most recently.
5. The MESH information processing method of claim 4, wherein, Further comprising: taking a SEQ value in the first historical node information as an initial value of a SEQ value in the current period.
6. The MESH information processing method of claim 4, wherein, After the first historical node information is checked and the check fails, further comprising: reading other historical node information from the target storage area in sequence according to a storage time sequence and checking the other historical node information; determining second historical node information, and reducing a saving step value corresponding to the second historical node information as the first saving step value; the second historical node information being node information stored in the target storage area most recently among the historical node information that is checked and the check is successful.
7. The MESH information processing method of claim 6, wherein, Further comprising: determining the initial value of the SEQ value in the current period as: SEQ initial = SEQ m +SEQ step_m + SEQ step_m+1 +……+ SEQ step_n ; wherein SEQ initial is an initial value of the SEQ value in the current period, SEQ m is the SEQ value in the historical node information with index number m, SEQ step_m is the saved step value in the historical node information with index number m, SEQ step_m+1 is the saved step value in the historical node information with index number m+1, SEQ step_n is the saved step value in the historical node information with index number n; the historical node information with index number m is the second historical node information, the historical node information with index number n is the first historical node information, and n and m are positive integers and n>m.
8. The MESH information processing method according to any one of claims 3 to 7, characterized by, Further comprising: in response to the target storage area storing historical node information, acquiring an amount of data already stored in the target storage area; if the amount of data already stored reaches a preset storage threshold, cleaning up data stored in the target storage area.
9. The MESH information processing method of claim 1, wherein, After detecting that a voltage is lower than a preset low voltage detection threshold at a first time in the current period, further comprising: Control to turn off circuit modules in the chip that are not related to data write operations.
10. The MESH information processing method of claim 1, wherein, The first save step value is less than a preset save step maximum value and greater than a preset save step minimum value. The second save step value is less than the save step maximum value and greater than the save step minimum value.
11. The MESH information processing method of claim 1, wherein, Also comprising: When the duration of detecting that the voltage is lower than the low voltage detection threshold in the current period is less than a preset first duration, it is determined that the save trigger condition is not met. The first duration is less than the minimum duration for data write of the non-volatile memory.
12. A MESH information processing device, characterized by comprising: Comprising: An acquisition unit, configured to acquire a SEQ value change amount in a current period; A storage unit, configured to store first node information and check information corresponding to the first node information to a target storage area in response to a save trigger condition being met, the save trigger condition comprising any one of the following: the SEQ value change amount reaches a first save step value corresponding to the current period, and a voltage lower than a preset low voltage detection threshold is detected in the current period; The first node information comprises node MESH information and the first save step value, and the node MESH information comprises a SEQ value corresponding to when the trigger condition is met; A check unit, configured to read the first node information and check information corresponding to the first node information from the target storage area, and check the first node information; A determination unit, configured to determine a second save step value based on a check result, the second save step value being a save step value of a next period; wherein if the check result is check success, the second save step value is greater than the first save step value; and if the check result is check failure, the second save step value is less than the first save step value.
13. A computer-readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, on which a computer program is stored, characterized by The computer program is run by the processor to execute the steps of the MESH information processing method of any one of claims 1-11.
14. A MESH information processing apparatus comprising a memory and a processor, said memory having stored thereon a computer program operable to run on said processor, characterized in that, The processor runs the computer program to execute the steps of the MESH information processing method of any one of claims 1-11.