CN111045930A - Method and system for downloading and debugging optical module code - Google Patents

Method and system for downloading and debugging optical module code Download PDF

Info

Publication number
CN111045930A
CN111045930A CN201911128527.1A CN201911128527A CN111045930A CN 111045930 A CN111045930 A CN 111045930A CN 201911128527 A CN201911128527 A CN 201911128527A CN 111045930 A CN111045930 A CN 111045930A
Authority
CN
China
Prior art keywords
optical module
debugging
downloading
pin
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911128527.1A
Other languages
Chinese (zh)
Inventor
陈建宇
谢炎飞
李成
胡毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Accelink Technologies Co Ltd
Wuhan Optical Valley Information Optoelectronic Innovation Center Co Ltd
Original Assignee
Accelink Technologies Co Ltd
Wuhan Optical Valley Information Optoelectronic Innovation Center Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Accelink Technologies Co Ltd, Wuhan Optical Valley Information Optoelectronic Innovation Center Co Ltd filed Critical Accelink Technologies Co Ltd
Priority to CN201911128527.1A priority Critical patent/CN111045930A/en
Publication of CN111045930A publication Critical patent/CN111045930A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging

Abstract

The invention relates to the field of optical communication, in particular to a method for downloading and debugging optical module codes, which mainly comprises the following steps: connecting an optical module function control pin and an optical module state pin with an MCU download debugging pin; confirming that the working mode state value of the optical module is set to be a downloading debugging mode; the optical module input pin and the optical module output pin are configured to be in an upward pull-up leakage mode; fixing the corresponding optical module input pin of the firmware code reading level signal as a non-enabled level; the output pins of the corresponding optical module which need to output level signals in the firmware codes are fixed to be high level or not output; and entering a downloading debugging mode, and downloading codes into the optical module or debugging the codes in the optical module. The invention can finish the downloading and debugging of the code without disassembling the shell and rewiring after the optical module is packaged, thereby improving the efficiency of code debugging and facilitating the maintenance and the updating of the code in the optical module.

Description

Method and system for downloading and debugging optical module code
[ technical field ] A method for producing a semiconductor device
The invention relates to the field of optical communication, in particular to a method and a system for downloading and debugging optical module codes.
[ background of the invention ]
With the development of optical communication technology, optical module technology as a key node in the construction of optical communication networks is increasingly refined, and the packaging form of optical modules is also developed towards the direction of smaller volume at the same rate and higher rate at the same volume.
Due to the increase of the integration level of the optical module, a Microcontroller Unit (MCU) is increasingly used in the optical module with digital diagnostic function. At present, there are two general methods for downloading and debugging a firmware program of an MCU chip of a microcontroller unit, the first method is that a Bootloader program is solidified inside an MCU, and a firmware of an optical module can be downloaded through a communication interface (a serial port or I2C, etc.) according to a manufacturer-specific protocol; the second method is to make several holes or pads on the PCB, and after a Serial Wire Debug (SWD) interface or a Joint Test Action Group (JTAG) protocol interface is connected and flying, a firmware program can be programmed, and a program can also be debugged online.
However, the first method can only download but not debug online, which brings great difficulty in positioning and solving the firmware problem in the initial stage of optical module development; in the second method, after the optical module is packaged, if a program needs to be updated or a problem needs to be debugged online, the shell needs to be disassembled for flying, and the optical module is easily damaged.
In view of this, how to overcome the defects in the prior art and solve the problem that the MCU firmware program on the packaged optical module cannot be downloaded or debugged online is a problem to be solved in the art.
[ summary of the invention ]
Aiming at the defects or the improvement requirements of the prior art, the invention solves the problem that the MCU firmware program on the packaged optical module is inconvenient to download and debug online.
The embodiment of the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for downloading and debugging an optical module code, which is characterized in that: connecting an optical module function control pin and an optical module state pin with an MCU download debugging pin; confirming that the working mode state value of the optical module is set to be a downloading debugging mode; the optical module input pin and the optical module output pin are configured to be in an upward pull-up leakage mode; fixing the corresponding optical module input pin of the firmware code reading level signal as a non-enabled level; the output pins of the corresponding optical module which need to output level signals in the firmware codes are fixed to be high level or not output; and entering a downloading debugging mode, and downloading codes into the optical module or debugging the codes in the optical module.
Preferably, after the optical module function control pin and the optical module status pin are connected to the MCU download debug pin, the method further includes: confirming that the working mode state value of the optical module is set to be a normal working mode; the optical module input pin and the optical module output pin are configured to be in an input and output mode under a normal working mode; the input pin and the output pin of the optical module are set to be input and output levels in a normal working mode; and entering a normal working mode, and enabling the optical module to work normally.
Preferably, the determining that the optical module has entered the download debugging mode or the determining that the optical module has entered the normal operating mode specifically includes: reading a working mode state value of an optical module; judging whether the working mode state value of the optical module is a downloading debugging mode or a normal working mode; if the working mode state value of the optical module is in a downloading debugging mode, completing pin setting required by the downloading debugging mode, and entering the downloading debugging mode; and if the working mode state value of the optical module is in a normal working mode, completing the pin setting required by the normal working mode, and entering the normal working mode.
Preferably, reading the operating mode state value of the optical module specifically includes: and reading a state value representing the current working mode of the optical module at the FLASH address specified by the optical module.
Preferably, after reading the state value of the operating mode of the optical module, if the operating mode of the optical module is not the currently-performed operating mode, the method further includes: and setting the state value representing the current working mode of the optical module at the specified address of the FLASH of the optical module as the state value of the current working mode to be carried out.
Preferably, before debugging the code in the optical module or before confirming that the optical module has entered the normal operating mode, the method further includes: judging whether the MCU has a downloaded firmware code; if yes, starting debugging or starting normal work; and if the code does not exist, downloading the code into the optical module, and starting debugging or starting normal work after the downloading is finished.
Preferably, before determining whether there is an MCU code that has been downloaded, the method further includes: and connecting a code downloading and debugging interface of the code integration development tool to the pins of the optical module connected with the downloading and debugging pins of the MCU.
Preferably, after the code is downloaded into the optical module or the state of the optical module is changed, the MCU is restarted and initialized.
On the other hand, the invention provides a system for downloading and debugging optical module codes, which is characterized in that: the optical module test board comprises an optical module test board 100, a PC200 and an optical module 300; the optical module test board 100 is connected to the optical module 300 through an electrical interface; the optical module test board 100 is connected with the PC200 through a communication interface; the optical module 100 includes an MCU320, a communication pin 321 of the MCU320 is connected to a corresponding optical module electrical interface 310 through a corresponding pin, a function control and status pin 322 of the MCU320 is connected to a corresponding optical module electrical interface 310 through a corresponding pin, and a code download and debug pin 323 of the MCU320 is connected to a corresponding optical module electrical interface 310 through a corresponding pin; the optical module test board 100 further includes a code download and debug interface 140, and the code download and debug interface 140 is connected to the optical module 100 through an electrical interface on the optical module electrical socket 110.
Preferably, the optical module test board 100 further includes an optical module function control and status display module 130, and the optical module function control and status display module 130 is connected to the optical module 100 through an electrical interface on the optical module electrical socket 110.
Compared with the prior art, the embodiment of the invention has the beneficial effects that: the download debugging pin and the state pin of the MCU are connected with the outside through the optical module control pin and the state pin and are correspondingly arranged, so that the MCU can receive program download and feed back the running state through the external control pin and the state pin reserved after the optical module is packaged, the pins of the MCU are not required to be connected with the outside after the packaged optical module is disassembled, and the download and online debugging of the MCU firmware program in the packaged optical module are realized.
The invention also provides a system for downloading and debugging the code of the optical module, which aims to connect the communication pin, the code downloading and debugging pin, the function control and state pin of the MCU with an external code programming tool, an optical module function control and state display module and the like through the electrical interface of the optical module on the test board so as to realize the downloading and online debugging of the MCU firmware program in the packaged optical module.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below. It is obvious that the drawings described below are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a flowchart of a method for downloading and debugging optical module codes according to an embodiment of the present invention;
fig. 2 is a flowchart of another method for downloading and debugging optical module codes according to an embodiment of the present invention;
fig. 3 is a flowchart of another method for downloading and debugging optical module code according to an embodiment of the present invention;
fig. 4 is a flowchart of another method for downloading and debugging optical module code according to an embodiment of the present invention;
fig. 5 is a flowchart of another method for downloading and debugging optical module code according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a system for downloading and debugging optical module codes according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of another system for downloading and debugging optical module codes according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of another system for downloading and debugging optical module codes according to an embodiment of the present invention;
fig. 9 is a diagram of a chip pin definition used in another system for downloading and debugging optical module code according to an embodiment of the present invention.
[ detailed description ] embodiments
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The present invention is a system structure of a specific function system, so the functional logic relationship of each structural module is mainly explained in the specific embodiment, and the specific software and hardware implementation is not limited.
In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other. The invention will be described in detail below with reference to the figures and examples.
In the field of optical module technology, MCUs are increasingly used in optical modules with digital diagnostic detection functions. The firmware program running in the MCU mainly monitors parameters such as the temperature, the power supply voltage, the bias current, the transmitting and receiving optical power and the like of the optical module with a digital diagnosis and detection function in real time, and judges the communication working condition of the optical module by analyzing a digital measurement result. And by programming the MCU chip, the corresponding communication link can be established for the register configuration in the EML laser driver.
In order to meet the requirements of various systems, the variety of optical modules will be increased, and the performance will also be higher. The selection of the microcontroller unit MCU chip in the current optical module is roughly divided into: ATEML, Silabs, ADI, and ST, etc. Generally, there are two methods for downloading and debugging the firmware program of the MCU chip of the microcontroller unit, one is JTAG and the other is SWD.
Because the packaging size of the optical module is smaller and smaller, no matter which downloading and debugging mode is, after the optical module is packaged, an external MCU program downloading and debugging interface cannot be reserved, so that the firmware program on the MCU cannot be downloaded and debugged after the optical module is packaged.
In the method for downloading and debugging the code of the optical module provided by the embodiment of the invention, only an external code integration development tool and a state display module need to be connected with an external interface reserved by the optical module, the external code integration development tool can download a firmware program into the MCU through a function control pin of the optical module, and the external state display module can also obtain the running state of the firmware program through a state pin of the optical module for debugging without damaging and changing the integrity and the electrical connection structure of the optical module.
Example 1:
in order to implement firmware program downloading and online debugging of a packaged optical module, this embodiment provides a method for downloading and debugging optical module codes, which includes the following steps, as shown in fig. 1:
step 101: and connecting the optical module function control pin and the optical module state pin to the MCU download debugging pin.
After the optical module is packaged, the MCU download debugging pin is packaged in the optical module and cannot be connected with the outside to download and debug the firmware program, but the interfaces of the optical module function control pin and the optical module state pin are reserved outside the optical module and can be communicated with the outside. The function control pin and the state pin of the optical module are connected with the MCU download debugging pin, and the MCU download debugging pin can be connected with the outside through the function control pin and the state pin of the optical module. According to different chips, the optical module function control pin, the optical module state pin and the MCU download debugging pin may all correspond to a plurality of specific chip pins, and when the embodiment is applied specifically, the corresponding pins need to be correctly connected one by one according to a chip pin manual, and the invention will be described as a pin connection mode in a specific practical scenario through embodiment 3.
Step 102: and confirming that the working mode state value of the optical module is set to be the downloading debugging mode.
In the method for downloading and debugging the code of the optical module provided by this embodiment, the packaged optical module can be switched between the operating mode and the debugging mode, so that the optical module is debugged when the firmware program needs to be downloaded and debugged, and the optical module is restored to normal operation when the firmware program does not need to be downloaded and debugged. Therefore, before downloading and debugging the code of the firmware program, the operating mode of the optical module needs to be set and confirmed, and the optical module can be downloaded and debugged only when the operating mode of the optical module is in the downloading and debugging mode.
Step 103: the optical module input pin and the optical module output pin are configured to be in a pull-up and drain mode.
The upper pull-open leakage mode is the level state of a pin, and the output pin is realized by controlling an MOS (metal oxide semiconductor) tube through a register. Opening and leaking: the controller is connected with the grid electrode of the MOS tube, the source electrode is connected with the negative electrode of the power supply, and the drain electrode is connected with the pin. Pulling up: on an open drain basis, a resistor is connected between the drain and the power supply, and this resistor is called a pull-up resistor. The pull-up drain mode may stabilize the level of the pin at a high level and increase the current sinking capability of the pin.
Step 104: and the input pin of the corresponding optical module which needs to use the firmware code to read the level signal is fixed to be the non-enabled level. Each pin of the optical module has a preset enable level and a preset disable level, and if a certain pin is defined as a high level enable in some specific application scenarios, a low level is the disable level, and the disable level can prevent the pin from receiving an input signal. In the normal working mode of the optical module, the firmware code may read level signals from some pins; in a download debugging mode, pins needing to use codes to read data are set to be at a non-enabling level, so that the debugging errors caused by the codes obtaining wrong input signals from the pins are avoided.
Step 105: and the output pin of the corresponding optical module which needs to output the level signal in the firmware code is fixed to be high level or not output.
In a normal working mode, an output pin of the optical module may output a low level, because the download debugging pin is connected with the download debugging pin, if the output pin always outputs the low level, the download or debugging cannot be performed, and in the download debugging mode, the output level of the output pin needs to be set to be a high level or not to be output, so that the debugging result is prevented from being influenced by an erroneous output signal. Step 103-step 105 are the setting mode of the status and pins of the optical module. In a normal operating mode, each status register of the optical module has its own normal operating status, and each pin of the optical module has its own normal input/output level. In the normal operation mode, the level of a part of input pins of the optical module needs to be read by an external device. When the debugging mode is downloaded, the input pin of the optical module is fixed to the suppression level, so that the influence of high and low levels on the working state stability of the optical module during debugging after downloading is prevented. For other optical module input pins which do not need to read data by using firmware codes and other optical module output pins which do not need to output data by using the firmware codes, pin level setting can be carried out according to actual needs and the specification of a chip manual.
Step 106: and entering a downloading debugging mode, and downloading codes into the optical module or debugging the codes in the optical module.
After the configuration in steps 103-105 is completed, the optical module completes the configuration of the download debugging mode, enters the download debugging mode, and downloads codes to the download debugging pins of the MCU through the input pins and the output pins of the optical module, or debugs existing codes in the optical module. Furthermore, when downloading the code into the optical module, the input pin and the output pin of the optical module need to be connected to the code programming interface of the external code programming tool, that is, the code programming interface of the external code programming tool is connected to the download debugging pin of the MCU through the input pin and the output pin of the optical module.
In the method for downloading and debugging the code of the optical module provided by this embodiment, the optical module is connected with corresponding pins of the MCU, and the external interface reserved after the optical module is packaged is used to realize downloading input and running state output of the firmware code in the MCU, so that the packaged optical module can be used to nondestructively replace a new firmware program, and to timely and accurately find out a program error or a fault reason, and after the firmware program is updated or the debugging is completed, the normal working state of the optical module can be recovered by only restoring the working mode, the state register value, and the pin level to the normal working mode, which is convenient for downloading, upgrading, debugging, repairing, etc. of the firmware code in the optical module.
In a specific usage scenario of this embodiment, the setting and determination of the operating mode, the pin operating mode, and the level setting in the optical module may be completed through PC communication, and specifically, I2C communication or serial port communication may be used. The firmware code downloading can be completed by using a downloading and debugging interface matched with the MCU, and particularly, an SWD interface or a JTAG protocol can be used. The optical module status display can be completed through a display device on the test board, specifically, the status display can be displayed by using an LED lamp, an LED display screen or an oscilloscope, and also can be displayed by using status display software on a PC through PC communication.
Example 2:
with respect to the method for downloading and debugging the code of the optical module provided in embodiment 1, the optical module can complete downloading and debugging the code of the firmware without disassembling or changing other hardware. After the optical module downloads and debugs the firmware codes, the working mode of the optical module is set to be a normal working mode, and pins and the level are set to be a normal and correct input and output level, so that the optical module can work normally.
As shown in fig. 2, the steps of switching the optical module to the normal operating state are as follows:
step 201: and confirming that the working mode state value of the optical module is set to be the normal working mode.
Before downloading and debugging the code of the firmware program, the working mode of the optical module needs to be set and confirmed, and the optical module can be ensured to be correctly recovered to the normal working mode only by recovering the pin state to the input/output mode and the pin level in the normal working mode when the working mode of the optical module is in the normal working mode.
Step 202: the optical module input pin and the optical module output pin are configured to be in an input and output mode under a normal working mode;
the input/output mode of the input pin and the output pin of the optical module is recovered to the input/output mode in the normal working mode, so that each pin can accurately input/output level signals, and the specific input/output mode is set according to a chip manual and actual use requirements, such as pull-up, pull-down, open-drain, floating and the like
Step 203: and the input pin and the output pin of the optical module are set to be input and output levels in a normal working mode.
The input and output levels of the input pin and the output pin of the optical module are restored to the input and output levels in the normal operating mode, so that each pin can operate at the correct operating level, and the specific input and output levels are set according to a chip manual and actual use requirements, for example, a certain pin is set to be high level enable or low level enable.
Step 204: and entering a normal working mode, and enabling the optical module to work normally.
In the method for downloading and debugging the code of the optical module provided in embodiment 1, the level of the pin of the optical module needs to be set when the code is downloaded and debugged. After debugging is finished, the hardware structure of the optical module and the electrical connection inside the optical module are not changed during debugging, so that normal work can be recovered only by setting the level of each pin of the optical module to be a normal and correct input and output level. In some specific application scenarios, if the optical module is already connected to the external code download debugging tool, the status display module, and the communication interface, the optical module needs to be disconnected from the external function modules before step 201.
By using the embodiment 1 and the setting method of this embodiment, the optical module can complete the switching between the download debugging mode and the normal operating mode. Therefore, before setting and operating a certain operation mode, the currently set operation mode of the optical module needs to be determined.
The steps after the download debugging mode and the normal working mode are combined are shown in fig. 3:
step 301: and reading the working mode state value of the optical module.
The working mode of the optical module can be judged according to the working mode state value of the optical module, and in different application scenes, the working mode state value of the optical module can exist in different forms, such as a numerical value in a register, a level signal of a certain pin and the like. Specifically, in some practical application scenarios of this embodiment, in step 301, the working mode state value of the optical module may be obtained by reading a state value of a FLASH address specified by the optical module, and the FLASH address value may be specified and set in a firmware code. Specifically, the state value in the optical module FLASH can be read through the MCU, then output is carried out through an output pin of the optical module, and display is carried out through PC communication or other state display modes.
Step 302: and judging that the working mode state value of the optical module is a downloading debugging mode or the working mode state value of the optical module is a normal working mode.
In a specific usage scenario of this embodiment, if the values in the register are used to represent the operating mode of the optical module, different values of the operating mode state values represent different current operating mode states of the optical module. In some specific application scenarios of this embodiment, the status value of the download debugging mode is 0xD001, and the status value of the normal operating mode is 0x 0000. If the read working mode state value is 0xD001, the optical module is currently working in a download debugging mode; and if the read working mode state value is 0x0000, indicating that the optical module works in the normal working mode at present.
The functions of step 301 and step 302 are equivalent to step 101 in fig. 1 and step 201 in fig. 2, and are specific implementations of step 101 and step 201.
Step 303: and finishing pin setting required by the downloading debugging mode, and entering the downloading debugging mode.
Wherein, the specific implementation manner of step 303 is step 103-step 106.
Step 304: and finishing the pin setting required by the normal working mode, and entering the normal working mode.
Wherein, the specific implementation manner of step 304 is step 202-step 204.
Further, when starting to download and debug or normally work, if the read state value of the optical module operating mode is not the state value of the operating mode to be currently performed, the state value needs to be set as the state value of the operating mode to be currently performed. Specifically, when the normal working mode is converted into the download debugging mode, a download debugging mode command is input to an input pin of the optical module through PC communication, the MCU acquires the download debugging mode command through a pin connected with the input pin of the optical module, and the MCU writes a download debugging mode state value 0xD001 into an address of a FLASH register storing the state value; when the downloading debugging mode is converted into the normal working mode, a command is input to an input pin of the optical module through PC communication, the MCU acquires the normal working mode command through a pin connected with the input pin of the optical module, and the MCU writes a state value of the normal working mode 0x0000 into an address of a FLASH register storing the state value.
The method for downloading and debugging the code of the optical module provided by the embodiments of the invention can switch the optical module between the download debugging mode and the normal working mode, and confirm the state value representing the current working mode before setting the pin state and the level, thereby avoiding the error caused by reading and writing under the wrong work. On the other hand, the operating state may also be switched by setting a state value.
In a specific application scenario of this embodiment, the MCU may not write code. Therefore, before debugging the code or changing the code into the normal operating mode, in order to avoid errors, a step of determining whether the MCU has downloaded MCU codes is added:
FIG. 4 shows a step of determining and downloading firmware code in the download debug mode; as shown in fig. 5, the steps for determining and downloading the firmware code in the normal operation mode are shown.
Step 401: and setting the working mode of the optical module into a downloading debugging or normal working mode, and correspondingly setting the input/output mode and the input/output level of each pin of the optical module.
Wherein, the specific implementation of step 401 is step 101-step 105.
Step 402: and connecting a code downloading and debugging interface in the code integration development tool to an optical module pin connected with a downloading and debugging pin of the MCU.
When downloading the code, the code downloading and debugging interface in the code integrated development tool needs to be connected with the downloading and debugging pin of the MCU. In the existing code downloading mode, a code downloading and debugging interface in a code integration development tool can only be directly connected with a downloading and debugging pin of an MCU (microprogrammed control unit), if an optical module is packaged, the downloading and debugging pin of the MCU is packaged in the optical module, and the connection can be completed only after the optical module is disassembled to expose the downloading and debugging pin of the MCU. In the method for downloading and debugging the code of the optical module provided by this embodiment, since the download debugging pin of the MCU is already connected to the pin of the optical module, the optical module housing does not need to be disassembled to perform flying connection on the pin of the MCU, and only the code download and debugging interface in the code integration development tool needs to be connected to the reserved pin of the optical module, and the code to be downloaded can be input to the download debugging pin of the MCU through the input pin of the optical module, and finally enters the MCU to complete downloading of the firmware code. The specific characteristics of the optical module golden finger in embodiment 3 will be specifically described.
Step 403: and judging whether the MCU has an MCU code which is downloaded completely.
In an actual application scenario, the code in the firmware can be read through the code integration development tool, and whether the downloaded firmware code exists is judged.
If the MCU codes which are downloaded completely exist, debugging is started normally or normal work is started normally; if the downloaded codes do not exist, the codes need to be downloaded first, and then debugging is carried out or normal work is started.
Step 404: and downloading the MCU codes to the optical module.
After the MCU program is programmed, or some devices in the optical module and the MCU are set, the setting can be enabled to be effective only by restarting. After the program of the MCU is programmed, or the state values of the operating modes of the optical module are switched, or the states of the pins of the optical module are switched, or the levels of the pins of the optical module are switched, or before the downloaded codes of the optical module enter the normal operating state, the MCU needs to be restarted and reinitialized to operate normally. Therefore, the following steps are also required:
step 405: the MCU restarts and initializes.
As shown in fig. 4, in the download debugging mode, the MCU needs to be restarted and initialized first, and then the code is downloaded. As shown in fig. 5, in the normal operation mode, after the code is downloaded, the MCU needs to be restarted and initialized to perform normal operation using the newly downloaded firmware code.
And after the MCU firmware code is downloaded and normally initialized, debugging or normal work can be carried out:
step 406: start firmware code debugging, or begin normal operation.
The method for downloading and debugging the optical module code provided by the embodiment realizes online downloading and debugging of the optical module firmware code without disassembling the optical module shell and adding extra wiring through switching of two working modes, and can return to the normal working mode after the downloading and debugging of the firmware code are completed. And errors such as incorrect working mode setting, un-downloaded codes in the MCU and the like are avoided through a series of additional judgment and processing, so that the optical module can correctly carry out code downloading debugging or normal work.
Example 3:
the optical module code download debugging methods provided in embodiments 1 and 2 can be implemented by corresponding optical module code download debugging systems.
As shown in fig. 6, the optical module code download debugging system implements the following module compositions and connection relationships.
The optical module code downloading and debugging system provided by the embodiment mainly comprises: optical module test board 100, PC200, and optical module 300.
As shown in fig. 6, the optical module test board 100 is electrically connected to the optical module 300 through an electrical interface. Specifically, as shown in fig. 7, the optical module test board 100 includes an optical module electrical interface socket 110, and the optical module test board 100 and the optical module 300 are connected through an electrical interface on the optical module electrical socket 110. The optical module test board 100 is provided with the optical module electrical interface socket 110, which can conveniently connect out pins of the optical module 300, facilitate the connection between the optical module pins and various functional modules on the optical module test board 100, and facilitate the downloading and debugging of firmware codes of the optical module 300.
The optical module test board 100 is connected to the PC200 through a communication interface. Specifically, as shown in fig. 7, the optical module test board 100 includes a communication interface 120, one side of the communication interface 120 is connected to the optical module electrical interface socket 110, and the other side is connected to the communication software 210 of the PC200, so that data can be transmitted between the PC200 and the optical module 300 through the communication interface 120, and functions of switching the operating state of the optical module 300, switching the pin state, setting the pin level, checking the operating state, and the like are implemented. According to specific use requirements, the communication interface can select common communication modes such as a serial port, an I2C interface, a USB interface and the like.
The optical module 300 includes an MCU320, a communication pin 321 of the MCU320 is connected to a corresponding module electrical interface 310 through a corresponding pin, a function control and status pin 322 of the MCU320 is connected to a corresponding optical module electrical interface 310 through a corresponding pin, and a code download and debug pin 323 of the MCU320 is connected to the function control and status pin 322 of the MCU through a corresponding pin. Connecting each pin on the MCU320 to one side of the module electrical interface 310, the pin can be led out of the optical module 300 through the module electrical interface 310 to be connected to an external interface, and further connected to the communication interface 120, the optical module function control and status display 130, and the code download and debug interface 140 on the optical module test board 100, so that the firmware code download and debug in the MCU320 and the output and monitoring of the optical module working status can be realized without disassembling the packaged optical module 300 and additional wiring on the communication software 210 and the code integration development tool 220 connected to the PC 200.
In some specific application scenarios of this embodiment, the optical module test board 100 further includes an optical module function control and status display module 130, and the optical module function control and status display module 130 is connected to the optical module 100 through an electrical interface on the optical module electrical socket 110. The status display module is directly disposed on the test board 100, so as to conveniently check the output of the pins of the optical module 300 in time and confirm the working status of the optical module 300 without being connected to the PC terminal through the communication interface 120 for checking. Specifically, the light module function control and status display module 130 is generally an LED lamp, and may also be an LED display screen, a liquid crystal display screen, or the like.
In other specific application scenarios of this embodiment, an optical module working state conversion module is further disposed on the optical module test board 100, and specifically, the optical module working state conversion module may be implemented by a tri-state dial switch. As shown in fig. 8, the tri-state toggle switches are distributed into a function enabled state, a function idle state, and a function inhibited state. The input pin of the optical module 300 is connected to the middle pole of the optical module working state switching module, and the tri-state dial switch can send a command to the optical module 300 in the form of an electrical signal, so as to realize the switching between the normal working mode and the download debugging mode of the optical module 300. When the tri-state dial switch is dialed to the function enabled state, the optical module 300 is in a normal working mode; when the tristate dial-up is turned on and the function is in an idle state, the optical module 300 is in a download debugging mode.
In some specific application scenarios of the present embodiment, the optical module 300 used is a 100G QSFP28 optical module, and the pin definition of the optical module is shown in fig. 9.
Specifically, there are 3 functional control pins of the optical module 300, which are ModSelL, ResetL, and LPMode/TxDis; there are 2 status display pins, ModPrsL and IntL/RxLOSL. In order to reduce the influence of MCU code downloading and debugging on the optical module function to a greater extent, an SWDIO pin is selected to be connected with an LPMode/TxDis pin on the optical module, and an SWDCLK pin is connected with an IntL/RxLOSL pin. Correspondingly, on the side of the optical module test board 100, the code download and debug interfaces SWDIO and SWDCLK are respectively connected to the ModPrsL control switch and the IntL/RxLOSL status display LED lamp. The download and debug interfaces VRef and GND can be directly led out from the test board. Therefore, the hardware connection of MCU downloading and debugging pins and test board downloading and debugging interfaces is completed by using the function control or state pins of the optical module. When downloading and debugging the code, the code programming tool and the code downloading and debugging interface are correctly connected one by one, and the three-state dial switch corresponding to the LPMode/TxDis is ensured to be dialed to a function idle state.
In other specific application scenarios of the embodiment, in the 400G OSFP optical module, the MCU is STM32L476 of ST corporation. The download and debug interface of STM32L476 is also SWD. The SWDIO and SWDCLK of the SWD are respectively connected with the output pin INT/RSTn and the input pin LPWn/PRSn, and the system connection method provided by the embodiment can also be used for realizing the downloading and debugging of the firmware code of the optical module.
In the optical module code download debugging system provided by this embodiment, the download debugging pin of the MCU is connected to the input/output pin of the module electrical interface of the optical module, so that the download debugging pin of the MCU can be connected to the outside through the input/output pin of the optical module, thereby realizing the download and debugging of the program in the MCU without damaging the existing hardware structure and electrical connection of the optical module.

Claims (10)

1. A method for downloading and debugging optical module codes is characterized in that:
connecting an optical module function control pin and an optical module state pin with an MCU download debugging pin;
confirming that the working mode state value of the optical module is set to be a downloading debugging mode;
the optical module input pin and the optical module output pin are configured to be in an upward pull-up leakage mode;
fixing the corresponding optical module input pin of the firmware code reading level signal as a non-enabled level;
the output pins of the corresponding optical module which need to output level signals in the firmware codes are fixed to be high level or not output;
and entering a downloading debugging mode, and downloading codes into the optical module or debugging the codes in the optical module.
2. The method for downloading and debugging optical module codes according to claim 1, wherein after connecting the optical module function control pin and the optical module status pin to the MCU download debugging pin, the method further comprises:
confirming that the working mode state value of the optical module is set to be a normal working mode;
the optical module input pin and the optical module output pin are configured to be in an input and output mode under a normal working mode;
the input pin and the output pin of the optical module are set to be input and output levels in a normal working mode;
and entering a normal working mode, and enabling the optical module to work normally.
3. The method for downloading and debugging optical module codes according to claim 2, wherein the step of confirming that the optical module has entered the download debugging mode or confirming that the optical module has entered the normal operating mode specifically comprises:
reading a working mode state value of an optical module;
judging whether the working mode state value of the optical module is a downloading debugging mode or a normal working mode;
if the working mode state value of the optical module is in a downloading debugging mode, completing pin setting required by the downloading debugging mode, and entering the downloading debugging mode;
and if the working mode state value of the optical module is in a normal working mode, completing the pin setting required by the normal working mode, and entering the normal working mode.
4. The method for downloading and debugging optical module codes according to claim 3, wherein reading the operating mode state value of the optical module specifically comprises: and reading a state value representing the current working mode of the optical module at the FLASH address specified by the optical module.
5. The method as claimed in claim 3, wherein after reading the state value of the operating mode of the optical module, if the operating mode of the optical module is not the currently-performed operating mode, the method further comprises: and setting the state value representing the current working mode of the optical module at the specified address of the FLASH of the optical module as the state value of the current working mode to be carried out.
6. The method for downloading and debugging the code of the optical module according to claim 1 or 2, wherein before debugging the code in the optical module or before confirming that the optical module has entered the normal operating mode, the method further comprises:
judging whether the MCU has a downloaded firmware code;
if yes, starting debugging or starting normal work;
and if the code does not exist, downloading the code into the optical module, and starting debugging or starting normal work after the downloading is finished.
7. The method for downloading and debugging optical module codes according to claim 6, wherein before determining whether there is any MCU code that has been downloaded, further comprising:
and connecting a code downloading and debugging interface of the code integration development tool to the pins of the optical module connected with the downloading and debugging pins of the MCU.
8. The method for downloading and debugging the code of the optical module according to claim 6 or 7, wherein: after the code is downloaded to the optical module or the state of the optical module is changed, the MCU is restarted and initialized.
9. A system for downloading and debugging optical module codes is characterized in that:
the optical module test board comprises an optical module test board (100), a PC (200) and an optical module (300);
the optical module test board (100) is connected with the optical module (300) through an electrical interface;
the optical module test board (100) is connected with the PC (200) through a communication interface;
the optical module (100) comprises an MCU (320), a communication pin (321) of the MCU (320) is connected with a corresponding optical module electrical interface (310) through a corresponding pin, a function control and status pin (322) of the MCU (320) is connected with the corresponding optical module electrical interface (310) through a corresponding pin, and a code download debugging pin (323) of the MCU (320) is connected with the corresponding optical module electrical interface (310) through a corresponding pin;
the optical module test board (100) further comprises a code downloading and debugging interface (140), and the code downloading and debugging interface (140) is connected with the optical module (100) through an electrical interface on the optical module electrical socket (110).
10. The system for downloading and debugging the code of the optical module according to claim 9, wherein:
the optical module test board (100) further comprises an optical module function control and state display module (130), and the optical module function control and state display module (130) is connected with the optical module (100) through an electrical interface on the optical module electrical socket (110).
CN201911128527.1A 2019-11-18 2019-11-18 Method and system for downloading and debugging optical module code Pending CN111045930A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911128527.1A CN111045930A (en) 2019-11-18 2019-11-18 Method and system for downloading and debugging optical module code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911128527.1A CN111045930A (en) 2019-11-18 2019-11-18 Method and system for downloading and debugging optical module code

Publications (1)

Publication Number Publication Date
CN111045930A true CN111045930A (en) 2020-04-21

Family

ID=70232827

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911128527.1A Pending CN111045930A (en) 2019-11-18 2019-11-18 Method and system for downloading and debugging optical module code

Country Status (1)

Country Link
CN (1) CN111045930A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782225A (en) * 2020-06-21 2020-10-16 陕西航空电气有限责任公司 Error-proof programming method for double CPUs
CN112543053A (en) * 2020-11-19 2021-03-23 深圳市友华通信技术有限公司 BOB online correction method based on automatic calibration process
CN113076274A (en) * 2021-04-30 2021-07-06 成都优博创通信技术有限公司 Optical module and software program acquisition method
CN113258993A (en) * 2021-07-14 2021-08-13 深圳市迅特通信技术股份有限公司 Communication interface circuit and control device of PAM4 optical module
CN114625639A (en) * 2022-03-03 2022-06-14 上海先楫半导体科技有限公司 Debugging method, system and chip based on system on chip

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458652A (en) * 2007-12-14 2009-06-17 上海海尔集成电路有限公司 Embedded on-line emulation debugging system for microcontroller
CN202798726U (en) * 2012-07-27 2013-03-13 青岛海信宽带多媒体技术有限公司 CFP optical module tester
CN106407107A (en) * 2016-08-31 2017-02-15 无锡市电子仪表工业有限公司 Auxiliary software debugging method of universal type optical module
CN108363577A (en) * 2018-02-01 2018-08-03 四川泰瑞创通讯技术股份有限公司 The device of automatic classifying downloaded optical module firmware program
CN108475227A (en) * 2016-03-31 2018-08-31 华为技术有限公司 Test functional component and data debugging method
CN109818677A (en) * 2019-03-20 2019-05-28 青岛海信宽带多媒体技术有限公司 Optical module and optical network apparatus
CN110365411A (en) * 2019-07-29 2019-10-22 武汉光迅科技股份有限公司 A kind of optical module

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458652A (en) * 2007-12-14 2009-06-17 上海海尔集成电路有限公司 Embedded on-line emulation debugging system for microcontroller
CN202798726U (en) * 2012-07-27 2013-03-13 青岛海信宽带多媒体技术有限公司 CFP optical module tester
CN108475227A (en) * 2016-03-31 2018-08-31 华为技术有限公司 Test functional component and data debugging method
CN106407107A (en) * 2016-08-31 2017-02-15 无锡市电子仪表工业有限公司 Auxiliary software debugging method of universal type optical module
CN108363577A (en) * 2018-02-01 2018-08-03 四川泰瑞创通讯技术股份有限公司 The device of automatic classifying downloaded optical module firmware program
CN109818677A (en) * 2019-03-20 2019-05-28 青岛海信宽带多媒体技术有限公司 Optical module and optical network apparatus
CN110365411A (en) * 2019-07-29 2019-10-22 武汉光迅科技股份有限公司 A kind of optical module

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782225A (en) * 2020-06-21 2020-10-16 陕西航空电气有限责任公司 Error-proof programming method for double CPUs
CN112543053A (en) * 2020-11-19 2021-03-23 深圳市友华通信技术有限公司 BOB online correction method based on automatic calibration process
CN113076274A (en) * 2021-04-30 2021-07-06 成都优博创通信技术有限公司 Optical module and software program acquisition method
CN113076274B (en) * 2021-04-30 2022-08-09 成都优博创通信技术有限公司 Optical module and software program acquisition method
CN113258993A (en) * 2021-07-14 2021-08-13 深圳市迅特通信技术股份有限公司 Communication interface circuit and control device of PAM4 optical module
CN113258993B (en) * 2021-07-14 2021-11-19 深圳市迅特通信技术股份有限公司 Communication interface circuit and control device of PAM4 optical module
CN114625639A (en) * 2022-03-03 2022-06-14 上海先楫半导体科技有限公司 Debugging method, system and chip based on system on chip

Similar Documents

Publication Publication Date Title
CN111045930A (en) Method and system for downloading and debugging optical module code
EP1205848A1 (en) Embedded microcontroller bound-out chip as preprocessor for a logic analyser
CN107704346B (en) SOC chip debugging method and system
KR20110124617A (en) System-on-chip and debugging method thereof
US20150253387A1 (en) Programmable interface-based validation and debug
JP2018508053A (en) Reprogramming the port controller via its own external port
CN101963934B (en) Method for debugging 8051 core-based system on chip (SOC) on line
JP2008226083A (en) On-chip debug emulator, debugging method and microcomputer
CN111459730A (en) PCH (physical channel) end parameter adjusting method and system under Whitley platform
CN117706322A (en) Chip testing method and system
CN110570897B (en) Memory detection system, memory detection method and error mapping table establishing method
CN112948186A (en) Detection device and detection method of interface signal
US11953550B2 (en) Server JTAG component adaptive interconnection system and method
CN110768874B (en) Modular Ethernet tester
CN114019357A (en) Management method of test pin of logic processing module and related assembly
CN210129213U (en) Chip carving and recording assembly
CN214175083U (en) CPLD firmware upgrading system
CN115114101B (en) Link testing method, device, system and storage medium
CN216145184U (en) Device for downloading and debugging optical module firmware code
CN211698947U (en) Numerical control system FPGA-flash memory chip configuration circuit
CN116155389B (en) Optical module debugging system and method
CN113341295B (en) Test jig and test system
CN215954292U (en) Vehicle MCU (microprogrammed control Unit) flash device based on external plug connector
CN201017308Y (en) Communication debugging device of I2C bus signal
KR100612576B1 (en) Self-Test Possible ASIC

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination