A master-slave switching circuit supporting USB dual ports
By supporting a master-slave switching circuit for dual USB ports, efficient identification and switching of dual USB ports is achieved, solving the problems of switching delay and VBUS backflow in existing technologies, reducing hardware costs and improving system reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING DAHUA RADIO INSTR FACTORY
- Filing Date
- 2026-03-12
- Publication Date
- 2026-06-09
Smart Images

Figure CN122173431A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to USB interfaces, and more particularly to a master-slave switching circuit that supports dual USB ports. Background Technology
[0002] With the widespread adoption and diversification of electronic devices, the USB (Universal Serial Bus) interface has become one of the standard interfaces for data transmission and power supply between various devices. The USB interface is not only used for connecting computers to peripherals, but also widely used in mobile terminals, industrial control, power electronic equipment, and other scenarios. The emergence of USB OTG (On-The-Go) technology has further expanded the application scope of USB, enabling devices to act as hosts to control other USB slave devices, or as slave devices to be controlled by other hosts. However, traditional USB OTG designs typically only support single-port master-slave switching, which cannot meet the needs of dual USB ports in certain special scenarios, such as power electronic equipment or industrial control equipment that requires simultaneous connection of master and slave USB ports. Therefore, how to implement dual-port master-slave identification and switching based on a USB controller has become an urgent problem to be solved in practical engineering.
[0003] Furthermore, VBUS (Voltage Bus) management of the USB interface is a critical issue in the design. Power supply and reverse current protection for VBUS are particularly important when switching between master and slave modes. Traditional VBUS management schemes may suffer from switching delays, power supply conflicts, or reverse current risks, leading to device damage or unstable data transmission. Therefore, there is an urgent need for a circuit design that can efficiently manage dual USB ports, support dynamic master-slave switching, and provide reliable VBUS protection.
[0004] Existing technology and its limitations:
[0005] Currently, most common USB master-slave switching solutions on the market are based on a single USB OTG controller, which identifies the device role (master or slave) through the level state of the ID pin. However, these solutions typically only support master-slave switching for a single physical port and cannot meet the application requirements that need dual USB ports to work independently.
[0006] In existing technologies, implementing dual USB ports on the same device typically requires integrating two independent USB controllers. This not only increases hardware costs and circuit complexity but may also lead to signal interference and increased power consumption. Furthermore, traditional USB switching circuits have deficiencies in VBUS power management, making them prone to voltage backflow. During mode switching, VBUS voltage may flow backward into circuits that should not be powered, causing device damage or system malfunction.
[0007] Furthermore, existing solutions are insufficient in terms of hot-plug identification and mode switching response speed, failing to promptly shut down the power supply link when no external host device is connected, resulting in the system's inability to quickly and reliably switch operating states. Therefore, the existing technology lacks a circuit solution that is simple in structure, cost-effective, supports dual USB ports, and can achieve reliable master-slave switching and VBUS backflow protection.
[0008] In view of this, the present invention is hereby proposed. Summary of the Invention
[0009] The purpose of this invention is to provide a master-slave switching circuit that supports USB dual ports, so as to solve the above-mentioned technical problems existing in the prior art.
[0010] The objective of this invention is achieved through the following technical solution:
[0011] Supports a master-slave switching circuit for dual USB ports, including a USB master port, a USB slave port, a DP / DM differential signal multiplexing switch circuit, a VBUS conversion circuit, a VBUS detection circuit, a USB control circuit, an MCU control circuit, and a power supply circuit.
[0012] The USB master port and USB slave port are respectively connected to the USB control circuit through a DP / DM differential signal multiplexing switch circuit, and the USB control circuit and the DP / DM differential signal multiplexing switch circuit are respectively connected to the MCU control circuit.
[0013] The USB master port and USB slave port are respectively connected to the VBUS conversion circuit, and the interface between the USB slave port and the VBUS conversion circuit is connected to a VBUS detection circuit, which is connected to the MCU control circuit.
[0014] The power supply circuit is connected to the VBUS conversion circuit and the MCU control circuit respectively.
[0015] Compared with the prior art, the master-slave switching circuit for dual USB ports provided by the present invention realizes dual USB ports through a USBOTG interface, supporting scenarios that require dual USB ports in special use cases; it adopts a dual-channel VBUS protection circuit to provide VBUS backflow prevention design. Attached Figure Description
[0016] Figure 1 A block diagram of a master-slave switching circuit supporting USB dual ports is provided for embodiments of the present invention.
[0017] Figure 2 A schematic diagram illustrating the principle of a master-slave switching circuit supporting USB dual ports is provided for embodiments of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them, and do not constitute a limitation on the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the protection scope of the present invention.
[0019] First, the following explanations are provided for the terms that may be used in this article:
[0020] The term "and / or" means that either or both can be achieved simultaneously. For example, X and / or Y means that it includes both "X" or "Y" as well as the three cases of "X and Y".
[0021] The terms "comprising," "including," "containing," "having," or other similar semantic descriptions should be interpreted as non-exclusive inclusion. For example, including a technical feature element (such as raw material, component, ingredient, carrier, dosage form, material, size, part, component, mechanism, device, step, process, method, reaction conditions, processing conditions, parameter, algorithm, signal, data, product or article of manufacture, etc.) should be interpreted as including not only the expressly listed technical feature element, but also other technical feature elements that are not expressly listed and are well-known in the art.
[0022] The term "composed of" excludes any technical features not expressly listed. When used in a claim, it closes the claim to exclude all technical features other than those expressly listed, except for associated conventional impurities. If the term appears only in a clause of a claim, it limits the claim to the elements expressly listed in that clause; elements recited in other clauses are not excluded from the overall claim.
[0023] The term "parts by mass" indicates the mass ratio between multiple components. For example, if component X is described as x parts by mass and component Y as y parts by mass, then the mass ratio of component X to component Y is x:y. One part by mass can represent any mass; for example, one part by mass can be expressed as 1 kg or 3.1415926 kg, etc. The sum of the parts by mass of all components is not necessarily 100 parts; it can be greater than 100 parts, less than 100 parts, or equal to 100 parts. Unless otherwise stated, parts, proportions, and percentages mentioned herein are all measured by mass.
[0024] Unless otherwise explicitly specified or limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this document according to the specific circumstances.
[0025] When concentration, temperature, pressure, size, or other parameters are expressed as numerical ranges, such ranges should be understood to specifically disclose all ranges formed by any pairing of upper limits, lower limits, or preferred values within that range, regardless of whether the range is explicitly stated; for example, if the numerical range "2 to 8" is stated, then that range should be interpreted to include ranges such as "2 to 7", "2 to 6", "5 to 7", "3 to 4 and 6 to 7", "3 to 5 and 7", "2 and 5 to 7", etc. Unless otherwise stated, the numerical ranges described herein include both their endpoints and all integers and fractions within that range.
[0026] The terms “center,” “longitudinal,” “lateral,” “length,” “width,” “thickness,” “up,” “down,” “front,” “back,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inner,” “outer,” “clockwise,” and “counterclockwise” indicate the current orientation or positional relationship, and are only for the convenience and simplification of description, and do not explicitly or implicitly suggest that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this document.
[0027] The technical solution provided by this invention will be described in detail below. Contents not described in detail in the embodiments of this invention are prior art known to those skilled in the art. Where specific conditions are not specified in the embodiments of this invention, they shall be performed according to conventional conditions in the art or conditions recommended by the manufacturer. Reagents or instruments used in the embodiments of this invention whose manufacturers are not specified are all conventional products that can be purchased commercially.
[0028] like Figure 1 As shown, a master-slave switching circuit supporting dual USB ports includes a USB master port, a USB slave port, a DP / DM differential signal multiplexing switch circuit, a VBUS conversion circuit, a VBUS detection circuit, a USB control circuit, an MCU control circuit, and a power supply circuit.
[0029] The USB master port and USB slave port are respectively connected to the USB control circuit through a DP / DM differential signal multiplexing switch circuit, and the USB control circuit and the DP / DM differential signal multiplexing switch circuit are respectively connected to the MCU control circuit.
[0030] The USB master port and USB slave port are respectively connected to the VBUS conversion circuit, and the interface between the USB slave port and the VBUS conversion circuit is connected to a VBUS detection circuit, which is connected to the MCU control circuit.
[0031] The power supply circuit is connected to the VBUS conversion circuit and the MCU control circuit respectively.
[0032] The DP / DM differential signal multiplexing switch circuit enables a USB control circuit to identify and switch between USB master and slave ports, allowing the USB control circuit to switch mutually exclusively to two USB ports, which correspond to a USB slave device and a USB master device, respectively.
[0033] The MCU control circuit, as an active device, can autonomously select whether to support the working mode of the external USB device as master or slave. When the MCU control circuit is a USB master device, it is connected to the USB master port; when the MCU control circuit is a USB slave device, it is connected to the USB slave port.
[0034] When the MCU control circuit acts as the master device, it switches the DP / DM differential signal of the USB master port to the DP / DM link of the USB control circuit by controlling the multiplexing switch circuit.
[0035] The MCU configures the USB control circuit and converts the power supply voltage of the power supply circuit into VBUS voltage through the VBUS control signal of the USB control circuit, and then connects it to the USB master port power supply link to supply power to the external USB slave device.
[0036] At the same time, the VBUS conversion circuit outputs a VBUS high-level voltage to the USB control circuit, enabling the USB control circuit to communicate with the USB slave device at the USB master port.
[0037] When the MCU control circuit acts as a slave device, it switches the DP / DM differential signal of the USB slave port to the DP / DM link of the USB control circuit by controlling the multiplexing switch circuit.
[0038] The MCU configures the USB control circuit and switches the USB from the VBUS voltage of the port to the VBUS input link of the USB control circuit through the VBUS control signal of the USB control circuit.
[0039] The USB port inputs a VBUS voltage signal to the VBUS detection circuit. When there is an external USB host device, the VBUS detection circuit outputs a high level VBUS Detect to the MCU. When there is no external USB host device, the VBUS detection circuit outputs a low level to the MCU.
[0040] When the MCU is in master mode, the power supply voltage of the power supply circuit needs to be supplied to the USB master port, but the power supply link from the USB slave port to the VBUS conversion circuit is disconnected.
[0041] When the MCU is in slave mode, the voltage link from the power supply circuit input to the VBUS conversion circuit is disconnected, and at the same time, the VBUS power supply link from the VBUS conversion circuit to the USB master port is disconnected, while the VBUS power supply link from the USB slave port to the USB control circuit is opened.
[0042] This ensures that when the MCU switches from USB master mode to USB slave mode, the VBUS power supply link of the USB master port can be shut down in time to protect the circuit.
[0043] In summary, the master-slave switching circuit supporting dual USB ports in this embodiment of the invention realizes dual USB ports through a single USB OTG interface, supporting scenarios requiring dual USB ports in special usage situations; it employs a dual-channel VBUS protection circuit to provide VBUS backflow prevention design.
[0044] To more clearly demonstrate the technical solution provided by the present invention and the resulting technical effects, the embodiments of the present invention will be described in detail below with reference to specific examples.
[0045] like Figure 1 As shown, the innovative points and principles of this invention are as follows:
[0046] The principle of this invention is to implement a USB (Universal Serial Bus) controller through a switching circuit and its auxiliary circuits to realize the identification and switching of USB master and slave ports. It can achieve mutual exclusion switching of a single USB control circuit to two USB ports, one corresponding to a USB slave device and the other to a USB master device.
[0047] like Figure 1 As can be seen, the circuit consists of a USB master port, a USB slave port, a DP / DM differential signal multiplexing switch, a VBUS (Voltage Bus) conversion circuit, a VBUS detection circuit, a USB control circuit, and an MCU (Microcontroller Unit) control circuit.
[0048] The working principle is as follows:
[0049] As an active device, the MCU can autonomously select whether to support the working mode of external USB devices as master or slave. When the MCU is a USB master device, it connects to the USB master port; when the MCU is a USB slave device, it connects to the USB slave port.
[0050] Therefore, when the MCU acts as the master device, it switches the DP / DM differential signal of the USB master port to the DP / DM link of the USB control circuit by controlling the multiplexing switch circuit. The MCU configures the USB control circuit and converts the power supply voltage of the power supply circuit into VBUS voltage through the VBUS control signal of the USB control circuit, and then connects it to the power supply link of the USB master port to power the external USB slave device. At the same time, the VBUS conversion circuit outputs a VBUS high-level voltage to the USB control circuit so that the USB control circuit is in the communication state with the USB slave device of the USB master port.
[0051] When the MCU acts as a slave device, it switches the DP / DM differential signal of the USB slave port to the DP / DM link of the USB control circuit through the control multiplexing switch circuit. The MCU configures the USB control circuit and switches the VBUS voltage of the USB slave port to the VBUS input link of the USB control circuit through the VBUS control signal of the USB control circuit. In addition, the VBUS voltage input signal of the USB slave port is sent to the VBUS detection circuit. When there is an external USB master device, the VBUS detection circuit outputs a high level VBUS Detect to the MCU; when there is no external USB master device, the VBUS detection circuit outputs a low level to the MCU.
[0052] In addition, the VBUS conversion circuit needs to perform the following functions: When the MCU is in master mode, the power supply voltage of the power supply circuit needs to be supplied to the USB master port, but the power supply link from the USB slave port to the VBUS conversion circuit is disconnected; when the MCU is in slave mode, the voltage link from the power supply circuit to the VBUS conversion circuit is disconnected, and at the same time, the VBUS power supply link from the VBUS conversion circuit to the USB master port is disconnected, while the VBUS power supply link from the USB slave port to the USB control circuit is opened; thus ensuring that when the MCU switches from USB master working mode to USB slave working mode, the VBUS power supply link of the USB master port can be shut down in time to protect the circuit.
[0053] Example 1
[0054] like Figure 2 As shown:
[0055] from Figure 2As can be seen from the diagram, the circuit consists of a USB master port, a USB slave port, a USB control circuit, an MCU control circuit, a power supply circuit, a VBUS conversion circuit 1, a VBUS conversion circuit 2, a VBUS detection circuit, and a DP / DM differential signal multiplexing switch circuit.
[0056] The specific functions of each circuit are as follows:
[0057] The USB host port provides a port for connecting USB slave devices.
[0058] The USB slave port provides a port for connecting to a USB host device.
[0059] The USB control circuit is mainly composed of Microchip's USB3320C chip, a highly integrated USB 2.0 transceiver chip that provides OTG (USB On-The-Go) functionality. The ID pin input of the USB3320C has the opposite level to the CPEN pin. That is, the high and low levels input from the ID pin of the USB3320C are respectively output as low and high levels on the CPEN pin, thereby setting the master / slave working mode of the USB through the ID pin.
[0060] The MCU provides user setting interaction functions and enables connection to the USB3320C chip pins of the USB control circuit via USB data line pins to implement the USB 2.0 data protocol.
[0061] The power supply circuit converts +12V into three operating voltages: +5V, +3.3V, and +1.8V for the circuit to use;
[0062] The VBUS conversion circuit 1 is mainly composed of MIC2025 (the high and low levels of the EN pin of MIC2025 control the on / off state from the IN pin to the OUT1 and OUT2 pins respectively, providing power on / off function). The VBUS conversion circuit 1 controls the on / off state of the VBUS link from the +5V power supply circuit to the USB control circuit through the USB_CPEN pin of the USB control circuit. An external diode is connected to realize reverse current protection.
[0063] VBUS conversion circuit 2 mainly consists of a PMOS (the threshold voltage of the PMOS is required to be greater than 3V; USB_CPEN controls the PMOS, high level is off, low level is on). VBUS conversion circuit 2 controls the on / off of the VBUS link from the USB slave port USB_MASTER_VBUS to VBUS conversion circuit 2 to USB control circuit through USB_CPEN. The function of the external diode is to realize the reverse flow protection.
[0064] The VBUS detection circuit converts the external USB host device's power supply voltage from 5V to 3.3V, and inputs the converted 3.3V voltage DETECT_3V3 to the MCU, allowing the MCU to read the hot-plug identification function of the external USB host device.
[0065] The multiplexing switch circuit mainly consists of a relay and an NMOS transistor (USB_CPEN controls the NMOS, high level is on, low level is off). When USB_CPEN is high, the relay opens the DP / DM link of the USB master port - multiplexing switch circuit - USB control circuit. When USB_CPEN is low, the relay opens the DP / DM link of the USB slave port - multiplexing switch circuit - USB control circuit.
[0066] When the MCU is operating in USB master mode, the MCU's USB_ID pin outputs a low level, and the USB_CPEN pin outputs a high level, turning off VBUS conversion circuit 2 and turning on VBUS conversion circuit 1. This means turning on the VBUS link from the +5V power supply circuit to the VBUS conversion circuit 1 and then to the USB control circuit. The multiplexer switch circuit turns on the DP / DM link from the USB master port to the multiplexer switch circuit and then to the USB control circuit. At the same time, the USB_MASTER_VBUS on the USB master port outputs the VBUS voltage to the external USB slave device.
[0067] When the MCU operates in USB slave mode, the MCU's USB_ID pin outputs a high level, and the USB_CPEN pin outputs a low level. This disables VBUS conversion circuit 1 and enables VBUS conversion circuit 2, thus opening the VBUS link from the USB slave port (USB_SLAVE_VBUS - VBUS conversion circuit 2 - USB control circuit). Simultaneously, the multiplexer circuit enables the DP / DM link from the USB slave port (multiplexer circuit - USB control circuit). Furthermore, the VBUS detection circuit converts the external USB host device's power supply voltage from 5V to 3.3V, thereby enabling the MCU to recognize the hot-plugging functionality of the USB host device.
[0068] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims. The information disclosed in the background section is intended only to enhance the understanding of the overall background technology of the present invention and should not be construed as an admission or implication in any way that such information constitutes prior art known to those skilled in the art.
Claims
1. A master-slave switching circuit supporting USB dual ports, characterized in that, It includes a USB master port, a USB slave port, a DP / DM differential signal multiplexing switch circuit, a VBUS conversion circuit, a VBUS detection circuit, a USB control circuit, an MCU control circuit, and a power supply circuit; The USB master port and USB slave port are respectively connected to the USB control circuit through a DP / DM differential signal multiplexing switch circuit, and the USB control circuit and the DP / DM differential signal multiplexing switch circuit are respectively connected to the MCU control circuit. The USB master port and USB slave port are respectively connected to the VBUS conversion circuit, and the interface between the USB slave port and the VBUS conversion circuit is connected to a VBUS detection circuit, which is connected to the MCU control circuit. The power supply circuit is connected to the VBUS conversion circuit and the MCU control circuit respectively.
2. The master-slave switching circuit supporting USB dual ports according to claim 1, characterized in that, The DP / DM differential signal multiplexing switch circuit enables a USB control circuit to identify and switch between USB master and slave ports, allowing the USB control circuit to switch mutually exclusively to two USB ports, which correspond to a USB slave device and a USB master device, respectively.
3. The master-slave switching circuit supporting USB dual ports according to claim 2, characterized in that, The MCU control circuit, as an active device, can autonomously select whether to support the working mode of the external USB device as master or slave. When the MCU control circuit is a USB master device, it is connected to the USB master port; when the MCU control circuit is a USB slave device, it is connected to the USB slave port.
4. The master-slave switching circuit supporting USB dual ports according to claim 3, characterized in that, When the MCU control circuit acts as the master device, it switches the DP / DM differential signal of the USB master port to the DP / DM link of the USB control circuit by controlling the multiplexing switch circuit. The MCU configures the USB control circuit and converts the power supply voltage of the power supply circuit into VBUS voltage through the VBUS control signal of the USB control circuit, and then connects it to the USB master port power supply link to supply power to the external USB slave device. At the same time, the VBUS conversion circuit outputs a VBUS high-level voltage to the USB control circuit, enabling the USB control circuit to communicate with the USB slave device at the USB master port.
5. The master-slave switching circuit supporting USB dual ports according to claim 3, characterized in that, When the MCU control circuit acts as a slave device, it switches the DP / DM differential signal of the USB slave port to the DP / DM link of the USB control circuit by controlling the multiplexing switch circuit. The MCU configures the USB control circuit and switches the USB from the VBUS voltage of the port to the VBUS input link of the USB control circuit through the VBUS control signal of the USB control circuit. The USB port inputs a VBUS voltage signal to the VBUS detection circuit. When there is an external USB host device, the VBUS detection circuit outputs a high level VBUS Detect to the MCU. When there is no external USB host device, the VBUS detection circuit outputs a low level to the MCU.
6. The master-slave switching circuit supporting USB dual ports according to any one of claims 1 to 5, characterized in that, The VBUS conversion circuit performs the following functions: When the MCU is in master mode, the power supply voltage of the power supply circuit needs to be supplied to the USB master port, but the power supply link from the USB slave port to the VBUS conversion circuit is disconnected. When the MCU is in slave mode, the voltage link from the power supply circuit input to the VBUS conversion circuit is disconnected, and at the same time, the VBUS power supply link from the VBUS conversion circuit to the USB master port is disconnected, while the VBUS power supply link from the USB slave port to the USB control circuit is opened. This ensures that when the MCU switches from USB master mode to USB slave mode, the VBUS power supply link of the USB master port can be shut down in time to protect the circuit.