Automatic switching circuit, universal serial bus interface and electronic equipment
The automatic switching circuit automatically switches the working mode and data interface of the main control device according to the target unit status of the external device, solving the cumbersome problem of charging and HOST device connection when the main control device only supports one set of USB interfaces, and improving the user experience.
Patent Information
- Application Number
- CN202422580778.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2034-10-22
AI Technical Summary
In the prior art, when the main control device only supports one set of USB interfaces, it is necessary to frequently manually plug and unplug the OTG adapter cable to achieve charging and connecting to the HOST device, resulting in a poor user experience.
An automatic switching circuit is designed. The first and second enabling modules enable the switching module according to whether the external device contains the target unit, so that the main control is in different working modes and data interfaces to achieve automatic switching.
Without the need to frequently plug and unplug the OTG adapter cable, the main control device can be charged normally and connected to other main control devices, which improves the user experience.
Smart Images

Figure CN223390113U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to the field of integrated circuits, in particular to an automatic switching circuit, a universal serial bus interface and electronic equipment. Background Art
[0002] In recent years, with the support of the USB (Universal Serial Bus) protocol, a wide variety of USB devices have emerged, such as USB cameras, mice, keyboards, printers, and more with a TYPE_A interface (a common interface for computers and electronic devices). These are essentially host devices, powered by a host controller (typically 5V), which detects the corresponding logic and communicates in host mode through the USB signal interface and signal lines to implement the corresponding functions. The other type of device is the TYPE_C interface, which is primarily used to connect to devices such as devices for charging, connecting to computers, or connecting to OTG (On-The-Go, a data exchange technology for electronic devices) adapters.
[0003] When the commonly used main control only supports one set of USB interfaces, in order to ensure that the device can be charged normally and connected to other main control devices, and also want to be used with a host device at the same time, it is generally necessary to frequently manually plug and unplug the OTG adapter cable from the TYPE_C interface to connect to the host device. This is obviously cumbersome and brings a bad experience to users. Utility Model Content
[0004] In view of the above problems, the utility model proposes an automatic switching circuit, a universal serial bus interface and an electronic device.
[0005] The embodiment of the utility model provides an automatic switching circuit, which includes: a first enabling module, a second enabling module, a first switching module, and a second switching module;
[0006] One end of the first enabling module is connected to the external device, and the other end is connected to the enabling end of the first switching module, and the first enabling module is configured to enable the state of the enabling end of the first switching module according to the connection with the external device containing or not containing the target unit;
[0007] One end of the second enabling module is connected to the external device, and the other end is connected to the enabling end of the second switching module, and the second enabling module is configured to enable the state of the enabling end of the second switching module based on the connection with the external device containing or not containing the target unit;
[0008] The first end of the first switching module is connected to the external device, and the second end is connected to the mode pin of the main control. The first switching module is configured to switch different channels according to the state of its own enable end, so that the main control is in different working modes;
[0009] The first end of the second switching module is connected to the external device, and the second end is connected to the data pin of the master control. The second switching module is configured to switch different data interfaces according to the state of its own enable end, so that the master control and the external device interact in different ways.
[0010] Optionally, the target unit is a circuit unit carrying a power supply terminal;
[0011] The first enabling module is configured to enable the enabling end of the first switching module to a valid state when the external device containing the target unit is connected, and to enable the enabling end of the first switching module to an invalid state when the external device not containing the target unit is connected;
[0012] The second enabling module is configured to enable the enabling end of the second switching module to a valid state when the external device connected contains the target unit, and to enable the enabling end of the second switching module to an invalid state when the external device not containing the target unit is connected.
[0013] Optionally, the working mode includes: master mode and slave mode;
[0014] The first switching module is configured to, when the state of its own enabling terminal is valid, switch the channel from the default channel to the non-default channel so that the master is in the slave mode; and when the state of its own enabling terminal is invalid, maintain the channel as the default channel so that the master is in the master mode;
[0015] The second switching module is configured to switch the data interface from the first interface to the second interface when the state of its own enabling end is valid enable, so that the external device can power the device where the main control is located and interact with it through the second interface; when the state of its own enabling end is invalid enable, maintain the data interface as the first interface, so that the device where the main control is located can power the external device through the first interface and interact with the external device.
[0016] Optionally, the first enabling module includes: a first resistor, a second resistor, and a third resistor;
[0017] The first end of the first resistor is connected to the power supply terminal of the external device;
[0018] The second end of the first resistor is connected to the second end of the second resistor and the first end of the third resistor respectively;
[0019] The first end of the second resistor is connected to the enable end of the first switching module;
[0020] The second end of the third resistor is grounded;
[0021] When the external device containing the target unit is connected, the first resistor receives a voltage provided by the power supply terminal of the external device, and the voltage is divided by the second resistor to pull up the enable terminal of the first switching module, so that the state of the enable terminal of the first switching module is valid;
[0022] When an external device without the target unit is connected, the first resistor cannot receive the voltage provided by the power supply terminal of the external device, and the enable terminal of the first switching module is not pulled high, so that the enable terminal of the first switching module is in an invalid state.
[0023] Optionally, the second enabling module includes: a fourth resistor, a fifth resistor, and a sixth resistor;
[0024] The first end of the fourth resistor is connected to the power supply end of the external device respectively;
[0025] The second end of the fourth resistor is connected to the second end of the fifth resistor and the first end of the sixth resistor respectively;
[0026] A first end of the fifth resistor is connected to an enable end of the second switching module;
[0027] The second end of the sixth resistor is grounded;
[0028] When the external device containing the target unit is connected, when the fourth resistor receives the voltage provided by the power supply terminal of the external device, the voltage is divided by the fifth resistor and then pulls up the enable terminal of the second switching module, so that the state of the enable terminal of the second switching module is valid;
[0029] When an external device that does not contain the target unit is connected, the fourth resistor cannot receive the voltage provided by the power supply terminal of the external device, and the enable terminal of the second switching module is not pulled high, so that the enable terminal of the second switching module is in an invalid state.
[0030] Optionally, the first switching module includes: a first selection switch and a second selection switch;
[0031] The first end of the first switching module includes: a first positive and negative pin;
[0032] The second end of the first switching module includes: a second positive and negative pin, and a third positive and negative pin;
[0033] One end of the positive pin of the first positive and negative pins is connected to the external device, and the other end is connected to the fixed end of the first selection switch;
[0034] One of the two movable ends of the first selection switch is connected to the positive pin end of the second positive and negative pins, and the other is connected to the positive pin end of the third positive and negative pins;
[0035] One end of the negative pin of the first positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the second selection switch;
[0036] One of the two movable ends of the second selection switch is connected to the negative pin end of the second positive and negative pins, and the other is connected to the negative pin end of the third positive and negative pins;
[0037] The other end of the positive pin of the second positive and negative pins is connected to the main control and grounded through a resistor, and the other end of the negative pin of the second positive and negative pins is connected to the main control;
[0038] The other end of the positive pin of the third positive and negative pin is connected to the main control and is connected to the power supply terminal of the external device through a resistor, and the other end of the negative pin of the third positive and negative pin is connected to the main control;
[0039] The power supply terminal of the first switching module is connected to the power supply terminal of the device where the main control is located;
[0040] Wherein, the default channel is a channel formed by connecting the first positive and negative pins and the second positive and negative pins;
[0041] The non-default channel is a channel formed by connecting the first positive and negative pins and the third positive and negative pins.
[0042] Optionally, the second switching module includes: a third selection switch and a fourth selection switch;
[0043] The first end of the second switching module includes: a fourth positive and negative pin;
[0044] The second end of the second switching module includes: a fifth positive and negative pin, and a sixth positive and negative pin;
[0045] One end of the positive pin of the fourth positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the third selection switch;
[0046] One of the two movable ends of the third selection switch is connected to the positive pin end of the fifth positive and negative pins, and the other is connected to the positive pin end of the sixth positive and negative pins;
[0047] One end of the negative pin of the fourth positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the fourth selection switch;
[0048] One of the two movable ends of the fourth selection switch is connected to the negative pin end of the fifth positive and negative pin, and the other is connected to the negative pin end of the sixth positive and negative pin;
[0049] The other end of the positive pin of the fifth positive and negative pin is connected to the main control, and the other end of the negative pin of the fifth positive and negative pin is connected to the main control;
[0050] The other end of the positive pin of the sixth positive and negative pin is connected to the main control, and the other end of the negative pin of the sixth positive and negative pin is connected to the main control;
[0051] The power supply terminal of the second switching module is connected to the power supply terminal of the device where the main control is located;
[0052] Wherein, the first interface is an interface formed by connecting the fourth positive and negative pins and the fifth positive and negative pins;
[0053] The second interface is an interface formed by connecting the fourth positive and negative pins and the sixth positive and negative pins.
[0054] Optionally, the automatic switching circuit further comprises: an isolation circuit;
[0055] One end of the isolation circuit is connected to the power supply end of the main control, and the other end is connected to the first enabling module and the second enabling module respectively;
[0056] The isolation circuit is configured to isolate or not isolate the path between the power supply terminal of the main control and the first enabling module and the second enabling module based on the working mode of the main control.
[0057] Optionally, the working mode includes: master mode and slave mode;
[0058] The isolation circuit is configured to not isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in the slave mode, and to isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in the master mode.
[0059] Optionally, the isolation circuit includes: a switch module, a first capacitor, a second capacitor, a seventh resistor, an eighth resistor, and a ninth resistor;
[0060] The first pin of the switch module is connected to the power supply terminal of the device where the main control is located and the first end of the second capacitor respectively, and the second end of the second capacitor is grounded;
[0061] The second pin of the switch module is grounded, and the third pin is left floating;
[0062] The fourth pin of the switch module is connected to the second end of the seventh resistor and the first end of the eighth resistor respectively;
[0063] The first end of the seventh resistor is connected to the sixth pin of the switch module, the first end of the first capacitor, the first enabling module, and the second enabling module respectively;
[0064] The second end of the eighth resistor is grounded;
[0065] The second end of the first capacitor is grounded;
[0066] The fifth pin of the switch module is connected to the first end of the ninth resistor, and the second end of the ninth resistor is grounded.
[0067] An embodiment of the present utility model provides a universal serial bus interface, and the universal serial bus interface includes: the automatic switching circuit as described in any one of the above items.
[0068] An embodiment of the present invention provides an electronic device, which includes the universal serial bus interface as described above.
[0069] The automatic switching circuit provided by the utility model includes: a first enabling module, a second enabling module, a first switching module, and a second switching module; the first enabling module has one end connected to an external device and the other end connected to the enabling end of the first switching module, and the first enabling module is configured to enable the state of the enabling end of the first switching module based on the connection with the external device containing or not containing a target unit. The second enabling module has one end connected to the external device and the other end connected to the enabling end of the second switching module, and the second enabling module is configured to enable the state of the enabling end of the second switching module based on the connection with the external device containing or not containing a target unit.
[0070] The first end of the first switching module is connected to the external device, and the second end is connected to the mode pin of the master control. The first switching module is configured to switch different channels according to the state of its own enable end, so that the master control is in different working modes; the first end of the second switching module is connected to the external device, and the second end is connected to the data pin of the master control. The second switching module is configured to switch different data interfaces according to the state of its own enable end, so that the master control and the external device interact in different ways.
[0071] The present invention aims to solve the problem that when only one set of USB interfaces is currently supported, if you want to carry both a host device and a device at the same time, you need to frequently manually plug and unplug the OTG adapter cable at the TYPE_C interface to achieve this. The invention creatively proposes a new automatic switching circuit. Based on whether the external device contains a target unit, it uses two enabling modules to determine the state of the enabling end of the switching module, and then switches different channels according to the state of the enabling end, so that the main control is in different working modes, and switches different data interfaces, so that the main control and the external device interact in different ways. When only one set of USB interfaces is supported, without the need for frequent manual plug and unplug of the OTG adapter cable, the device can be charged normally, connected to other host devices, and can be used with a host device at the same time. The main control is adjusted to the corresponding logic circuit based on whether the external device contains a target unit, thereby automatically switching to the corresponding application scenario, which brings a better user experience and has good practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0073] Figure 1 This is a schematic diagram of the automatic switching circuit according to an embodiment of the present invention;
[0074] Figure 2 This is a circuit structure diagram of a preferred first enabling module and a first switching module in an embodiment of the present utility model;
[0075] Figure 3 This is a circuit structure diagram of a preferred second enabling module and a second switching module in an embodiment of the present utility model;
[0076] Figure 4 This is a structural diagram of a preferred isolation circuit in an embodiment of the present utility model;
[0077] Figure 5 This is an architectural diagram illustrating an embodiment of the present invention, using a tablet computer as an example, for connecting to external devices through an automatic switching circuit. DETAILED DESCRIPTION
[0078] In order to make the above-mentioned objects, features and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, are only part of the embodiments of the present invention, not all of the embodiments, and are not intended to limit the present invention.
[0079] The inventors discovered that most current mobile smart devices, such as smartphones and tablets, only have one USB port. This means their main controllers only support one USB port. For example, mainstream smartphones and tablets typically have only one Type-C port, which is often used to plug in a data cable and power adapter, and then connect to a power source (e.g., an outlet) for charging.
[0080] As for the HOST device, it is generally a TYPE_A interface, such as USB cameras, mice, keyboards, printers, etc., which need to be powered by the device where the main control is located, that is, the smartphone or tablet computer, when working. The main control first detects the corresponding logic through the CC line number (generally CC1 and CC2 signals, used for charging, communication, control, etc.), and then communicates in the HOST mode of the main control through the DP and DM signals in the USB (DP and DM usually refer to the positive and negative data signal lines, which are used for data communication between USB devices and are jointly responsible for data transmission between USB devices; DP represents the USB data positive signal line, that is, USB Data Positive, abbreviated as D+; DM represents the USB data negative signal line, that is, USB Data Minus, abbreviated as D-) to realize the function.
[0081] The inventors further discovered that for devices of this type that only support one set of USB interfaces, in order to ensure that the device can be charged normally and connected to other host devices, and also to be used with a host device at the same time, it is generally necessary to frequently manually plug and unplug the OTG adapter cable in the TYPE_C interface to connect to the host device. For example, when charging, unplug the charging cable and power head from the TYPE_C port, then plug in the OTG adapter cable, and then connect to the host device. This is obviously cumbersome and gives users a bad experience.
[0082] In order to solve the above problems, the inventor creatively proposes an automatic switching circuit, a universal serial bus interface and an electronic device of the present invention. The technical solution of the present invention is explained and illustrated in detail below.
[0083] The automatic switching circuit of the present invention comprises: a first enabling module, a second enabling module, a first switching module and a second switching module, Figure 1 As shown in the architectural diagram of the automatic switching circuit, one end of the first enabling module is connected to the external device, and the other end is connected to the enabling end of the first switching module. The first enabling module is configured to enable the state of the enabling end of the first switching module based on the connection with the external device containing or not containing the target unit.
[0084] One end of the second enabling module is connected to the external device, and the other end is connected to the enabling end of the second switching module. The second enabling module is configured to enable the state of the enabling end of the second switching module based on the connection with the external device containing or not containing the target unit.
[0085] The first end of the first switching module is connected to the external device, and the second end is connected to the mode pin of the main control. The first switching module is configured to switch different channels according to the state of its own enable end to put the main control in different working modes.
[0086] The first end of the second switching module is connected to the external device, and the second end is connected to the data pin of the main control. The second switching module is configured to switch different data interfaces according to the state of its own enabling end, so that the main control and the external device interact in different ways.
[0087] That is, for the main control that only supports one set of USB interfaces, the CC1 and CC2 signals of the main control are switched to different channels by enabling the state of the enable end of the switching module according to whether the external device contains the target unit. Different channels correspond to different states of the CC signal, so that the main control USB works in different working modes and switches different data interfaces according to the state of the enable end, so that the DM and DP signals of the main control USB interact with external devices in different ways: in HOST mode, the functions of HOST devices: USB cameras, barcode scanners, etc. can be realized; in DEVICE mode, the functions of DEVICE devices: charging heads, computers, OTG adapter cables, etc. can be realized.
[0088] In one possible embodiment, the target unit is a circuit unit with a power supply terminal (a circuit unit with a power supply terminal may include not only a power supply terminal but also include or integrate other power-related functional units, such as: a functional unit with voltage stabilization, ripple reduction or elimination; a functional unit with voltage reduction or voltage boost; and a frequency conversion function, etc., which may involve power-related technologies); an external device containing a target unit means: an external device has a power supply terminal in its own circuit structure, and when connected to a main control, its power supply terminal provides voltage to the main control); an external device not containing a target unit means: an external device has no power supply terminal in its own circuit structure, or although the external device has a power supply terminal in its own circuit structure, its power supply terminal does not provide voltage to the main control when connected to the main control. That is, an external device containing a target unit is a DEVICE device, and an external device not containing a target unit is a HOST device.
[0089] Based on the above division, the first enabling module is configured to enable the state of the enabling end of the first switching module to be valid when connecting to an external device containing a target unit, and to enable the state of the enabling end of the first switching module to be invalid when connecting to an external device not containing a target unit; the second enabling module is configured to enable the state of the enabling end of the second switching module to be valid when connecting to an external device containing a target unit, and to enable the state of the enabling end of the second switching module to be invalid when connecting to an external device not containing a target unit.
[0090] In one possible embodiment, the operating modes of the master control include: master mode and slave mode, i.e., host mode and device mode. The first switching module is configured to, when the state of its own enable terminal is valid, switch the channel from the default channel to the non-default channel, so that the master control is in slave mode; and, when the state of its own enable terminal is invalid, maintain the channel as the default channel, so that the master control is in master mode.
[0091] The second switching module is configured to switch the data interface from the first interface to the second interface when the state of its own enabling end is valid enable, so that the external device can power the device where the main control is located and interact with it through the second interface; when the state of its own enabling end is invalid enable, maintain the data interface as the first interface, so that the device where the main control is located can power the external device and interact with it through the first interface.
[0092] That is, the enabling module determines the state of the enabling end of the switching module according to whether the external device contains the target unit, and the switching module determines the switching of the channels corresponding to the CC1 and CC2 signals and the switching of the data interfaces corresponding to the DP and DP signals according to the states of their respective enabling ends, thereby determining the working mode of the main control and the specific interaction method between the main control and the external device.
[0093] In order to better understand the above-mentioned first enabling module and first switching module, refer to Figure 2 A circuit structure diagram of a preferred first enabling module and a first switching module is shown, wherein the first enabling module includes: a first resistor R1, a second resistor R2, and a third resistor R3; the first switching module includes: a first selection switch S1 and a second selection switch S2; the first end of the first switching module includes: first positive and negative pins D1+ and D1-; the second end of the first switching module includes: second positive and negative pins D2+ and D2-; and third positive and negative pins D3+ and D3-.
[0094] The first end of the first resistor R1 is connected to the power supply terminal USB_VBUS of the external device; the second end of the first resistor R1 is connected to the second end of the second resistor R2 and the first end of the third resistor R3 respectively; the first end of the second resistor R2 is connected to the enable terminal SEL of the first switching module; the second end of the third resistor R3 is grounded.
[0095] One end of the positive pin D1+ of the first positive and negative pins D1+ and D1- is connected to an external device ( Figure 2 The first selection switch S1 has two movable ends, one of which is connected to the positive pin D2+ of the second positive and negative pins D2+ and D2-, and the other is connected to the positive pin D3+ of the third positive and negative pins D3+ and D3-.
[0096] One end of the negative pin D1- of the first positive and negative pins D1+ and D1- is connected to an external device ( Figure 2 The second selection switch S2 has two movable ends, one of which is connected to the negative pin D2- of the second positive and negative pins D2+ and D2-, and the other is connected to the negative pin D3- of the third positive and negative pins D3+ and D3-.
[0097] The other end of the positive pin D2+ of the second positive and negative pins D2+ and D2- is connected to the main control ( Figure 2 It is represented by USB0_CC1_A), and is grounded through a resistor R10. The other end of the negative pin D2- of the second positive and negative pins D2+ and D2- is connected to the main control ( Figure 2 (represented by USB0_CC2_A).
[0098] The other end of the positive pin D3+ of the third positive and negative pins D3+ and D3- is connected to the main control ( Figure 2 It is represented by USB0_CC1_B), and is connected to the power supply terminal USB_VBUS of the external device through a resistor R11. The other end of the negative pin D3- of the third positive and negative pins D3+ and D3- is connected to the main control ( Figure 2Indicated by USB0_CC2_B. Furthermore, since the first switching module itself requires power, its power supply terminal VCC is connected to the power supply terminal VPH_PWR of the device where the main control resides. For example, if the main control device is a smartphone or tablet, its power supply terminal is actually its battery. This battery then serves as the power supply terminal VPH_PWR to power the first switching module.
[0099] based on Figure 2 In the structure shown, when an external device containing a target unit is connected, it can provide voltage, so the first resistor R1 receives the voltage provided by the power supply terminal of the external device, and the voltage is divided by the second resistor R2 to pull up the enable terminal SEL of the first switching module, so that the state of the enable terminal SEL of the first switching module is valid; when an external device not containing a target unit is connected, it does not provide voltage, so the first resistor R1 does not receive the voltage provided by the power supply terminal of the external device, and the enable terminal SEL of the first switching module is not pulled high, so that the state of the enable terminal SEL of the first switching module is invalid.
[0100] The default channel is the channel formed by connecting the first positive and negative pins D1+, D1- with the second positive and negative pins D2+, D2-; the non-default channel is the channel formed by connecting the first positive and negative pins D1+, D1- with the third positive and negative pins D3+, D3-. Because the first switching module is configured to switch the channel from the default channel to the non-default channel when the state of its own enable terminal SEL is valid, that is, through the two selection switches S1 and S2, the channel formed by connecting the first positive and negative pins D1+, D1- with the second positive and negative pins D2+, D2- is switched to the channel formed by connecting the first positive and negative pins D1+, D1- with the third positive and negative pins D3+, D3-, thereby placing the master control in slave mode. When the state of the first switching module's own enable terminal SEL is invalid, the channel is maintained as the default channel, that is, the channel formed by connecting the first positive and negative pins D1+, D1- with the second positive and negative pins D2+, D2- is maintained, thereby placing the master control in master mode.
[0101] Through the above method, the main controller only supports one set of USB interfaces, but can carry HOST devices and DEVICE devices at the same time. According to the different devices carried, the channels corresponding to the CC1 and CC2 signals of the main controller are automatically switched to put them in different working modes.
[0102] In order to better understand the above second enabling module and second switching module, refer to Figure 3A circuit structure diagram of a preferred second enabling module and a second switching module is shown, in which the second enabling module includes: a fourth resistor R4, a fifth resistor R5, and a sixth resistor R6; the second switching module includes: a third selection switch S3 and a fourth selection switch S4; the first end of the second switching module includes: fourth positive and negative pins D4+ and D4-; the second end of the second switching module includes: fifth positive and negative pins D5+ and D5-; and sixth positive and negative pins D6+ and D6-.
[0103] The first end of the fourth resistor R4 is connected to the power supply terminal USB_VBUS of the external device; the second end of the fourth resistor R4 is connected to the second end of the fifth resistor R5 and the first end of the sixth resistor R6 respectively; the first end of the fifth resistor R5 is connected to the enable end SEL of the second switching module; the second end of the sixth resistor R6 is grounded.
[0104] The positive pin D4+ of the fourth positive and negative pins D4+ and D4- is connected to an external device ( Figure 3 The first and second terminals of the third selection switch S3 are connected to the positive pin D5+ of the fifth positive and negative pins D5+ and D5-, and the second and second terminals of the third selection switch S3 are connected to the positive pin D6+ of the sixth positive and negative pins D6+ and D6-.
[0105] The negative pin D4- of the fourth positive and negative pins D4+ and D4- is connected to an external device ( Figure 3 The fourth selection switch S4 has two movable ends, one of which is connected to the negative pin D5- of the fifth positive and negative pins D5+ and D5-, and the other is connected to the negative pin D6- of the sixth positive and negative pins D6+ and D6-.
[0106] The other end of the positive pin D5+ of the fifth positive and negative pins D5+ and D5- is connected to the main control ( Figure 3 The other end of the negative pin D5- of the fifth positive and negative pins D5+ and D5- is connected to the main controller ( Figure 3 (represented by USB0_DM_CAM).
[0107] The other end of the sixth positive and negative pins D63+ and D63- is connected to the main control ( Figure 3 The other end of the negative pin D63- of the third positive and negative pins D63+ and D63- is connected to the main controller ( Figure 3 Indicated by USB0_DM_CON. In addition, since the second switching module itself needs to be powered, the power supply terminal VCC of the second switching module is also connected to the power supply terminal VPH_PWR of the device where the main control is located.
[0108] based on Figure 3 In the structure shown, when an external device containing a target unit is connected, it can provide voltage, so the fourth resistor R4 receives the voltage provided by the power supply terminal of the external device, and the voltage is divided by the fifth resistor R5 to pull up the enable terminal SEL of the second switching module, so that the state of the enable terminal SEL of the second switching module is valid; when an external device not containing a target unit is connected, it does not provide voltage, so the fourth resistor R4 does not receive the voltage provided by the power supply terminal of the external device, and the enable terminal SEL of the second switching module is not pulled high, so that the state of the enable terminal SEL of the second switching module is invalid.
[0109] The first interface is formed by connecting the fourth positive and negative pins D4+, D4- with the fifth positive and negative pins D5+, D5-; the second interface is formed by connecting the fourth positive and negative pins D4+, D4- with the sixth positive and negative pins D6+, D6-. Because the second switching module is configured to switch the data interface from the first interface to the second interface when the state of its enable terminal SEL is effectively enabled, that is, the interface formed by connecting the fourth positive and negative pins D4+, D4- with the fifth positive and negative pins D5+, D5- is switched to the interface formed by connecting the fourth positive and negative pins D4+, D4- with the sixth positive and negative pins D6+, D6- through the two selection switches S3, S4, so that the external device can supply power to the device where the main control is located and interact with it through the second interface. When the state of the enable terminal SEL of the second switching module itself is invalid, the data interface is maintained as the first interface, that is, the interface formed by the fourth positive and negative pins D4+, D4- and the fifth positive and negative pins D5+, D5- is maintained, so that the device where the main control is located can power the external device through the first interface and interact with the external device.
[0110] Through the above method, the main controller only supports one set of USB interfaces, but can carry HOST devices and DEVICE devices at the same time. According to the different devices carried, the data interfaces corresponding to the DP and DM signals of the main controller are automatically switched to correspond to the original working mode of the main controller and realize the corresponding functions.
[0111] Based on the above Figure 2 、 3The inventors also discovered that, because the main controller operates in both DEVICE mode and HOST mode, the first resistor R1 or the fourth resistor R4 uses the same path to receive USB_VBUS, and the main controller outputs 5V USB_VBUS in HOST mode. Combined with the above working principle, it can be seen that when the main controller is in HOST mode, the enable terminals SEL of the first switching module and SEL of the second switching module will also become high, which will cause the switching of the two switching modules to jump back and forth between D2+ / D2-, D3+ / D3-, or D5+ / D5-, D6+ / D6-, resulting in errors. To solve this problem, the inventors have also creatively proposed two solutions:
[0112] The first method is to prevent the SEL of the first switching module from becoming high when the main control is in HOST mode through software design;
[0113] The second way is to avoid, through hardware design, causing the SEL of the first switching module to be high when the main controller is in the HOST mode.
[0114] The advantage of the first method is that no additional circuit components are required, which indirectly saves costs. The disadvantage is that the software relies on the main control to be implemented, and the main control itself needs to process a large amount of data, which may cause software control delays, errors or even failures.
[0115] The advantage of the first approach is that it's implemented through hardware circuitry, eliminating the need for software control. However, the disadvantage is a slight increase in cost compared to software. However, considering the need for circuit reliability, a hardware approach is more appropriate. Furthermore, the hardware design proposed in this invention uses very few components, resulting in high reliability and low incremental cost.
[0116] In one possible embodiment, in order to solve the above problem, the hardware design adopted is to add an isolation circuit, one end of the isolation circuit is connected to the power supply end of the main control, and the other end is connected to the first enabling module and the second enabling module respectively; the isolation circuit is configured to isolate or not isolate the path between the power supply end of the main control and the first enabling module and the second enabling module based on the working mode of the main control.
[0117] In a possible embodiment, since the working modes of the master control include: master mode and slave mode; therefore, the isolation circuit is configured to not isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in slave mode, and to isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in master mode.
[0118] Through the above-mentioned isolation circuit, when the main controller is in HOST mode, the power supply end of the main controller will output voltage. At this time, the path between it and the first and second enabling modules is isolated through the isolation circuit, and the voltage cannot be output to the first and second enabling modules. Therefore, the enable ends of the two enabling modules are both in an invalid state and will not affect the corresponding switching of CC1, CC2, DM, and DP signals; when the external device is a DEVICE device, the voltage generated by the external device is transmitted to the device where the main controller is located through the isolation circuit.
[0119] To better understand the above isolation circuit, refer to Figure 4 The structure diagram of a preferred isolation circuit shown in FIG. 1 includes: a switch module U, a first capacitor C1, a second capacitor C2, a seventh resistor R7, an eighth resistor R8, and a ninth resistor R9.
[0120] The first pin of the switch module U is connected to the power terminal USB_VBUS_BTB of the main control device and the first end of the second capacitor C2 respectively, and the second end of the second capacitor C2 is grounded; the second pin of the switch module U is grounded, and the third pin is suspended.
[0121] The fourth pin of the switch module U is connected to the second end of the seventh resistor R7 and the first end of the eighth resistor R8 respectively; the first end of the seventh resistor R7 is connected to the sixth pin of the switch module U, the first end of the first capacitor C1, the first enabling module, and the first resistor R1 and the fourth resistor R4 receiving USB_VBUS in the second enabling module respectively.
[0122] The second end of the eighth resistor R8 is grounded; the second end of the first capacitor C1 is grounded; the fifth pin of the switch module U is connected to the first end of the ninth resistor R9, and the second end of the ninth resistor R9 is grounded.
[0123] When the main controller is in HOST mode, the power supply terminal USB_VBUS_BTB of the device where the main controller is located will output voltage. At this time, the path between it and the first and second enabling modules is isolated by the isolation circuit, and the voltage cannot be output to the first and second enabling modules. That is, there will be no USB_VBUS on the sixth pin of the switch module U to transmit to the first resistor R1 and the fourth resistor R4 in the first enabling module and the second enabling module that receive USB_VBUS. Therefore, the enable terminals of the two enabling modules are both in an invalid state and will not affect the corresponding switching of CC1, CC2, DM, and DP signals. When the external device is a DEVICE device, the voltage USB_VBUS generated by the external device is transmitted to the power supply terminal USB_VBUS_BTB of the device where the main controller is located through the isolation circuit. For example, if the external device is a power plug or a charging cable, the voltage USB_VBUS received by the power plug is transmitted to the power supply terminal USB_VBUS_BTB of the device where the main controller is located via the charging cable and the isolation circuit.
[0124] Take a tablet computer as an example: Figure 5 The architecture diagram shown, Figure 5 The middle controller is the main controller of the tablet computer, which only supports one set of USB interfaces. The tablet computer needs to ensure normal charging and connection to other DEVICE devices ( Figure 5 TYPE_C in the diagram), the 5V on the right arrow indicates that the DEVICE device provides 5V voltage to the main control; it is also equipped with a USB camera and a barcode scanner ( Figure 5 The 5V on the left-pointing arrow indicates that the master controller supplies 5V to the host device. The master controller uses the automatic switching circuit proposed in this utility model to automatically switch to the corresponding channel and data interface to implement the corresponding function according to whether the external device contains the target unit.
[0125] Based on the above automatic switching circuit, the present invention further provides a universal serial bus interface, which includes: any automatic switching circuit as described above.
[0126] Based on the above automatic switching circuit, the utility model further provides an electronic device, which includes the above universal serial bus interface.
[0127] In summary, the automatic switching circuit provided by the present invention includes: a first enabling module, a second enabling module, a first switching module, and a second switching module; the first enabling module has one end connected to an external device and the other end connected to the enabling terminal of the first switching module, and the first enabling module is configured to enable the state of the enabling terminal of the first switching module based on the connection with the external device that contains or does not contain a target unit. The second enabling module has one end connected to the external device and the other end connected to the enabling terminal of the second switching module, and the second enabling module is configured to enable the state of the enabling terminal of the second switching module based on the connection with the external device that contains or does not contain a target unit.
[0128] The first end of the first switching module is connected to the external device, and the second end is connected to the mode pin of the master control. The first switching module is configured to switch different channels according to the state of its own enable end, so that the master control is in different working modes; the first end of the second switching module is connected to the external device, and the second end is connected to the data pin of the master control. The second switching module is configured to switch different data interfaces according to the state of its own enable end, so that the master control and the external device interact in different ways.
[0129] The present invention aims to solve the problem that when only one set of USB interfaces is currently supported, if you want to carry both a host device and a device at the same time, you need to frequently manually plug and unplug the OTG adapter cable at the TYPE_C interface to achieve this. The invention creatively proposes a new automatic switching circuit. Based on whether the external device contains a target unit, it uses two enabling modules to determine the state of the enabling end of the switching module, and then switches different channels according to the state of the enabling end, so that the main control is in different working modes, and switches different data interfaces, so that the main control and the external device interact in different ways. When only one set of USB interfaces is supported, without the need for frequent manual plug and unplug of the OTG adapter cable, the device can be charged normally, connected to other host devices, and can be used with a host device at the same time. According to the type of external device, the main control is adjusted to the corresponding logic circuit, thereby automatically switching to the corresponding application scenario, bringing a better user experience and good practicality.
[0130] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0131] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0132] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which are all within the protection of the present invention.
Claims
1. An automatic switching circuit, characterized in that: The automatic switching circuit includes: a first enabling module, a second enabling module, a first switching module and a second switching module; One end of the first enabling module is connected to an external device, and the other end is connected to the enabling end of the first switching module, and the first enabling module is configured to enable the state of the enabling end of the first switching module based on the connection with the external device containing or not containing the target unit; One end of the second enabling module is connected to the external device, and the other end is connected to the enabling end of the second switching module, and the second enabling module is configured to enable the state of the enabling end of the second switching module based on the connection with the external device containing or not containing the target unit; The first end of the first switching module is connected to the external device, and the second end is connected to the mode pin of the main control. The first switching module is configured to switch different channels according to the state of its own enable end, so that the main control is in different working modes; The first end of the second switching module is connected to the external device, and the second end is connected to the data pin of the master control. The second switching module is configured to switch different data interfaces according to the state of its own enable end, so that the master control and the external device interact in different ways.
2. The automatic switching circuit according to claim 1, characterized in that: The target unit is a circuit unit carrying a power supply terminal; The first enabling module is configured to enable the enabling end of the first switching module to a valid state when the external device containing the target unit is connected, and to enable the enabling end of the first switching module to an invalid state when the external device not containing the target unit is connected; The second enabling module is configured to enable the enabling end of the second switching module to a valid state when the external device connected contains the target unit, and to enable the enabling end of the second switching module to an invalid state when the external device not containing the target unit is connected.
3. The automatic switching circuit according to claim 1, characterized in that: The working modes include: master mode and slave mode; The first switching module is configured to, when the state of its own enabling terminal is valid, switch the channel from the default channel to the non-default channel so that the master is in the slave mode; and when the state of its own enabling terminal is invalid, maintain the channel as the default channel so that the master is in the master mode; The second switching module is configured to switch the data interface from the first interface to the second interface when the state of its own enabling end is valid enable, so that the external device can power the device where the main control is located and interact with it through the second interface; when the state of its own enabling end is invalid enable, maintain the data interface as the first interface, so that the device where the main control is located can power the external device through the first interface and interact with the external device.
4. The automatic switching circuit according to claim 2, characterized in that: The first enabling module includes: a first resistor, a second resistor, and a third resistor; The first end of the first resistor is connected to the power supply terminal of the external device; The second end of the first resistor is connected to the second end of the second resistor and the first end of the third resistor respectively; The first end of the second resistor is connected to the enable end of the first switching module; The second end of the third resistor is grounded; When the external device containing the target unit is connected, the first resistor receives a voltage provided by the power supply terminal of the external device, and the voltage is divided by the second resistor to pull up the enable terminal of the first switching module, so that the state of the enable terminal of the first switching module is valid; When an external device without the target unit is connected, the first resistor cannot receive the voltage provided by the power supply terminal of the external device, and the enable terminal of the first switching module is not pulled high, so that the enable terminal of the first switching module is in an invalid state.
5. The automatic switching circuit according to claim 2, characterized in that: The second enabling module includes: a fourth resistor, a fifth resistor, and a sixth resistor; The first end of the fourth resistor is connected to the power supply end of the external device respectively; The second end of the fourth resistor is connected to the second end of the fifth resistor and the first end of the sixth resistor respectively; A first end of the fifth resistor is connected to an enable end of the second switching module; The second end of the sixth resistor is grounded; When the external device containing the target unit is connected, when the fourth resistor receives the voltage provided by the power supply terminal of the external device, the voltage is divided by the fifth resistor and then pulls up the enable terminal of the second switching module, so that the state of the enable terminal of the second switching module is valid; When an external device that does not contain the target unit is connected, the fourth resistor cannot receive the voltage provided by the power supply terminal of the external device, and the enable terminal of the second switching module is not pulled high, so that the enable terminal of the second switching module is in an invalid state.
6. The automatic switching circuit according to claim 3, characterized in that: The first switching module includes: a first selection switch and a second selection switch; The first end of the first switching module includes: a first positive and negative pin; The second end of the first switching module includes: a second positive and negative pin, and a third positive and negative pin; One end of the positive pin of the first positive and negative pins is connected to the external device, and the other end is connected to the fixed end of the first selection switch; One of the two movable ends of the first selection switch is connected to the positive pin end of the second positive and negative pins, and the other is connected to the positive pin end of the third positive and negative pins; One end of the negative pin of the first positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the second selection switch; One of the two movable ends of the second selection switch is connected to the negative pin end of the second positive and negative pins, and the other is connected to the negative pin end of the third positive and negative pins; The other end of the positive pin of the second positive and negative pins is connected to the main control and grounded through a resistor, and the other end of the negative pin of the second positive and negative pins is connected to the main control; The other end of the positive pin of the third positive and negative pin is connected to the main control and is connected to the power supply terminal of the external device through a resistor, and the other end of the negative pin of the third positive and negative pin is connected to the main control; The power supply terminal of the first switching module is connected to the power supply terminal of the device where the main control is located; Wherein, the default channel is a channel formed by connecting the first positive and negative pins and the second positive and negative pins; The non-default channel is a channel formed by connecting the first positive and negative pins and the third positive and negative pins.
7. The automatic switching circuit according to claim 3, characterized in that: The second switching module includes: a third selection switch and a fourth selection switch; The first end of the second switching module includes: a fourth positive and negative pin; The second end of the second switching module includes: a fifth positive and negative pin, and a sixth positive and negative pin; One end of the positive pin of the fourth positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the third selection switch; One of the two movable ends of the third selection switch is connected to the positive pin end of the fifth positive and negative pins, and the other is connected to the positive pin end of the sixth positive and negative pins; One end of the negative pin of the fourth positive and negative pin is connected to the external device, and the other end is connected to the fixed end of the fourth selection switch; One of the two movable ends of the fourth selection switch is connected to the negative pin end of the fifth positive and negative pin, and the other is connected to the negative pin end of the sixth positive and negative pin; The other end of the positive pin of the fifth positive and negative pin is connected to the main control, and the other end of the negative pin of the fifth positive and negative pin is connected to the main control; The other end of the positive pin of the sixth positive and negative pin is connected to the main control, and the other end of the negative pin of the sixth positive and negative pin is connected to the main control; The power supply terminal of the second switching module is connected to the power supply terminal of the device where the main control is located; Wherein, the first interface is an interface formed by connecting the fourth positive and negative pins and the fifth positive and negative pins; The second interface is an interface formed by connecting the fourth positive and negative pins and the sixth positive and negative pins.
8. The automatic switching circuit according to claim 1, characterized in that: The automatic switching circuit further comprises: an isolation circuit; One end of the isolation circuit is connected to the power supply end of the main control, and the other end is connected to the first enabling module and the second enabling module respectively; The isolation circuit is configured to isolate or not isolate the path between the power supply terminal of the main control and the first enabling module and the second enabling module based on the working mode of the main control.
9. The automatic switching circuit according to claim 8, characterized in that: The working modes include: master mode and slave mode; The isolation circuit is configured to not isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in the slave mode, and to isolate the path between the power supply end of the master control and the first enabling module and the second enabling module when the master control is in the master mode.
10. The automatic switching circuit according to claim 8, characterized in that: The isolation circuit includes: a switch module, a first capacitor, a second capacitor, a seventh resistor, an eighth resistor and a ninth resistor; The first pin of the switch module is connected to the power supply terminal of the device where the main control is located and the first end of the second capacitor respectively, and the second end of the second capacitor is grounded; The second pin of the switch module is grounded, and the third pin is left floating; The fourth pin of the switch module is connected to the second end of the seventh resistor and the first end of the eighth resistor respectively; The first end of the seventh resistor is connected to the sixth pin of the switch module, the first end of the first capacitor, the first enabling module, and the second enabling module respectively; The second end of the eighth resistor is grounded; The second end of the first capacitor is grounded; The fifth pin of the switch module is connected to the first end of the ninth resistor, and the second end of the ninth resistor is grounded.
11. A universal serial bus interface, characterized in that: The universal serial bus interface comprises: the automatic switching circuit according to any one of claims 1-10.
12. An electronic device, characterized in that: The electronic device comprises the universal serial bus interface according to claim 11.