CN118041882A - Loop back device and method for switch - Google Patents

Loop back device and method for switch Download PDF

Info

Publication number
CN118041882A
CN118041882A CN202410165832.2A CN202410165832A CN118041882A CN 118041882 A CN118041882 A CN 118041882A CN 202410165832 A CN202410165832 A CN 202410165832A CN 118041882 A CN118041882 A CN 118041882A
Authority
CN
China
Prior art keywords
voltage
mcu
power
loop back
modulation units
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
CN202410165832.2A
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.)
Xian Yep Telecommunication Technology Co Ltd
Original Assignee
Xian Yep Telecommunication Technology 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 Xian Yep Telecommunication Technology Co Ltd filed Critical Xian Yep Telecommunication Technology Co Ltd
Priority to CN202410165832.2A priority Critical patent/CN118041882A/en
Publication of CN118041882A publication Critical patent/CN118041882A/en
Pending legal-status Critical Current

Links

Landscapes

  • Control Of Voltage And Current In General (AREA)

Abstract

The application provides a loop back device and method for a switch, wherein the loop back device comprises: the voltage monitoring unit, MCU, multiunit modulating unit; the control end of each group of modulation units is connected with the GPIO of the MCU, the input end is connected with the voltage input port, and the output end is grounded; the voltage monitoring unit is connected with the MCU through a communication line, is also connected with a voltage input port, and is used for detecting the voltage input to each group of modulation units and sending the voltage to the MCU; the MCU is used for generating PWM signals and adjusting the duty ratio of the PWM signals according to the voltage, and the PWM signals are used for adjusting the input voltage passing through each group of modulation units. The maximum power of the loop device provided by the device can be determined by the number of the modulation units, and the working power of the modulation units is adjusted through PWM signals according to the voltage actually measured, so that the power of the optical module during working can be accurately simulated.

Description

Loop back device and method for switch
Technical Field
The present application relates to communication technologies, and in particular, to a loop device and method for a switch.
Background
The optical module is used as an important component in optical fiber communication and is used for converting an electric signal and an optical signal. When the optical module is matched with the switch for use, different connection modes are adopted to realize different network requirements.
Several matching schemes are currently common: the optical fiber cable comprises an optical fiber cable adding module, an active optical cable and a direct connection cable. When testing the switch performance, the above schemes are inconvenient to plug and pull, and the cable is long, so that the cable is easy to bend, and the data transmission is damaged. When the transmission line is subjected to verification test, the loop-back device LOOPBACK is adopted to simulate the power of the optical module during working, so that the assembly time can be saved, and the cable bending is avoided. However, the power consumption design of the traditional loop device realizes large-level precision adjustment by controlling the resistance load, and the adjustment precision is 1.5W. Therefore, the conventional loop device cannot design power consumption to achieve precision according to requirements, and in the working process, the working voltage changes can cause a large actual power error.
Therefore, how to fine-tune the power of the loop back device is a problem to be solved.
Disclosure of Invention
The application provides a loop back device and a loop back method for a switch, which are used for solving the problem of insufficient power adjustment precision of the loop back device.
In a first aspect, the present application provides a loop back device for a switch, the loop back device comprising:
the device comprises a voltage monitoring unit, a micro control unit MCU and a plurality of groups of modulation units;
The control end of each group of modulation units is connected with the general purpose input/output port GPIO of the MCU, the input end of each group of modulation units is connected with the voltage input port, and the output end of each group of modulation units is grounded;
The voltage monitoring unit is connected with the MCU through a communication line, is also connected with the voltage input port, and is used for detecting the voltage input to each group of modulation units and sending the voltage to the MCU;
The MCU is used for generating Pulse Width Modulation (PWM) signals and adjusting the duty ratio of the PWM signals according to the voltage, wherein the PWM signals are used for adjusting the input voltage passing through each group of modulation units.
Optionally, each group of modulation units comprises:
The triode, the first power resistance, a plurality of second power resistances;
one end of the first power resistor is connected with the GPIO pin of the MCU, and the other end of the first power resistor is connected with the base electrode of the triode;
One end of the second power resistors are connected with the collector electrode of the triode, and the other end of the second power resistors are connected with a voltage input port which is used for being connected with an external switch to obtain voltage;
And the emitter electrode of the triode is grounded.
Optionally, the voltage monitoring unit is connected with the MCU through an integrated circuit bus I2C.
Optionally, the loop back device further includes: an I2C bus interface;
the I2C bus interface is connected with the MCU, and the I2C bus interface is used for receiving an externally input instruction.
Optionally, the instruction is to modify the bit signal PRESENT.
Optionally, the apparatus further includes: a BOOT0 pin;
When the BOOT0 pin is pulled up, the I2C bus interface is used for carrying out firmware upgrade on the MCU;
And when the BOOT0 pin is pulled down, the I2C bus interface is used for receiving an externally input instruction.
Optionally, the loop back device further includes: a receiving interface RX and a transmitting interface TX;
The TX and the RX are interconnected for simulating a data exchange procedure.
Optionally, an attenuation network is disposed between the TX and the RX.
Optionally, the voltage monitoring unit is further connected to a voltage input port of the MCU, and the voltage monitoring unit is configured to detect a voltage input to the MCU.
In a second aspect, the present application further provides a loop-back method for a switch, which is applied to the micro control unit MCU of any loop-back device in the first aspect, and the method includes:
Acquiring voltage acquired by a voltage and current monitoring unit;
Inquiring the duty ratio of the Pulse Width Modulation (PWM) signals from a preset corresponding table according to the voltage and the current set power, wherein the corresponding table stores the duty ratio of the PWM signals corresponding to a plurality of groups of voltages corresponding to each power;
generating a target PWM signal according to the inquired duty ratio of the PWM signal;
the target PWM signal is output to at least one modulation unit.
In a third aspect, the present application also provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the loop-back method for a switch according to any of the second aspects when executed by a processor.
The application provides a loop back device and a method for a switch, wherein the loop back device comprises: the device comprises a voltage monitoring unit, a micro control unit MCU and a plurality of groups of modulation units; the control end of each group of modulation units is connected with a general purpose input/output port GPIO of the MCU, the input end of each group of modulation units is connected with a voltage input port, and the output end of each group of modulation units is grounded; the voltage monitoring unit is connected with the MCU through a communication line, is also connected with a voltage input port, and is used for detecting the voltage input to each group of modulation units and sending the voltage to the MCU; the MCU is used for generating Pulse Width Modulation (PWM) signals and adjusting the duty ratio of the PWM signals according to the voltage, and the PWM signals are used for adjusting the input voltage passing through each group of modulation units. The maximum power of the loop device provided by the device can be determined by the number of the modulation units, the working power of the modulation units can be adjusted through PWM signals according to the actual voltage, and the power of the optical module during working can be accurately simulated.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of an application scenario provided by the present application;
fig. 2 is a schematic structural diagram of a first embodiment of a loop apparatus for a switch according to the present application;
fig. 3 is a schematic structural diagram of a second embodiment of a loop apparatus for a switch according to the present application;
fig. 4 is a schematic structural diagram of a third embodiment of a loop apparatus for a switch according to the present application;
fig. 5 is a schematic structural diagram of a fourth embodiment of a loop apparatus for a switch according to the present application;
fig. 6 is a schematic structural diagram of a fifth embodiment of a loop apparatus for a switch according to the present application;
Fig. 7 is a schematic structural diagram of a loop apparatus for a switch according to a sixth embodiment of the present application;
Fig. 8 is a schematic flow chart of a loop method embodiment one of the present application for a switch;
fig. 9 is a schematic structural diagram of a loop device according to the present application.
Reference numerals illustrate:
11-a voltage monitoring unit; 12-a micro control unit MCU; 13-multiple groups of modulation units; 131-triode; 132—a first power resistor; 133-a second power resistor; 14-a voltage input port; 15-I2C bus interface; 16-BOOT0 pin; 17-a receiving interface RX; 18-transmit interface TX; 19-an attenuation network.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
First, the background art related to the present application is described:
In the current switch system, there are three common collocation schemes:
1. fiber optic line + optical module.
2. An active optical cable (Active Optical Cables, AOC).
3. A direct-connect cable (DIRECT ATTACH Cables, DAC).
According to the scheme of the first optical fiber line and the optical module, the transmission distance is flexible and controllable, but the optical fiber line can be dust due to the fact that the optical fiber line is plugged and pulled for a plurality of times, and the transmission quality is affected. And when the optical fiber wires are subjected to cross interconnection test, the length of the wires is too long, so that the test is inconvenient.
The second scheme AOC integrates the optical module and the optical cable, so that the possibility of pollution of an optical port is avoided, and the reliability is improved.
The third scheme DAC has no photoelectric conversion module, and the cable is provided with simple cable connectors at both ends, so that the cost is very low, but the transmission distance is too short. Only has a transmission distance of about 2-5 meters.
However, the scheme is not easy to break, inconvenient to plug, short in service life and fixed in power, and various types of application environments with different functional powers can be tested. And the cable has the condition of alternately interconnection, and the cable is longer, leads to the switch to plug inconvenient. When the high-low temperature box is used for reliability test, the temperature box equipment is narrow, and the optical fiber cable is possibly bent, so that data transmission is damaged, and the reasons for data abnormality are difficult to judge. And like the optical module of 400G, the unit price is relatively expensive, and the cost is increased when the optical module is distributed to each team for testing.
Therefore, the loop device (loop) is adopted to replace the optical module, so that the assembly environment time is saved, the research and development cost is saved, and the abnormality caused by cable bending can be avoided.
However, the traditional LOOPBACK changes the power consumption of the LOOPBACK by increasing the load quantity of work through pin control, and the design adjustment precision is influenced by the load power consumption. In the using process of the LOOPBACK, the amount of power entering the load can be changed only by controlling the level of a pin through an external command, for example, one load generates 1.5W of power at rated voltage, and the step size can only be adjusted by 1.5W of steps in power adjustment, so that the power adjustment precision is limited, and when the external voltage is not fixed, the power of each group of loads is changed, so that the error between the actual power and the power required by design is increased.
In view of this, the inventors found in the course of the study that by detecting the voltage input to the load of the loop, when detecting that the voltage is higher or lower than the standard voltage, the power of the load may be abnormally changed, and at this time, the voltage on the load is adjusted by changing the duty ratio of the PWM signal, so that the power of the loop reaches the preset power, and the loop with controllable power accuracy may be designed according to the required power. Based on the above, the application provides a loop device and a loop method based on a switch.
Fig. 1 is a schematic view of an application scenario provided by the present application, as shown in fig. 1, where an lock is inserted on a switch, the switch supplies power to the lock, and a signal generated by the switch is looped back to the switch through the lock, and LOPPBACK is used to simulate optical modules with different power consumption to perform signal test.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a schematic structural diagram of a first embodiment of a loop back device for a switch according to the present application, where, as shown in fig. 2, the loop back device includes:
The voltage monitoring unit 11, the micro control unit MCU12, the multiunit modulation unit 13.
The control end of each group of modulation units 13 is connected with a general purpose input/output port GPIO of the MCU12, the input end of each group of modulation units is connected with a voltage input port 14, and the output end of each group of modulation units is grounded.
The modulating unit 13 is a load circuit connected to the MCU12, an input end of the load circuit is connected to a voltage input port to receive power (Volt Current Condenser, VCC for short) of an external switch, and an output end of the load circuit is grounded; the modulation unit 13 may be modulated by a PWM signal generated by the MCU12, to control the switching and closing of the internal circuit of the modulation unit 13, and further control the working voltage of the modulation unit, that is, control the power generated by the modulation unit. In fig. 2, two sets of modulation units 13 are shown, the number of modulation units 13 being not limited.
In designing the load, how many groups of modulation units can be set according to the power of the optical module to be simulated, and the power of each group of modulation units at the rated voltage can be the same or different. The MCU12 can control the operation state of the modulation units through the level of the GPIO pins of each group of modulation units, thereby changing the maximum adjustable power of the entire looback. The number of the connected modulation units is determined according to the number of pins of the MCU12 and actual requirements, after the circuit design is finished, the number of groups of modulation units in the loopback is determined, and the working power of each group of modulation units under the rated voltage is fixed.
By way of example, each group of modulation units operates at a power of 1.5W at 3.3V, and when it is desired to simulate the power of the optical module 8W, it is desired to activate at least 6 groups of modulation units.
The modulation unit 13 may be composed of a transistor and a resistor or a mosfet and a resistor, and can perform a modulation effect according to the PWM signal.
The voltage monitoring unit 11 is connected with the MCU12 through a communication line and is connected to an I2C pin (two pins of the I2C correspond to pins of a clock line and a data line) of the MCU 12; the voltage monitoring unit 11 is also connected to a voltage input port 14, and the voltage monitoring unit 11 is configured to detect a voltage input to each group of modulation units and transmit the detected voltage to the MCU12 through a communication line.
Optionally, the communication line is an integrated circuit bus I2C, and the voltage monitoring unit 11 is connected to a corresponding pin of the MCU12 through a serial clock line and a serial data line of the I2C.
Wherein the voltage monitoring unit 11 is connected to the voltage input port of each group of modulation units, and detects the voltage input to the modulation units through the voltage input port by the switch.
The MCU12 is used to generate a pulse width modulated PWM signal and to adjust the duty cycle of the PWM signal according to the voltage, the PWM signal being used to adjust the input voltage through each set of modulation units.
Wherein, the MCU12 receives the voltage data sent by the voltage monitoring unit 11, modulates the PWM signal according to the voltage data, and the MCU12 generates the PWM signal by controlling the level change of each group of modulation units connected to the pins of the MCU 12. This typically involves varying the pulse width of the signal in a period, the time of which is fixed, while the pulse width can be adjusted. In one implementation, when the voltage input ports of the multiple groups of modulation units are the same input ports, the input voltages loaded on each group of modulation units are the same, and the modulation signals transmitted to each group of modulation units through the GPIO pins according to the PWM signals modulated by the voltages are the same, so that the working power of each group of modulation units is controlled. In another possible implementation, the input voltages of any two groups of modulation units are different, and the PWM signal of each group of modulation units needs to be modulated separately according to the voltage. Therefore, each GPIO pin can be independently controlled, and a plurality of pins can be controlled together to output PWM, so that the power control range is wider.
For example, the working power of each group of modulation units is 1.5W at 3.3V, when the power of the optical module 8W needs to be simulated, when 6 groups of modulation units are started, the maximum power of 9W can be simulated, the working power of each group of modulation units can be reduced to 1.33W through PWM signal modulation, and the power of LOOPBACK can accurately reach 8W. When the voltage of the input end of the modulation unit changes, the voltage input is changed from 3.3V to 3.4V, the actual power is larger than 1.33W, and the MCU12 modulates the duty ratio of the PWM signal to control the actual power to 1.33W according to the collected voltage, so that the accurate adjustment can be realized.
The present embodiment provides a loop back device for a switch, the loop back device including: the voltage monitoring unit 11, the micro control unit MCU12, the multi-group modulation unit 13; the control end of each group of modulation units is connected with a general purpose input/output port GPIO of the MCU12, the input end is connected with a voltage input port, and the output end is grounded; the voltage monitoring unit 11 is connected with the MCU12 through a communication line, the voltage monitoring unit 11 is also connected with a voltage input port, and the voltage monitoring unit 11 is used for detecting the voltage input to each group of modulation units and sending the voltage to the MCU12; the MCU12 is used to generate a pulse width modulated PWM signal and to adjust the duty cycle of the PWM signal according to the voltage, the PWM signal being used to adjust the input voltage through each set of modulation units. The maximum power of the loop device provided by the device can be determined through the number of the modulation units, and the working power of the modulation units can be adjusted through PWM signals according to the actual voltage, so that the effect of accurately adjusting the power of the loop device is achieved.
Fig. 3 is a schematic structural diagram of a second embodiment of a loop back device for a switch according to the present application, as shown in fig. 3, on the basis of the first embodiment, each group of modulation units 13 in the loop back device includes:
A transistor 131, a first power resistor 132, and a plurality of second power resistors 133.
One end of the first power resistor 132 is connected with a GPIO pin of the MCU12, and the other end of the first power resistor is connected with a base electrode of the triode 131;
One end of the second power resistor 133 is connected to the collector of the triode 131, and the other end is connected to the voltage input port 14, and the voltage input port 14 is used for connecting an external switch to obtain voltage. The second power resistor 133 is used to generate power consumption, and other components may be used to achieve the same function.
In one implementation, the modulation unit 13 includes a plurality of second power resistors 133, where the plurality of second power resistors 133 are connected in parallel, and one end of the second power resistor is connected to the collector of the triode 131 after being connected in parallel, and the other end of the second power resistor is connected to the voltage input port 14.
In another implementation, the plurality of second power resistors are connected in series.
The emitter of transistor 131 is grounded.
The MCU12 generates a PWM signal by controlling a level change of a GPIO pin to which the first power resistor 132 is connected to the MCU 12. The PWM signal has a period including a high level time and a low level time. The pulse width is the time of the high level, usually expressed in terms of duty cycle (ratio of high level time to period). When an analog power consumption determination is required, the duty cycle of the PWM signal for each group of modulation units is determined at the nominal voltage. The duty cycle of the PWM signal when the voltage varies. The PWM signal can control the level on the collector electrode of the triode, when the level is high, the triode is conducted, when the level is low, the triode is disconnected, the average voltage input into the loop device can be adjusted by adjusting the duty ratio, and then the power consumption of the loop device is changed.
In the loop device provided by the embodiment, the MCU generates PWM signals by changing the level change of the GPIO pin to control the on-off of the triode; when the power of the loop device needs to be regulated, the power generated by the second power resistor in the modulation unit can be changed only by changing the duty ratio of PWM, so that the real-time regulation of the power of the loop device is realized.
Fig. 4 is a schematic structural diagram of a third embodiment of a loop back device for a switch according to the present application, as shown in fig. 4, where on the basis of any one of the foregoing embodiments, the loop back device further includes: I2C bus interface 15.
The I2C bus interface 15 is connected to the MCU12 through an I2C bus, and the I2C bus interface 15 is configured to receive an externally input instruction. Optionally, the I2C bus interface 15 is disposed in a golden finger of the loop device, and the transmission of information from the outside to the MCU12 is implemented through the golden finger.
When the user needs to adjust the settings of the loop back device, a command is sent to the MCU12 through the I2C bus interface.
The externally input instruction may be an instruction to change the configuration of the GPIO registers to which the modulation units are connected, for changing the number of modulation units that are enabled.
The externally input instruction may also be an instruction to modify the bit signal PRESENT. The numerical value in the register can be modified through the instruction to simulate the signal in-place condition, the manual intervention of the plugging operation is not needed, the labor cost can be saved compared with the traditional manual plugging operation, the abrasion of the plugging operation to the golden finger is reduced, and the service life of the product is prolonged. The conventional golden finger is plugged and pulled for about 500 times, the service life can be greatly prolonged through the mode, testing by a tester is facilitated, the golden finger is not required to be plugged and pulled back and forth, and labor is saved.
Optionally, the loop back device further includes any one of the following interfaces: through an asynchronous serial port (Universal Asynchronous Receiver/Transmitter, abbreviated as UART), a synchronous serial peripheral interface (SERIAL PERIPHERAL INTERFACE, abbreviated as SPI), or a universal serial bus interface (Universal Serial Bus, abbreviated as USB). Communication between the MCU12 and the outside is achieved through the above-described interface.
Optionally, a field replaceable unit (Force Research Unit, abbreviated as FRU) of the MCU12 may record key vendor information, SN number, and adjustable power range information. The user can read the information in the FRU to confirm the simulatable power range of the loop back device.
Fig. 5 is a schematic structural diagram of a fourth embodiment of a loop back device for a switch according to the present application, as shown in fig. 5, on the basis of the third embodiment, the loop back device further includes: BOOT0 pin 16.
A user may modify the register configuration corresponding to the BOOT0 pin through the I2C bus interface and may pull the BOOT0 pin 16 high or low.
The I2C bus interface is used to perform a firmware upgrade to MCU12 when BOOT0 pin 16 is pulled high.
The I2C bus interface is configured to receive an externally input instruction when the BOOT0 pin 16 is pulled low.
In this embodiment, the upgrade firmware and command transmission of the loop device are both performed through the same I2C channel, so as to distinguish the two functions, and only when the BOOT0 of the MCU12 is pulled high, the operation of the upgrade instruction can be performed. This prevents firmware from being misplaced due to a mishandling command.
Fig. 6 is a schematic structural diagram of a fifth embodiment of a loop back device for a switch according to the present application, where, as shown in fig. 6, the loop back device further includes: a receive interface RX 17 and a transmit interface TX 18;
The TX and RX may be interconnected within the MCU12 or connected externally to the MCU bypassing the MCU for use in simulating the data exchange process, with the data of the switch being received by the RX of the loop back means and returned to the switch by the TX. In fig. 6 it is schematically shown that TX and RX are interconnected outside the MCU.
Optionally, an attenuation network 19 is provided between TX and RX.
The attenuation network 19 is usually designed as a circuit or a network of combined resistors and capacitors for attenuating the analog signal during transmission. The attenuation network can be controlled by the MCU, and the user can select different attenuation types by sending instructions. The attenuation network may include different types of attenuation such as impedance mismatch, signal propagation delay, etc. on the transmission line. Attenuation networks are used to simulate different application scenarios such networks can simulate resistive losses as signals travel over long distance transmission lines.
Exemplary:
1. The attenuation network is a resistive attenuation network: using resistors in series or parallel, for example:
TX-R1-R2-RX; wherein R1 and R2 are resistors connected in series.
Such networks may simulate resistive losses as signals travel over long distance transmission lines.
2. The attenuation network is a low-pass filter attenuation network:
Low pass filters using inductive and capacitive components, such as:
TX-L1-C1-RX; where L1 represents inductance and C1 represents capacitance.
This may simulate high frequency attenuation of the signal on the transmission line, especially in long distance transmissions.
The choice of these exemplary attenuation networks depends on the particular signal attenuation conditions and application scenario that need to be simulated. In design, the appropriate circuit elements may be selected according to the scene actually to be simulated.
Fig. 7 is a schematic structural diagram of a sixth embodiment of a loop device for a switch according to the present application, as shown in fig. 7, on the basis of any one of the above embodiments, a voltage monitoring unit 11 is further connected to a voltage input port of an MCU12, and the voltage monitoring unit 11 is configured to detect a voltage input to the MCU 12.
The voltage input port of the MCU12 and the voltage input port of the modulation unit may be the same, and they are powered by a gold finger, or may be different power supply ports.
The voltage monitoring unit 11 is also used for detecting current and temperature.
The MCU12 is further configured to read the data detected by the voltage monitoring unit 11 (including the data input to the MCU12 and the data input to the modulation unit), and when any one of the voltage, the current, and the temperature in the read data exceeds the monitoring range, power consumption setting is stopped (i.e. power is not regulated according to the real-time voltage any more) or working power is reduced, so as to protect equipment safety.
Optionally, the loop device further includes an LED indicator, indicating the power consumption state of the loop device, when the indicator indicates a green light, indicating no power consumption setting, and when the indicator indicates a red light, indicating to turn on the power consumption setting, so that a tester can clearly distinguish whether the power consumption setting is made.
In the loop device provided in this embodiment, the voltage monitoring unit 11 is further connected to the voltage input port of the MCU12, monitors the voltage, current and temperature input to the MCU12, and stops the power consumption setting to protect the equipment safety when the voltage, current and temperature exceed the monitoring range, thereby improving the equipment safety.
Fig. 8 is a schematic flow chart of a first embodiment of a loop-back method for a switch, which is applied to a micro control unit MCU of a loop-back device, as shown in fig. 8, and the method includes:
S801, acquiring voltage acquired by a voltage and current monitoring unit.
Firstly, the circuit design of the loop device is designed according to the power required to be simulated in advance, specifically, the power of an optical module required to be simulated is determined, the input voltage of the loop device is 3.3v, the power of each group of modulation units under 3.3v is 1.5W, and the number of modulation units required to be started is determined according to the power required to be simulated. For example, it is required to simulate 8W of power, and at least 6 groups of modulation units are required without considering the consumed power of the MCU and the voltage and current monitoring unit, the MCU enables modification of the values in GPIO registers connected to the 6 groups of modulation units, so that the 6 groups of modulation units are in an operable state. Meanwhile, the power consumption of the 6 groups of modulation units is 9W and is larger than 8W to be simulated, the power consumption of the 6 groups of modulation units needs to be reduced, otherwise, the heat dissipation of the loop device is increased, and therefore, the MCU reduces the average voltage of the units through PWM signals, the power consumption of each group of modulation units reaches 1.33W, and the accurate simulation can be realized.
After the design of the loop device is completed, the power consumption setting can be started, namely, the power consumption setting can be modified according to a command instruction, namely, any power between the maximum value and the minimum value of the power of the loop device can be regulated and controlled through the modulation of the PWM signal. By way of example, in the above example, a power of 8W was simulated, and by setting the power to 4W by software, the duty cycle of the PWM signal was reduced by half.
In the use process of the loop device, the voltage loaded on the modulation unit is not fixed, when the voltage loaded on the modulation unit exceeds 3.3V, the power is higher, and when the voltage is lower than 3.3V, the power is lower. Therefore, the MCU reads the voltage loaded on the modulation unit detected by the voltage monitoring unit in real time through the I2C bus, or the voltage monitoring unit sends the detected voltage data on the modulation unit to the MCU at fixed time.
Optionally, current and temperature data also collected by the voltage monitoring unit are obtained.
S802, inquiring the duty ratio of the pulse width modulation PWM signals from a preset corresponding table according to the voltage and the current set power, wherein the corresponding table stores the duty ratio of the PWM signals corresponding to a plurality of groups of voltages corresponding to each power.
In this step, the MCU stores a preset correspondence table in which the duty ratio of the PWM signal at different voltages is actually measured for each group of power. For example, at 8W power, the duty cycle of the PWM signal is at 3.1v,3.15v,3.2v,3.25v,3.3v voltages, respectively. Similarly, the corresponding table stores the duty ratios of the PWM signals at different voltages at other powers.
The duty cycle of the PWM signal may be determined from a lookup table of the measured voltage and the current set power, which is input to the inside of the MCU through the interface by the user.
S803, generating a target PWM signal according to the inquired duty ratio of the PWM signal.
In this step, the PWM signal currently being used, including the frequency and the initial duty cycle, is acquired, and the duty cycle is adjusted according to the duty cycle of the PWM signal you have queried and the frequency of the PWM signal being used. If the target duty cycle is higher than the original duty cycle, the pulse width needs to be increased; if it is lower, the pulse width needs to be reduced. Generating a target PWM signal using the adjusted duty cycle and the frequency of the original PWM signal.
S804, the target PWM signal is output to at least one modulation unit.
In this step, the MCU outputs the target PWM signal according to a level change on an output pin to which the target PWM signal is connected to the modulation unit.
The MCU controls a plurality of groups of modulation units according to the target PWM signals, so that each GPIO pin can be independently controlled according to the voltage of each group of modulation units, and the pins of the plurality of groups of modulation units can be controlled together to output PWM signals according to the voltage of the modulation units.
When the loop device works, data transmitted by the RX receiving switch returns to the switch through the TX, and the interaction process of the switch and the optical module is simulated in the mode, so that the condition that the bending wiring data is damaged in the prior art is avoided, and in addition, the loop device can accurately simulate the working power of the optical module, and the testing accuracy can be improved.
The embodiment provides a loop-back method for a switch, when a loop-back device is plugged in the switch, the loop-back device needs to be powered on from the switch, but the power simulated by the loop-back device is caused to have errors due to voltage change, so that an MCU obtains the voltage loaded on a modulation unit, changes the duty ratio of a PWM signal of the modulation unit according to the voltage actually measured, and modulates the power of the loop-back device according to the changed PWM signal, so that the power of the loop-back device can accurately simulate the working power of an optical module.
The method for carrying out loop-back through the loop-back device simulates the mode of sending packets and streaming of the optical module, can restore the power consumption environment of the real optical module according to accurate power consumption simulation, conveniently tests the data service port of the switch, and has high efficiency. When the test is developed, the true module is not required to be adopted for the test, and all functional development can be completed only by a low-price loop-back device. And the loop device can simulate different power consumption environments, does not need to buy a plurality of types of fixed-power-consumption loopbacks, and is convenient to control. The redundant cable plugging and unplugging operations can be reduced in the production test.
When the user needs to upgrade the firmware of the loop back device or send a command, the host equipment of the user is connected with the MCU through the I2C bus interface, and the same channel is used for upgrading the firmware and issuing the command. To prevent misoperation, the operation of the upgrade instruction is only executed when the BOOT0 pin of the MCU is pulled high, and the default BOOT0 pin is pulled low, so that the instruction can be transmitted when the BOOT0 pin is pulled low. Additional precautions are ensured in upgrading the firmware by a hardware switch (BOOT 0 pin), which may prevent unexpected firmware upgrades from occurring during normal transmission of instructions.
After receiving the voltage, the MCU also needs to judge the voltage, judges whether the voltage exceeds a preset range, and stops the power consumption setting or turns off a power supply switch of the loop device when the voltage exceeds the preset range, so that the safety of equipment is protected. The voltage is not only the voltage applied to the modulation unit, but also the voltage supplying the MCU.
Optionally, the voltage needs to be judged, the temperature needs to be monitored, and when the temperature exceeds a preset range, the power consumption setting is stopped or the power supply switch of the loop device is disconnected.
When a user needs to simulate a plug signal, the user does not need to plug the golden finger any more, and only needs to input a command to modify the numerical value of the in-place signal PRESENT in a register, so that the situation that the signal is in place or not in place can be simulated, the manual intervention plug operation is not needed, the labor cost can be saved compared with the traditional manual plug operation, the abrasion of the plug operation on the golden finger is reduced, and the service life of a product is prolonged. The conventional golden finger plug is about 500 times, the service life of the scheme can be greatly prolonged, the testing personnel can conveniently test the golden finger plug, the golden finger plug is not used for the back and forth plug operation, and the labor is saved.
TX and RX of data transmission in the MCU are directly interconnected, the total data transmission bandwidth can be increased in the MCU by using a multi-channel (a plurality of Lanes), each Lane is an independent communication channel and is responsible for transmitting data, and the maximum data transmission rate which can be supported by each independent channel (Lane) is 112Gbps. It is understood that TX and RX are directly interconnected, supporting 112Gbps for a single Lane. The MCU can receive instructions input by a user, and change attenuation network configuration between TX and RX so as to simulate different application scenes.
The configuration of the attenuation network may take one or more of the following configurations, and the type of attenuation network between TX and RX may be changed according to user instructions.
High attenuation scene: the use of an attenuation network introduces more signal attenuation, simulating the performance of a signal in long distance transmission or high noise environments.
Frequency response scenario: attenuation networks using low-pass or high-pass filters, analog signals attenuate over a specific frequency range to test the robustness of the system to the frequency response.
Transmission line model scenario: the attenuation network is designed to simulate the capacitance, inductance and resistance of the transmission line to investigate the adaptability of the system to the effects of the transmission line.
Jitter and clock synchronization scenarios: an attenuation network is introduced to simulate clock jitter to verify the performance of the system under different clock synchronization conditions.
According to the embodiment, the simulation reality can be improved by configuring the attenuation network between the TX and the RX, the attenuation network can be selected through the command according to the user requirement, and the diversity of simulation scenes is improved.
Fig. 9 is a schematic structural diagram of a loop back device according to the present application, as shown in fig. 9, the device 900 includes:
an acquisition module 911 for acquiring the voltage acquired by the voltage and current monitoring unit;
The query module 912 is configured to query the duty ratio of the PWM signal from a preset corresponding table according to the voltage and the current set power, where the corresponding table stores the duty ratios of the PWM signals corresponding to multiple groups of voltages corresponding to each power;
A generating module 913, configured to generate a target PWM signal according to the duty cycle of the queried PWM signal;
An output module 914 for outputting the target PWM signal to at least one modulation unit.
Optionally, the apparatus further comprises a receiving module 915, which is configured to receive an externally input instruction.
Optionally, the instruction is to modify the bit signal PRESENT.
Optionally, when the BOOT0 pin is pulled up, the receiving module is configured to receive an instruction for firmware upgrade of the MCU;
Optionally, when the BOOT0 pin is pulled down, the receiving module is configured to receive an externally input instruction.
Optionally, the apparatus further includes: a data interaction module, which is used for the data interaction module,
The data interaction module is used for receiving data input by RX and transmitting the data through TX and is used for simulating a data exchange process.
Optionally, the data interaction module further includes an attenuation network sub-module, different attenuation network sub-modules represent different application scenarios, and the data interaction module is further configured to select a corresponding attenuation network sub-module according to a user instruction.
The loop back device provided by the embodiment of the present application is used for implementing the loop back method for the switch described in any one of the foregoing method embodiments, and the implementation principle and the technical effect are similar, and are not described herein.
In the physical device of any of the loop back apparatuses, the MCU may also use a central processing unit (Central Processing Unit, CPU), or other general purpose Processor, microprocessor (Micro Processor Unit, MPU), digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may be a separate memory unit or may be a memory unit integrated in the MCU. The memory stores therein the computer operation instructions and the correspondence table referred to in the above embodiment.
All or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a readable memory. The program, when executed, performs steps including the method embodiments described above; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state disk, magnetic tape (MAGNETIC TAPE), floppy disk (floppy disk), optical disk (optical disk), and any combination thereof.
The present application also provides a computer-readable storage medium having stored therein computer-executable instructions for implementing a loop-back method for a switch as in any of the foregoing method embodiments when executed by a processor.
It will be appreciated that the memory in embodiments of the application may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an erasable programmable ROM (erasable PROM), an electrically erasable programmable EPROM (EEPROM), or a flash memory. The volatile memory may be random access memory (random access memory, RAM) which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (STATIC RAM, SRAM), dynamic random access memory (DYNAMIC RAM, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (doubledata RATE SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous link dynamic random access memory (SYNCHLINK DRAM, SLDRAM), and direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the above-referenced memories are intended to comprise, without being limited to, these and any other suitable types of memories.
Embodiments of the present application also provide a computer program product, which includes a computer program stored in a computer readable storage medium, from which at least one processor can read the computer program, and when the at least one processor executes the computer program, the loop-back method for a switch according to any one of the foregoing method embodiments can be implemented.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1.A loop back apparatus for a switch, the loop back apparatus comprising:
the device comprises a voltage monitoring unit, a micro control unit MCU and a plurality of groups of modulation units;
The control end of each group of modulation units is connected with the general purpose input/output port GPIO of the MCU, the input end of each group of modulation units is connected with the voltage input port, and the output end of each group of modulation units is grounded;
The voltage monitoring unit is connected with the MCU through a communication line, is also connected with the voltage input port, and is used for detecting the voltage input to each group of modulation units and sending the voltage to the MCU;
The MCU is used for generating Pulse Width Modulation (PWM) signals and adjusting the duty ratio of the PWM signals according to the voltage, wherein the PWM signals are used for adjusting the input voltage passing through each group of modulation units.
2. The loop back apparatus of claim 1, wherein each set of modulation units comprises:
The triode, the first power resistance, a plurality of second power resistances;
one end of the first power resistor is connected with the GPIO pin of the MCU, and the other end of the first power resistor is connected with the base electrode of the triode;
One end of the second power resistors are connected with the collector electrode of the triode, and the other end of the second power resistors are connected with a voltage input port which is used for being connected with an external switch to obtain voltage;
And the emitter electrode of the triode is grounded.
3. Loop back apparatus according to claim 1 or 2, characterized in that the voltage monitoring unit is connected to the MCU via an integrated circuit bus I2C.
4. The loop back device according to claim 1 or 2, characterized in that the loop back device further comprises: an I2C bus interface;
the I2C bus interface is connected with the MCU, and the I2C bus interface is used for receiving an externally input instruction.
5. The loop back apparatus of claim 4 wherein the instruction is to modify a bit signal PRESENT.
6. The loop back device of claim 4, wherein the device further comprises: a BOOT0 pin;
When the BOOT0 pin is pulled up, the I2C bus interface is used for carrying out firmware upgrade on the MCU;
And when the BOOT0 pin is pulled down, the I2C bus interface is used for receiving an externally input instruction.
7. The loop back device according to claim 1 or 2, characterized in that the loop back device further comprises: a receiving interface RX and a transmitting interface TX;
The TX and the RX are interconnected for simulating a data exchange procedure.
8. The loop back apparatus of claim 7, wherein an attenuation network is disposed between the TX and RX.
9. Loop-back device according to claim 1 or 2, characterized in that the voltage monitoring unit is further connected to a voltage input port of the MCU, the voltage monitoring unit being adapted to detect a voltage input to the MCU.
10. A loop back method for a switch, characterized by a micro control unit MCU applied to the loop back device of any one of claims 1 to 9, the method comprising:
Acquiring voltage acquired by a voltage and current monitoring unit;
Inquiring the duty ratio of the Pulse Width Modulation (PWM) signals from a preset corresponding table according to the voltage and the current set power, wherein the corresponding table stores the duty ratio of the PWM signals corresponding to a plurality of groups of voltages corresponding to each power;
generating a target PWM signal according to the inquired duty ratio of the PWM signal;
the target PWM signal is output to at least one modulation unit.
CN202410165832.2A 2024-02-05 2024-02-05 Loop back device and method for switch Pending CN118041882A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410165832.2A CN118041882A (en) 2024-02-05 2024-02-05 Loop back device and method for switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410165832.2A CN118041882A (en) 2024-02-05 2024-02-05 Loop back device and method for switch

Publications (1)

Publication Number Publication Date
CN118041882A true CN118041882A (en) 2024-05-14

Family

ID=91003572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410165832.2A Pending CN118041882A (en) 2024-02-05 2024-02-05 Loop back device and method for switch

Country Status (1)

Country Link
CN (1) CN118041882A (en)

Similar Documents

Publication Publication Date Title
US7420375B2 (en) Method for digital bus testing
DE112009000147T5 (en) Mobile device that allows UART and USB communication using the same connector, and methods of operating the same
CN104733966A (en) Power distribution inside cable
US20080143370A1 (en) I/o port tester
CN108900251A (en) A kind of optimization method, device and the optical module of optical module balance parameters
CN103364599A (en) Probe having attenuating function, signal acquisition system and signal acquisition method
CN111586131A (en) Vehicle-mounted Ethernet fault injection test device and test method
JP7191083B2 (en) Charging device test board, test system and test method
US20060095216A1 (en) Optic module calibration using an enhanced golden module
CN211062033U (en) Test adapter and test equipment
CN110736953A (en) digital oscilloscope checking device
CN203261333U (en) Optical module debug system
CN111538630B (en) Evaluation board for simultaneously realizing time-sharing multiplexing of C2 bus and I2C bus of optical module
CN118041882A (en) Loop back device and method for switch
CN111929562B (en) Chip test system, test method, test response method of chip and chip
CN206402245U (en) A kind of test board
CN115904849B (en) PCIE link signal testing method, system, computer equipment and medium
CN102255654B (en) Light emission component testing tool and applied circuit thereof
CN208581235U (en) A kind of optical module for local loopback test
CN114448854B (en) Communication link operation characteristic test system and test method
CN103580971A (en) Multifunction vehicle bus interference device
RU2656095C2 (en) Emc test bench comprising item of equipment under test which is intended to be loaded on board aircraft
CN102164030B (en) Single-port communication circuit and communication method thereof
CN210123977U (en) Relay cable and augmented reality system
CN103344800B (en) Program-control electronic load for relay protection

Legal Events

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