Methods, systems, optical modules, and media for preventing accidental erasure and rewriting of optical module data storage areas.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2026-08-14
AI Technical Summary
[0005]然而,这种设计是存在技术缺陷的,具体是:当MCU在非正常工作或受到外部环境干扰,如上电电压不稳、高温、过流等时,MCU内部的程序计数器存在随机跳转的情况,即程序不会按照代码设定的逻辑执行,有较大风险导致即使擦写命令标识为假也会执行擦写函数,从而导致数据存储区中的数据被误擦写掉
[0039] This invention provides a method, system, optical module, and medium for preventing accidental erasure and rewriting of the data storage area of an optical module. By adding an intermediate key variable and setting a password that requires the correct erase/write key constant to be passed to the intermediate key variable, and further setting the intermediate key variable to be passed to the key variable when the erase/write command flag is true during polling, even if the MCU jumps to execute the erase/write function due to an internal program counter error, the intermediate key variable passed to the key variable will be an incorrect key value due to an incorrect password, thus causing the erase/write to fail. This can avoid or greatly reduce the probability of accidental erasure and rewriting of the data storage area of the optical module, avoid adverse effects on customers, and reduce the risk of customer complaints.
Smart Images

Figure CN115859392B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical communication technology, and in particular to a method, system, optical module, and medium for preventing accidental erasure and rewriting of the data storage area of an optical module. Background Technology
[0002] With the rapid development of optical communication technology, optical modules, as one of the essential core components in optical networks, are widely used in application scenarios such as data centers, base stations, local area networks, and backbone networks.
[0003] Currently, most optical module products on the market use MCUs, which integrate FLASH memory. To save costs and space, the data storage area of the optical module is generally allocated to a certain area of the FLASH memory, used to store the configuration data required for the optical module to operate normally.
[0004] Flash memory supports multiple rewritable erasures, but this requires a specific key. The erasure / write operation succeeds only if the key is correct; otherwise, it fails. The existing program design works as follows: the erase / write function has a set of input parameters called the key variable. When the IIC interrupt routine receives data to set the data storage area, it sets the erase / write command flag to true (this flag is a global variable, initially set to false). The main loop polls to check if the erase / write command flag is true. If it is, the correct erase / write key constant is directly passed to the key variable, and then the erase / write function is executed, successfully completing the erase / write operation. After the erase / write is complete, the erase / write command flag is reset to false.
[0005] However, this design has a technical flaw: when the MCU is operating abnormally or is subjected to external environmental interference, such as unstable power-on voltage, high temperature, or overcurrent, the MCU's internal program counter may randomly jump, meaning the program will not execute according to the logic set in the code. This poses a significant risk that the erase / write function will be executed even if the erase / write command flag is false, resulting in the data in the data storage area being accidentally erased or overwritten. When the optical module is powered on again, it will malfunction because the data in the data storage area has been tampered with, causing serious adverse effects on customers and increasing the risk of customer complaints.
[0006] Therefore, improvements to existing technologies are necessary.
[0007] The above information is provided as background information only to aid in understanding this disclosure and does not constitute an assertion or admission that any of the above content can be used as prior art relative to this disclosure. Summary of the Invention
[0008] This invention provides a method, system, optical module, and medium for preventing accidental erasure and writing of the data storage area of an optical module, so as to avoid or minimize the probability of accidental erasure and writing of the data storage area of the optical module.
[0009] To achieve the above objectives, the present invention provides the following technical solution:
[0010] In a first aspect, the present invention provides a method for preventing accidental erasure and rewriting of the data storage area of an optical module, the method comprising:
[0011] Receive the input password and determine whether the password is correct;
[0012] When the password is correct, it is determined that the user has permission to erase and rewrite the data area, and the correct erase and rewrite key constant is passed to the key intermediate variable; the key intermediate variable is a global variable and its initial value is the incorrect key value.
[0013] Receive the input data for the data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable with an initial value of false;
[0014] Poll to determine whether the erase / write command flag is true;
[0015] When the erase / write command flag is true, the intermediate key variable is passed to the key variable, and the erase / write function is executed to perform the erase / write operation; the key variable is a local variable.
[0016] Furthermore, in the method for preventing accidental erasure and rewriting of the optical module data storage area, after the step of passing the intermediate key variable to the key variable and executing the erasure and rewrite function when the erasure and rewrite command identifier is true, the method further includes:
[0017] The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
[0018] Furthermore, in the method for preventing accidental erasure and rewriting of the optical module data storage area, the step of receiving the input password and determining whether the password is correct is as follows:
[0019] The input password is received by the IIC interrupt program, which then determines whether the password is correct.
[0020] Furthermore, in the method for preventing accidental erasure and rewriting of the optical module data storage area, the step of receiving the input data for setting the data storage area and setting the erase / write command flag to true includes:
[0021] The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to.
[0022] When the data is erasable and writable, set the erase / write command flag to true.
[0023] Secondly, the present invention provides a system for preventing accidental erasure and rewriting of the data storage area of an optical module, the system comprising:
[0024] A password receiving module is used to receive the input password and determine whether the password is correct.
[0025] The permission determination module is used to determine that the user has permission to erase and write the data area when the password is correct, and to pass the correct erase and write key constant to the key intermediate variable; the key intermediate variable is a global variable and its initial value is an incorrect key value;
[0026] The data receiving module is used to receive the input data of the data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable with an initial value of false.
[0027] The identifier determination module is used to poll and determine whether the erase / write command identifier is true;
[0028] The erase / write execution module is used to pass the intermediate key variable to the key variable and execute the erase / write function to perform the erase / write action when the erase / write command identifier is true; the key variable is a local variable.
[0029] Furthermore, in the optical module data storage area anti-accidental erasure and rewriting system, the system also includes a recovery setting module, used for:
[0030] The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
[0031] Furthermore, in the optical module data storage area anti-accidental erasure and rewriting system, the password receiving module is specifically used for:
[0032] The input password is received by the IIC interrupt program, which then determines whether the password is correct.
[0033] Furthermore, in the optical module data storage area anti-accidental erasure and rewriting system, the data receiving module is specifically used for:
[0034] The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to.
[0035] When the data is erasable and writable, set the erase / write command flag to true.
[0036] Thirdly, the present invention provides an optical module that employs the optical module data storage area anti-accidental erasure and rewriting method as described in the first aspect above.
[0037] Fourthly, the present invention provides a storage medium containing executable instructions, which are loaded and executed by a processor to implement the method for preventing accidental erasure and rewriting of the optical module data storage area as described in the first aspect above.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] This invention provides a method, system, optical module, and medium for preventing accidental erasure and rewriting of the data storage area of an optical module. By adding an intermediate key variable and setting a password that requires the correct erase / write key constant to be passed to the intermediate key variable, and further setting the intermediate key variable to be passed to the key variable when the erase / write command flag is true during polling, even if the MCU jumps to execute the erase / write function due to an internal program counter error, the intermediate key variable passed to the key variable will be an incorrect key value due to an incorrect password, thus causing the erase / write to fail. This can avoid or greatly reduce the probability of accidental erasure and rewriting of the data storage area of the optical module, avoid adverse effects on customers, and reduce the risk of customer complaints. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating a method for preventing accidental erasure and rewriting of the data storage area of an optical module according to Embodiment 1 of the present invention.
[0042] Figure 2 This is a functional module schematic diagram of an optical module data storage area anti-accidental erasure and rewriting system provided in Embodiment 2 of the present invention; Detailed Implementation
[0043] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0044] In the description of this invention, it should be understood that when a component is considered to be "connected" to another component, it can be directly connected to the other component or there may be an intermediate component present simultaneously. When a component is considered to be "set" on another component, it can be directly set on the other component or there may be an intermediate component present simultaneously.
[0045] Furthermore, terms such as “long,” “short,” “inner,” and “outer” indicate orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings. They are used only for the purpose of describing the present invention and are not intended to indicate or imply that the device or component referred to must have this specific orientation or operate in a specific orientational configuration. Therefore, they should not be construed as limitations of the present invention.
[0046] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0047] Example 1
[0048] In view of the shortcomings of existing optical module data storage area anti-accidental write technologies, the applicant, based on years of rich practical experience and professional knowledge in this field, and combined with the application of theoretical principles, has actively conducted research and innovation to create a technology that can solve the shortcomings of existing technologies, thereby minimizing or avoiding the probability of accidental writes to the optical module data storage area. After continuous research, design, and repeated improvements, this invention, which is indeed feasible, has finally been created.
[0049] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for preventing accidental erasure and rewriting of the data storage area of an optical module, provided by an embodiment of the present invention. This method is applicable to scenarios where optical module products using an MCU are applied in optical networks. The method is executed by an anti-accidental erasure and rewriting system for the optical module's data storage area, which can be implemented in software and / or hardware and integrated within the optical module. The method specifically includes the following steps:
[0050] S101. Receive the input password and determine whether the password is correct.
[0051] It should be noted that, like existing technologies, if it is necessary to modify the data in the data storage area, the entered password must be verified first to determine whether the user has the permission to erase and write the data area. Only after it is determined that the user has the permission to erase and write the data area can the user enter data to make modifications.
[0052] Password input methods are not limited to keyboard input, touch screen input, QR code input, or mobile terminal upload.
[0053] In this embodiment, step S101 can be further refined into the following steps:
[0054] The input password is received by the IIC interrupt program, which then determines whether the password is correct.
[0055] It should be noted that, in this field, the input password can generally only be received as a data string through the IIC interrupt program.
[0056] S102. When the password is correct, determine that you have the permission to erase and rewrite the data area, and pass the correct erase and rewrite key constant to the key intermediate variable; the key intermediate variable is a global variable and its initial value is the incorrect key value.
[0057] It should be noted that, compared to existing technologies, the key intermediate variable is a key feature of this invention and one of the features that existing technologies do not have.
[0058] The risk of accidental erasure and rewriting in existing technologies stems from the fact that the password verification process only determines whether input data is allowed. Whether the intermediate key variable value is directly passed to the key variable depends on the erase / write command flag. However, existing technologies set the erase / write command flag to true as soon as input data is received. This means that if the MCU's internal program counter jumps to and executes the erase / write function, the intermediate key variable value is directly passed to the key variable, inevitably leading to accidental erasure and rewriting. In contrast, this invention adds an intermediate key variable, requiring a correct password to pass the correct erase / write key constant to it. Furthermore, it sets the intermediate key variable to be passed to the key variable only when the erase / write command flag is true during polling. This ensures that even if the MCU's internal program counter jumps to execute the erase / write function, the incorrect password will result in an incorrect intermediate key value being passed to the key variable, causing the erasure / write to fail. Specifically, this is because the password verification process not only determines whether input data is allowed, but also whether the correct erase / write key constant is passed to the key intermediate variable. Thus, if the password verification fails or the process skips the password verification step and jumps directly to the erase / write function, the incorrect key value will be passed to the key variable because the initial value of the key intermediate variable is incorrect.
[0059] S103. Receive the input data for the data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable with an initial value of false.
[0060] It should be noted that this step in this embodiment is the same as the prior art, that is, after receiving the input data of the setting data storage area, the erase / write command flag is set to true. However, unlike the prior art, this embodiment adds a key intermediate variable with an initial value of an incorrect key value, thus forming a double verification. It is not enough for the erase / write command flag to be true to erase successfully. The correct erase / write key constant must also be passed to the key intermediate variable after the password is correct.
[0061] In this embodiment, step S103 can be further refined to include the following steps:
[0062] The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to.
[0063] When the data is erasable and writable, set the erase / write command flag to true.
[0064] It should be noted that, in this field, the input data, like the password mentioned earlier, can generally only be received as a data string via the IIC interrupt routine. After the IIC interrupt routine receives the input data for the setting data storage area, since the module processes different functional data differently, it is necessary to determine which specific functional data within the module the data corresponds to. If the data is erasable and writable, then the erase / write command flag is set to true.
[0065] S104. Poll to determine whether the erase / write command identifier is true.
[0066] S105. When the erase / write command flag is true, the intermediate key variable is passed to the key variable, and the erase / write function is executed to perform the erase / write operation; the key variable is a local variable.
[0067] It should be noted that, as mentioned earlier, the initial value of the intermediate key variable is an incorrect key value before the input password is incorrect. Therefore, even if the erase / write command is true and the intermediate key variable is passed to the key variable, the erase / write will fail because the intermediate key variable is an incorrect key value. Only after verifying the password and passing the correct erase / write key constant to the intermediate key variable can it be guaranteed that the intermediate key variable passed to the key variable is correct when the erase / write command is true, thus ensuring a successful erase / write.
[0068] In this embodiment, after step S105, the steps can be further refined to include the following:
[0069] The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
[0070] It should be noted that after each successful erase / write operation, the intermediate key variable needs to be reset to the incorrect key value, and the erase / write command identifier needs to be reset to false. This is to prevent the situation where subsequent erase / write operations will necessarily succeed due to a successful erase / write operation once, and to prevent erroneous erase / write operations.
[0071] This invention provides a method for preventing accidental erasure and rewriting of the optical module data storage area. By adding a key intermediate variable and setting a password that requires the correct erase / write key constant to be passed to the key intermediate variable, and further setting the key intermediate variable to be passed to the key variable when the erase / write command flag is true during polling, even if the MCU jumps to execute the erase / write function due to an internal program counter error, the key intermediate variable passed to the key variable will be an incorrect key value due to an incorrect password, thus causing the erase / write to fail. This method can avoid or greatly reduce the probability of accidental erasure and rewriting of the optical module data storage area, avoid adverse effects on customers, and reduce the risk of customer complaints.
[0072] Example 2
[0073] Please refer to Figure 2 , Figure 2 This is a functional module diagram of an optical module data storage area anti-accidental erasure and rewriting system provided in Embodiment 2 of the present invention. This system is applicable to implementing the optical module data storage area anti-accidental erasure and rewriting method provided in this embodiment of the invention. Specifically, the system includes the following modules:
[0074] The password receiving module 201 is used to receive the input password and determine whether the password is correct;
[0075] The permission determination module 202 is used to determine that the user has permission to erase and write the data area when the password is correct, and to pass the correct erase and write key constant to the key intermediate variable; the key intermediate variable is a global variable and its initial value is an incorrect key value.
[0076] The data receiving module 203 is used to receive the input data of the setting data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable and its initial value is false.
[0077] The identifier judgment module 204 is used to poll and determine whether the erase / write command identifier is true;
[0078] The erase / write execution module 205 is used to pass the intermediate key variable to the key variable and execute the erase / write function to perform the erase / write action when the erase / write command identifier is true; the key variable is a local variable.
[0079] Preferably, the system further includes a recovery settings module, used for:
[0080] The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
[0081] Preferably, the password receiving module 201 is specifically used for:
[0082] The input password is received by the IIC interrupt program, which then determines whether the password is correct.
[0083] Preferably, the data receiving module 203 is specifically used for:
[0084] The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to.
[0085] When the data is erasable and writable, set the erase / write command flag to true.
[0086] This invention provides a system to prevent accidental erasure and rewriting of the optical module data storage area. By adding a key intermediate variable and setting a password that requires the correct erase / write key constant to be passed to the key intermediate variable, and further setting the system to pass the key intermediate variable to the key variable when polling to determine if the erase / write command flag is true, even if the MCU jumps to execute the erase / write function due to an internal program counter error, the key intermediate variable passed to the key variable will be an incorrect key value due to an incorrect password, thus causing the erase / write to fail. This system can avoid or greatly reduce the probability of accidental erasure and rewriting of the optical module data storage area, avoid adverse effects on customers, and reduce the risk of customer complaints.
[0087] The above system can execute the methods provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the methods.
[0088] Example 3
[0089] Embodiment 3 of the present invention provides an optical module, which is manifested in the form of a general optical module and may include, but is not limited to, a central processing unit (CPU), non-volatile memory (ROM), volatile memory (RAM), peripheral devices and supporting circuits.
[0090] The optical module employs the anti-accidental erasure and rewriting method for the optical module data storage area provided in all embodiments of this application. By using the above method, it is ensured that even if the MCU's internal program counter jumps to execute the erase / write function due to some malfunction, the intermediate key variable passed to the key variable will be an incorrect key value due to an incorrect password, thus causing the erase / write to fail. This avoids or greatly reduces the probability of the optical module's data storage area being accidentally erased or rewritten, preventing adverse effects on customers.
[0091] Example 4
[0092] Embodiment 4 of the present invention provides a readable storage medium storing executable instructions, which, when loaded and executed by a processor, implement the method for preventing accidental erasure and rewriting of the optical module data storage area as provided in all embodiments of the present application:
[0093] That is, when this instruction is loaded and executed by the processor, it performs the following: receiving the input password and determining whether the password is correct; when the password is correct, determining that it has the permission to erase and write the data area, and passing the correct erase and write key constant to the key intermediate variable; the key intermediate variable is a global variable, and its initial value is an incorrect key value; receiving the input data for setting the data storage area, and setting the erase and write command flag to true; the erase and write command flag is a global variable, and its initial value is false; polling to determine whether the erase and write command flag is true; when the erase and write command flag is true, passing the key intermediate variable to the key variable, and executing the erase and write function to perform the erase and write operation.
[0094] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by instructing related hardware through an optical module control program. The optical module control program can be stored in a non-volatile computer-readable storage medium. When the optical module control program is executed, it can include the processes of the embodiments of the above methods.
[0095] Any references to memory, storage, database, or other media used in the embodiments provided in this invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), direct RAM bus RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0096] Although this invention frequently uses terms such as erase / write key constant, key intermediate variable, global variable, erase / write command identifier, key variable, and erase / write function, the possibility of using other terms is not excluded. These terms are used merely for the convenience of describing and explaining the essence of this invention; interpreting them as any additional limitation would contradict the spirit of this invention.
[0097] In summary, after reading this detailed disclosure, those skilled in the art will understand that the foregoing detailed disclosure is presented by way of example only and is not restrictive. Although not explicitly stated herein, those skilled in the art will understand that this application is intended to encompass various reasonable changes, improvements, and modifications to the embodiments. These changes, improvements, and modifications are intended to be made by this application and are within the spirit and scope of the exemplary embodiments of this application.
[0098] Furthermore, certain terms used in this application have been used to describe embodiments of this application. For example, "an embodiment," "an embodiment," and / or "some embodiments" mean that a particular feature, structure, or characteristic described in connection with that embodiment may be included in at least one embodiment of this application. Therefore, it is to be emphasized and understood that two or more references to "an embodiment" or "an embodiment" or "an alternative embodiment" in various parts of this specification do not necessarily refer to the same embodiment. Moreover, specific features, structures, or characteristics may be appropriately combined in one or more embodiments of this application.
Claims
1. A method for preventing accidental erasure and rewriting of the data storage area of an optical module, characterized in that, The method includes: Receive the input password and determine whether the password is correct; When the password is correct, it is determined that the user has permission to erase and rewrite the data area, and the correct erase and rewrite key constant is passed to the key intermediate variable; the key intermediate variable is a global variable and its initial value is the incorrect key value. Receive the input data for the data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable with an initial value of false; Poll to determine whether the erase / write command flag is true; When the erase / write command flag is true, the intermediate key variable is passed to the key variable, and the erase / write function is executed to perform the erase / write operation; the key variable is a local variable. After the steps of passing the intermediate key variable to the key variable and executing the erase / write function to perform the erase / write operation when the erase / write command identifier is true, the method further includes: The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
2. The method for preventing accidental erasure and rewriting of the optical module data storage area according to claim 1, characterized in that, The steps of receiving the input password and determining whether the password is correct are as follows: The input password is received by the IIC interrupt program, which then determines whether the password is correct.
3. The method for preventing accidental erasure and rewriting of the optical module data storage area according to claim 1, characterized in that, The step of receiving input data for the data storage area and setting the erase / write command flag to true includes: The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to. When the data is erasable and writable, set the erase / write command flag to true.
4. A system for preventing accidental erasure and rewriting of the data storage area of an optical module, characterized in that, The system includes: A password receiving module is used to receive the input password and determine whether the password is correct. The permission determination module is used to determine that the user has permission to erase and write the data area when the password is correct, and to pass the correct erase and write key constant to the key intermediate variable; the key intermediate variable is a global variable and its initial value is an incorrect key value; The data receiving module is used to receive the input data of the data storage area and set the erase / write command flag to true; the erase / write command flag is a global variable with an initial value of false. The identifier determination module is used to poll and determine whether the erase / write command identifier is true; The erase / write execution module is used to pass the intermediate key variable to the key variable and execute the erase / write function when the erase / write command identifier is true, so as to perform the erase / write operation; the key variable is a local variable; The system also includes a recovery settings module for: The intermediate key variable is restored to the incorrect key value, and the erase / write command identifier is restored to false.
5. The optical module data storage area anti-accidental erasure and rewriting system according to claim 4, characterized in that, The password receiving module is specifically used for: The input password is received by the IIC interrupt program, which then determines whether the password is correct.
6. The optical module data storage area anti-accidental erasure and rewriting system according to claim 4, characterized in that, The data receiving module is specifically used for: The IIC interrupt routine receives the input data from the setting data storage area and determines which specific function data within the module the data corresponds to. When the data is erasable and writable, set the erase / write command flag to true.
7. An optical module, characterized in that, The optical module employs the method for preventing accidental erasure and rewriting of the optical module data storage area as described in any one of claims 1-3.
8. A storage medium containing executable instructions, said executable instructions being loaded and executed by a processor to implement the method for preventing accidental erasure and rewriting of the optical module data storage area as described in any one of claims 1-3.
Citation Information
Patent Citations
Optical module parameter modification method, optical module parameter modification device and optical module
CN105306218A
Data erasure of a target device
US20160328180A1