USB master-slave mode switching circuit

By designing the USB master-slave mode switching circuit and using the slave device power supply control and the level switching of the USB_ID pin, the problems of difficult operation, high cost and low reliability of USB devices when switching between master and slave modes are solved, and high efficiency is achieved. Reliable communication link switching.

CN221811908UActive Publication Date: 2024-10-08SHANDONG YOU INTERNET OF THINGS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202323553256.9
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2024-10-08
Estimated Expiration
2033-12-25

Smart Images

  • Figure CN221811908U_ABST
    Figure CN221811908U_ABST
Patent Text Reader

Abstract

The utility model discloses a universal serial bus (USB) master-slave mode switching circuit, which comprises a master controller module, a slave device module, a slave device power supply control circuit module and an external interface module, the external interface module is connected with the master controller module to form a first communication channel, and the master controller module is connected with the slave device module to form a second communication channel. The slave equipment power supply control circuit module is connected with the slave equipment module to form a power supply path; the external interface module is in USB ID control connection with the master controller module and the slave device power supply control circuit module, so that when only one USB interface of the master device has an OTG function, other devices are not added, master-slave switching can be realized, and meanwhile, the reliability of a communication link can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The utility model relates to the technical field of USB interface data communication, in particular to a USB master-slave mode switching circuit. Background Art

[0002] USB devices are divided into USB host devices and USB slave devices. USB host devices obtain data from USB slave devices and update data in USB slave devices. Since the USB protocol adopts the master-slave working mode, that is, only the master device and the slave device can communicate with each other, there is a defect that USB host devices cannot communicate with each other, and slave devices cannot communicate with each other.

[0003] With the emergence of USB OTG technology, a device can switch between the master and slave devices in different situations. However, most of the current main control chips only have one USB interface that supports the OTG function. To achieve the master-slave mode switch in use, two solutions are generally adopted: Solution 1 is to achieve the master-slave mode switch of the device by setting pins on the circuit board and using jumper caps; Solution 2 is to achieve the master-slave mode switch of the device by setting analog switches and controlling the switch state of the analog switches. For Solution 1, it is generally used in the device development stage and needs to be switched manually. Once the device leaves the factory, the pins will be enclosed in the device shell, which has problems such as difficulty in operation, low efficiency, and lack of intelligence; For Solution 2, it is necessary to add an analog switch, which will increase the cost of the device. At the same time, the analog switch is unreliable in the communication path. When switching the master-slave mode of the USB device, as the number of analog switch switching increases, the analog switch may be damaged, and the reliability of the master-slave mode switch cannot be guaranteed, which will affect the connectivity of the communication path, and there are problems such as high cost and low reliability. Utility Model Content

[0004] In order to solve the technical problems existing in the prior art, the utility model provides a USB master-slave mode switching circuit, which can quickly and effectively realize the switching of devices between USB master-slave modes, and can also ensure the reliability of the communication link.

[0005] To achieve the above purpose, the utility model is implemented through the following technical solutions:

[0006] The utility model provides a USB master-slave mode switching circuit, comprising a master controller module, a slave device module, a slave device power supply control circuit module and an external interface module;

[0007] The external interface module is connected to the main controller module to form a first communication path; the main controller module is connected to the slave device module to form a second communication path; the slave device power supply control circuit module is connected to the slave device module to form a power supply path;

[0008] The external interface module is controlled and connected to the main controller module and the slave device power supply control circuit module respectively.

[0009] Furthermore, the slave device module is a single slave device.

[0010] Further, alternatively, the slave device module is a hub module.

[0011] Furthermore, the hub module is connected to one or more slave devices.

[0012] Furthermore, the main controller module includes a first USB data pin and a first USB_ID pin.

[0013] Furthermore, the first USB data pin is connected to the slave device module.

[0014] Furthermore, the first USB data pin is connected to an external interface module.

[0015] Furthermore, the external interface module includes a second USB data pin and a second USB_ID pin.

[0016] Furthermore, the second USB_ID pin is connected to a slave device power supply control circuit module.

[0017] Furthermore, the second USB_ID pin is connected to the first USB_ID pin of the main controller module.

[0018] Beneficial effects of the utility model:

[0019] The utility model provides a USB master-slave mode switching circuit. When a main control device has only one USB interface supporting an OTG function, the circuit can realize the master-slave switching and also ensure the reliability of the communication link.

[0020] In the utility model, no other devices are added to the USB interface connection, and the USB paths are directly connected. Since no additional USB control switching devices are added, the reliability of communication can be guaranteed, and at the same time, a switching switch is saved, and the device cost and the cost of repair in case of problems are saved.

[0021] The utility model cuts off the influence of the USB slave device on the USB link by controlling the power supply on and off of the slave device, because USB communication does not support one-to-many but only one-to-one. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a structural diagram of a USB master-slave mode switching circuit connected to a single slave device in Example 1;

[0023] Figure 2 This is a structural diagram of a USB master-slave mode switching circuit connecting multiple slave devices in Example 2;

[0024] Figure 3 Schematic diagram of the main controller module in this embodiment;

[0025] Figure 4 is a schematic diagram of an external interface module in this embodiment;

[0026] FIG5(a) is a schematic diagram of a single slave device module in Embodiment 1, and FIG5(b) is a schematic diagram of multiple slave devices in Embodiment 2;

[0027] Figure 6 is a schematic diagram of a hub module in Embodiment 2;

[0028] Figure 7 Schematic diagram of the power supply control circuit module in this embodiment. DETAILED DESCRIPTION

[0029] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0030] Example 1

[0031] See also Figure 1 As shown, the utility model provides a USB master-slave mode switching circuit, including a master controller module, a slave device module, a slave device power supply control circuit module and an external interface module;

[0032] The external interface module is connected to the main controller module to form a first communication path; the main controller module is connected to the slave device module to form a second communication path; the slave device power supply control circuit module is connected to the slave device module to form a power supply path;

[0033] The external interface module is controlled and connected to the main controller module and the slave device power supply control circuit module respectively.

[0034] In this embodiment, the slave device module is a single slave device. As shown in FIG5(a), the slave device module includes USB_DP, USB_DM, VCC, and GND pins, which are respectively connected to corresponding pins in the main controller module and the external interface module.

[0035] The slave device module refers to a slave device, which is integrated with the main controller chip inside the device. The slave device is a general interface device, such as a USB to RJ45 conversion interface chip. The internal circuit of the chip is connected to the peripheral circuit to form pins, which constitute the interface of the chip and use the USB interface for communication.

[0036] In this embodiment, if Figure 3 As shown, the main controller module includes a first USB data pin, a first USB_ID pin, a power pin USB_VBUS, a ground pin USB_GND and a VCC_IN pin; wherein the first USB data pin is USB_DP and USB_DM, and the first USB data pin is connected to the slave device module and the external interface module respectively; the first USB_ID pin is connected to the second USB_ID pin of the external interface module.

[0037] In this embodiment, if Figure 4 As shown, the external interface module includes a second USB data pin, a second USB_ID pin, a power pin USB_VBUS and a ground pin USB_GND, and the second USB data pin is USB_DP and USB_DM; wherein the second USB data pin of the external interface module is respectively connected to the first USB data pin of the main controller module and the USB data pin of the slave device module, and the second USB_ID pin of the external interface module is respectively connected to the first USB_ID pin of the main controller module and the USB_ID of the slave device power supply control circuit module.

[0038] In the external interface module, the control connection is USB ID control, and the high and low levels of the second USB_ID pin are controlled by whether an external OTG line is inserted or not.

[0039] The external interface module is the USB interface, which is a serial bus standard that regulates the connection and communication between computers and external devices. The USB interface with OTG function can realize direct connection and data transmission between devices. The OTG interface allows an OTG-supported device to act as a master device and connect to other USB devices as slave devices to realize data transmission, file sharing and other functions.

[0040] In this embodiment, if Figure 7 As shown, the slave device power supply control circuit module controls the power supply of the slave device module, and the slave device power supply control circuit module specifically includes: resistors R1, R2, R3, R4, R5, R6 and capacitors C1, C2 and MOS tubes Q1, Q2; wherein: the power supply VCC is connected to one end of the resistor R4, the other end of the resistor R4 is respectively connected to one end of R2, R3 and the gate G of Q1, the other end of the resistor R2 is connected to the source S of Q1 and grounded, and R2 is connected in parallel with the capacitor C1, and the other end of the resistor R3 is connected to the second USB_ID pin; the power supply VCC is respectively connected to one end of the resistor R5 and the source S of Q2, R5 is connected in parallel with the capacitor C2, the other end of R5 is connected to one end of R1 and connected to the gate G of Q2, and the other end of the resistor R1 is connected to the drain D of Q1; one end of the resistor R6 is respectively connected to the drain D of Q2 and the VCC end, and the other end is grounded.

[0041] In this embodiment, the resistor R1 is 1K-F, R2 is 56K-F, R3 is 1K-F, R4 is 100K-F, R5 is 10K-F, and R6 is 10K-F; the capacitor C1 is marked as 4.7uF / 10V / 10%, and C2 is marked as 100nF / 25V / 10%; the MOS tube Q1 is marked as SI2302 / A2SHB, and Q2 is marked as YJL2301C.

[0042] In the power supply control circuit, the USB_ID pin of the externally inserted OTG line is low level by default, USB_ID access is low level, Q1 is not conducting and Q2 is not conducting, VCC and VCC_IN are not connected, VCC_IN is not powered, that is, VCC is not powered, and the power supply of the slave device is disconnected;

[0043] USB_ID is floating and not connected, Q1 and Q2 are turned on, VCC and VCC_IN are connected, VCC_IN supplies power to VCC, and thus supplies power to the slave device.

[0044] It should be noted here that the power supply control circuit Figure 7 In addition to the structure in, other existing circuits can also be used to implement it. Those skilled in the art can make specific designs according to actual conditions, which will not be described in detail here.

[0045] The specific switching control method is:

[0046] When the external interface module, i.e., the USB interface, is inserted, the second USB_ID pin is at a low level, the USB master-slave mode switching pin is at a low level, the main controller module is controlled to be in slave mode, and the data path is connected from the USB interface to the main controller module. At the same time, the USB slave device power supply control circuit module cuts off the power supply of the USB slave device module, so that the power supply of the USB slave device module is cut off, and the USB line connected to the slave device module is disconnected, which does not affect the communication between the USB interface and the main controller module. The USB communication does not support a one-master-multiple-slave mode, and can only communicate one-to-one.

[0047] When the external interface module, i.e., the USB interface, is not inserted, the second USB_ID pin is at a high level, the USB master-slave mode switching pin is at a high level, the main controller module is controlled to be in the master mode, and the data path is connected from the USB slave device module to the main controller module. At the same time, the USB slave device power supply control circuit module turns on the power supply of the USB slave device module, so that the USB slave device module is powered on, and the connection between the USB main controller module and the USB interface will not affect the communication between the USB slave device module and the main controller module.

[0048] During the control process, the USB_ID pin of the externally inserted OTG line is at a low level by default, and the line is ready; an ID detection pin is set on the main controller. When the USB_ID pin of the USB interface is connected to a low level, the main controller detects it as a low level and switches to slave mode; when the USB interface is not inserted, the main controller detects it as a high level and switches to master mode.

[0049] Example 2

[0050] See also Figure 2 As shown, an embodiment of the utility model provides a USB master-slave mode switching circuit, including a master controller module, a slave device module, a slave device power supply control circuit module and an external interface module;

[0051] The external interface module is connected to the main controller module to form a first communication path; the main controller module is connected to the slave device module to form a second communication path; the slave device power supply control circuit module is connected to the slave device module to form a power supply path;

[0052] The external interface module is controlled and connected to the main controller module and the slave device power supply control circuit module respectively.

[0053] In this embodiment, if Figure 6 As shown, the hub module is connected to multiple slave devices. The hub module USB HUB includes multiple USB_DP and USB_DM pins for connecting to multiple slave devices; it also includes VCC and GND pins.

[0054] Further, as shown in FIG. 5( b ), the slave device includes USB_DP, USB_DM, VCC, and GND pins, which are respectively connected to corresponding pins of the hub module.

[0055] In this embodiment, the specific structures and connection relationships of the main controller module, the slave device module, the slave device power supply control circuit module, and the external interface module are the same as those in Embodiment 1, and will not be elaborated herein.

[0056] The specific switching control method is:

[0057] When the external interface module, i.e., the USB interface, is inserted, the second USB_ID pin is at a low level, the USB master-slave mode switching pin is at a low level, the main controller module is controlled to be in slave mode, and the data path is connected from the USB interface to the main controller module. At the same time, the USB hub power supply control circuit module cuts off the power supply of the hub module USB HUB, so that the power supply of the USB HUB is cut off, and the USB line connected to the USB HUB is disconnected, which does not affect the communication between the USB interface and the main controller module. The USB communication does not support a one-master-multiple-slave mode, and can only communicate one-to-one.

[0058] When the USB interface is not plugged in, the second USB_ID pin is at a high level, the USB master-slave mode switching pin is at a high level, the main controller module is controlled to be in master mode, and the data path is connected from the USB HUB to the main controller module. At the same time, the USB HUB hub power supply control circuit module connects the power supply of the USB HUB hub module to power on the USB HUB, and the connection between the USB host controller module and the USB interface will not affect the communication between the USB HUB and the main controller module.

[0059] As an implementation method, the USB paths in a USB master-slave mode switching circuit may not be directly connected, and the master-slave mode switching can also be achieved by adding a multi-way analog switch for control, but the cost and reliability cannot be guaranteed.

[0060] Although the above describes the specific implementation methods of the utility model in combination with the accompanying drawings, it is not intended to limit the scope of protection of the utility model. Technical personnel in the relevant field should understand that on the basis of the technical solution of the utility model, various modifications or deformations that can be made by technical personnel in this field without creative work are still within the scope of protection of the utility model.

Claims

1. A USB master-slave mode switching circuit, characterized in that: It includes a main controller module, a slave device module, a slave device power supply control circuit module and an external interface module; The external interface module is connected to the main controller module to form a first communication path; the main controller module is connected to the slave device module to form a second communication path; the slave device power supply control circuit module is connected to the slave device module to form a power supply path; The external interface module is controlled and connected to the main controller module and the slave device power supply control circuit module respectively.

2. A USB master-slave mode switching circuit as claimed in claim 1, characterized in that: The slave device module is a single slave device.

3. A USB master-slave mode switching circuit as claimed in claim 1, characterized in that: Alternatively, the slave device module is a hub module.

4. A USB master-slave mode switching circuit as claimed in claim 3, characterized in that: The hub module is connected to one or more slave devices.

5. A USB master-slave mode switching circuit as claimed in claim 1, characterized in that: The main controller module includes a first USB data pin and a first USB_ID pin.

6. A USB master-slave mode switching circuit as claimed in claim 5, characterized in that: The first USB data pin is connected to the slave device module.

7. A USB master-slave mode switching circuit as claimed in claim 5, characterized in that: The first USB data pin is connected to the external interface module.

8. A USB master-slave mode switching circuit as claimed in claim 1, characterized in that: The external interface module includes a second USB data pin and a second USB_ID pin.

9. A USB master-slave mode switching circuit as claimed in claim 8, characterized in that: The second USB_ID pin is connected to the slave device power supply control circuit module.

10. A USB master-slave mode switching circuit as claimed in claim 8, characterized in that: The second USB_ID pin is connected to the first USB_ID pin of the main controller module.