Mini file system and operating method in an optical module

CN117130556BActive Publication Date: 2026-09-22LIGHTREND TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311104994.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2026-09-22
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

然而Flash的擦除次数受物理上的限制,频繁地更新光模块内的数据,将缩短板载MCU的使用寿命

Benefits of technology

[0020]本设计中所述的微型文件系统,在固件上采用独特算法,既缩短了新数据Flash的保存时间,使之更符合MSA协议,又减少在数据保存时Flash的擦除操作次数,延长了MCU的使用寿命。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117130556B_ABST
    Figure CN117130556B_ABST
Patent Text Reader

Abstract

The application discloses a micro file system in an optical module and an operating method thereof. The micro file system is logically composed of a RAM cache and two same flash memory areas in internal structure. The flash memory areas include a basic data area and an extended data area. The basic data area of the flash memory area stores original data of a file, which is a small data block of one page (128 bytes). The basic data area in the RAM cache is a cache corresponding to the basic data area in the active flash memory area. The micro file system in the design adopts a unique algorithm on firmware. The unique algorithm shortens the saving time of new data flash, makes the new data flash more comply with the MSA protocol, reduces the erasing operation times of the flash during data saving, and prolongs the service life of the MCU.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical module technology, and more specifically to a micro file system and its operation method in an optical module. Background Technology

[0002] The Flash memory within the onboard MCU of the optical module has always served as program memory. Due to cost considerations, a small area of ​​Flash is typically allocated for data storage, eliminating the need for an additional EEPROM. Data is stored in pages, each containing 128 bytes. Several pages of data in the optical module are stored in this data storage. When an external host modifies part or all of the data on a page in the MCU's RAM via the TWI interface, to ensure security and integrity, the updated data should be saved to Flash within a certain time t to overwrite the old data. Saving a page involves two steps: first, erasing the corresponding sector in Flash by address, and then writing the entire page of data word by word. The Flash save time t is strictly defined in the MSA protocol, with a maximum of 40 milliseconds. The smaller the t value, the lower the probability of data loss due to unexpected power outages. However, some MCUs, such as the ADUCM430, have sector erase times as long as 80 milliseconds, far exceeding the standard specified by the MSA protocol. In addition, every time data in RAM is updated, it must be saved immediately, and the corresponding sector in Flash memory will be erased accordingly. However, the number of times Flash memory can be erased is physically limited, and frequent updates to the data in the optical module will shorten the lifespan of the onboard MCU. Summary of the Invention

[0003] To overcome the aforementioned deficiencies of the prior art, this invention provides a miniature file system and its operation method in an optical module. The aim is to shorten the storage time of new data in the Flash memory to meet the MSA protocol; and to reduce the number of Flash sector erases during data storage, thereby extending the lifespan of the onboard MCU.

[0004] The technical solution of this invention is as follows:

[0005] A miniature file system in an optical module and its operation method.

[0006] The micro file system is logically constructed by consisting of a RAM cache and two identical Flash storage areas, wherein:

[0007] The Flash storage area includes a basic data area and an extended data area. The basic data area stores the original data of the file, which is a small data block of 1 page (128 bytes). The extended data area stores several modification records appended in chronological order. Only one of the two Flash storage areas is active at any given time. When one of the Flash storage areas is being used by the MCU, the other Flash storage area is always ready to be written to.

[0008] The basic data area in the RAM cache is the high-speed cache in RAM corresponding to the basic data area in the active Flash storage area. When a micro file is modified, the modification record formed by the location and time of the original data modification and the new value after the update is first cached in a circular queue in RAM, and then appended to the extended data area in the active Flash storage area.

[0009] The method for manipulating mini files is as follows:

[0010] (1) Creation of micro file: The two Flash storage areas of the micro file are preset in the firmware of the MCU. Their initial state is: the basic data area of ​​Flash storage area 1# is preset with original data, and its extended data area has no data; the basic data area and extended data area of ​​Flash storage area 2# have no data.

[0011] (2) Reading the micro file: When the MCU powers on and performs the initialization process, it needs to load data from Flash into the RAM cache; the steps for reading the micro file are as follows:

[0012] a. Determine if there is data in the basic data area of ​​Flash storage area 1#. If there is data, mark 1# as active; otherwise, mark 2# as active.

[0013] b. Load raw data from the base data area of ​​the active Flash storage area and fill it into the base data area of ​​the RAM cache;

[0014] c. Read the modification records sequentially from the extended data area of ​​the active Flash storage area. Each modification record contains the location where the original data of the file was changed and the new value of the changed data; based on its location information, overwrite the old value of the corresponding original data in the basic data area of ​​the RAM cache with its new value;

[0015] (3) Data update in the micro file: When an external host writes data to the module through the TWI interface, the onboard MCU obtains the data in the I2C slave interrupt service routine. On the one hand, it updates the old data in the basic data area of ​​the RAM cache according to the position information of the new data being written. On the other hand, it forms a new modification record with the position information and the new data value and inserts it into the circular queue of the RAM cache. Finally, when exiting the interrupt service routine, the MCU sends a thread message to notify the thread that saves the data to do the next step.

[0016] (4) Saving data in the micro file: After receiving the notification message and being awakened, the high-priority thread retrieves the modified record from the circular queue of the RAM cache in turn and appends it to the extended data area of ​​the active Flash storage area; when the extended data area is full, the basic data area of ​​the RAM cache is transferred: the data in the basic data area of ​​the RAM cache is directly written to the basic data area of ​​the ready Flash storage area, and the Flash storage area is marked as active at the same time; the Flash storage area that has been filled with data is marked as ready and is erased once by sector when the MCU is idle.

[0017] The modification record is a custom data structure that records which original data in the basic data area has been modified and the new values ​​of the original data after modification.

[0018] The circular queue is a first-in-first-out (FIFO) data structure with the head and tail connected. It uses the linear space of an array, has simple data organization, can quickly determine whether the queue is full or empty, and can store and retrieve data at a very fast speed.

[0019] The technical effects and advantages of this invention are as follows:

[0020] The micro file system described in this design employs a unique algorithm in its firmware, which shortens the flash memory retention time for new data, making it more compliant with the MSA protocol, and reduces the number of flash erase operations during data storage, thus extending the lifespan of the MCU. Attached Figure Description

[0021] Figure 1 This is a block diagram showing the internal structure logic of the optical module micro file system of the present invention.

[0022] Figure 2This diagram illustrates the internal memory management space of a 400G optical module as defined by the Common Management Interface Specification (a type of MSA protocol). A page is a 128-byte data block, and the data within the optical module is stacked in a page structure, accessed by the external host via the TWI serial bus interface. Detailed Implementation

[0023] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] like Figure 1 and Figure 2 The diagram illustrates a miniature file system in an optical module and its operation method.

[0025] The micro file system is logically constructed by consisting of a RAM cache and two identical Flash storage areas, wherein:

[0026] The Flash storage area includes a basic data area and an extended data area. The basic data area stores the original data of the file, which is a small data block of 1 page (128 bytes). The extended data area stores several modification records appended in chronological order. Only one of the two Flash storage areas is active at any given time. When one of the Flash storage areas is being used by the MCU, the other Flash storage area is always ready to be written to.

[0027] The basic data area in the RAM cache is the high-speed cache in RAM corresponding to the basic data area in the active Flash storage area. When a micro file is modified, the modification record formed by the location and time of the original data modification and the new value after the update is first cached in a circular queue in RAM, and then appended to the extended data area in the active Flash storage area.

[0028] The method for manipulating mini files is as follows:

[0029] (1) Creation of micro file: The two Flash storage areas of the micro file are preset in the firmware of the MCU. Their initial state is: the basic data area of ​​Flash storage area 1# is preset with original data, and its extended data area has no data; the basic data area and extended data area of ​​Flash storage area 2# have no data.

[0030] (2) Reading the micro file: When the MCU powers on and performs the initialization process, it needs to load data from Flash into the RAM cache; the steps for reading the micro file are as follows:

[0031] a. Determine if there is data in the basic data area of ​​Flash storage area 1#. If there is data, mark 1# as active; otherwise, mark 2# as active.

[0032] b. Load raw data from the base data area of ​​the active Flash storage area and fill it into the base data area of ​​the RAM cache;

[0033] c. Read the modification records sequentially from the extended data area of ​​the active Flash storage area. Each modification record contains the location where the original data of the file was changed and the new value of the changed data; based on its location information, overwrite the old value of the corresponding original data in the basic data area of ​​the RAM cache with its new value;

[0034] (3) Data update in the micro file: When an external host writes data to the module through the TWI interface, the onboard MCU obtains the data in the I2C slave interrupt service routine. On the one hand, it updates the old data in the basic data area of ​​the RAM cache according to the position information of the new data being written. On the other hand, it forms a new modification record with the position information and the new data value and inserts it into the circular queue of the RAM cache. Finally, when exiting the interrupt service routine, the MCU sends a thread message to notify the thread that saves the data to do the next step.

[0035] (4) Saving data in the micro file: After receiving the notification message and being awakened, the high-priority thread retrieves the modified record from the circular queue of the RAM cache in turn and appends it to the extended data area of ​​the active Flash storage area; when the extended data area is full, the basic data area of ​​the RAM cache is transferred: the data in the basic data area of ​​the RAM cache is directly written to the basic data area of ​​the ready Flash storage area, and the Flash storage area is marked as active at the same time; the Flash storage area that has been filled with data is marked as ready and is erased once by sector when the MCU is idle.

[0036] Furthermore, the modification record is a custom data structure that records which original data in the basic data area has been modified and the new values ​​of the original data after modification.

[0037] Furthermore, the circular queue is a first-in-first-out (FIFO) data structure with the head and tail connected. It uses the linear space of an array, has simple data organization, can quickly determine whether the queue is full or empty, and can store and retrieve data at a very fast speed.

[0038] Definitions:

[0039] 1. Flash memory (FLASH EEPROM), also known as flash storage, is a type of EEPROM. It combines the advantages of ROM and RAM. It not only possesses the electronically erasable and programmable (EEPROM) capabilities but also retains data even when power is off and allows for rapid data retrieval. The biggest difference between FLASH and EEPROM is that FLASH operates on a sector (block) basis, while EEPROM operates on a byte basis. FLASH has a simpler circuit structure, occupies less chip area for the same capacity, and is therefore less expensive than EEPROM, making it suitable for use as program memory.

[0040] 2. RAM, also known as Random Access Memory, allows the contents of memory cells to be randomly retrieved or stored as needed, and the access speed is independent of the location of the memory cell. This type of memory loses its stored contents when power is off, so it is mainly used to store programs that are used for short periods of time.

[0041] It is mainly used to store variables used in the program. All variables that need to be modified in the entire program (including global variables, local variables, stack segments, etc.) are stored in RAM.

[0042] 3. MCU (Microcontroller Unit): A microcontroller is an integrated circuit chip that uses very large-scale integrated circuit technology to integrate the functions of a central processing unit (CPU), random access memory (RAM), read-only memory (ROM), etc., onto a single silicon chip to form a small but complete microcomputer system.

[0043] 4. MSA: (MultiSource Agreement). As the world's largest professional technical organization, IEEE (Institute of Electrical and Electronics Engineers) has established standards for optical modules. However, optical modules from different manufacturers have diverse interface types. In order to solve the problem of insufficient interoperability, multiple manufacturers jointly formed an organization to standardize and specify the interface types, installation, and functions of optical modules. MSA came into being and supplemented the IEEE standard.

[0044] 5. TWI: Two Wire Interface (an obsolescent alias for I2C), I2C serial bus interface.

[0045] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A micro file system and its operation method in an optical module, characterized in that: The micro file system is logically constructed by consisting of a RAM cache and two identical Flash storage areas, wherein: The Flash storage area includes a basic data area and an extended data area. The basic data area stores the original data of the file, which is a small data block of 1 page or 128 bytes. The extended data area stores several modification records appended in chronological order. Only one of the two Flash storage areas is active at any given time. When one of the Flash storage areas is being used by the MCU, the other is always in a ready state to be written to. The basic data area in the RAM cache is the high-speed cache in RAM corresponding to the basic data area in the active Flash storage area. When a micro file is modified, the modification record formed by the location and time information of the original data being modified and the new value after the update is first cached in the circular queue in RAM, and then appended to the extended data area in the active Flash storage area. The method for manipulating mini files is as follows: (1) Creation of micro file: The two Flash storage areas of the micro file are preset in the firmware of the MCU. Their initial state is: the basic data area of ​​Flash storage area 1# is preset with original data, and its extended data area has no data; the basic data area and extended data area of ​​Flash storage area 2# have no data. (2) Reading the micro file: When the MCU powers on and performs the initialization process, it needs to load data from Flash into the RAM cache; the steps for reading the micro file are as follows: a. Determine if there is data in the basic data area of ​​Flash storage area 1#. If there is data, mark 1# as active; otherwise, mark 2# as active. b. Load raw data from the base data area of ​​the active Flash storage area and fill it into the base data area of ​​the RAM cache; c. Read the modification records sequentially from the extended data area of ​​the active Flash storage area; each modification record contains the location where the original data of the file was changed and the new value of the changed data; based on its location information, overwrite the old value of the corresponding original data in the basic data area of ​​the RAM cache with its new value; (3) Data update in the micro file: When an external host writes data to the module through the TWI interface, the onboard MCU obtains the data in the I2C slave interrupt service routine. On the one hand, it updates the old data in the basic data area of ​​the RAM cache according to the position information of the new data being written. On the other hand, it forms a new modification record with the position information and the new data value and inserts it into the circular queue of the RAM cache. Finally, when exiting the interrupt service routine, the MCU sends a thread message to notify the thread that saves the data to do the next step. (4) Saving data in the micro file: After receiving the notification message and being awakened, the high-priority thread retrieves the modified record from the circular queue of the RAM cache in turn and appends it to the extended data area of ​​the active Flash storage area; when the extended data area is full, the basic data area of ​​the RAM cache is transferred: the data in the basic data area of ​​the RAM cache is directly written to the basic data area of ​​the ready Flash storage area, and the Flash storage area is marked as active at the same time; the Flash storage area that has been filled with data is marked as ready and is erased once by sector when the MCU is idle.

2. The micro file system and its operation method in an optical module according to claim 1, characterized in that: The modification record is a custom data structure that records which original data in the basic data area has been modified and the new values ​​of the original data after modification.

3. The micro file system and its operation method in an optical module according to claim 1, characterized in that: The circular queue is a first-in-first-out data structure with its head and tail connected. It uses the linear space of an array, has simple data organization, can quickly determine whether the queue is full or empty, and can store and retrieve data at a very fast speed.

Citation Information

Patent Citations

  • Method for storing nonvolatile data by using MCU internal data Flash

    CN102662852A

  • Writing method and apparatus for flash data in optical module

    CN106021122A