Data file management system of launch control equipment

By designing a data file management system based on microcontrollers and NandFlash in the development and control equipment, the problems of high resource consumption and poor reliability of general file systems are solved, efficient data storage, reading and writing are achieved, costs are reduced, and product development efficiency is improved. and reliability.

CN118838869AInactive Publication Date: 2024-10-25CHONGQING YAXUN TECH CO LTD

Patent Information

Application Number
CN202410842625.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing technology, when the general file system manages the data of the development and control equipment, it consumes a lot of resources, is complex, and easily causes file damage when the power supply device is powered off, resulting in low product development efficiency and poor reliability, thereby increasing costs.

Method used

Design a data file management system for development and control equipment, based on single-chip microcomputer and external NandFlash storage device, using APP interface layer, FTL transmission control layer and Flash driver management layer to provide file operation interface and realize the conversion and corruption of logical address to physical address. Block management and power-down safety control improve read and write efficiency through DMA transmission and reduce dependence on the operating system.

Benefits of technology

It improves product development efficiency and reliability, reduces costs, realizes rapid storage of massive data and safe preservation of log and alarm data, and ensures file integrity and reading and writing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118838869A_ABST
    Figure CN118838869A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data file management, in particular to a launch control equipment data file management system. The system runs based on a single-chip microcomputer and an external Nand Flash storage device, comprises an APP interface layer, an FTL transmission control layer and a Flash drive management layer, meets the storage requirements of clients for high-speed and mass data by designing an independent storage data structure, designs the storage space of log files, and achieves the storage of the log files through a file backup and cyclic coverage method. According to the method, the running state and the alarm log information of the power supply equipment are recorded for a long time, the Flash bad block is automatically identified and marked, and the bad block is prevented from being used through virtual address mapping, so that the problem that the product cost is increased due to insufficient product development efficiency and poor product reliability is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data file management, and in particular to a data file management system for a control device. Background Art

[0002] When developing products, it is found that developers are often required to control the read and write interfaces and manage the flash by themselves. If a general file system is used for management, it not only requires operating system support, but also consumes a large amount of resources and adds additional off-chip RAM. Although the general file system is comprehensive, it is relatively complex. In scenarios such as direct power failure of the power supply device, it is easy to cause file damage, resulting in insufficient reliability. In view of this, there is an urgent need for a file management system that can improve product development efficiency, ensure product reliability, and reduce product costs. Summary of the invention

[0003] The purpose of the present invention is to provide a data file management system for a transmission and control device, aiming to solve the problems existing in the prior art of insufficient product development efficiency and poor product reliability leading to increased product costs.

[0004] To achieve the above purpose, a data file management system for a transmission and control device is provided, which is based on a single-chip microcomputer and an external NandFlash storage device and includes:

[0005] The APP interface layer is used to provide a file operation calling interface and divide the power acquisition data storage interval and the log data storage interval. The electrical data can be quickly stored in an external Nand flash storage device, and the power supply equipment maintenance data such as logs and alarms can also be saved separately;

[0006] The FTL transmission control layer is responsible for converting logical addresses to physical addresses, managing bad blocks of external Nand Flash storage devices, and balancing the internal space of external Nand Flash storage devices. At the same time, it implements power-off safety control of external Nand Flash storage devices through log rollback technology;

[0007] The Flash driver management layer is used to unify the read and write interface for external Nand Flash storage devices, and adopts DMA transmission mode to ensure read and write efficiency and minimize interference with the main control process of the product.

[0008] The APP interface layer of the data file management system of the control device of the present application provides a convenient and fast file operation calling interface, and divides the power acquisition data storage interval and the log data storage interval. Software developers can easily and quickly store massive electrical data such as current and voltage in the external Nand Flash, and can also save the power supply equipment maintenance data such as logs and alarms separately; the self-developed FTL transmission control layer is an important functional layer of the file management system of the present application, which is responsible for the conversion of logical addresses to physical addresses, bad block management of flash, and balanced control of flash space. At the same time, the power-off safety control of flash reading and writing is realized through log rollback technology. Finally, the Flash driver management layer realizes a unified read and write interface for the external NandFlash, and its DMA transmission method ensures the read and write efficiency and the interference to the main control process of the product will be minimized. That is, compared with the current mainstream Fatfs, yaffs and other general file systems, the file management system of the present application does not require an operating system and can be used only by relying on the memory on the microcontroller. At the same time, according to the data characteristics of the power supply equipment, it can achieve centralized writing and batch writing with high reading and writing efficiency.

[0009] Among them, the APP interface layer includes a file creation module, a file deletion module, a power data saving module and a log reading and writing module. The file creation module is used to create a log file, the file deletion module is used to judge the log file to confirm whether to delete it, the power data saving module is used to store power data according to the saving steps, and the log reading and writing module is used to read and write log files.

[0010] Among them, the FTL transmission control layer includes an address mapping module, a bad block management module, a balancing control module and a power-off safety module. The address mapping module is used for initializing file information. The bad block management module is used to obtain the bad block mark and block allocation mark of each memory block, and does not read, write or record data when a bad block is detected. The balancing control module is used to detect the number of writes when writing a file to prevent a block from being written too many times, resulting in a bad block, thereby causing a write failure.

[0011] Among them, the Flash drive management layer includes a Flash write module, a Flash read module, a Flash erase module and an ECC check module. The Flash write module is used to call a page write function to write data, the Flash read module is used to read the corresponding data according to the read length to cache the read data, and the Flash erase module is used to delete files without retaining the content.

[0012] The specific process of creating a log file is as follows:

[0013] The file is initially created when power is turned on. Initialization starts after entering the loop for the first time. The Flash object is created, and the SPI is initialized. The global time is obtained and the time to start creating the log file is calibrated.

[0014] Perform the log file creation step, use the Flash object parameters to judge the existing log files, after the opening judgment, the successfully opened log file is identified as a new file, the unsuccessfully opened log file is deleted, and the log file is created again, until the log file is successfully opened through the above process, and then it is identified as a new file;

[0015] Register a timer to periodically process deleted log files and damaged log files caused by power failure.

[0016] The electrical file creation process in the file creation module is as follows: after entering the loop for the first time after power-on, start initialization, create a flash object, initialize SPI, register a 5 millisecond timer, perform garbage collection processing regularly, register a 1-minute file deletion detection, register a 5ms data recording timer, obtain the global time, calibrate the time to start creating the file, create a log file, determine the flash object parameters, try to open the file, if it can be opened, do not create the log file, delete the file and recreate it if the power is off and the file is damaged, directly create a new file if the file does not exist, and determine the new file after opening or creating the file successfully;

[0017] The process of creating a file is as follows: first determine whether the file identifier is empty. If it is empty, exit and return the parameter error flag. Determine whether the file is too long. If it is too long, exit and return the file name too long flag. Determine whether the file space is insufficient. If there is insufficient space, return the space full flag. Check whether there is a file with the same name. If there is, return the file existence flag. Determine whether the position of the root file block is empty. If it is not empty, the file is successfully created and the file exists flag is returned. If there is no file with the same name, apply for a new file header space in the root block. If the first application fails, switch to the root block and continue to apply. If the application still fails, return the failure parameter. If the application is successful, fill in the file header information. Find free space, count, and set the occupied flag. Find free blocks, allocate the file start block, and return an error if the allocation fails for 5 consecutive times. If the allocation is successful, continue to initialize the file header information, and then write the start block information to the file header area. After the file is written, return the successful file creation flag.

[0018] File deletion operation: Determine whether the file identifier is empty. Determine whether the file is open. If it is open, return the file unclosed flag. Continue to read the file identifier to determine whether the file is deleted. If it is deleted, directly return the file deleted flag. If it is not deleted, set the deletion flag and reduce the file number by 1.

[0019] Power data preservation: register a 5ms timing interrupt function, set two buffers, and first determine whether the file is created when entering the function. If not, exit without recording data. If the file is created, use one buffer to store power data and record it every 5ms. If the buffer is full, switch to the second buffer. If the buffer is full, set the buffer full flag. Call the data write function in the loop, first determine the write time and file identification parameters. If both parameters are normal, continue to check whether the time has expired and whether to create a new file. If not, continue to use the file. If it has expired, create a new file, determine the buffer full flag, and if the buffer full flag is set, write the power data in the buffer to the file. The same execution process is followed for the second buffer.

[0020] Log reading and writing: divided into reading logs and writing logs.

[0021] When reading the log, first determine the log update flag and the number of screen pages. If the log update flag is true and the number of screen pages is the number of log pages, fill the log header; determine whether to turn the page, and clear the data in the cache when turning the page, and re-read the log; determine the parameters, and obtain the log file size after the parameter determination is passed, set the searched log file as the current file, find the log record position, locate the log reading position, and finally read a single log, then display the header and the log content.

[0022] Writing logs requires storing the operation behaviors of recording logs. First, set up the log buffer area, then write the logs to the buffer area through the function, and then write the logs in the buffer area to the log file. When writing the log file, first determine the file parameters and fix the log length. If the end of the file is reached, switch to another file. Before writing, encapsulate it in the buffer in a specific format, and then write the buffered data to the file.

[0023] The specific process of storing the power data according to the saving step is as follows:

[0024] Register a timer interrupt function, set two buffer areas, and first determine whether the file is created when entering the function. If the file is not created, exit without recording data.

[0025] If a file is created, a buffer will be used to store power data, and the data will be recorded every period. If the buffer is full, the second buffer will be switched. If any buffer is full of data, the buffer full flag will be set.

[0026] Call the data writing function in the loop, first determine the writing time and file identification parameters, if both parameters are normal, then continue to check whether the time has expired and whether to create a new file, if not, continue to use the file, if it has expired, create a new file, determine the cache full flag, if the cache full flag is set, execute the power data of the cache to write to the file, and the subsequent caches execute the same process.

[0027] The process of reading and writing log files is as follows:

[0028] When reading a log, determine the log update flag. If the log update flag is true, proceed to the next determination step.

[0029] Determine whether the screen page number is the log page number. If the screen page number is the log page number, fill in the log header and proceed to the subsequent determination step;

[0030] Perform page turning judgment. If the page is turned, clear the data in the cache, re-read the log, and perform subsequent judgment steps;

[0031] Parameter judgment: after parameter judgment, the size of the log file is obtained, and the searched log file is set as the current file to display the log content;

[0032] When writing logs, first set the log buffer area, and then write the logs to the buffer area through the function;

[0033] Then write the logs of the cache area into the log file;

[0034] When writing to a log file, first determine the file parameters and fix the log length. If the end of the file is reached, switch to another file, encapsulate it in a specific format in the cache before writing, and then write the cached data to the file.

[0035] A data file management system for a control device of the present invention, based on the prior art and targeting at the characteristics of the product, proposes a management system, which meets the customer's high-speed and massive data storage requirements by designing an independent storage data structure, designs the storage space for log files, ensures long-term recording of the power supply equipment operating status and alarm log information by file backup and circular overwriting methods, automatically identifies and marks Flash bad blocks, and avoids the use of bad blocks by virtual address mapping, thereby solving the problem of insufficient product development efficiency and poor product reliability leading to increased product costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 The present invention is a processing flow chart of a data file management system for a control device. DETAILED DESCRIPTION

[0038] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0039] In the description of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, in the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined.

[0040] See also Figure 1 , a data file management system for a transmission and control device, based on a single-chip microcomputer and an external Nand Flash storage device, comprising:

[0041] The APP interface layer is used to provide a file operation calling interface and divide the power acquisition data storage interval and the log data storage interval. The electrical data can be quickly stored in an external Nand flash storage device, and the power supply equipment maintenance data such as logs and alarms can also be saved separately;

[0042] The FTL transmission control layer is responsible for converting logical addresses to physical addresses, managing bad blocks of external Nand Flash storage devices, and balancing the internal space of external Nand Flash storage devices. At the same time, it implements power-off safety control of external Nand Flash storage devices through log rollback technology;

[0043] The Flash driver management layer is used to unify the read and write interface for external Nand Flash storage devices, and adopts DMA transmission mode to ensure read and write efficiency and minimize interference with the main control process of the product.

[0044] The APP interface layer of the data file management system of the control device of the present application provides a convenient and fast file operation calling interface, and divides the power acquisition data storage interval and the log data storage interval. Software developers can easily and quickly store massive electrical data such as current and voltage in the external Nand Flash, and can also save the power supply equipment maintenance data such as logs and alarms separately; the self-developed FTL transmission control layer is an important functional layer of the file management system of the present application, which is responsible for the conversion of logical addresses to physical addresses, bad block management of flash, and balanced control of flash space. At the same time, the power-off safety control of flash reading and writing is realized through log rollback technology. Finally, the Flash driver management layer realizes a unified read and write interface for the external NandFlash, and its DMA transmission method ensures the read and write efficiency and the interference to the main control process of the product will be minimized. That is, compared with the current mainstream Fatfs, yaffs and other general file systems, the file management system of the present application does not require an operating system and can be used only by relying on the memory on the microcontroller. At the same time, according to the data characteristics of the power supply equipment, it can achieve centralized writing and batch writing with high reading and writing efficiency.

[0045] Furthermore, the APP interface layer includes a file creation module, a file deletion module, a power data saving module and a log reading and writing module. The file creation module is used to create a log file, the file deletion module is used to judge the log file to confirm whether to delete it, the power data saving module is used to store the power data according to the saving steps, and the log reading and writing module is used to read the log file and write the log file.

[0046] Furthermore, the FTL transmission control layer includes an address mapping module, a bad block management module, a balancing control module and a power-off safety module. The address mapping module is used for initializing file information. The bad block management module is used for obtaining the bad block mark and block allocation mark of each memory block, and does not read, write or record data when a bad block is detected. The balancing control module is used for detecting the number of writes when writing a file to prevent a block from being written too many times, resulting in a bad block, thereby causing a write failure.

[0047] Furthermore, the Flash driver management layer includes a Flash write module, a Flash read module, a Flash erase module and an ECC check module. The Flash write module is used to call a page write function to write data, the Flash read module is used to read corresponding data according to the read length to cache the read data, and the Flash erase module is used to delete files without retaining the content.

[0048] Furthermore, the specific process of creating a log file is as follows:

[0049] The file is initially created when power is turned on. Initialization starts after entering the loop for the first time. The Flash object is created, and the SPI is initialized. The global time is obtained and the time to start creating the log file is calibrated.

[0050] Perform the log file creation step, use the Flash object parameters to judge the existing log files, after the opening judgment, the successfully opened log file is identified as a new file, the unsuccessfully opened log file is deleted, and the log file is created again, until the log file is successfully opened through the above process, and then it is identified as a new file;

[0051] Register a timer to periodically process deleted log files and damaged log files caused by power failure.

[0052] The electrical file creation process in the file creation module is as follows: after entering the loop for the first time after power-on, start initialization, create a flash object, initialize SPI, register a 5 millisecond timer, perform garbage collection processing regularly, register a 1-minute file deletion detection, register a 5ms data recording timer, obtain the global time, calibrate the time to start creating the file, create a log file, determine the flash object parameters, try to open the file, if it can be opened, do not create the log file, delete the file and recreate it if the power is off and the file is damaged, directly create a new file if the file does not exist, and determine the new file after opening or creating the file successfully;

[0053] The process of creating a file is as follows: first determine whether the file identifier is empty. If it is empty, exit and return the parameter error flag. Determine whether the file is too long. If it is too long, exit and return the file name too long flag. Determine whether the file space is insufficient. If there is insufficient space, return the space full flag. Check whether there is a file with the same name. If there is, return the file existence flag. Determine whether the position of the root file block is empty. If it is not empty, the file is successfully created and the file exists flag is returned. If there is no file with the same name, apply for a new file header space in the root block. If the first application fails, switch to the root block and continue to apply. If the application still fails, return the failure parameter. If the application is successful, fill in the file header information. Find free space, count, and set the occupied flag. Find free blocks, allocate the file start block, and return an error if the allocation fails for 5 consecutive times. If the allocation is successful, continue to initialize the file header information, and then write the start block information to the file header area. After the file is written, return the successful file creation flag.

[0054] File deletion operation: Determine whether the file identifier is empty. Determine whether the file is open. If it is open, return the file unclosed flag. Continue to read the file identifier to determine whether the file is deleted. If it is deleted, directly return the file deleted flag. If it is not deleted, set the deletion flag and reduce the file number by 1.

[0055] Power data preservation: register a 5ms timing interrupt function, set two buffers, and first determine whether the file is created when entering the function. If not, exit without recording data. If the file is created, use one buffer to store power data and record it every 5ms. If the buffer is full, switch to the second buffer. If the buffer is full, set the buffer full flag. Call the data write function in the loop, first determine the write time and file identification parameters. If both parameters are normal, continue to check whether the time has expired and whether to create a new file. If not, continue to use the file. If it has expired, create a new file, determine the buffer full flag, and if the buffer full flag is set, write the power data in the buffer to the file. The same execution process is followed for the second buffer.

[0056] Log reading and writing: divided into reading logs and writing logs.

[0057] When reading the log, first determine the log update flag and the number of screen pages. If the log update flag is true and the number of screen pages is the number of log pages, fill the log header; determine whether to turn the page, and clear the data in the cache when turning the page, and re-read the log; determine the parameters, and obtain the log file size after the parameter determination is passed, set the searched log file as the current file, find the log record position, locate the log reading position, and finally read a single log, then display the header and the log content.

[0058] Writing logs requires storing the operation behaviors of recording logs. First, set up the log buffer area, then write the logs to the buffer area through the function, and then write the logs in the buffer area to the log file. When writing the log file, first determine the file parameters and fix the log length. If the end of the file is reached, switch to another file. Before writing, encapsulate it in the buffer in a specific format, and then write the buffered data to the file.

[0059] Furthermore, the specific process of storing the power supply data according to the saving step is as follows:

[0060] Register a timer interrupt function, set two buffer areas, and first determine whether the file is created when entering the function. If the file is not created, exit without recording data.

[0061] If a file is created, a buffer will be used to store power data, and the data will be recorded every period. If the buffer is full, the second buffer will be switched. If any buffer is full of data, the buffer full flag will be set.

[0062] Call the data writing function in the loop, first determine the writing time and file identification parameters, if both parameters are normal, then continue to check whether the time has expired and whether to create a new file, if not, continue to use the file, if it has expired, create a new file, determine the cache full flag, if the cache full flag is set, execute the power data of the cache to write to the file, and the subsequent caches execute the same process.

[0063] Furthermore, the process of reading and writing log files is as follows:

[0064] When reading a log, determine the log update flag. If the log update flag is true, proceed to the next determination step.

[0065] Determine whether the screen page number is the log page number. If the screen page number is the log page number, fill in the log header and proceed to the subsequent determination step;

[0066] Perform page turning judgment. If the page is turned, clear the data in the cache, re-read the log, and perform subsequent judgment steps;

[0067] Parameter judgment: after parameter judgment, the size of the log file is obtained, and the searched log file is set as the current file to display the log content;

[0068] When writing logs, first set the log buffer area, and then write the logs to the buffer area through the function;

[0069] Then write the logs of the cache area into the log file;

[0070] When writing to a log file, first determine the file parameters and fix the log length. If the end of the file is reached, switch to another file, encapsulate it in a specific format in the cache before writing, and then write the cached data to the file.

[0071] Furthermore, the address mapping module is used for initializing file information, applying for file space, setting file information, applying for space statistics on file allocation, initializing all file information to 0, applying for a page of data size memory as a cache area according to the attributes of the flash, applying for memory to save block allocation statistics, applying for memory to save happy list information, initializing block allocation information, searching for block addresses, establishing a bad block table, reading the spare area of ​​page 0, obtaining bad block marks and block allocation marks, checking bad blocks and allocated block marks, checking whether it is a root block, and creating a root block if the root block is not found.

[0072] When registering files and allocating blocks, the bad block management module obtains the bad block mark and block allocation mark of each memory block, checks the bad block mark, and treats the bad block as an allocated block, but does not read the bad block information. When reading and writing logs and recording power data, the bad block mark and occupied flag are checked, and reading and writing and data recording are not performed if they are checked.

[0073] The balance control module is used to detect the number of write times when writing a file to prevent a block from being written too many times, resulting in a bad block and causing a write failure.

[0074] The power-off safety module is used to read the entire file when creating a file, determine whether it corresponds to the power-off mark, and if so, process it, delete the file and create it again.

[0075] When the Flash write module is running, data can only be written by page. For data that spans multiple pages, the data size needs to be calculated and the page write function needs to be called multiple times to write data.

[0076] The Flash reading module is used to read data from the address to be read in a single read, read the corresponding data according to the length required to be read, and finally cache the read data.

[0077] The Flash erase module flash is used to delete files without retaining the content.

[0078] The ECC check module is used to judge the number of communication failures. If it is equal to the communication failure flag, a timeout flag is returned. If it is not equal, the writing judgment continues. If it times out, the communication failure number is judged. If it is lower than the communication failure flag, it is automatically increased. If it exceeds the communication failure flag, the ECC check failure flag is returned. If there is no timeout, the communication failure number is cleared and the write judgment flag is returned.

[0079] A data file management system for a control device of the present invention, based on the prior art and targeting at the characteristics of the product, proposes a management system, which meets the customer's high-speed and massive data storage requirements by designing an independent storage data structure, designs the storage space for log files, ensures long-term recording of the power supply equipment operating status and alarm log information by file backup and circular overwriting methods, automatically identifies and marks Flash bad blocks, and avoids the use of bad blocks by virtual address mapping, thereby solving the problem of insufficient product development efficiency and poor product reliability leading to increased product costs.

[0080] What is disclosed above is only a preferred embodiment of the present invention, and it certainly cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.

Claims

1. A data file management system for a control device, based on a single-chip microcomputer and an external Nand Flash storage device, characterized in that: include: The APP interface layer is used to provide a file operation calling interface and divide the power acquisition data storage interval and the log data storage interval. The electrical data can be quickly stored in an external Nand flash storage device, and the power supply equipment maintenance data such as logs and alarms can also be saved separately; The FTL transmission control layer is responsible for converting logical addresses to physical addresses, managing bad blocks of external Nand Flash storage devices, and balancing the internal space of external Nand Flash storage devices. At the same time, it implements power-off safety control of external Nand Flash storage devices through log rollback technology; The Flash driver management layer is used to unify the read and write interface for external Nand Flash storage devices, and adopts DMA transmission mode to ensure read and write efficiency and minimize interference with the main control process of the product.

2. The data file management system for control equipment according to claim 1, characterized in that: The APP interface layer includes a file creation module, a file deletion module, a power data saving module and a log reading and writing module. The file creation module is used to create a log file, the file deletion module is used to judge the log file to confirm whether to delete it, the power data saving module is used to store power data according to the saving steps, and the log reading and writing module is used to read and write log files.

3. The data file management system for control equipment according to claim 1, characterized in that: The FTL transmission control layer includes an address mapping module, a bad block management module, a balancing control module and a power-off safety module. The address mapping module is used for initializing file information. The bad block management module is used for obtaining the bad block mark and block allocation mark of each memory block, and does not read, write or record data when a bad block is detected. The balancing control module is used for detecting the number of writes when writing a file to prevent a block from being written too many times, resulting in a bad block, thereby causing a write failure.

4. The data file management system for control equipment according to claim 1, characterized in that: The Flash drive management layer includes a Flash write module, a Flash read module, a Flash erase module and an ECC check module. The Flash write module is used to call a page write function to write data. The Flash read module is used to read corresponding data according to the read length to cache the read data. The Flash erase module is used to delete files without retaining the content.

5. The data file management system for control equipment according to claim 2, characterized in that: The specific process of creating a log file is as follows: The file is initially created when power is turned on. Initialization starts after entering the loop for the first time. The Flash object is created, and the SPI is initialized. The global time is obtained and the time to start creating the log file is calibrated. Perform the log file creation step, use the Flash object parameters to judge the existing log files, after the opening judgment, the successfully opened log file is identified as a new file, the unsuccessfully opened log file is deleted, and the log file is created again, until the log file is successfully opened through the above process, and then it is identified as a new file; Register a timer to periodically process deleted log files and damaged log files caused by power failure.

6. The data file management system for control equipment according to claim 5, characterized in that: The judgment process after opening judgment is as follows: Determine whether the log file identifier is empty. If it is empty, return the parameter error flag. If it is not empty, continue with the subsequent judgment. Determine whether the log file name is too long. If it is too long, exit and return the file name too long flag. If it is not too long, continue with the subsequent judgment. Determine whether the file space is sufficient. If the space is insufficient, return the full space mark. If the space is insufficient, continue with the subsequent determination. Determine whether there is a file with the same name. If there is a file with the same name, return the file existence flag. If there is no file with the same name, continue with the subsequent judgment; Determine whether the location of the root file block is empty. If it is not empty, the log file is successfully created, and the log file existence flag is returned, and the subsequent judgment continues; Apply for new file header space in the root block. If the application fails, switch to the root block and continue to apply. After at least 5 consecutive failures, return an error flag. If the allocation is successful, continue to initialize the file header information and return a successful file creation flag.

7. The data file management system for control equipment according to claim 2, characterized in that: The specific process of storing power data according to the saving step is as follows: Register a timer interrupt function, set two buffer areas, and first determine whether the file is created when entering the function. If the file is not created, exit without recording data. If a file is created, a buffer will be used to store power data, and the data will be recorded every period. If the buffer is full, the second buffer will be switched. If any buffer is full of data, the buffer full flag will be set. Call the data writing function in the loop, first determine the writing time and file identification parameters, if both parameters are normal, then continue to check whether the time has expired and whether to create a new file, if not, continue to use the file, if it has expired, create a new file, determine the cache full flag, if the cache full flag is set, execute the power data of the cache to write to the file, and the subsequent caches execute the same process.

8. The data file management system for control equipment according to claim 2, characterized in that: The process of reading and writing log files is as follows: When reading a log, determine the log update flag. If the log update flag is true, proceed to the next determination step. Determine whether the screen page number is the log page number. If the screen page number is the log page number, fill in the log header and proceed to the subsequent determination step; Perform page turning judgment. If the page is turned, clear the data in the cache, re-read the log, and perform subsequent judgment steps; Parameter judgment: after parameter judgment, the size of the log file is obtained, and the searched log file is set as the current file to display the log content; When writing logs, first set the log buffer area, and then write the logs to the buffer area through the function; Then write the logs of the cache area into the log file; When writing a log file, first determine the file parameters and fix the log length. If the end of the file is reached, switch to another file, encapsulate it in a specific format in the cache before writing, and then write the cached data to the file.

Citation Information

Patent Citations

  • Reliable static planning file system oriented to NandFlash

    CN108038024A

  • Security log file system, implementation method thereof and medium

    CN112035294A

  • Adaptive write behavior for a system having non-volatile memory

    US20120047315A1

  • Nonvolatile memory device, electronic device and computing system including the same

    US20140281172A1

Cited By

  • Automatic regression method for chip verification

    CN121257426A

  • An automated regression method for chip verification

    CN121257426B