Optical module and power-on time recording method
By setting the buffer and nonvolatile memory in the MCU of the optical module, alternately storing real-time operating parameters, the problem of high power consumption during the recording power-on time of the optical module is solved, and a low power consumption and data-safe storage method is realized.
Patent Information
- Application Number
- CN202311488302.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2025-05-09
Smart Images

Figure CN119966518A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of optical communication technology, and in particular to an optical module and a power-on time recording method. Background Art
[0002] With the development of new services and application models such as cloud computing, mobile Internet, and video, the development and progress of optical communication technology has become increasingly important. In optical communication technology, optical modules are tools for converting optical and electrical signals and are one of the key components in optical communication equipment.
[0003] After the optical module has been running for a long time, the internal laser device has aging problems, and the gold finger of the connector has oxidation problems, which leads to an increase in the bit error rate and even communication termination. Therefore, it is necessary to record the power-on time of the optical module, evaluate the operating life of the optical module through the power-on time, and issue early warnings in time to facilitate later maintenance. The current conventional method is to set an electrically erasable programmable read only memory (EEPROM) outside the optical module, and the MCU stores the recorded power-on time in the EEPROM, and the host computer reads the EEPROM to obtain the power-on time.
[0004] However, when the power-on time of the optical module is recorded through the EEPROM external to the optical module, the MCU of the optical module needs to be communicated with the external EEPROM, resulting in higher operating power consumption of the optical module. Summary of the invention
[0005] The disclosed embodiments provide an optical module and a power-on time recording method to store the power-on time of the optical module in an MCU to avoid the operating power consumption caused by an external EEPROM.
[0006] In a first aspect, the present disclosure provides an optical module, comprising:
[0007] Circuit boards;
[0008] An MCU is mounted on the circuit board, and the MCU includes:
[0009] A buffer is configured to cache the real-time operating parameters of the optical module and update the real-time operating parameters according to a recording period;
[0010] A non-volatile memory, comprising a first partition and a second partition, wherein the second partition comprises a first page and a second page, wherein the first partition is used to store firmware operating parameters, the first page and the second page are used to store updated real-time operating parameters, and storage flags are alternately set in the first page and the second page according to a recording period of the real-time operating parameters;
[0011] The MCU is configured to: after the real-time operation parameters in the buffer are updated, execute a first thread, wherein the first thread includes: obtaining the cached real-time operation parameters, storing the real-time operation parameters in a page with the storage flag set, or storing the real-time operation parameters in a page without the storage flag set;
[0012] When receiving the parameter reading instruction, executing the second thread, the second thread includes: reading the real-time operating parameters cached in the buffer, or reading the firmware operating parameters stored in the first partition;
[0013] The first thread and the second thread may be executed in parallel, and the first thread and the second thread are not executed on the same partition.
[0014] In a second aspect, the present disclosure provides a method for recording the power-on time of an optical module, wherein the optical module includes an MCU, the MCU includes a buffer and a non-volatile memory, the non-volatile memory includes a first partition and a second partition, the second partition includes a first page and a second page, and storage flags are alternately set in the first page and the second page according to a recording period of the power-on time. The method for recording the power-on time by the MCU includes:
[0015] The buffer caches the power-on time of the optical module;
[0016] The MCU updates the power-on time cached by the buffer according to the recording period;
[0017] After the power-on time is updated, the MCU executes a first thread, the first thread comprising: obtaining the updated power-on time, storing the updated power-on time in a page with the storage flag set, or storing the updated power-on time in a page without the storage flag set;
[0018] When the MCU receives a parameter reading instruction, the MCU executes a second thread, which can be executed in parallel with the first thread. The second thread includes: reading real-time operating parameters cached in the buffer, or reading firmware operating parameters stored in the first partition.
[0019] It can be seen from the above embodiments that the optical module provided by the embodiment of the present disclosure includes a circuit board and an MCU, the MCU is installed on the circuit board, the MCU includes a cache and a non-volatile memory, the cache is configured to cache the real-time operating parameters of the optical module, and update the real-time operating parameters according to the recording period; the non-volatile memory includes a first partition and a second partition, the second partition includes a first page and a second page, the first partition is used to store the firmware operating parameters, the first page and the second page are used to store the updated real-time operating parameters, so as to realize a double backup of the real-time operating parameters; wherein, after the power-on time in the cache is updated, the MCU executes a first thread, and the first thread includes: obtaining the power-on time cached in the cache, and alternately storing the power-on time in the first page and the second page, and in order to avoid repeatedly storing the power-on time in the same page, storing the power-on time in the first page and the second page alternately. The storage flag is alternately set in the paging according to the recording period of the power-on time. The MCU stores the real-time operating parameters updated in the buffer in the paging set with the storage flag, or stores the updated real-time operating parameters in the paging not set with the storage flag, so as to alternately store the real-time operating parameters updated in the buffer in the first page and the second page, which can avoid losing the power-on time when the optical module is powered off; the host computer is connected to the MCU of the optical module for communication. In order to obtain the operating parameters of the optical module, the host computer can send a parameter reading instruction to the MCU. After receiving the parameter reading instruction, the MCU executes the second thread, and the second thread includes: reading the real-time operating parameters cached in the buffer, or reading the firmware operating parameters stored in the first partition, that is, when the host computer reads the operating parameters of the optical module, it can read the operating parameters from the buffer or the first partition. When the MCU executes the first thread and the second thread, since the first thread stores the power-on time in the second partition and the second thread reads the operating parameters from the cache or the first partition, the first thread and the second thread do not perform read and write operations on the same partition. When the MCU executes the first thread, it does not affect the execution of the second thread. Therefore, the first thread and the second thread can be executed in parallel. The MCU can execute the threads while reading and writing at the same time, and complete the access communication with the host computer while recording the power-on time of the optical module.
[0020] The optical module provided by the present invention divides the memory of the MCU into a first partition and a second partition, so that the MCU can execute multiple threads, and the read thread between the host computer and the MCU and the write thread of the MCU to the second partition do not act on the same partition, so that the MCU can directly record the power-on time of the optical module, which can save the material cost brought by the external EEPROM and reduce the operating power consumption of the optical module; in addition, the second partition is divided into a first page and a second page, and the MCU stores the power-on time alternately in the first page and the second page, so as to adopt a double backup storage method, which can avoid the optical module accidentally losing power when storing the power-on time, resulting in the loss of the power-off time. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present disclosure, the following briefly introduces the drawings required to be used in some embodiments of the present disclosure. Obviously, the drawings described below are only drawings of some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can also be obtained based on these drawings. In addition, the drawings described below can be regarded as schematic diagrams, and are not intended to limit the actual size of the product involved in the embodiments of the present disclosure, the actual process of the method, the actual timing of the signal, etc.
[0022] Figure 1 A partial structural diagram of an optical communication system provided according to some embodiments of the present disclosure;
[0023] Figure 2 A partial structural diagram of a host computer provided according to some embodiments of the present disclosure;
[0024] Figure 3 A structural diagram of an optical module provided according to some embodiments of the present disclosure;
[0025] Figure 4 An exploded view of an optical module provided according to some embodiments of the present disclosure;
[0026] Figure 5 A partial structural diagram of an optical module provided according to some embodiments of the present disclosure;
[0027] Figure 6 A structural block diagram of an MCU in an optical module provided according to some embodiments of the present disclosure;
[0028] Figure 7 A schematic diagram of space allocation of a memory in an optical module provided according to some embodiments of the present disclosure;
[0029] Figure 8 A schematic diagram of storing power-on time in an optical module according to some embodiments of the present disclosure Figure 1 ;
[0030] Fig. 9 A schematic diagram of storing power-on time in an optical module according to some embodiments of the present disclosure Figure 2 ;
[0031] Fig.10 A schematic diagram of reading and writing operation of operating parameters in an optical module provided according to some embodiments of the present disclosure;
[0032] Fig.11 A flowchart of a method for recording power-on time of an optical module provided according to some embodiments of the present disclosure;
[0033] Fig.12A detailed process of a method for recording the power-on time of an optical module according to some embodiments of the present disclosure Figure 1 ;
[0034] Fig.13 A detailed process of a method for recording the power-on time of an optical module according to some embodiments of the present disclosure Figure 2 . DETAILED DESCRIPTION
[0035] Some embodiments of the present disclosure will be described in detail below in conjunction with the accompanying drawings. However, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments provided by the present disclosure, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of the present disclosure.
[0036] Unless the context requires otherwise, throughout the specification and claims, the term "comprising" is to be interpreted as having an open, inclusive meaning, that is, "including, but not limited to"; the terms "first" and "second" are not to be understood as indicating or implying relative importance or indicating an upper limit on quantity; the term "plurality" means two or more; the term "connected" is to be understood in a broad sense, for example, "connected" can be a fixed connection, a detachable connection, or an integral connection, and can be directly connected or indirectly connected through an intermediate medium; the use of the terms "suitable for" or "configured to" implies open and inclusive language, which does not exclude devices that are suitable for or configured to perform additional tasks or steps; descriptions such as "parallel", "perpendicular", "same", "consistent", and "flush" are not limited to absolute mathematical theoretical relationships, but also include an acceptable error range generated in practice, and also include differences based on the same design concept but due to manufacturing reasons.
[0037] In optical communication technology, in order to establish information transmission between information processing devices, it is necessary to load information onto light and use the propagation of light to achieve information transmission. Here, the light loaded with information is an optical signal. When optical signals are transmitted in information transmission equipment, the loss of optical power can be reduced, so high-speed, long-distance, and low-cost information transmission can be achieved. The signals that information processing equipment can recognize and process are electrical signals. Information processing equipment usually includes optical network terminals (Optical Network Unit, ONU), gateways, routers, switches, mobile phones, computers, servers, tablets, televisions, etc., and information transmission equipment usually includes optical fibers and optical waveguides.
[0038] The optical module can realize the mutual conversion between optical signals and electrical signals between information processing equipment and information transmission equipment. For example, at least one of the optical signal input end or the optical signal output end of the optical module is connected to an optical fiber, and at least one of the electrical signal input end or the electrical signal output end of the optical module is connected to an optical network terminal; the first optical signal from the optical fiber is transmitted to the optical module, and the optical module converts the first optical signal into a first electrical signal, and transmits the first electrical signal to the optical network terminal; the second electrical signal from the optical network terminal is transmitted to the optical module, and the optical module converts the second electrical signal into a second optical signal, and transmits the second optical signal to the optical fiber. Since multiple information processing devices can transmit information through electrical signals, at least one of the multiple information processing devices needs to be directly connected to the optical module, and all information processing devices do not need to be directly connected to the optical module. Here, the information processing device directly connected to the optical module is called the upper computer of the optical module. In addition, the optical signal input end or the optical signal output end of the optical module can be called an optical port, and the electrical signal input end or the electrical signal output end of the optical module can be called an electrical port.
[0039] Figure 1 FIG. 1 is a partial structural diagram of an optical communication system provided according to some embodiments of the present disclosure. Figure 1 As shown, the optical communication system mainly includes a remote information processing device 1000 , a local information processing device 2000 , a host computer 100 , an optical module 200 , an optical fiber 101 and a network cable 103 .
[0040] One end of the optical fiber 101 extends toward the remote information processing device 1000, and the other end of the optical fiber 101 is connected to the optical module 200 through the optical port of the optical module 200. The optical signal can be totally reflected in the optical fiber 101, and the propagation of the optical signal in the total reflection direction can almost maintain the original optical power. The optical signal undergoes multiple total reflections in the optical fiber 101 to transmit the optical signal from the remote information processing device 1000 to the optical module 200, or to transmit the optical signal from the optical module 200 to the remote information processing device 1000, thereby realizing long-distance, low-power loss information transmission.
[0041] The optical communication system may include one or more optical fibers 101, and the optical fibers 101 are detachably connected or fixedly connected to the optical module 200. The host computer 100 is configured to provide data signals to the optical module 200, receive data signals from the optical module 200, or monitor or control the working state of the optical module 200.
[0042] The host computer 100 includes a substantially rectangular housing and an optical module interface 102 disposed on the housing. The optical module interface 102 is configured to connect to the optical module 200 so that the host computer 100 and the optical module 200 establish a unidirectional or bidirectional electrical signal connection.
[0043] The host computer 100 also includes an external electrical interface, which can be connected to an electrical signal network. For example, the external electrical interface includes a Universal Serial Bus (USB) interface or a network cable interface 104, and the network cable interface 104 is configured to access the network cable 103 so that the host computer 100 establishes a unidirectional or bidirectional electrical signal connection with the network cable 103. One end of the network cable 103 is connected to the local information processing device 2000, and the other end of the network cable 103 is connected to the host computer 100, so as to establish an electrical signal connection between the local information processing device 2000 and the host computer 100 through the network cable 103. For example, the third electrical signal sent by the local information processing device 2000 is transmitted to the host computer 100 through the network cable 103, and the host computer 100 generates a second electrical signal according to the third electrical signal. The second electrical signal from the host computer 100 is transmitted to the optical module 200, and the optical module 200 converts the second electrical signal into a second optical signal, and transmits the second optical signal to the optical fiber 101, and the second optical signal is transmitted to the remote information processing device 1000 in the optical fiber 101. For example, the first optical signal from the remote information processing device 1000 is transmitted through the optical fiber 101, and the first optical signal from the optical fiber 101 is transmitted to the optical module 200, and the optical module 200 converts the first optical signal into a first electrical signal, and the optical module 200 transmits the first electrical signal to the host computer 100, and the host computer 100 generates a fourth electrical signal according to the first electrical signal, and transmits the fourth electrical signal to the local information processing device 2000. It should be noted that the optical module is a tool for realizing the mutual conversion between optical signals and electrical signals. During the conversion process between the optical signals and electrical signals, the information does not change, but the encoding and decoding methods of the information can change.
[0044] In addition to the optical network terminal, the host computer 100 also includes an optical line terminal (OLT), an optical network device (ONT), or a data center server.
[0045] Figure 2 1 is a partial structural diagram of a host computer provided according to some embodiments of the present disclosure. In order to clearly show the connection relationship between the optical module 200 and the host computer 100, Figure 2 Only the structure of the host computer 100 related to the optical module 200 is shown. Figure 2 As shown, the host computer 100 further includes a PCB circuit board 105 disposed in the housing, a cage 106 disposed on the surface of the PCB circuit board 105, a heat sink 107 disposed on the cage 106, and an electrical connector disposed inside the cage 106. The electrical connector is configured to access the electrical port of the optical module 200; the heat sink 107 has a protruding structure such as fins to increase the heat dissipation area.
[0046] The optical module 200 is inserted into the cage 106 of the host computer 100, and the cage 106 fixes the optical module 200. The heat generated by the optical module 200 is transferred to the cage 106 and then diffused through the heat sink 107. After the optical module 200 is inserted into the cage 106, the electrical port of the optical module 200 is connected to the electrical connector inside the cage 106, so that the optical module 200 establishes a bidirectional electrical signal connection with the host computer 100. In addition, the optical port of the optical module 200 is connected to the optical fiber 101, so that the optical module 200 establishes a bidirectional optical signal connection with the optical fiber 101.
[0047] Figure 3 is a structural diagram of an optical module provided according to some embodiments of the present disclosure, Figure 4 FIG. 1 is an exploded view of an optical module provided according to some embodiments of the present disclosure. Figure 3 and Figure 4 As shown, the optical module 200 includes a shell, a circuit board 300 disposed in the shell, a light emitting component 400 and a light receiving component 500. However, the present disclosure is not limited thereto. In some embodiments, the optical module 200 includes one of the light emitting component 400 and the light receiving component 500.
[0048] The housing comprises an upper housing 201 and a lower housing 202 . The upper housing 201 covers the lower housing 202 to form the housing having two openings 204 and 205 . The outer contour of the housing is generally a square body.
[0049] In some embodiments, the lower shell 202 includes a bottom plate 2021 and two lower side plates 2022 located on both sides of the bottom plate 2021 and arranged perpendicular to the bottom plate 2021; the upper shell 201 includes a cover plate 2011, and the cover plate 2011 covers the two lower side plates 2022 of the lower shell 202 to form the above-mentioned shell.
[0050] In some embodiments, the lower shell 202 includes a bottom plate 2021 and two lower side plates 2022 located on both sides of the bottom plate 2021 and vertically arranged with the bottom plate 2021; the upper shell 201 includes a cover plate 2011 and two upper side plates located on both sides of the cover plate 2011 and vertically arranged with the cover plate 2011, and the two upper side plates are combined with the two lower side plates 2022 to realize that the upper shell 201 covers the lower shell 202.
[0051] The direction of the line connecting the two openings 204 and 205 may be consistent with the length direction of the optical module 200, or may be inconsistent with the length direction of the optical module 200. For example, the opening 204 is located at the end of the optical module 200 ( Figure 3 The opening 205 is also located at the end of the optical module 200 ( Figure 3Alternatively, the opening 204 is located at the end of the optical module 200, and the opening 205 is located at the side of the optical module 200. The opening 204 is an electrical port, and the gold finger 301 of the circuit board 300 extends from the electrical port and is inserted into the electrical connector of the host computer 100; the opening 205 is an optical port, which is configured to access the external optical fiber 101, so that the optical fiber 101 connects the optical emitting component 400 and the optical receiving component 500 in the optical module 200.
[0052] The assembly method of combining the upper shell 201 and the lower shell 202 is adopted, which facilitates the installation of the circuit board 300, the light emitting component 400, the light receiving component 500, etc. into the above shell, and the upper shell 201 and the lower shell 202 can encapsulate and protect the above components. In addition, when assembling the circuit board 300, the light emitting component 400 and the light receiving component 500, etc., it is convenient to deploy the positioning components, heat dissipation components and electromagnetic shielding components of these components, which is conducive to the automated production.
[0053] In some embodiments, the upper shell 201 and the lower shell 202 are made of metal materials to facilitate electromagnetic shielding and heat dissipation.
[0054] In some embodiments, the optical module 200 further includes an unlocking component 600 located outside its housing. The unlocking component 600 is configured to achieve a fixed connection between the optical module 200 and the host computer, or to release the fixed connection between the optical module 200 and the host computer.
[0055] For example, the unlocking component 600 is located on the outside of the two lower side plates 2022 of the lower housing 202, and includes a snap-fit component that matches the cage 106 of the host computer 100. When the optical module 200 is inserted into the cage 106, the snap-fit component of the unlocking component 600 fixes the optical module 200 in the cage 106; when the unlocking component 600 is pulled, the snap-fit component of the unlocking component 600 moves accordingly, thereby changing the connection relationship between the snap-fit component and the host computer, so as to release the fixation of the optical module 200 and the host computer, so that the optical module 200 can be pulled out of the cage 106.
[0056] The circuit board 300 includes circuit traces, electronic components and chips, etc. The electronic components and chips are connected according to the circuit design through the circuit traces to realize the functions of power supply, electrical signal transmission and grounding. The electronic components may include capacitors, resistors, transistors, metal-oxide-semiconductor field-effect transistors (Metal-Oxide-Semiconductor Field-Effect Transistor, MOSFET). The chip may include a microcontroller unit (Microcontroller Unit, MCU), a laser driver chip, a transimpedance amplifier (Transimpedance Amplifier, TIA), a limiting amplifier (Limiting Amplifier, LA), a clock and data recovery chip (Clock and Data Recovery, CDR), a power management chip, and a digital signal processing (Digital Signal Processing, DSP) chip.
[0057] The circuit board 300 is generally a rigid circuit board. Due to its relatively hard material, the rigid circuit board can also realize the load-bearing function. For example, the rigid circuit board can stably carry the above-mentioned electronic components and chips; the rigid circuit board can also be inserted into the electrical connector in the cage 106 of the host computer 100.
[0058] The circuit board 300 also includes a gold finger 301 formed on the end surface thereof. The gold finger 301 is composed of a plurality of independent pins. The circuit board 300 is inserted into the cage 106, and the gold finger 301 is connected to the electrical connector in the cage 106. The gold finger 301 can be provided on only one side of the circuit board 300 (e.g. Figure 4 The upper surface shown in the figure) can also be set on the upper and lower surfaces of the circuit board 300 to provide more pins, so as to adapt to occasions where the number of pins is large. The gold finger 301 is configured to establish an electrical connection with the host computer to achieve power supply, grounding, two-wire synchronous serial (Inter-Integrated Circuit, I2C) signal transmission, data signal transmission, etc. Of course, flexible circuit boards are also used in some optical modules. Flexible circuit boards are generally used in conjunction with rigid circuit boards to supplement rigid circuit boards.
[0059] At least one of the light emitting component 400 or the light receiving component 500 is located on a side of the circuit board 300 away from the gold finger 301 .
[0060] In some embodiments, the light emitting component 400 and the light receiving component 500 are physically separated from the circuit board 300 and then electrically connected to the circuit board 300 through corresponding flexible circuit boards or electrical connectors.
[0061] In some embodiments, at least one of the light emitting component 400 or the light receiving component 500 may be directly disposed on the circuit board 300. For example, at least one of the light emitting component 400 or the light receiving component 500 may be disposed on a surface of the circuit board 300 or a side of the circuit board 300.
[0062] In SFP56 / QSFP28 / QSFPDD optical modules, customers often ask for recording the power-on time of the optical modules. Customers can evaluate the working life of the optical modules based on the power-on time of the optical modules, or perform reliability analysis on failed optical modules. When the SFP56 / QSFP28 / QSFPDD optical modules are running, the host computer 100 accesses the optical modules through the I2C interface. If the power-on time of the optical modules is directly written into the memory of the MCU, since the general MCU can only run in a single thread, when recording the power-on time of the optical modules, the optical modules will not be able to respond to the I2C communication of the host computer 100. Therefore, an external EEPROM is generally set to store the power-on time of the optical modules in the external EEPROM, which does not affect the original I2C communication between the host computer 100 and the MCU.
[0063] However, when recording the power-on time of the optical module through an external EEPROM of the optical module, an external EEPROM needs to be added, and the external EEPROM is connected to the MCU. The MCU stores the recorded power-on time in the external EEPROM, which increases the operating power consumption of the optical module. In addition, the external EEPROM of the optical module may affect the sealing of the optical module, thereby affecting the electromagnetic interference (EMI) of the optical module.
[0064] In order to solve the above problems, in the optical module provided by the embodiment of the present disclosure, the memory of the MCU includes multiple partitions, and the firmware operating parameters and real-time operating parameters of the optical module are stored in different partitions, so that the MCU can execute multiple threads. When the MCU stores the real-time operating parameters in the cache to a partition of the memory, the MCU can execute the reading thread of the host computer and read other parameters from the cache or another partition of the memory. The two threads can be executed in parallel. In this way, the MCU can complete the I2C communication with the host computer 100 while recording the power-on time of the optical module. There is no need to use an external EEPROM to record the power-on time of the optical module, which can reduce the operating power consumption and EMI of the optical module.
[0065] Figure 5 is a partial structural diagram of an optical module provided according to some embodiments of the present disclosure, Figure 6 FIG. 1 is a structural block diagram of an MCU in an optical module according to some embodiments of the present disclosure. Figure 5 and Figure 6As shown, an MCU302 is provided on the circuit board 300, and the MCU302 is connected to the gold finger 301 on the circuit board 300 through the I2C bus communication to realize the I2C communication between the MCU302 and the host computer 100; the MCU302 can be connected to the light emitting component 400 and the light receiving component 500 to obtain the operating parameters of the light emitting component 400 and the light receiving component 500, for example, light emitting power, temperature, light receiving power and other operating parameters, and the MCU302 stores the obtained operating parameters in its own memory to facilitate reporting the operating parameters to the host computer 100.
[0066] In order to store the operating parameters, MCU302 includes a buffer 3021 and a memory 3022. The buffer 3021 is a random access memory (RAM). The buffer 3021 is used to cache the real-time operating parameters of the optical module, such as the running program code and data, data cache, user data, etc. After the optical module is powered on, the data that can be changed in real time are cached in the buffer 3021, such as the power-on time. After the optical module 200 loses power, the data cached in the buffer 3021 will be lost.
[0067] The memory 3022 is a non-volatile semiconductor memory (Read Only Memory, ROM). The memory 3022 is used to store the firmware operating parameters of the optical module, such as the boot program, firmware, unchangeable data, protection of key information, etc. After the optical module 200 loses power, the data stored in the memory 3022 will not be lost.
[0068] In some embodiments, the memory Flash generally includes NOR Flash and NAND Flash. The address line and data line of NOR Flash are independent, which can realize fast random addressing and have local execution (eXecute In Place, XIP) function; the address line and data line of NAND Flash are shared, and do not have random addressing and XIP functions.
[0069] NOR Flash includes parallel Flash and serial Flash. Parallel Flash is divided into multi-partition Flash and single-partition Flash. Multi-partition Flash allows read, write or erase operations on different partitions at the same time, and can execute multiple threads at the same time; single-partition Flash can only perform one read, write or erase operation at a time point, that is, it can only execute a single thread.
[0070] Figure 7 FIG. 1 is a schematic diagram of space allocation of a memory in an optical module according to some embodiments of the present disclosure. Figure 7As shown, in order to enable the MCU to execute the read and write threads simultaneously, the memory 3022 includes a first partition and a second partition, the first partition is used to store firmware operating parameters, and the second partition is used to store real-time operating parameters.
[0071] After the optical module is powered on, the real-time operating parameters of the optical module are cached in the buffer 3021. The MCU 302 updates the real-time operating parameters cached in the buffer 3021 according to the recording period, that is, the buffer 3021 periodically updates the cached real-time operating parameters. Among them, the real-time operating parameters include the power-on time, taking the real-time operating parameter as the power-on time as an example:
[0072] When the time difference between the current time and the last recorded time of the power-on time satisfies the recording period, the MCU 302 adds 1 to the power-on time cached in the buffer 3021 to update the power-on time of the optical module.
[0073] For example, the power-on time last updated in the buffer 3021 is 100. After a recording cycle (such as 2 hours), the cached power-on time is updated again, and the MCU 302 updates the power-on time 100 cached in the buffer 3021 to 101. In some embodiments, the operating time (power-on time) of the optical module 200 is twice the power-on time cached in the buffer 3021. If the power-on time cached in the buffer 3021 is 101, the operating time of the optical module 200 is 202 hours.
[0074] After MCU302 updates the power-on time cached in cache 3021 according to the recording period, in order to avoid the loss of the power-on time cached in cache 3021 after the optical module 200 loses power, MCU302 executes the first thread, which includes: obtaining the power-on time cached in cache 3021 and storing the power-on time in the second partition of memory 3022.
[0075] After MCU302 executes the first thread to store the power-on time cached in the cache 3021 to the second partition of the memory 3022, after the optical module 200 loses power unexpectedly, the optical module 200 is first powered on and restarted, and then MCU302 reads the historical power-on time stored in the second partition, caches the read historical power-on time to the cache 3021, and then updates the power-on time cached in the cache 3021 according to the recording period. Then, after the cache 3021 updates the power-on time, MCU302 executes the first thread, and repeats this cycle to accurately record the power-on time of the optical module 200.
[0076] In some embodiments, when storing data, the memory 3022 needs to erase the stored data before writing new data. If the MCU302 stores the updated power-on time in the buffer 3021 to the second partition of the memory 3022, the power-on time written in the second partition is erased first. Since erasing the power-on time takes tens of milliseconds, if the optical module accidentally loses power during the erasing of the power-on time, the power-on time of the optical module will be lost because the updated power-on time is not stored in the second partition, and the customer will not be able to know the cumulative power-on time of the optical module.
[0077] Figure 8 A schematic diagram of storing power-on time in an optical module according to some embodiments of the present disclosure Figure 1 .like Figure 7 and Figure 8 As shown, in order to avoid the loss of power-on time, the second partition includes a first page and a second page. When MCU302 executes the first thread to store the power-on time cached in the buffer 3021 to the second partition, MCU302 stores the power-on time alternately in the first page and the second page, so as to adopt a double backup storage method to avoid the loss of power-off time due to accidental power failure of the optical module when storing the power-on time.
[0078] For example, in the previous recording cycle, MCU302 stores the power-on time in the second page, then in the current recording cycle, MCU302 stores the power-on time in the first page and erases the power-on time in the second page; in the next recording cycle, MCU302 stores the power-on time in the second page and erases the power-on time in the first page. By alternating the storage, the power-on time can be directly stored in the page of the second partition without waiting for the erase time.
[0079] In some embodiments, when the power-on time cached in the buffer is stored in the first page or the second page, a storage flag is alternately set in the first page or the second page according to the recording period of the power-on time. When MCU302 executes the first thread, MCU302 stores the cached power-on time in the page with the storage flag set, or stores the cached power-on time in the page without the storage flag set.
[0080] Specifically, after MCU302 executes the first thread to store the power-on time in the first page or the second page, a storage flag is set in the first page or the second page, and the power-on time stored in the second page or the first page is erased; when MCU302 stores the power-on time of the next cycle in the second partition, the page where the storage flag is located is identified, and the power-on time of the next cycle is stored in the page where the storage flag is not set.
[0081] For example, in the last cycle, the MCU 302 stores the power-on time cached in the buffer 3021 to the first page, the MCU 302 controls to set a storage flag in the first page, and erases the power-on time stored in the second page.
[0082] In some embodiments, when setting a storage flag in the first page or the second page, the storage flag can be set in the page immediately after the power-on time is stored in the page; the power-on time values stored in the first page and the second page can also be compared, and the storage flag can be set in the page where the larger power-on time value is located, and the smaller power-on time value can be erased.
[0083] For example, in the previous cycle, MCU302 stores the power-on time cached in buffer 3021, such as 100, to the first page, compares the values of the power-on time stored in the first page and the second page, and if the value of the power-on time stored in the first page is greater than the value of the power-on time stored in the second page, a storage flag is set in the first page; if the value of the power-on time stored in the second page is greater than the value of the power-on time stored in the first page, a storage flag is set in the second page.
[0084] When MCU302 stores the power-on time of the current cycle, such as 101, to the second partition, it first detects whether the storage flag is located in the first page. If the storage flag is located in the first page, MCU302 stores the power-on time of the current cycle to the second page to avoid erasing the power-on time stored in the first page. When storing the power-on time to the second page, the power-on time stored in the first page is erased at the same time to facilitate storing the power-on time of the next cycle in the first page.
[0085] If the storage flag is not located in the first page, MCU302 stores the power-on time of the current cycle in the first page to avoid erasing the power-on time stored in the second page. When storing the power-on time in the first page, the power-on time stored in the second page is erased at the same time to facilitate storing the power-on time of the next cycle in the second page.
[0086] Fig. 9 A schematic diagram of storing power-on time in an optical module according to some embodiments of the present disclosure Figure 2 .like Fig. 9As shown, if the optical module 200 accidentally loses power after MCU302 stores the power-on time of the current cycle in the second partition and before the power-on time of the next cycle is updated, then after the optical module 200 is powered on and restarted, MCU302 can read the power-on time stored in the first page and the power-on time stored in the second page, and then MCU302 compares the power-on time values in the first page and the second page, caches the larger power-on time value in the buffer 3021, and erases the smaller power-on time value at the same time, so as to facilitate the storage of the updated power-on time in the buffer 3021.
[0087] For example, after the optical module 200 is powered on and restarted, MCU302 reads the power-on time stored in the first page as 100, and the power-on time stored in the second page as 101. MCU302 caches the power-on time 101 stored in the second page into the buffer 3021. Then the buffer 3021 updates the power-on time according to the recording cycle. At the same time, MCU302 erases the power-on time 100 stored in the first page to facilitate the storage of the updated power-on time in the next cycle into the first page.
[0088] In some embodiments, when MCU302 stores the periodically updated power-on time in the buffer 3021 alternately in the first page and the second page, the host computer 100 may access MCU302 through the I2C bus and read the operating parameters stored in MCU302 so that the host computer 100 can know the operating status of the optical module 200.
[0089] Fig.10 Schematic diagram of reading and writing operation of operating parameters in an optical module according to some embodiments of the present disclosure. Fig.10 As shown, when the host computer 100 communicates with MCU302 via I2C, the host computer 100 sends a parameter reading instruction to MCU302. After receiving the parameter reading instruction, MCU302 executes a second thread, which includes: reading the real-time operating parameters cached in the buffer 3021, or reading the firmware operating parameters stored in the first partition.
[0090] Specifically, the buffer 3021 in the MCU302 caches real-time operating parameters, such as power-on time, temperature, current size, optical power and other parameters, and the first partition stores firmware operating parameters, such as Bootloader program, control program, etc. The host computer 100 may want to know the real-time operating parameters of the optical module, and may also want to know the firmware operating parameters of the optical module. Therefore, after MCU302 receives the parameter reading instruction sent by the host computer 100, MCU302 detects whether there are operating parameters corresponding to the parameter reading instruction in the buffer 3021. If there are operating parameters corresponding to the parameter reading instruction in the buffer 3021, the host computer 100 reads the real-time operating parameters stored in the buffer 3021; if there are no operating parameters corresponding to the parameter reading instruction in the buffer 3021, the host computer 100 reads the firmware operating parameters stored in the first partition.
[0091] For example, if the host computer 100 wants to know the power-on time of the optical module 200, the host computer 100 sends a power-on time reading instruction to the MCU 302. After receiving the power-on time reading instruction, the MCU 302 controls the host computer 100 to communicate with the buffer 3021, so that the host computer 100 reads the power-on time cached in the buffer 3021. If the host computer 100 wants to know the Bootloader program of the optical module 200, the host computer 100 sends a firmware program reading instruction to the MCU 302. After receiving the firmware program reading instruction, the MCU 302 controls the host computer 100 to communicate with the first partition, so that the host computer 100 reads the Bootloader program stored in the first partition.
[0092] In some embodiments, MCU302 executes the first thread according to the recording period of the power-on time, and executes the second thread according to the parameter instruction sent by the host computer 100. Since MCU302 executes the first thread to store the power-on time in the second partition, MCU302 executes the second thread to read parameters from the cache or the first partition. MCU302 does not execute the first thread and the second thread on the same partition. Therefore, the first thread and the second thread can be executed in parallel, that is, MCU302 executes the first thread and the second thread at the same time, realizing the read-while-write operation of MCU302.
[0093] MCU302 may also execute the first thread and the second thread separately. For example, when MCU302 executes the first thread in the recording period of the power-on time, if the host computer 100 does not send a parameter reading instruction during this period, MCU302 only executes the first thread in the current period.
[0094] After the MCU 302 has executed the first thread, or before the power-on time recording period has arrived, the MCU 302 receives a parameter reading instruction sent by the host computer 100 , and the MCU 302 only executes the second thread during this period.
[0095] In some embodiments, after the upper computer 100 obtains the power-on time of the optical module through I2C communication, it can be used to evaluate the operating life of the optical module. When the power-on time of the optical module exceeds a preset threshold, the upper computer 100 promptly issues an early warning to the optical module to facilitate replacement or subsequent maintenance of the optical module.
[0096] The optical module provided by the present disclosure divides the memory of the MCU into a first partition and a second partition, so that the MCU can execute multiple threads, and the read thread between the host computer and the MCU and the write thread of the MCU to the second partition do not act on the same partition, so that the MCU can directly record the power-on time of the optical module, and there is no need to place an EEPROM outside the optical module to record the power-on time of the optical module, thereby saving the material cost brought by the external EEPROM and reducing the operating power consumption of the optical module; in addition, the second partition is divided into a first page and a second page, and the MCU stores the power-on time alternately in the first page and the second page, and adopts a double backup storage method, which avoids the loss of power-off time due to accidental power failure of the optical module when storing the power-on time.
[0097] Based on the optical module described in the above embodiment, the embodiment of the present disclosure also provides a method for recording the power-on time of the optical module. The method is based on the dual partitioning of the internal Flash of the MCU in the optical module to support read-while-write characteristics. While the MCU of the optical module records the power-on time of the optical module, it can also complete I2C communication with the host computer, which can save the material cost brought by the external EEPROM, and also reduce the operating power consumption and EMI of the optical module.
[0098] Fig.11 The following is a flow chart of a method for recording the power-on time of an optical module according to some embodiments of the present disclosure. Fig.11 As shown, the method for recording the power-on time of an optical module provided by an embodiment of the present disclosure includes:
[0099] S100: The buffer caches the power-on time of the optical module.
[0100] In the optical module provided in the embodiment of the present disclosure, the MCU includes a cache and a memory. The cache is used to cache the real-time operating parameters of the optical module, such as the running program code and data, data cache, user data, etc. After the optical module is powered on, the data that can be changed in real time are cached in the cache, such as the power-on time.
[0101] The memory is used to store the firmware operating parameters of the optical module, such as the boot program, firmware, unchangeable data, and key protection information. After the optical module loses power, the data stored in the memory will not be lost.
[0102] When the optical module is powered on for the first time, the cache caches the power-on time of the optical module according to the recording period, and periodically stores the power-on time in the memory; after the optical module is powered on and restarted, the MCU reads the power-on time stored in the memory, and caches the stored power-on time in the cache, and the cache caches the power-on time of the optical module according to the recording period.
[0103] S200: The MCU updates the power-on time cached in the buffer according to the recording period.
[0104] After the power-on time of the optical module is cached in the buffer, the MCU periodically updates the power-on time cached in the buffer, such as adding 1 to the power-on time cached in the buffer every 2 hours.
[0105] S300: After the power-on time is updated, the MCU executes a first thread, which includes: obtaining the updated power-on time, storing the updated power-on time in a page with a storage flag, or storing the updated power-on time in a page without a storage flag.
[0106] Generally, the memory in the MCU contains only one partition, and only one read, write or erase operation can be performed at a point in time. In order to enable the MCU to execute read and write threads at the same time, the memory includes a first partition and a second partition. The first partition is used to store the firmware operating parameters of the optical module, and the second partition is used to store the real-time operating parameters of the optical module, such as the power-on time.
[0107] After the MCU updates the power-on time cached in the buffer according to the recording cycle, in order to avoid the power-on time cached in the buffer from being lost after the optical module is powered off, the first thread is executed to store the power-on time cached in the buffer in the second partition of the memory.
[0108] When the MCU stores the power-on time in the second partition, it must first erase the previously stored power-on time before writing the new power-on time. If the optical module loses power during the erasing period, the power-on time will be lost. In order to avoid the optical module accidentally losing power when storing the power-on time, resulting in the loss of the power-on time, the second partition includes a first page and a second page. When the MCU executes the first thread, the power-on time is alternately stored in the first page and the second page, so as to adopt a double backup storage method to protect the power-on time of the optical module.
[0109] Fig.12 A detailed process of a method for recording the power-on time of an optical module according to some embodiments of the present disclosure Figure 1 .like Fig.12 As shown, the specific steps of the MCU executing the first thread and alternately storing the power-on time in the first page and the second page include:
[0110] S310: Detect whether a storage flag is set in the first page.
[0111] After the MCU executes the first thread to store the power-on time in the first page or the second page, a storage flag is set in the first page or the second page, and the power-on time stored in the second page or the first page is erased.
[0112] When MCU302 stores the power-on time of the next cycle in the second partition, it first detects whether a storage flag is set in the first page. If the first storage flag is set in the first page, it means that the power-on time of the current cycle is stored in the first page, and then S320 is executed; if the first storage flag is not set in the first page, it means that the power-on time of the current cycle is stored in the second page, and then S330 is executed.
[0113] S320: If a storage flag is set in the first page, the updated power-on time is stored in the second page, and the power-on time in the first page is erased.
[0114] If a storage flag is set in the first page, it means that the power-on time of the current cycle is stored in the first page. When storing the power-on time of the next cycle, in order to avoid the erase time of the first page, the power-on time of the next cycle is stored in the second page, and the power-on time in the first page is erased at the same time to facilitate the storage of the power-on time of the next cycle.
[0115] S330: If the storage flag is not set in the first page, the updated power-on time is stored in the first page, and the power-on time in the second page is erased.
[0116] If there is no storage flag set in the first page, it means that the power-on time of the current cycle is stored in the second page. When storing the power-on time of the next cycle, in order to avoid the erasure time of the second page, and the data stored in the first page has been erased, the power-on time of the next cycle is stored in the first page, and the power-on time in the second page is erased at the same time to facilitate the storage of the power-on time of the next cycle.
[0117] S400: When the MCU receives a parameter reading instruction, the MCU executes a second thread, and the second thread and the first thread can be executed in parallel. The second thread includes: reading real-time operating parameters cached in a buffer, or reading firmware operating parameters stored in the first partition.
[0118] When the MCU stores the periodically updated power-on time in the cache alternately in the first page and the second page, the host computer may access the MCU through the I2C bus. When the host computer communicates with the MCU through I2C, the host computer sends a parameter reading instruction to the MC. After receiving the parameter reading instruction, the MCU executes the second thread. The second thread includes: reading the real-time operating parameters cached in the cache, or reading the firmware operating parameters stored in the first partition.
[0119] The buffer in the MCU caches real-time operating parameters, such as power-on time, temperature, current, optical power and other parameters. The first partition stores the operating parameters of the firmware, such as the Bootloader program, the control program, etc. The host computer may want to know the real-time operating parameters of the optical module, or the firmware operating parameters of the optical module. Therefore, after the MCU receives the parameter reading instruction sent by the host computer, the MCU needs to identify the specific parameters to be read.
[0120] Fig.13 A detailed process of a method for recording the power-on time of an optical module according to some embodiments of the present disclosure Figure 2 .like Fig.13 As shown, the MCU responds to the parameter reading instruction sent by the host computer, and the steps of reading specific parameters include:
[0121] S410: In response to a parameter read instruction, detecting whether there is an operating parameter corresponding to the parameter read instruction in the buffer.
[0122] S420: If there are operating parameters corresponding to the parameter reading instruction in the buffer, the real-time operating parameters stored in the buffer are read.
[0123] S430: If the operating parameters corresponding to the parameter reading instruction do not exist in the buffer, read the firmware operating parameters stored in the first partition.
[0124] After receiving the parameter reading instruction sent by the host computer, the MCU detects whether there are operating parameters corresponding to the parameter reading instruction in the buffer. If there are operating parameters corresponding to the parameter reading instruction in the buffer, the host computer reads the real-time operating parameters stored in the buffer; if there are no operating parameters corresponding to the parameter reading instruction in the buffer, the host computer reads the firmware operating parameters stored in the first partition.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. An optical module, characterized in that: include: Circuit boards; An MCU is mounted on the circuit board, and the MCU includes: A buffer is configured to cache the real-time operating parameters of the optical module and update the real-time operating parameters according to a recording period; A non-volatile memory, comprising a first partition and a second partition, wherein the second partition comprises a first page and a second page, wherein the first partition is used to store firmware operating parameters, the first page and the second page are used to store updated real-time operating parameters, and storage flags are alternately set in the first page and the second page according to a recording period of the real-time operating parameters; The MCU is configured to: after the real-time operation parameters in the buffer are updated, execute a first thread, wherein the first thread includes: obtaining the cached real-time operation parameters, storing the real-time operation parameters in a page with the storage flag set, or storing the real-time operation parameters in a page without the storage flag set; When receiving the parameter reading instruction, executing the second thread, the second thread includes: reading the real-time operating parameters cached in the buffer, or reading the firmware operating parameters stored in the first partition; The first thread and the second thread may be executed in parallel, and the first thread and the second thread are not executed on the same partition.
2. The optical module according to claim 1, characterized in that: The real-time operation parameters include power-on time, and the buffer is further configured to, after the optical module is powered on, add 1 to the cached power-on time when the time difference between the current time and the last recorded time satisfies the recording period to update the power-on time.
3. The optical module according to claim 2, characterized in that: The MCU is further configured to, after the optical module is powered on and restarted, read the historical power-on time stored in the second partition, cache the historical power-on time in the buffer, and update the historical power-on time in the buffer according to the recording period.
4. The optical module according to claim 2, characterized in that: The MCU is further configured to, after storing the power-on time in the first page or the second page, set a storage flag in the first page or the second page, and erase the power-on time stored in the second page or the first page.
5. The optical module according to claim 2, characterized in that: The MCU is also configured to, after storing the power-on time in the first page or the second page, compare the power-on time stored in the first page with the power-on time stored in the second page, set a storage flag in the page where the larger power-on time is located, and erase the smaller power-on time.
6. The optical module according to claim 4 or 5, characterized in that: The MCU is also configured to, when storing the updated power-on time in the second partition, store the updated power-on time in a page where the storage flag is not set, and erase the power-on time in the page where the storage flag is located.
7. The optical module according to claim 1, characterized in that: The MCU is further configured to read the corresponding real-time operation parameters stored in the buffer when the parameter reading instruction is a real-time operation parameter reading instruction; When the parameter reading instruction is a firmware operation parameter instruction, the corresponding firmware operation parameters stored in the first partition are read.
8. A method for recording the power-on time of an optical module, characterized in that: The optical module includes an MCU, the MCU includes a buffer and a non-volatile memory, the non-volatile memory includes a first partition and a second partition, the second partition includes a first page and a second page, and storage flags are alternately set in the first page and the second page according to a recording cycle of the power-on time. The method for recording the power-on time by the MCU includes: The buffer caches the power-on time of the optical module; The MCU updates the power-on time cached by the buffer according to the recording period; After the power-on time is updated, the MCU executes a first thread, the first thread comprising: obtaining the updated power-on time, storing the updated power-on time in a page with the storage flag set, or storing the updated power-on time in a page without the storage flag set; When the MCU receives a parameter reading instruction, the MCU executes a second thread, which can be executed in parallel with the first thread. The second thread includes: reading real-time operating parameters cached in the buffer, or reading firmware operating parameters stored in the first partition.
9. The method for recording the power-on time of an optical module according to claim 8, characterized in that: In the step of storing the updated power-on time in a page not provided with the storage flag, the method comprises: Detecting whether a storage flag is set in the first page; When the storage flag is set in the first page, the updated power-on time is stored in the second page, and the power-on time in the first page is erased; When the storage flag is not set in the first page, the updated power-on time is stored in the first page, and the power-on time in the second page is erased.
10. The method for recording the power-on time of an optical module according to claim 8, characterized in that: In the step of the MCU executing the second thread, the method includes: In response to the parameter reading instruction, detecting whether there is an operating parameter corresponding to the parameter reading instruction in the buffer; When the operating parameters corresponding to the parameter reading instruction exist in the buffer, reading the real-time operating parameters stored in the buffer; When the operating parameters corresponding to the parameter reading instruction do not exist in the buffer, the firmware operating parameters stored in the first partition are read.