Data read-write method of terminal, readable storage medium, program product and terminal

By dividing the NV storage area in the LTE Cat.1 terminal and optimizing the write strategy according to the startup and mobility states, the problem of accelerated Flash wear was solved, the lifespan of the Flash was extended, and the power consumption of the device was reduced.

CN120994137APending Publication Date: 2025-11-21CORE WING INFORMATION TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511161024.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-19
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In existing LTE Cat.1 terminals, the Flash memory wears out faster due to frequent writes, leading to storage media failure and affecting the lifespan and reliability of the device.

Method used

By dividing the NV storage area and determining read and write strategies based on the terminal's startup and mobility status, unnecessary Flash write operations are reduced. Triggered events are used to trigger writes, and the write strategy is optimized to extend the Flash lifespan.

Benefits of technology

Without affecting terminal services, reduce the number of Flash writes, extend the lifespan of Flash, reduce device power consumption, and avoid device scrapping due to storage failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994137A_ABST
    Figure CN120994137A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication, and discloses a data read-write method of a terminal, a readable storage medium, a program product and the terminal. The data reading and writing method of the terminal comprises the steps that the starting state of the terminal is determined, a reading strategy for reading NV data from at least part of NV storage areas of Flash is determined according to the starting state of the terminal, and the NV storage areas are divided according to the change frequency of the NV data corresponding to the NV storage areas in the running process of the terminal; the method comprises the steps of determining the moving state of a terminal according to the NV data, determining a writing strategy for writing at least part of parameters in the NV data into at least part of an NV storage area of Flash according to the moving state of the terminal, and at least part of writing operation when the at least part of parameters are written into the at least part of the NV storage area of the Flash is triggered by a set trigger event. According to the technical scheme, unnecessary write-in operation on the Flash can be reduced under the condition that the service of the terminal is not affected, the service life of the Flash is prolonged, the situation that the terminal is scrapped too early due to storage faults is avoided, and the power consumption of equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, and particularly relates to a data reading and writing method of a terminal, a readable storage medium, a program product and a terminal. BACKGROUND

[0002] LTE Cat.1 (a kind of LTE terminal-Category 1) is a kind of terminal category defined in 4G LTE network, designed for low-speed Internet of Things scene, first proposed by 3rd Generation Partnership Project (3GPP) standardization organization in Release 8 (3GPP standardization organization officially released a kind of technical specification version in March 2009) and continuously optimized in subsequent versions. LTE Cat.1 is an important terminal category of LTE network defined user equipment access capability and data transmission performance, and its technical specification clearly defines the basic communication capability of device in 4G LTE network. As a key component of cellular Internet of Things, LTE Cat.1 supports uplink peak rate 5Mbit / s, downlink peak rate 10Mbit / s, and provides an economical and efficient wireless connection solution for Internet of Things devices.

[0003] At present, LTE Cat.1 has been widely used in smart metering, asset tracking, wearable devices, intelligent parking and smart home due to its characteristics of low speed, low cost and low power consumption. With the rapid development of Internet of Things, more and more device manufacturers choose LTE Cat.1 as the communication module of their products. At the same time, with the popularization of Fifth Generation Mobile Networks (5G) network, LTE Cat.1 may be integrated with 5G technology to provide faster and lower latency communication services. In addition, with the increasing number of Internet of Things devices, LTE Cat.1 may be applied in more fields such as intelligent transportation and smart city.

[0004] In the existing LTE Cat.1 terminal, the flash memory is used as a non-volatile storage medium to save key information such as network configuration parameters, location information, and state data. In the LTE network environment, the LTE Cat.1 terminal needs to frequently perform operations such as registration, cell camping, cell reselection, tracking area update (TAU), and the like, and these processes all involve real-time writing to the flash memory. For example, the LTE Cat.1 terminal updates identity and access parameters when registering at startup or switching networks, periodically monitors signals and updates cell camping information in the idle state, and performs TAU when crossing tracking areas to maintain connectivity. Since the erase-write life of the flash memory is limited, usually 100,000 to 1,000,000 times, frequent writing will accelerate the wear and tear of the flash memory, resulting in an increase in the number of bad blocks of the flash memory, and eventually causing the storage medium to fail, thereby causing data damage or device failure. Therefore, there is an urgent need for a technical solution to effectively reduce the number of flash write operations to improve device service life. SUMMARY

[0005] Therefore, the embodiments of the present application provide a terminal data read-write method, a readable storage medium, a program product, and a terminal. The technical solution of the present application can reduce unnecessary write operations to the flash memory without affecting the business of the terminal, prolong the service life of the flash memory, avoid premature scrapping of the terminal due to storage failure, and reduce device power consumption.

[0006] In a first aspect, the present application provides a terminal data read-write method, the terminal comprising a flash memory, the flash memory comprising a plurality of NV storage areas, each NV storage area being used to store corresponding NV data, the method comprising: determining the startup state of the terminal, and determining a read strategy for reading NV data from at least part of the NV storage areas of the flash memory according to the startup state of the terminal, wherein the NV storage areas are divided according to the frequency of change of the NV data corresponding to the NV storage areas during terminal operation; determining the movement state of the terminal, and determining a write strategy for writing at least part of the parameters in the NV data to at least part of the NV storage areas of the flash memory according to the movement state of the terminal, wherein at least part of the write operation when writing the at least part of the parameters to at least part of the NV storage areas of the flash memory is triggered by a set trigger event.

[0007] In a possible implementation of the first aspect, the plurality of NV storage areas include a first NV storage area, a second NV storage area, a third NV storage area, and a fourth NV storage area, wherein the first NV storage area is configured to store first NV data, the second NV storage area is configured to store second NV data, the third NV storage area is configured to store third NV data, and the fourth NV storage area is configured to store fourth NV data.

[0008] In a possible implementation of the first aspect, the start state of the terminal includes power-on boot, deep sleep wake-up, and soft boot, and the read strategy of reading the NV data from at least part of the NV storage areas of the Flash is determined according to the start state of the terminal, including: In the case of power-on boot of the terminal, the first NV data is determined to be read from the first NV storage area of the Flash, and the third NV data is determined to be read from the third NV storage area of the Flash to the memory of the terminal; In the case of deep sleep wake-up of the terminal, the first NV data is determined to be read from the first NV storage area of the Flash, the third NV data is determined to be read from the third NV storage area of the Flash, and the fourth NV data is determined to be read from the fourth NV storage area of the Flash to the memory of the terminal; In the case of soft boot of the terminal, the first NV data and the third NV data read to the memory in the case of power-on boot of the terminal are kept unchanged.

[0009] In a possible implementation of the first aspect, the first NV data includes radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information. The second NV data includes dynamic context information of the terminal. The third NV data includes dynamic configurable network management information of the terminal. The fourth NV data includes data that needs to be saved when the terminal is in deep sleep.

[0010] In a possible implementation of the first aspect, the method further includes: Determining an influence degree of at least part of the parameters in the NV data on recovery of the terminal service; Classifying at least part of the parameters in the NV data according to the influence degree of at least part of the parameters in the NV data on recovery of the terminal service, to obtain core parameters, auxiliary parameters, and non-critical parameters.

[0011] In a possible implementation of the first aspect, the moving state of the terminal includes a static state, a low-speed moving state, a medium-speed moving state, and a high-speed moving state.

[0012] In a possible implementation of the first aspect, the core parameters include an AT command operation field, candidate frequency point information, RPLMN information, and security context information, and the set trigger event includes a first trigger event, The write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal includes: In a case where the terminal is in a static state or a low-speed moving state, For the AT command operation field, the AT command operation field is written into the first NV storage area of the Flash in real time by using a blocking operation; For the candidate frequency point information, if a first trigger event is detected, the candidate frequency point information is written into the third NV storage area of the Flash by using a non-blocking operation; For the RPLMN information and the security context information, in a case where the terminal is in a soft shutdown or deep sleep, the RPLMN information and the security context information are written into the third NV storage area of the Flash.

[0013] In a possible implementation of the first aspect, the method further includes: monitoring a power supply voltage; In a case where the power supply voltage is monitored to be lower than a set voltage threshold, it is determined that the terminal is in a power-off process, and then the candidate frequency point information and the RPLMN information are preferentially written into the third NV storage area of the Flash.

[0014] In a possible implementation of the first aspect, the auxiliary parameters include cell frequency point information, CellId, SIB2 code stream, historical frequency point information, and measurement values, and the set trigger event includes a second trigger event, The write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal includes: In a case where the terminal is in a static state or a low-speed moving state, if a second trigger event is detected, the cell frequency point information, CellId, SIB2 code stream, historical frequency point information, and measurement values are written into the third NV storage area of the Flash.

[0015] In a possible implementation of the first aspect, the non-critical parameters include timer information, temporary measurement reports, and intermediate states, and the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage areas of the Flash according to the moving state of the terminal comprises: In the case where the terminal is in a stationary state or a low-speed moving state, in the case where it is determined that the logical storage unit corresponding to the second NV storage area in the terminal needs to be powered off, the timer information, the temporary measurement reports, and the intermediate states are written into the second NV storage area of the Flash before the logical storage unit is powered off.

[0016] In a possible implementation of the first aspect, the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage areas of the Flash according to the moving state of the terminal further comprises: In the case where the terminal is in a medium-speed or high-speed moving state, For the case of intra-frequency cell reselection of the terminal, if a TAU procedure of the terminal is triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage areas of the Flash in the case where the TAU procedure ends and a second triggering event occurs; for the case of intra-frequency cell reselection of the terminal, if the TAU procedure of the terminal is not triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage areas of the Flash in the case where the terminal is powered off or the second triggering event occurs. For the case of inter-frequency cell reselection of the terminal, if a TAU procedure of the terminal is triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage areas of the Flash in the case where the TAU procedure ends and a second triggering event occurs; for the case of inter-frequency cell reselection of the terminal, if the TAU procedure of the terminal is not triggered, candidate frequency point information in the core parameters is updated, and at least part of the parameters in the updated core parameters and at least part of the parameters in the auxiliary parameters are written into the corresponding NV storage areas of the Flash in the case where the terminal is powered off or the second triggering event occurs. For the case of connection state switching of the terminal, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage areas of the Flash in the case where the second triggering event occurs.

[0017] In a possible implementation of the first aspect, the moving state of the terminal is determined in the following manner: The mobile state of the terminal is determined according to the number of times of cell reselection or cell handover of the terminal within a set time range.

[0018] In a second aspect, a computer readable storage medium is provided, and the computer readable storage medium stores instructions, which, when executed on an electronic device, cause the electronic device to perform the data read-write method of the terminal in the first aspect and any possible implementation of the first aspect.

[0019] In a third aspect, a computer program product is provided, and the computer program product includes instructions for implementing the data read-write method of the terminal in the first aspect and any possible implementation of the first aspect when executed on one or more processors.

[0020] In a fourth aspect, a terminal is provided, and the terminal includes: a memory configured to store instructions, and one or more processors configured to execute the instructions, and the one or more processors perform the data read-write method of the terminal in the first aspect and any possible implementation of the first aspect when the instructions are executed.

[0021] Compared with the prior art, the beneficial effects of the present application are that: by determining the mobile state of the terminal, the present application determines the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the mobile state of the terminal, so that the terminal has a corresponding write strategy in different mobile states, and since the write operation when at least part of the parameters are written into at least part of the NV storage area of the Flash is at least partially triggered by a set trigger event, unnecessary write operations to the Flash can be reduced without affecting the service of the terminal, not only the service life of the Flash can be prolonged, but also the terminal can be prevented from being prematurely scrapped due to storage failure, and the power consumption of the device can be reduced. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 According to some embodiments of the present application, an application scenario of a terminal is shown; Figure 2 According to some embodiments of the present application, a flowchart of a data read-write method of a terminal is shown; Figure 3 According to some embodiments of the present application, a brief schematic diagram of a terminal performing NV reading and writing in different stages is shown; Figure 4 According to some embodiments of the present application, a structural block diagram of a terminal is shown. DETAILED DESCRIPTION

[0023] The illustrative embodiments of the present application include, but are not limited to, a terminal-based data read-write method, a readable storage medium, a program product, and a terminal.

[0024] In order to facilitate understanding of the technical solutions of the present application, some technical terms that may be involved in the present application will be explained first.

[0025] 1) Non-Volatile Storage (NV Storage), hereinafter referred to as NV, refers to a storage medium that can still retain data after power failure, and its core feature is data persistence, which is widely used in electronic devices that need to store data for a long time.

[0026] 2) Flash memory is one of the current mainstream non-volatile storage technologies, which has the characteristics of high density, low power consumption, and fast reading and writing. When NV needs to store data, the logical address is mapped to the physical sector of Flash, and the data is written into Flash through the driver, in other words, Flash is the hardware carrier of NV. The software layer accesses data through the NV interface, but the bottom layer relies on hardware entities such as Flash, and the two are a "logical-physical" mapping relationship.

[0027] 3) Terminal power-on boot Terminal power-on boot refers to the process of starting the terminal from a completely powered-off state, establishing communication services through a complete system initialization and network access process. Key processes include: hardware power-on and self-check, frequency band scanning, selecting PLMN, cell search and synchronization, system information reading, security authentication and registration attachment. Its characteristics are complete start-up process, involving full-link initialization, such as radio frequency, protocol stack loading, long time consumption and high power consumption, but ensuring that the terminal accesses the network from zero state and obtains all service capabilities. Application scenarios mainly apply to user manual start, device restart after a long period of non-use, or initial configuration when first entering the network, providing basic communication connection and identity authentication for the terminal.

[0028] 4) Terminal soft boot Terminal soft boot refers to the process of recovering to a communicable state through a fast initialization process based on the preservation of part of the power supply and context information. Key processes include: waking up the reserved hardware modules, reusing existing network configurations, simplified random access and RRC connection reconstruction, and fast NAS layer registration update. Its characteristics are to skip hardware cold start and full network search, rely on historical context to achieve fast access, and reduce start-up delay and power consumption. Application scenarios include: device wake-up from sleep / low-power mode, restart after temporary interruption, or fast reconnection after network switching, suitable for scenarios sensitive to start-up speed and stable network environment, such as daily wake-up of smart wearable devices.

[0029] 5) Terminal deep sleep wakeup Terminal deep sleep wakeup refers to the process of a terminal resuming from a deep sleep state with extremely low power consumption to an active communication state through a specific triggering mechanism. The key processes include: hardware module extremely low power sleep, such as turning off the radio frequency and most of the baseband, periodic listening to wake-up signals / timer triggering, fast frame synchronization and system information acquisition, on-demand RRC (Radio Resource Control) connection reconstruction or direct entry into data transmission. Its characteristics are: only necessary timing and storage modules are maintained during sleep, the wake-up delay is controllable, and the device endurance can be extended. Application scenarios include periodic data collection, low-frequency communication terminals, and mobile devices that require long standby and fast response, which sacrifice part of the real-time performance for extreme power consumption optimization.

[0030] 6) Intra-frequency cell reselection Intra-frequency cell reselection refers to the process of a terminal in idle state autonomously selecting and switching to a cell with better signal quality in the same frequency band according to the network-configured intra-frequency neighbor list and measurement rules. This process is based on the terminal's continuous monitoring of the signal strength of the current serving cell and intra-frequency neighbors. When the neighbor cell meets the pre-set reselection criteria, such as R criteria (a type of cell reselection criteria), i.e. the target cell ranking value Rn consistently outperforms the serving cell Rs for more than a certain time threshold, and the terminal has been camping on the current cell for more than 1 second, the trigger is triggered. The core goal is to optimize the camping location by user equipment autonomously, ensuring that the terminal is always connected to the best intra-frequency cell in terms of signal quality, thereby improving communication stability and resource utilization. This mechanism is particularly crucial when the intra-frequency priority is higher than the inter-frequency scenario, avoiding unnecessary inter-frequency handover.

[0031] 7) Inter-frequency cell reselection Inter-frequency cell reselection refers to the behavior of a terminal in idle state switching from the current serving frequency band to a cell in another frequency band with signal quality meeting the conditions according to the frequency priority and measurement parameters broadcast by the system. Inter-frequency reselection supports network load balancing and differentiated quality of service through the introduction of frequency priority strategy, and is a key technology for cross-frequency mobility management.

[0032] 8) Connected state Connected state, i.e. RRC_CONNECTED state, is the active state of a terminal with a complete signaling connection and data transmission channel established between the terminal and the radio access network and core network. In this state, the terminal maintains uplink and downlink resource allocation with the base station, supports real-time data transmission and dynamic resource scheduling, and ensures service continuity during mobility through handover, link adaptation, etc. The terminal in connected state is controlled by the network and can perform handover based on coverage, load or traffic, and supports multiple radio bearer configurations to meet different business needs.

[0033] 9) Idle state Idle state, i.e. RRC_IDLE state, is a low-power resident state in which the terminal has no signaling connection with the network and does not perform data transmission. In this state, the terminal maintains network configuration synchronization by periodically listening to system messages, such as SIB1 / SIB3, autonomously performs cell selection and reselection to optimize the resident position, and keeps reachability through a tracking area update mechanism. The terminal only saves necessary contexts, such as PLMN (Public Land Mobile Network) identification and TA (Tracking Area) list, in the idle state, significantly reducing power consumption and signaling overhead, but can quickly recover to the connected state to respond to network or user-initiated service requests through paging or random access. Its core functions include location management, mobility optimization, and resource saving, and it is the basic running mode of the terminal in a stationary or low business demand.

[0034] 10) Attach procedure The attach procedure is a core procedure for the terminal to access the network for the first time or to re-register to the LTE network after a long time off-network, to establish a connection between the terminal and the core network and allocate necessary resources, to ensure that the terminal obtains basic communication capabilities and enters a serviceable state. The attach procedure includes the following steps: 1. The user terminal (UE) in the RRC_IDLE state initiates the Attach procedure, first initiates the random access procedure, i.e. MSG1 message; 2. After the eNB (evolved NodeB) detects the MSG1 message, it sends a random access response message, i.e. MSG2 message, to the UE; 3. After receiving the random access response, the UE adjusts the uplink transmission timing according to the TA of MSG2, and sends an RRCConnectionRequest message to the eNB; 4. The eNB sends an RRCConnectionSetup message to the UE, including SRB1 bearer information and radio resource configuration information; 5. The UE completes the SRB1 bearer and radio resource configuration, and sends an RRCConnectionSetupComplete message to the eNB, including NAS layer Attach request information; 6. The eNB selects the MME and sends an INITIAL UE MESSAGE message to the MME, including the NAS (Non-Access Stratum) layer Attach request message; 7. MME (Mobility Management Entity) sends INITIAL CONTEXT SETUP REQUEST message to eNB, requests to establish default bearer, contains NAS layer Attach Accept, Activate default EPS bearer context request message; 8. eNB receives INITIAL CONTEXT SETUP REQUEST message, if it does not contain UE capability information, eNB sends UE Capability Enquiry message to UE to inquire UE capability; 9. UE sends UECapabilityInformation message to eNB to report UE capability information; 10. eNB sends UE CAPABILITY INFO INDICATION message to MME to update UE capability information of MME; 11. eNB sends SecurityModeCommand message to UE according to security information supported by UE in INITIAL CONTEXT SETUP REQUEST message, to perform security activation; 12. UE sends SecurityModeComplete message to eNB to indicate that security activation is completed; 13. eNB sends RRCConnectionReconfiguration message to UE according to ERAB establishment information in INITIAL CONTEXT SETUP REQUEST message to perform UE resource reconfiguration, including reconfiguring SRB1 and radio resource configuration, establishing SRB2, DRB (including default bearer) and the like; 14. UE sends RRCConnectionReconfigurationComplete message to eNB to indicate that resource configuration is completed; 15. eNB sends INITIAL CONTEXT SETUP RESPONSE response message to MME to indicate that UE context establishment is completed; 16. UE sends UL direct transfer message to eNB, containing NAS layer Attach Accept, Activate default EPS bearer context accept message; 17. The eNB sends an Uplink Direct Transfer (UL NAS Transport) message to the MME, containing the NAS layer Attach Accept, Activate default EPS bearer context accept message.

[0035] 11) LTE TAU procedure The LTE TAU (Tracking Area Update) procedure is a key procedure for a terminal to update its location information to the core network in idle or connected state, to ensure the network can accurately track the terminal's tracking area (TA) and maintain its reachability. The procedure is divided into idle TAU and connected TAU. The idle TAU procedure includes the following steps: 1. The UE sends a RA Preamble message to the eNB; 2. The eNB returns a RA Response message to the UE; 3. The UE sends a RRC Connection Request message to the eNB; 4. The eNB returns a RRC Connection Setup message to the UE; 5. The UE sends a RRC Connection Complete message to the eNB, containing a TAU request message; 6. The eNB sends an Initial UE Message to the EPC, containing a TAU request message; 7. The EPC and the UE authenticate (Authentication / Security) each other to ensure the UE's legitimacy; 8. The EPC updates the UE's context information between MMEs; 9. The EPC sends a Downlink NAS Transport message to the eNB, containing a TAU Accept message; 10. The eNB sends a DL Information Transfer message to the UE, containing a TAU Complete message; 11. The UE sends an UL Information Transfer message to the eNB, containing a TAU Complete message; 12. The eNB sends an Uplink NAS Transport message to the EPC, containing a TAU Accept message; 13. The EPC sends a UE CONTEXT RELEASE COMMAND A message to the eNB; 14. The eNB sends a RRC Connection Relase message to the UE, and the UE enters IDLE mode; 15. The eNB sends a UE CONTEXT RELEASE COMPLETE message to the EPC.

[0036] The procedure of the connected state TAU includes the following steps: 1. The UE sends a ULInformation Transfer message to the eNB, containing a TAU request message; 2. The eNB sends a UPLINK NAS TRANSPORT message to the EPC, containing the TAU request message; 3. The MME of the EPC updates the UE context and the like information; 4. The EPC sends a DOWNLINK NAS TRANSPORT message to the eNB, containing a TAU Accept message; 5. The eNB sends a DLInformation Transfer message to the UE, containing the TAU Accept message; 6. The UE sends a ULInformation Transfer message to the eNB, containing a TAU Complete message; 7. The eNB sends a UPLINK NAS TRANSPORT message to the EPC, containing the TAU Complete message.

[0037] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0038] In order to facilitate the understanding of the technical solutions of the present application, first, the technical solutions of the present application will be described in detail below with reference to the accompanying drawings and embodiments. Figure 1 An application scenario of the technical solutions of the present application will be described in detail. Reference is made to the accompanying drawings and embodiments. Figure 1The terminal 100, the base station 200 and the core network 300 are included, after the terminal 100 is powered on, the terminal 100 first searches and selects the best cell signal to complete camping and establish initial connection with the base station 200; subsequently, the terminal 100 initiates a registration request to the core network 300 through the base station 200, the core network 300 authenticates the terminal 100 identity and allocates communication resources, and establishes a data transmission channel for the terminal 100; finally, the terminal 100 is under the wireless signal coverage of the base station 200, and realizes real-time communication with the Internet or other terminals 100 by means of the connection management and routing function of the core network 300, completes data transmission and interactive service.

[0039] The terminal 100 adopts the data read-write method of the terminal 100 provided by the application, determines the moving state of the terminal 100, determines the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal 100, so that the terminal 100 has corresponding write strategy in different moving states, and since the write operation of writing at least part of the parameters into at least part of the NV storage area of the Flash is at least partially triggered by the set trigger event, unnecessary write operation to the Flash can be reduced without affecting the service of the terminal 100, the service life of the Flash in the terminal 100 can be prolonged, the terminal 100 can be prevented from being prematurely scrapped due to storage failure, and the power consumption of the terminal 100 can be reduced.

[0040] The data read-write method of the terminal 100 provided by the application will be described in detail below. Figure 2 And Figure 3 The terminal 100 includes a Flash, the Flash includes a plurality of NV storage areas, and each NV storage area is used to store corresponding NV data. It should be understood that each NV storage area is the physical storage space corresponding to each NV of the terminal 100, that is, when the NV needs to store data, the logical address of the NV is mapped to each NV storage area of the Flash.

[0041] In some embodiments, the NV in the terminal 100 can be divided into four categories according to the frequency of change of the data stored in the NV, so as to realize the classified storage of the data. For example, the NV in the terminal 100 is divided into Factory Nv, Retention NV, History Nv and DeepSleep Nv. Among them, the Factory Nv is used to store factory-related information, and the Factory Nv is the factory NV. The factory-related information stored in the Factory Nv includes radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information; the Retention NV is used to store the dynamic context information of the terminal 100 which is easy to change, including the remaining time of various UE timers, service cell related information, forbidden Plmn, security key and count value, etc.; the History Nv is used to store information which can be dynamically modified, and the frequency of change of the information is smaller than that of the data stored in the Retention NV, including the storage of frequency points, the ID and key SIB of the service cell, registration information and security context information, EPLMN list information, TAI list information, IMSI information, and preset frequency point and preset frequency band information, etc.; the DeepSleep Nv is used to store information which needs to be saved when the terminal 100 is in deep sleep. Such information is generally not easy to change and is relatively stable, and is only stored in the DeepSleep Nv before the terminal 100 is in deep sleep.

[0042] In some embodiments, in order to balance the wear risk of the NV in the terminal 100, prolong the life of the NV, and ensure the reliability and performance of the NV, the present application adopts the following wear balancing methods for the four categories of NV divided above respectively: for the Factory Nv, the size is 4KB, and 2 times wear balancing is adopted, which needs to occupy 8KB Flash space, for example, the NV1-factory in Figure 3 The size of the Factory Nv corresponding to the Factory Nv should be understood to be 4KB, and since it adopts 2 times wear balancing, there should also be NV2-factory corresponding in the flash. Figure 3 The NV2-factory is not shown in

[0043] For the Retention NV, the size is 4KB, for example, the Retention Memory in Figure 3 If the Retention NV needs to be powered off, 4KB Flash space is needed for storage and recovery, and wear balancing is not needed.

[0044] For the History Nv, the size is 4KB, and 3 times wear balancing is adopted, which needs to occupy 12KB Flash space, for example, the History Nv in Figure 3NV2-historyNv-1, NV2-historyNv-2 and NV2-historyNv-3 in the table 1; For DeepSleep Nv, the size is 8KB, 2 times wear leveling is adopted, and 16KB Flash space is occupied, for example Figure 3 NV3-deepsleepNv-1 and NV3-deepsleepNv-2 in the table 1.

[0045] It should be noted that the sizes of the above 4 NVs are only for illustrative purposes of the technical solutions of the present application, and in actual applications, the sizes of the NVs and the corresponding wear leveling manners can be adjusted according to actual conditions, which are not limited by the present application.

[0046] With reference to the table 1, Figure 2 The data read-write method of the terminal 100 provided by the present application comprises the following steps: S11: Determine the startup state of the terminal 100, and determine the read strategy for reading NV data from at least part of the NV storage area of the Flash according to the startup state of the terminal 100. The NV data refers to the data stored in the NV storage area of the Flash.

[0047] The NV storage area is divided according to the change frequency of the NV data corresponding to the NV storage area in the running process of the terminal 100, in other words, the change frequency of the NV data stored in different NV storage areas is different. By storing data with different change frequencies in different NV storage areas, it is beneficial to read and write different regions of the Flash, so that the read strategy of different NV storage areas can be flexibly set, unnecessary read and write operations can be reduced, excessive wear of part of the storage area of the Flash can be avoided, and the service life of the Flash can be prolonged.

[0048] In some embodiments, the plurality of NV storage areas comprises a first NV storage area, a second NV storage area, a third NV storage area and a fourth NV storage area, wherein the first NV storage area is used to store first NV data, the second NV storage area is used to store second NV data, the third NV storage area is used to store third NV data, and the fourth NV storage area is used to store fourth NV data.

[0049] In some embodiments, the first NV storage area is the storage area corresponding to the Factory Nv in the Flash of the terminal 100, and the logical address of the Factory Nv corresponds to the physical address of the first NV storage area.

[0050] In some embodiments, the second NV storage area, i.e. the storage area corresponding to the Retention NV in the Flash of the terminal 100, has a logical address corresponding to a physical address of the second NV storage area.

[0051] In some embodiments, the third NV storage area, i.e. the storage area corresponding to the History Nv in the Flash of the terminal 100, has a logical address corresponding to a physical address of the third NV storage area.

[0052] In some embodiments, the fourth NV storage area, i.e. the storage area corresponding to the DeepSleep Nv in the Flash of the terminal 100, has a logical address corresponding to a physical address of the fourth NV storage area.

[0053] In some embodiments, the first NV data, i.e. the factory-related information stored in the Factory Nv, includes the following: radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information.

[0054] In some embodiments, the second NV data, i.e. the easily-changing dynamic context information of the terminal 100 stored in the Retention NV, in other words, the second NV data includes the dynamic context information of the terminal 100, which includes the following: the remaining time of various UE timers, service cell-related information, forbidden Plmn, Security keys, and Count values, etc.

[0055] In some embodiments, the third NV data, i.e. the dynamically-modifiable information stored in the History Nv, is referred to as the dynamic configurable network management information of the terminal 100, i.e. the third NV data includes the dynamic configurable network management information of the terminal 100. In some embodiments, the dynamic configurable network management information of the terminal 100 includes the following: candidate frequency points, IDs and key SIBs of service cells, registration information and security context information, EPLMN list information, TAI list information, IMSI information, and preset frequency points and preset frequency band information, etc.

[0056] In some embodiments, the fourth NV data, i.e. the information that needs to be saved when the terminal 100 is in deep sleep, i.e. the fourth NV data includes the data that needs to be saved when the terminal 100 is in deep sleep.

[0057] In some embodiments, the start-up state of the terminal 100 includes power-on boot, deep sleep wake-up and soft boot, the read strategy of reading the NV data from at least part of the NV storage area of the Flash is determined according to the start-up state of the terminal 100, including: In the case of power-on boot of the terminal 100, it is determined to read the first NV data from the first NV storage area of the Flash and the third NV data from the third NV storage area of the Flash into the memory of the terminal 100.

[0058] In other words, since the data in the Flash needs to be read into the memory when the terminal 100 is powered on to ensure the initialization of the functions of the terminal 100, the rapid start of the software system and the access to the network, and the implementation of the communication service, in the case of power-on boot of the terminal 100, it is determined to read the first NV data stored in the first NV storage area corresponding to the Factory Nv in the Flash and the third NV data stored in the third NV storage area corresponding to the History Nv in the Flash into the memory of the terminal 100.

[0059] In the case of deep sleep wake-up of the terminal 100, it is determined to read the first NV data from the first NV storage area of the Flash, the third NV data from the third NV storage area of the Flash and the fourth NV data from the fourth NV storage area of the Flash into the memory of the terminal 100.

[0060] In other words, in the case of deep sleep wake-up of the terminal 100, in order to quickly restore the terminal 100 to the state before sleep, the first NV data stored in the first NV storage area corresponding to the Factory Nv in the Flash, the third NV data stored in the third NV storage area corresponding to the History Nv in the Flash and the fourth NV data stored in the fourth NV storage area corresponding to the DeepSleep Nv in the Flash need to be read into the memory.

[0061] It should be noted that since the Retention NV is basically long-powered, in the sleep scenario of the terminal 100, it is not powered off, in other words, the Retention NV always exists and the content is valid. If in some embodiments, for the deep sleep state of the terminal 100, even if the Retention NV needs to be powered off, before the power-off, the data stored by the Retention NV will be written into the corresponding storage area in the Flash, for example, written into the second NV storage area described above, so that in the case of deep sleep wake-up of the terminal 100, the second NV data from the second NV storage area of the Flash is read into the memory of the terminal 100 for recovery.

[0062] In the case of soft boot of the terminal 100, the first NV data and the third NV data read into the memory in the case of power-on boot of the terminal 100 are kept unchanged. In some embodiments, in the case of soft boot of the terminal 100, the second storage area and the fourth storage area in the Flash are also cleared, or only a small amount of information is retained in the second storage area, because the information is no longer valid in the process of re-booting of the terminal 100, and can be overwritten by new data.

[0063] In some embodiments, the data reading and writing method of the terminal 100 provided in the present application further comprises: determining the influence degree of at least part of the parameters in the NV data on the service recovery of the terminal 100, and classifying at least part of the parameters in the NV data according to the influence degree of at least part of the parameters in the NV data on the service recovery of the terminal 100, to obtain core parameters, auxiliary parameters and non-critical parameters. It should be understood that the NV data herein includes the first NV data, the second NV data, the third NV data and the fourth NV data described above.

[0064] For example, in some embodiments, the NV data includes AT command operation fields, candidate frequency point information, RPLMN information, security context information, cell frequency point information, Cell Id, SIB2 code stream, historical frequency point information and measurement values, timer information, temporary measurement reports and intermediate states. Then, according to the influence degree of these data on the service recovery of the terminal 100, these NV data are classified to obtain core parameters, auxiliary parameters and non-critical parameters.

[0065] At least part of the parameters in the above-mentioned NV data are classified according to the influence degree on the service recovery of the terminal 100, so that the classified data can be stored differently, which not only ensures the normal operation of the service of the terminal 100, but also reduces the write operation to the Flash of the terminal 100, and helps to prolong the service life of the Flash.

[0066] S12: determining the movement state of the terminal 100, and determining the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage areas of the Flash according to the movement state of the terminal 100, wherein at least part of the write operation when writing at least part of the parameters into at least part of the NV storage areas of the Flash is triggered by a set trigger event.

[0067] In some embodiments, the movement state of the terminal 100 includes: a stationary state, a low-speed movement state, a medium-speed movement state and a high-speed movement state. In some embodiments, the movement state of the terminal 100 is determined by: determining the movement state of the terminal 100 according to the number of times of cell reselection or cell handover of the terminal 100 within a set time range.

[0068] For example, the time range is set to 1 minute, and if the terminal 100 performs cell reselection less than or equal to 1 time within 1 minute, it is determined that the terminal 100 is in a static or low-speed moving state.

[0069] For example, the time range is set to 1 second, and if the terminal 100 performs cell reselection more than 1 time within 1 second, it is determined that the terminal 100 is in a high-speed moving state.

[0070] It should be noted that the specific values of the above-mentioned time range and the number of cell reselections can be determined according to actual conditions, and the specific values of the time range and the number of cell reselections in the above-mentioned embodiments do not constitute a limitation on the technical solutions of the present application.

[0071] In some embodiments, the core parameters described above include AT command operation fields, candidate frequency point information, RPLMN information, and security context information, the set trigger event includes a first trigger event, and the write strategy of writing at least part of the parameters in the NV data to at least part of the NV storage area of the Flash is determined according to the moving state of the terminal 100, including: In the case that the terminal 100 is in a static state or a low-speed moving state, For the AT command operation field, the AT command operation field is written into the first NV storage area of the Flash in real time using a blocking operation; For the candidate frequency point information, if the first trigger event is detected, the candidate frequency point information is written into the third NV storage area of the Flash using a non-blocking operation; For the RPLMN information and the security context information, in the case that the terminal 100 is in a soft shutdown or deep sleep state, the RPLMN information and the security context information are written into the third NV storage area of the Flash.

[0072] For the AT command operation field, the AT command operation field is written into the first NV storage area of the Flash in real time using a blocking operation, which means that when the AT command operation field is written into the first NV storage area of the Flash, the terminal 100 will first pause other operations, and only after the AT command operation field is successfully written into the first NV storage area of the Flash, the upper layer will be notified that the writing has been successful. Even if the terminal 100 is powered off immediately after receiving this successful writing notification, it can still ensure that the AT command operation field has been safely saved, avoiding the loss of the AT command operation field due to incomplete writing. It should be understood that the AT command operation field is a core configuration parameter of the terminal 100, which directly affects the function and state of the terminal 100. Using a blocking operation to write the AT command operation field into the Flash can avoid configuration loss due to upper layer misoperation or power failure, thereby ensuring the deterministic execution of the terminal 100 function and system stability.

[0073] In some embodiments, the first trigger event described above is that the RRC layer is triggered by the NAS layer to write the candidate frequency information into the Flash when the terminal 100 completes the connection state. For the candidate frequency information, if the first trigger event is detected, the candidate frequency information is written into the third NV storage area of the Flash using a non-blocking operation, which specifically means that the RRC layer is triggered by the NAS layer to write the candidate frequency information into the Flash when the terminal 100 completes the connection state, and the candidate frequency information is written into the Flash, and at the same time, the key SIB code stream, such as SIB2, is also written into the third NV storage area of the Flash together with the candidate frequency information. In some embodiments, the writing of the candidate frequency information uses a non-blocking operation, that is, a separate thread is started, and the thread has a low priority, which is generally lower than that of a service thread. The separate thread is used as a background thread to write the Flash asynchronously, so as to avoid blocking the main thread and affecting the continuity of the service.

[0074] For the RPLMN information and the security context information, the RPLMN information and the security context information are written into the third NV storage area of the Flash when the terminal 100 is in soft shutdown or deep sleep, which specifically means that the RPLMN information and the security context information are written into the USIM card of the terminal 100 in real time after the terminal 100 completes the connection state, and only when the terminal 100 is in soft shutdown or deep sleep, the RPLMN information and the security context information are written into the third NV storage area of the Flash. In this way, when the terminal 100 performs the deep sleep wake-up process, the USIM card does not need to be initialized, and the RPLMN information and the security context information can be recovered from the third NV storage area of the Flash for continuous use, which can shorten the service recovery time and reduce power consumption.

[0075] In some embodiments, the data reading and writing method of the terminal 100 provided in the present application further comprises: monitoring the power supply voltage; and in the case that the power supply voltage is lower than the set voltage threshold, it is judged that the terminal 100 is in the power-off process, and then the candidate frequency information and the RPLMN information are preferentially written into the third NV storage area of the Flash in real time. By judging that the terminal 100 is in the power-off process, the RPLMN information and the candidate frequency information are preferentially saved, which can ensure that the terminal 100 quickly recovers the network connection after restarting, reduce the time delay and power consumption of the full network search, improve the user experience, at the same time, protect the key communication parameters from being lost, and enhance the system robustness.

[0076] In some embodiments, the auxiliary parameters include cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values, the set trigger event includes a second trigger event, and the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash is determined according to the moving state of the terminal 100, including: In the case where the terminal 100 is in a stationary state or a low-speed moving state, if the second trigger event is detected, the cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values are written into the third NV storage area of the Flash. The cell frequency information refers to the related information of the service frequency of the cell currently camped by the terminal 100, and the historical frequency information refers to the related information of the service frequency of the cell historically camped by the terminal 100. In the logic of searching for a network in the power-on process of the terminal 100, the cell frequency information, Cell Id, and measurement values are used to determine whether the terminal 100 needs to perform discrete frequency searching or only perform cell searching of the original cell; the SIB2 code stream is a specific data stream transmitted by the base station 200 to the terminal 100, which is used to configure the common parameters of the physical layer of the terminal 100, and at the same time, the terminal 100 uses these information to measure the wireless environment and receives the paging message from the base station 200, so as to ensure that the terminal 100 can correctly decode the network signal and respond to the network request in time; the historical frequency information is composed of candidate frequencies, different-frequency frequencies in Sib5, and frequencies collected in the movement track of the terminal 100, and in the discrete frequency searching, these frequencies are used for discrete frequency scanning, which can shorten the time of cell camping.

[0077] In some embodiments, the second trigger event described above refers to the terminal 100 leaving the RRC connected state and returning to the idle state. The above-mentioned writing of the cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values into the third NV storage area of the Flash when the second trigger event is detected specifically refers to that, for the cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values, after the terminal 100 receives or updates these information, the corresponding storage area in the Flash is not written in real time, but only triggers the writing operation into the Flash once in the subsequent process of leaving the RRC connected state and returning to the idle state, and if these information is written into the third NV storage area of the Flash at the same time, other information needs to be written into the third NV storage area of the Flash, then the other information and the above-mentioned information can be written into the third NV storage area of the Flash at the same time.

[0078] It should be understood that in the service process initiated by the terminal 100, the connection state is maintained for a long time, and the connection state is likely to be frequently switched, so the corresponding service cell is updated many times, and the cell data is also updated many times. If the updated cell data is written into the Flash every time the service cell is updated, the frequent writing operation will affect the service life of the Flash. Therefore, according to the technical solution of the present application, the writing operation of the Flash is triggered only when the corresponding trigger time occurs, which does not affect the service and reduces the writing times of the Flash.

[0079] As described above, in the technical solution of the present application, if the second trigger event is detected, the SIB2 code stream in the SIB code stream will be written into the third NV storage area of the Flash, and other SIBs will not be saved. For example, for Sib5, the inter-frequency frequency point is dynamically obtained through the adjacent cell measurement result. When the terminal 100 returns to the idle state, SIB2 and its associated frequency point information are written into the third NV storage area of the Flash.

[0080] In some embodiments, after the cell camping in the idle state is successful, it is judged whether there is a cached connection establishment before writing the Flash. If there is, the Flash is not written temporarily, the connection establishment process is initiated, and the Flash is written when the new connection is released to return to the idle state. The reason for this is that the reading operation of Sib5 and other system information is concurrent with the service process, and after the frequency points in Sib5 are collected, the terminal 100 returns to the idle state and the storage is performed together.

[0081] For auxiliary parameters, in addition to the two ways of writing the Flash together with other processes and triggering the writing of the Flash once when returning from the connection state to the idle state, other parameters are only written into the Flash when soft shutdown or deep sleep. In this way, the writing times of the Flash can be reduced.

[0082] In some embodiments, before writing the Flash, it can be determined whether the data in the storage space of the Flash to be written and the data to be written are the same. If they are the same, the writing operation of the Flash is not performed, which is also conducive to reducing the writing times of the Flash.

[0083] In some embodiments, the non-critical parameters include timer information, temporary measurement reports, and intermediate states. According to the movement state of the terminal 100, a writing strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash is determined, including: In the case that the terminal 100 is in a static state or a low-speed moving state, in the case that it is determined that the logical storage unit corresponding to the second NV storage area in the terminal 100 needs to be powered off, the timer information, the temporary measurement report and the intermediate state are written into the second NV storage area of the Flash before the logical storage unit is powered off, so that the data integrity in the case of sudden power failure or abnormal shutdown can be ensured.

[0084] The temporary measurement report refers to the measurement result reported by the physical layer; the intermediate state refers to the case that some processing procedures of the terminal can be divided into multiple steps, and the state before the completion is referred to as the intermediate state.

[0085] In some embodiments, the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal 100 further comprises: In the case that the terminal 100 is in a medium-speed or high-speed moving state, For the case of the same frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage area of the Flash in the case that the TAU procedure ends and the second trigger event occurs; for the case of the same frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is not triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage area of the Flash in the case that the terminal 100 is powered off or the second trigger event occurs; For the case of the different frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is triggered, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage area of the Flash in the case that the TAU procedure ends and the second trigger event occurs; for the case of the different frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is not triggered, the candidate frequency point information in the core parameters is updated, and at least part of the parameters in the updated core parameters and at least part of the parameters in the auxiliary parameters are written into the corresponding NV storage area of the Flash in the case that the terminal 100 is powered off or the second trigger event occurs; For the case of the connection state switching of the terminal 100, at least part of the parameters in the core parameters and the auxiliary parameters are written into the corresponding NV storage area of the Flash in the case that the second trigger event occurs.

[0086] In some embodiments, in the case that the terminal 100 is in a medium or high speed moving state, for the case of intra-frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is triggered, a write Flash operation is triggered only once when the terminal 100 returns from the connected state to the idle state, for example, candidate frequency point information in the core parameters is written into the third NV storage area of the Flash, and SIB2 code stream, historical frequency point, and measurement value information in the auxiliary parameters are also written into the third NV storage area of the Flash; if the TAU procedure of the terminal 100 is not triggered, the write Flash procedure is not triggered, and the parameters are written into the Flash only when the terminal 100 is powered off or returns from the connected state to the idle state, that is, the parameters are written into the Flash in batches, the number of Flash write operations is reduced, the Flash life is prolonged, the power consumption peak of the Flash is reduced by reducing the Flash write frequency, the energy efficiency of the terminal is optimized, and the terminal is more suitable for application in a battery life sensitive application scenario, where the battery life sensitive scenario includes but is not limited to wearable devices and remote monitoring terminals.

[0087] In some embodiments, in the case that the terminal 100 is in a medium or high speed moving state, for the case of inter-frequency cell reselection of the terminal 100, if the TAU procedure of the terminal 100 is triggered, a write Flash operation is triggered only once when the terminal 100 returns from the connected state to the idle state, for example, candidate frequency point information in the core parameters is written into the third NV storage area of the Flash, and SIB2 code stream, historical frequency point, and measurement value information in the auxiliary parameters are also written into the third NV storage area of the Flash; if the TAU procedure is not triggered, candidate frequency point information in the core parameters is updated, for example, the service frequency point related information of the current cell is added to the candidate frequency point list, and the order of the candidate frequency points is changed, and the Flash is not written in real time, and the updated candidate frequency point information in the core parameters and SIB2 code stream information in the auxiliary parameters are written into the corresponding NV storage area of the Flash when the terminal 100 is powered off or returns from the connected state to the idle state.

[0088] In some embodiments, in the case that the terminal 100 is in a medium or high speed moving state, for the case of connected state switching of the terminal 100, that is, the service cell is changed in the connected state and the service is maintained, a write Flash operation of at least part of the data in the core parameters and the auxiliary parameters is triggered only once when the network releases and the terminal 100 returns from the connected state to the idle state.

[0089] It can be understood that the execution order of the above steps S11 to S12 is only illustrative, and in other embodiments, other execution orders can also be used, and part of the steps can be split or combined, which is not limited herein.

[0090] The technical solution of the present application is triggered by a set of trigger events when writing at least part of the parameters into at least part of the NV storage area of the Flash, thereby reducing unnecessary write operations on the Flash without affecting the terminal service, not only prolonging the service life of the Flash, avoiding the premature scrapping of the terminal due to storage failure, but also reducing the power consumption of the device.

[0091] And in the prior art, if power failure, system reset or interference occurs during Flash writing, it may cause incomplete data writing, i.e. "partial writing" phenomenon, causing data errors or metadata damage, while the present application triggers the write operation on the Flash through the above trigger events, which can reduce the risk of data loss caused by single write failure and improve reliability.

[0092] In the prior art, Flash writing is usually a synchronous operation, and frequent writing will occupy CPU and bus system resources, causing other tasks of the terminal such as communication and sensor collection to be blocked, affecting real-time performance. While the present application reduces the number of Flash writes, it can reduce the load of the terminal and avoid affecting the performance of the terminal due to storage operations, so that the terminal has better performance in some scenarios that require high concurrency, such as real-time data collection and communication scenarios.

[0093] Embodiments of the present application also provide a terminal 100, as shown in Figure 4 The terminal 100 includes a memory 101 and a processor 102, the memory 101 is used to store computer programs executable by the processor 102; the processor 102 is used to execute the computer programs in the memory 101 to realize the data read-write method of the terminal provided by any one of the above embodiments.

[0094] Figure 4 The terminal 100 also includes a communication interface 103. The processor 102, the memory 101 and the communication interface 103 are connected through a communication bus and complete communication among each other.

[0095] The processor 102 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.

[0096] The communication interface 103 is used for communication with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.

[0097] The memory 101 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other type of dynamic storage device that can store information and instructions, and can be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disk storage, a magneto-optical disk, a magnetic disk storage or other magnetic storage devices, or any other medium capable of storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory can exist independently, and is connected to the processor through a bus. The memory can also be integrated with the processor.

[0098] Embodiments of the present application also provide a computer readable storage medium, which stores instructions, and the instructions, when executed on an electronic device, cause the electronic device to perform the data read-write method of the terminal provided in any of the above embodiments.

[0099] Embodiments of the present application also provide a computer program product, which includes instructions for implementing the data read-write method of the terminal as provided in any of the above embodiments when executed by one or more processors.

[0100] Embodiments of the mechanisms disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. Embodiments of the application can be implemented as computer programs or program code executing on programmable systems comprising at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0101] It should be noted that each unit / module mentioned in each device embodiment of the present application is a logical unit / module, and in the physical world, one logical unit / module can be a physical unit / module, or a part of a physical unit / module, or be realized in a combination of multiple physical unit / modules, and the physical realization of these logical units / modules is not the most important, and the combination of the functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce the units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.

[0102] It should be noted that in the examples and descriptions of the present patent, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including one" does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0103] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it should be understood that various changes in form and detail can be made therein without departing from the spirit and scope of the application.

Claims

1. A data read / write method of a terminal, characterized by, The terminal includes a Flash, and the Flash includes a plurality of NV storage areas, each of which is used to store corresponding NV data. The method includes: determining a startup state of the terminal, determining a reading strategy for reading NV data from at least part of the NV storage areas of the Flash according to the startup state of the terminal, wherein the NV storage areas are divided according to the frequency of change of the NV data corresponding to the NV storage areas during terminal operation; determining a moving state of the terminal, determining a writing strategy for writing at least part of the parameters in the NV data to at least part of the NV storage areas of the Flash according to the moving state of the terminal, wherein at least part of the writing operation of writing the at least part of the parameters to at least part of the NV storage areas of the Flash is triggered by a set trigger event.

2. The data read / write method of a terminal according to claim 1, wherein, The plurality of NV storage areas include a first NV storage area, a second NV storage area, a third NV storage area, and a fourth NV storage area, wherein the first NV storage area is used to store first NV data, the second NV storage area is used to store second NV data, the third NV storage area is used to store third NV data, and the fourth NV storage area is used to store fourth NV data.

3. The data read / write method of a terminal according to claim 2, wherein, The startup state of the terminal includes power-on boot, deep sleep wake-up, and soft boot, and the reading strategy for reading NV data from at least part of the NV storage areas of the Flash according to the startup state of the terminal includes: in the case of power-on boot of the terminal, determining to read the first NV data from the first NV storage area of the Flash and the third NV data from the third NV storage area of the Flash into the memory of the terminal; in the case of deep sleep wake-up of the terminal, determining to read the first NV data from the first NV storage area of the Flash, the third NV data from the third NV storage area of the Flash, and the fourth NV data from the fourth NV storage area of the Flash into the memory of the terminal; in the case of soft boot of the terminal, keeping the first NV data and the third NV data read into the memory of the terminal in the case of power-on boot unchanged.

4. The data reading and writing method of the terminal according to claim 3, wherein: the first NV data includes radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information; the second NV data includes dynamic context information of the terminal; the third NV data includes dynamic configurable network management information of the terminal; the fourth NV data includes data that needs to be saved when the terminal is in deep sleep.

5. The data read / write method of a terminal according to claim 3, wherein, The method further includes: determining the influence degree of at least part of the parameters in the NV data on the terminal service recovery; classifying at least part of the parameters in the NV data according to the influence degree of at least part of the parameters in the NV data on the terminal service recovery to obtain core parameters, auxiliary parameters, and non-critical parameters.

6. The data read / write method of a terminal according to claim 5, wherein, The moving state of the terminal includes a static state, a low-speed moving state, a medium-speed moving state, and a high-speed moving state.

7. The data read / write method of a terminal according to claim 6, wherein, The core parameters include an AT command operation field, candidate frequency point information, RPLMN information, and security context information, and the set trigger event includes a first trigger event, The write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal includes: In the case where the terminal is in a static state or a low-speed moving state, For the AT command operation field, the AT command operation field is written into the first NV storage area of the Flash in real time by using a blocking operation; For the candidate frequency point information, if the first trigger event is detected, the candidate frequency point information is written into the third NV storage area of the Flash by using a non-blocking operation; For the RPLMN information and the security context information, in the case where the terminal is in a soft shutdown or deep sleep, the RPLMN information and the security context information are written into the third NV storage area of the Flash.

8. The data read / write method of a terminal according to claim 7, wherein, The method further includes: monitoring a power supply voltage; In the case where the power supply voltage is monitored to be lower than a set voltage threshold, it is judged that the terminal is in a power-off process, and then the candidate frequency point information and the RPLMN information are written into the third NV storage area of the Flash.

9. The data read / write method of a terminal according to claim 7, wherein, The auxiliary parameters include cell frequency point information, Cell Id, SIB2 code stream, historical frequency point information, and measurement value, and the set trigger event includes a second trigger event, The write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal includes: In the case where the terminal is in a static state or a low-speed moving state, if the second trigger event is detected, the cell frequency point information, Cell Id, SIB2 code stream, historical frequency point information, and measurement value are written into the third NV storage area of the Flash.

10. The data read / write method of a terminal according to claim 9, wherein, The non-key parameters include timer information, temporary measurement report, and intermediate state, and the write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal includes: In the case where the terminal is in a static state or a low-speed moving state, in the case where it is determined that the logical storage unit corresponding to the second NV storage area in the terminal needs to be powered off, before the logical storage unit is powered off, the timer information, temporary measurement report, and intermediate state are written into the second NV storage area of the Flash.

11. The data read / write method of a terminal according to claim 10, wherein, The write strategy of writing at least part of the parameters in the NV data into at least part of the NV storage area of the Flash according to the moving state of the terminal further includes: In the case where the terminal is in a medium-speed or high-speed moving state, For the intra-frequency cell reselection of the terminal, if the TAU procedure of the terminal is triggered, at least part of the core parameters and the auxiliary parameters are written into the corresponding NV storage area in the Flash when the TAU procedure ends and the second triggering event occurs; for the intra-frequency cell reselection of the terminal, if the TAU procedure of the terminal is not triggered, at least part of the core parameters and the auxiliary parameters are written into the corresponding NV storage area in the Flash before the terminal is powered off or the second triggering event occurs; For the inter-frequency cell reselection of the terminal, if the TAU procedure of the terminal is triggered, at least part of the core parameters and the auxiliary parameters are written into the corresponding NV storage area in the Flash when the TAU procedure ends and the second triggering event occurs; for the inter-frequency cell reselection of the terminal, if the TAU procedure of the terminal is not triggered, the candidate frequency point information in the core parameters is updated, and at least part of the updated core parameters and at least part of the auxiliary parameters are written into the corresponding NV storage area in the Flash before the terminal is powered off or the second triggering event occurs; For the connection state switching of the terminal, at least part of the core parameters and the auxiliary parameters are written into the corresponding NV storage area in the Flash when the second triggering event occurs.

12. The data read / write method of a terminal according to claim 1, wherein The moving state of the terminal is determined in the following manner: The moving state of the terminal is determined according to the number of times of cell reselection or cell switching of the terminal within a set time range.

13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, which, when executed on an electronic device, cause the electronic device to perform the data read-write method of the terminal according to any one of claims 1 to 12.

14. A computer program product, characterised in that, The computer program product includes instructions for implementing the data read-write method of the terminal according to any one of claims 1 to 12 when executed by one or more processors.

15. A terminal, characterized by It includes: a memory for storing instructions, and one or more processors, which, when the instructions are executed by the one or more processors, perform the data read-write method of the terminal according to any one of claims 1 to 12.