Data processing method and device of NAND flash memory, storage medium and electronic equipment

By using SRAM cache in embedded systems and optimizing the data processing method of NAND flash memory, the number of write operations on NAND flash memory is reduced, the life span is extended and the writing efficiency is improved, and the memory unit wear caused by frequent write operations is solved. .

CN118915965APending Publication Date: 2024-11-08SHENZHEN QUANHUIDA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410982968.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Frequent writes significantly shorten the life of NAND flash memory, especially in embedded systems, where small amounts of data are written multiple times lead to increased wear and tear, resulting in memory cells being marked as bad blocks and can no longer be used.

Method used

Use SRAM as the data buffer to detect that NAND flash memory is cached into SRAM when powered on. After receiving the write command, query the target page in SRAM and write data. When the preset conditions are met, synchronize to NAND flash memory to reduce direct writing to NAND flash memory. number of times.

Benefits of technology

It extends the life of NAND flash memory, improves data writing efficiency, reduces system power consumption, and enhances system stability. It is suitable for embedded system application scenarios with high frequency and small data volumes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118915965A_ABST
    Figure CN118915965A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data processing method and device of an NAND flash memory, a storage medium and electronic equipment, and relates to the field of computers. According to the data processing method, the SRAM is introduced to serve as the data buffer area, and the NAND flash memory is optimized, so that an effective solution is provided for an embedded system application scene with small high-frequency data volume. The service life of the NAND flash memory can be prolonged, the data writing efficiency can be improved, the system power consumption is reduced, and the system stability is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a data processing method, device, storage medium and electronic device for a NAND flash memory. Background Art

[0002] The life of NAND flash memory is limited by the wear of the storage unit. Each storage unit has a certain life. When the erase / write times reach the life, it will be marked as a bad block and can no longer be used to store data. Data in embedded systems often presents the characteristics of small amounts and multiple times. For example, when programming a certain part on a CNC machine tool, each parameter needs to be saved, but the amount of data for each parameter is very small, only one word or even one byte. If the data is written directly, it will cause data to be continuously read from the original page and written to the new page, which will seriously reduce the life of NAND flash memory. Summary of the invention

[0003] The embodiments of the present application provide a data processing method, device, storage medium and electronic device for NAND flash memory, which can solve the problem in the prior art that frequent write operations reduce the life of NAND flash memory. The technical solution is as follows:

[0004] In a first aspect, an embodiment of the present application provides a method for processing data of a NAND flash memory, the method comprising:

[0005] When it is detected that the NAND flash memory is powered on, the data in the NAND flash memory is cached into the SRAM;

[0006] receiving a write instruction for the NAND flash memory, wherein the write instruction carries a write address and write data;

[0007] According to the write address, the SRAM searches for a corresponding target page, and if a write target page is found, writes the write data into the target page;

[0008] When it is detected that a preset write-back condition is met, the data in the SRAM is compared with the data in the NAND flash memory to see if they are the same. If they are different, the data in the SRAM is synchronized to the NAND flash memory.

[0009] In a second aspect, an embodiment of the present application provides a NAND flash memory data processing device, the device comprising:

[0010] A cache unit, configured to cache data in the NAND flash memory into the SRAM when detecting that the NAND flash memory is powered on;

[0011] A receiving unit, configured to receive a write instruction for the NAND flash memory, wherein the write instruction carries a write address and write data;

[0012] A writing unit, used for searching the SRAM for a corresponding target page according to the write address, and if a write target page is found, writing the write data into the target page;

[0013] The synchronization unit is used to compare whether the data in the SRAM and the data in the NAND flash memory are the same when detecting that a preset write-back condition is met. If they are different, the data in the SRAM is synchronized to the NAND flash memory.

[0014] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.

[0015] In a fourth aspect, an embodiment of the present application provides an electronic device, including: a microcontroller, a NAND flash memory, a display screen, and a data processing device of the above-mentioned NAND flash memory.

[0016] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:

[0017] By introducing SRAM as a data buffer and optimizing the data processing method of NAND flash memory, an effective solution is provided for embedded system application scenarios with high-frequency data volume. It can not only extend the life of NAND flash memory, but also improve data writing efficiency, reduce system power consumption and enhance system stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 It is a structural diagram of the system architecture provided by the embodiment of the present application;

[0020] Figure 2 It is a flowchart of a data processing method of a NAND flash memory provided in an embodiment of the present application;

[0021] Figure 3 It is a structural schematic diagram of a NAND flash memory data processing device provided by the present application;

[0022] Figure 4 It is another structural schematic diagram of the data processing device of the NAND flash memory provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0024] It should be noted that the data processing method of the NAND flash memory provided in the present application is generally executed by a data processing device of the NAND flash memory. Accordingly, the data processing device of the NAND flash memory is generally arranged in a chip or an electronic device.

[0025] It should be noted that the NAND flash memory data processing method provided in the present application is generally executed by a NAND flash memory data processing device.

[0026] Figure 1 A schematic structural diagram of an electronic device that can be applied to the present application is shown.

[0027] See also Figure 1 , which provides a schematic diagram of a system structure for an embodiment of the present application. Figure 1 As shown, the electronic device includes: a NAND flash memory data processing device, a NAND flash memory, a NAND flash memory controller, an SRAM controller and an SRAM (Static Random-Access Memory).

[0028] Among them, the data processing device of the NAND flash memory is respectively connected to the NAND flash memory controller and the SRAM controller, the NAND flash memory controller is connected to the NAND flash memory, the SRAM controller is connected to the SRAM, and the NAND flash memory controller is connected to the SRAM controller to achieve data synchronization between the SRAM and the NAND flash memory.

[0029] exist Figure 1 In the data processing device of the NAND flash memory shown in FIG. 1 , the processor (CPU) can be used to call the application program stored in the memory and specifically execute the following steps: Figure 2 The specific process can be referred to Figure 2 As shown, no further description is given here.

[0030] The following will be combined with the attached Figure 2 , the data processing method of the NAND flash memory provided in the embodiment of the present application is described in detail. Among them, the data processing device of the NAND flash memory in the embodiment of the present application can be Figure 1 The data processing device of the NAND flash memory is shown.

[0031] See also Figure 2 , is a flow chart of a method for processing data of a NAND flash memory provided by an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps:

[0032] S201 , when it is detected that the NAND flash memory is powered on, the data in the NAND flash memory is cached into the SRAM.

[0033] Among them, after the system is powered on, the CPU starts to execute the initial code pointed to by its reset vector. NAND flash and SRAM initialization: The CPU initializes the NAND flash controller and SRAM controller to ensure that they can work properly, including setting appropriate timing parameters, interface modes, etc. During the initialization process, the CPU controls the NAND flash controller to traverse the occupied pages in the NAND flash, identify all pages marked as occupied (or containing valid data), and read the data in these pages into the SRAM for caching. This process may involve reading the mark bits in the spare area (Spare Area) of the NAND flash memory or using the file system metadata to determine which pages are occupied. Once the occupied pages are determined, the CPU reads the data of these pages through the NAND flash controller and stores them in the SRAM for subsequent quick access.

[0034] S202: Receive a write instruction for the NAND flash memory.

[0035] The CPU receives a write instruction from upper-level software or hardware, and the instruction includes a write address and write data.

[0036] Address resolution: The CPU resolves the write address to determine the location of the target page for the write operation in the NAND flash memory.

[0037] S203, querying the corresponding target page according to the write address SRAM, and if the target page is found, writing the write data into the cache page.

[0038] Among them, the CPU checks whether there is a data page matching the address in the SRAM cache according to the write address. This usually involves indexing or traversing the SRAM cache to confirm whether there is a target page corresponding to the write address. If there is a cache page corresponding to the write address in the SRAM, prepare to update the data in the cache page; if not, additional processing may be required, such as writing the data directly in the NAND flash memory (if allowed), or writing the data to the free area of ​​​​the SRAM first, and updating the relevant index or mapping table.

[0039] S204: When it is detected that the preset write-back condition is met, compare whether the data in the SRAM is the same as the data in the NAND flash memory. If they are different, synchronize the data in the SRAM to the NAND flash memory.

[0040] Among them, the CPU continuously or periodically detects whether the preset write-back conditions are met. These conditions may include cache time thresholds, cache data volume thresholds, system idle status, etc. When the write-back conditions are met, the CPU compares whether the target page data cached in the SRAM is the same as the data of the corresponding page in the NAND flash memory. This usually involves reading data from the NAND flash memory and comparing it with the data in the SRAM. If the data is detected to be different, the CPU controls the NAND flash memory controller to synchronize (write back) the data cached in the SRAM to the corresponding location in the NAND flash memory. This includes sending a write command, address, and data to the NAND flash memory, and waiting for the write operation to be completed. During the data reading, writing, or synchronization process, if an error occurs (such as NAND flash memory damage, write failure, etc.), the CPU should perform corresponding error handling, such as retrying, reporting errors, etc. The CPU feedbacks the status of the write operation to the upper-level software or hardware, including success, failure, or information that needs further processing.

[0041] In some embodiments of the present application, the preset write-back conditions may indeed include multiple situations to ensure that the cached data in the SRAM can be synchronized back to the NAND flash memory in a timely and effective manner, while preventing the SRAM from exhausting its limited capacity due to caching too much data. The following is a detailed explanation of the four preset write-back conditions listed:

[0042] 1. The free capacity in SRAM is less than the capacity threshold:

[0043] This condition is based on the capacity management of SRAM. When the space in SRAM used to cache NAND flash data approaches or reaches a certain preset threshold of its physical capacity, the system triggers a write-back operation, which prevents the SRAM from overflowing due to caching too much data and ensures that the system can continue to run efficiently.

[0044] 2. Detect that the current time reaches the preset time:

[0045] This condition is based on a time-triggered write-back mechanism. The system can set one or more specific time points (such as a certain period of time every day) for periodic triggering. When the system clock reaches these preset time points, the write-back operation will be performed regardless of the cache state of the SRAM. This helps to ensure the consistency and reliability of data within a specific time.

[0046] 3. It is detected that the time without inputting the write command exceeds the preset time:

[0047] This condition is based on system activity considerations. If the system does not receive a new write command within a certain period of time (such as a few minutes, hours, etc.), it is considered that the system is in a relatively idle state, and a write-back operation can be triggered at this time. This helps reduce the amount of cached data in the SRAM when the system is inactive, thereby saving energy and reducing the risk of data loss.

[0048] 4. Receive the user's write-back instruction:

[0049] This condition is based on the write-back mechanism of user interaction. The user can directly issue a write-back instruction through some means (such as software interface, command line tool, etc.), requiring the system to immediately synchronize the cache data in SRAM back to NAND flash memory. This mechanism provides users with flexibility and control over data management.

[0050] In actual applications, the preset write-back conditions can be selected and adjusted according to the specific needs of the system and the operating environment. For example, for systems that require high reliability and data consistency, you may tend to set more stringent write-back conditions (such as capacity thresholds and time point triggers); while for systems that have higher performance requirements and less stringent real-time requirements, you may pay more attention to the write-back conditions of system activity and user interaction. At the same time, the system can also dynamically adjust these conditions according to the runtime situation to achieve the optimal balance between performance and reliability.

[0051] In some embodiments of the present application, it also includes:

[0052] If the write target page is not found, a new write target page is created in the SRAM, and the write data is written into the new write target page.

[0053] The CPU receives a read instruction for the NAND flash memory from upper-layer software, hardware or other input sources. The instruction includes a read address, that is, a location in the NAND flash memory where data needs to be read.

[0054] Query the SRAM cache:

[0055] The CPU queries the SRAM cache based on the read address to see if there is a target page corresponding to the address. This step usually involves looking up an index or mapping table of the SRAM cache to determine whether the required data page is cached.

[0056] Reading data:

[0057] If the target page corresponding to the read address is found in the SRAM cache (i.e., a cache hit), the CPU will directly read the required data from the cache page. Since the access speed of SRAM is much faster than that of NAND flash memory, this step can significantly reduce the latency of data reading.

[0058] If the corresponding target page is not found in the SRAM cache (i.e., cache miss), the CPU needs to do one of the following:

[0059] Data is read directly from NAND flash to the CPU, which may then cache it in SRAM for subsequent use (if the SRAM has enough free space).

[0060] If the system policy does not allow or caching is not possible due to insufficient SRAM space, the data is only read from the NAND flash to the CPU without caching.

[0061] Return data:

[0062] The CPU returns the read data to the requesting party (such as upper-layer software, hardware, or other processing units).

[0063] Update cache status (optional):

[0064] If system policy permits and there is sufficient SRAM space, the CPU may add the newly read data page to the SRAM cache and update the cache's index or mapping table to reflect this change.

[0065] Subsequent actions to handle cache misses (optional):

[0066] In the case of cache misses, the system may record the addresses of these misses in order to optimize the cache strategy in subsequent data accesses (such as using a more complex cache replacement algorithm, increasing the cache size, etc.).

[0067] Through the above process, the CPU can efficiently process read instructions for NAND flash memory and reduce the number of direct accesses to NAND flash memory by using SRAM cache, thereby improving the overall performance and response speed of the system. At the same time, the system can also dynamically adjust the cache strategy according to the runtime situation and strategy to achieve the optimal balance between performance and reliability.

[0068] In some embodiments of the present application, traversing occupied pages in the NAND flash memory includes:

[0069] Traverse the mark bit of each page in the NAND flash memory, if the value of the mark bit corresponding to the page is equal to the preset value;

[0070] An integrity check is performed on the data of the page. If the check passes, the page is determined to be an occupied page.

[0071] Among them, the CPU first needs to traverse each page in the NAND flash memory. This usually means that the CPU will access the pages in the NAND flash memory one by one in a certain order (such as physical address order). For each page traversed, the CPU will read the mark bit (or called status bit, valid bit, etc.) in the spare area (Spare Area) of the page that is usually reserved in the NAND flash memory. These mark bits are used to indicate whether the page contains valid data. The CPU compares the value of the mark bit with a preset value (usually a specific value indicating "valid" or "occupied", such as 1). If the value of the mark bit is equal to the preset value, the CPU believes that the page may contain valid data and needs further verification. Once it is determined that a page may be an occupied page (that is, it contains valid data), the CPU will perform an integrity check on the data of the page. This is usually achieved by calculating the checksum of the data (such as CRC checksum, ECC checksum, etc.) and comparing it with the expected checksum stored in the page or spare area. If the calculated checksum matches the stored checksum, the CPU believes that the data of the page is complete, that is, it has not been damaged due to errors in the storage process. At this point, the CPU can confirm that the page is indeed an occupied page and is ready to read its data into SRAM or other processing units. If the checksum is found to be mismatched during the data integrity check, the CPU will think that the data of the page may be damaged or not valid data. At this point, the CPU can decide whether to try to recover the data, ignore the page, or take other appropriate measures based on the system's error handling strategy. For occupied pages that pass the check, the CPU may record their addresses or other related information for subsequent quick access. At the same time, the CPU can also read the data of these pages into SRAM for caching to increase the speed of subsequent data access.

[0072] Furthermore, in order to improve the efficiency of traversal, the CPU may adopt some optimization strategies, such as traversing only the blocks containing valid data instead of the entire NAND flash memory, using a more efficient traversal algorithm, etc. These optimization strategies can be selected according to the specific characteristics of the NAND flash memory and the performance requirements of the system.

[0073] Through the above process, the CPU can accurately identify the occupied pages in the NAND flash memory and effectively access and manage data on them. This helps improve the data consistency and reliability of the system while reducing the overhead of invalid data access and error handling.

[0074] In some embodiments of the present application, if the write target page is not found, a new write target page is created in the SRAM, and the write data is written into the new write target page.

[0075] Among them, the CPU first queries the SRAM cache according to the target address provided by the write operation, trying to find the target page corresponding to the address. If the corresponding target page is not found in the SRAM cache, that is, a cache miss occurs, the CPU will perform the following steps to create a new target page. The CPU searches for a free location in the SRAM cache, that is, a cache page space that has not been occupied by other data. This usually involves accessing and updating the free page list, bitmap, or other management structure of the SRAM cache. Once a free cache page is found, the CPU will initialize it. This may include setting the status bit of the page (marked as a valid or dirty page, depending on the cache policy), clearing or initializing the data area within the page, and setting necessary metadata (such as ECC checksums, timestamps, etc., if the system requires these). The CPU writes the data provided by the write operation to the newly initialized cache page. During the write process, the CPU may perform data alignment, formatting, or other necessary data processing operations. The CPU updates the mapping table (or index table) of the SRAM cache to reflect the correspondence between the newly created cache page and the target address. In this way, when there is a subsequent read or write request for the address, the CPU can quickly locate the correct cache page.

[0076] In some embodiments of the present application, synchronizing the data in the SRAM to the NAND flash memory includes:

[0077] Each occupied page in the SRAM is traversed, and the data in each occupied page traversed is packaged and sent to the NAND flash memory.

[0078] Among them, the CPU first determines which occupied pages in the SRAM need to be written back to the NAND flash memory. This may be because the cache is full and space needs to be made for new data; or because the system policy requires that the cache data be written back to the NAND flash memory periodically to maintain data persistence. The CPU traverses all occupied pages in the SRAM cache. Occupied pages are those cache pages that contain valid data and are marked as valid. This usually involves traversing the index table or mapping table in the SRAM cache to determine which pages are occupied pages. For each occupied page traversed, the CPU reads the data in the page and may perform necessary data processing, such as calculation and addition of ECC checksums, adjustment of data formats, etc. The CPU may also package this data into a format suitable for NAND flash write operations. This usually involves combining data from multiple pages into a larger data block and possibly adding some additional metadata (such as page number, timestamp, checksum, etc.). The CPU sends a write-back instruction to the NAND flash controller, which contains information such as the address and size of the data block to be written to the NAND flash memory. At the same time, the CPU sends the prepared data block to the NAND flash controller. This is usually done over the system bus or other data transmission channels. After the NAND flash controller receives the write-back instruction and data, it writes the data to the specified address location in the NAND flash. During the write process, the NAND flash controller may perform some internal data verification and error correction operations to ensure the integrity and reliability of the data. Once the data is successfully written back to the NAND flash, the CPU needs to update the state of the SRAM cache. This usually involves marking the occupied pages that have been written back as invalid or cleared so that they can be reused by subsequent data. When all occupied pages that need to be written back are successfully written back to the NAND flash and the state of the SRAM cache is updated, the CPU completes the write-back operation. At this point, it can report the success or failure status of the write-back operation to the system and perform subsequent operations as needed.

[0079] The technical effects of this application include:

[0080] In embedded systems, SRAM is used as a data buffer due to its high-speed access characteristics. When the system needs to write data, the data is first written to SRAM instead of directly writing it to NAND flash memory.

[0081] The SRAM cache can temporarily store data to be written to the NAND flash memory, thereby reducing direct write operations to the NAND flash memory.

[0082] Optimizing data processing methods for NAND flash memory:

[0083] By accumulating a certain amount of data in SRAM and then writing it to NAND flash memory in a unified manner, the number of write operations to NAND flash memory can be reduced. This is because the write operation of NAND flash memory is usually performed in units of pages or blocks, and frequent writing of small amounts of data will result in a large amount of write operation overhead.

[0084] At the same time, through reasonable cache replacement strategies (such as LRU, LFU, etc.), it can be ensured that the most frequently used or recently used data is stored in the cache, further improving the efficiency of data access.

[0085] Reduce the number of times to write and erase NAND flash memory:

[0086] Since both the write and erase operations of NAND flash memory will affect its lifespan, especially the erase operation has a more significant impact on the lifespan, the lifespan of NAND flash memory can be significantly extended by reducing the number of write and erase operations.

[0087] The introduction of SRAM cache enables the system to write data to NAND flash memory only when necessary, thus avoiding unnecessary write operations. At the same time, through reasonable data packaging and merging strategies, the number of write operations can be further reduced.

[0088] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0089] See also Figure 3 , which shows a schematic diagram of the structure of a data processing device of a NAND flash memory provided by an exemplary embodiment of the present application, hereinafter referred to as a data processing device 3 of a NAND flash memory. The data processing device 3 of the NAND flash memory can be implemented as all or part of a chip through software, hardware, or a combination of both. The data processing device 3 of the NAND flash memory includes: a cache unit 301, a receiving unit 302, a writing unit 303, and a synchronization unit 304.

[0090] The cache unit 301 is used to cache the data in the NAND flash memory into the SRAM when detecting that the NAND flash memory is powered on;

[0091] A receiving unit 302, configured to receive a write instruction for the NAND flash memory, wherein the write instruction carries a write address and write data;

[0092] A writing unit 303 is used to query the corresponding target page in the SRAM according to the write address, and if the write target page is found, write the write data into the target page;

[0093] The synchronization unit 304 is used to compare whether the data in the SRAM and the data in the NAND flash memory are the same when it is detected that a preset write-back condition is met. If they are different, the data in the SRAM is synchronized to the NAND flash memory.

[0094] In one or more possible embodiments, the preset write-back condition includes one or more of the following:

[0095] The free capacity in the SRAM is less than a threshold value;

[0096] It is detected that the current time reaches the preset time;

[0097] It is detected that the duration of inputting the write command exceeds the preset duration;

[0098] Receive a write-back instruction from the user.

[0099] In one or more possible embodiments, it further includes:

[0100] A reading unit, used to receive a read instruction for the NAND flash memory, wherein the read instruction carries a write address;

[0101] A corresponding target page is searched in the SRAM according to the read address, and data is read from the target page.

[0102] In one or more possible embodiments, caching the data in the NAND flash memory into the SRAM includes:

[0103] The occupied pages are traversed in the NAND flash memory, and the data in the traversed occupied pages are cached in the SRAM.

[0104] In one or more possible embodiments, traversing occupied pages in the NAND flash memory includes:

[0105] Traverse the mark bit of each page in the NAND flash memory, if the value of the mark bit corresponding to the page is equal to the preset value;

[0106] An integrity check is performed on the data of the page. If the check passes, the page is determined to be an occupied page.

[0107] In one or more possible embodiments, it further includes:

[0108] The creating unit is used to create a new writing target page in the SRAM if the writing target page is not found, and write the writing data into the new writing target page.

[0109] In one or more possible embodiments, synchronizing the data in the SRAM to the NAND flash memory includes:

[0110] Each occupied page in the SRAM is traversed, and the data in each occupied page traversed is packaged and sent to the NAND flash memory.

[0111] It should be noted that, when the device 3 provided in the above embodiment executes the data processing method of the NAND flash memory, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above functions. In addition, the data processing device of the NAND flash memory provided in the above embodiment and the data processing method embodiment of the NAND flash memory belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.

[0112] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0113] See also Figure 4 , is a schematic diagram of a structure of a NAND flash memory data processing device provided in an embodiment of the present application. Figure 4 As shown, the data processing device 400 may include: at least one processor 401 , at least one network interface 404 , a user interface 403 , a memory 405 , and at least one communication bus 402 .

[0114] The communication bus 402 is used to realize the connection and communication between these components.

[0115] The user interface 403 may include a display screen (Display) and a camera (Camera), and the optional user interface 403 may also include a standard wired interface and a wireless interface.

[0116] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0117] Among them, the processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect the various parts of the entire data processing device 400, and executes various functions and processes data of the data processing device 400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the processor 401 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 401 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 401, and it can be implemented by a single chip.

[0118] Among them, the memory 405 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 405 includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 405 may optionally be at least one storage device located away from the aforementioned processor 401. As Figure 4 As shown, the memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program.

[0119] exist Figure 4In the data processing device 400 shown in FIG. 1 , the user interface 403 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 401 can be used to call the application stored in the memory 405 and specifically execute the following steps: Figure 2 The specific process can be referred to Figure 2 As shown, no further description is given here.

[0120] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 2 The method steps of the embodiment shown in the figure can be found in the specific implementation process. Figure 2 The specific description of the illustrated embodiment will not be repeated here.

[0121] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the data processing method of the NAND flash memory described in the above embodiments.

[0122] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0123] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A method for processing data of a NAND flash memory, characterized in that: include: When it is detected that the NAND flash memory is powered on, the data in the NAND flash memory is cached into the SRAM; receiving a write instruction for the NAND flash memory, wherein the write instruction carries a write address and write data; According to the write address, the SRAM searches for a corresponding target page, and if a write target page is found, writes the write data into the target page; When it is detected that a preset write-back condition is met, the data in the SRAM is compared with the data in the NAND flash memory to see if they are the same. If they are different, the data in the SRAM is synchronized to the NAND flash memory.

2. The method according to claim 1, characterized in that: The preset write-back condition includes one or more of the following: The free capacity in the SRAM is less than a threshold value; It is detected that the current time reaches the preset time; It is detected that the duration of inputting the write command exceeds the preset duration; Receive a write-back instruction from the user.

3. The method according to claim 1 or 2, characterized in that: Also includes: Receiving a read instruction for a NAND flash memory, wherein the read instruction carries a write address; A corresponding target page is searched in the SRAM according to the read address, and data is read from the target page.

4. The method according to claim 3, characterized in that The step of caching the data in the NAND flash memory into the SRAM comprises: The occupied pages are traversed in the NAND flash memory, and the data in the traversed occupied pages are cached in the SRAM.

5. The method according to claim 3, characterized in that: The traversing the occupied pages in the NAND flash memory includes: Traverse the mark bit of each page in the NAND flash memory, if the value of the mark bit corresponding to the page is equal to the preset value; An integrity check is performed on the data of the page. If the check passes, the page is determined to be an occupied page.

6. The method according to claim 5, characterized in that Also includes: If the write target page is not found, a new write target page is created in the SRAM, and the write data is written into the new write target page.

7. The method according to claim 1 or 2 or 4 or 6, characterized in that: The step of synchronizing the data in the SRAM to the NAND flash memory comprises: Each occupied page in the SRAM is traversed, and the data in each occupied page traversed is packaged and sent to the NAND flash memory.

8. A data processing device for a NAND flash memory, characterized in that: include: A cache unit, configured to cache data in the NAND flash memory into the SRAM when detecting that the NAND flash memory is powered on; A receiving unit, configured to receive a write instruction for the NAND flash memory, wherein the write instruction carries a write address and write data; A writing unit, used for searching the SRAM for a corresponding target page according to the write address, and if a write target page is found, writing the write data into the target page; The synchronization unit is used to compare whether the data in the SRAM and the data in the NAND flash memory are the same when detecting that a preset write-back condition is met. If they are different, the data in the SRAM is synchronized to the NAND flash memory.

9. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A NAND flash memory controller, a NAND flash memory, a SRAM flash memory controller, a SRAM, and a data processing device for the NAND flash memory as claimed in claim 8.