A switching circuit for type C switching between host and device modes

Through the switching circuit of the host and device modes of Type C, the problem that the Type C interface cannot support multiple USB peripherals and charging in the existing technology is solved, and the automatic switching and diversified interface functions are realized, satisfying the diversity of products Demand.

CN111030247BActive Publication Date: 2024-11-19EMDOORVR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911396146.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-30
Publication Date
2024-11-19
Estimated Expiration
2039-12-30

AI Technical Summary

Technical Problem

The existing mobile platform only supports one Type C interface, which is difficult to meet the needs of multiple USB peripheral connections, computer debugging, data transmission and charging at the same time, limiting the diversification of products.

Method used

A switching circuit for switching host and device modes with Type C is designed, including Type C interface, USB mode switching module, DSP, power management module, charging module and USB expansion module. The detection circuit, VBUS power path management circuit and The USB DM/DP switching circuit realizes automatic switching of interfaces, supporting multiple USB signal expansion and fast charging protocols.

Benefits of technology

It realizes host and device status switching of Type C interface, is compatible with charging and fast charging protocols, is simple in design, low-cost, simple in software modification and maintenance, and meets diverse needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111030247B_ABST
    Figure CN111030247B_ABST
Patent Text Reader

Abstract

The present invention provides a switching circuit for switching between host and device modes of type C, belonging to the technical field of USB. The present invention comprises a type C interface, a USB mode switching module, a DSP, a power management module, a charging module connected to the power management module, and a battery connected to the charging module, wherein the DSP is respectively connected to the USB mode switching module and the power management module, the power management module supplies power to the entire circuit, and the USB mode switching module is respectively connected to the charging module and the type C interface. The beneficial effects of the present invention are: simple design, low cost, and simple software modification and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of USB interfaces, and in particular to a switching circuit for switching between host and device modes of a type C. Background Art

[0002] Many existing mobile platforms only support one type C interface, which has the functions of connecting to a computer, charging, and connecting to external devices. Because there is only one type C interface, it cannot meet the requirements of supporting multiple USB peripherals and charging and connecting to a computer for debugging and data transmission at the same time. It has great limitations and is difficult to meet the diversified needs of products. Summary of the invention

[0003] In order to solve the problems in the prior art, the present invention provides a switching circuit for switching between host and device modes of type C.

[0004] The present invention comprises a type C interface, a USB mode switching module, a DSP, a power management module, a charging module connected to the power management module and a battery connected to the charging module, wherein the DSP is respectively connected to the USB mode switching module and the power management module, the power management module supplies power for the entire circuit, and the USB mode switching module is respectively connected to the charging module and the type C interface.

[0005] The present invention is further improved and further comprises a USB expansion module, which is respectively connected to the DSP and the USB mode switching module and is used for expanding the USB signal given by the DSP into multiple USB signals.

[0006] The present invention is further improved, the USB expansion module includes a hub HUB, more than two USB interfaces respectively connected to the hub HUB, and also includes a boost unit and an overcurrent protection unit, wherein the hub HUB is respectively connected to the DSP and the USB mode switching module, the boost unit and the overcurrent protection unit respectively provide stable power for the hub HUB and the USB interface, the input end of the boost unit is electrically connected to the output end of the power management module, the output end of the boost unit is electrically connected to the input end of the overcurrent protection unit, the output end of the overcurrent protection unit is electrically connected to the USB interface, and the boost unit is also connected to the DSP through a signal line.

[0007] The USB mode switching module of the present invention comprises an insertion detection circuit, a VBUS power path management circuit and a USBDM / DP switching circuit, wherein the input end of the insertion detection circuit is connected to the type C interface, and the output end is connected to the DSP input end, the input ends of the VBUS power path management circuit and the USB DM / DP switching circuit are respectively connected to the DSP output end, and the USB DM / DP switching circuit is also respectively connected to the type C interface and the USB expansion module.

[0008] The insertion detection circuit of the present invention includes a switch tube Q1, a resistor R1, a resistor R2, a resistor R3 and a capacitor C2, wherein the source of the switch tube Q1 is grounded, and the drain is respectively connected to one end of the resistor R1, the grounded capacitor C2 and the detection pin of the DSP, the other end of the resistor R1 is connected to a 1.8V power supply, the gate of the switch tube Q1 is respectively connected to one end of the resistor R2 and the resistor R3, the other end of the resistor R3 is grounded, and the other end of the resistor R2 is connected to the VBUS pin of the type C interface.

[0009] The VBUS power path management circuit of the present invention includes switch tubes Q2-Q5 and peripheral resistor and capacitor components and a diode D1, wherein:

[0010] The drain of the switch tube Q4 is connected to the gate of the switch tube Q2, the gate of the switch tube Q3 and the charging IC respectively, the source of the switch tube Q4 is grounded, and the gate is connected to one end of the ground resistor R7, one end of the resistor R14 and one end of the resistor R6 respectively, the other end of the resistor R14 is connected to the cathode of the diode D1, and the anode of the diode D1 is connected to the host mode enable pin of the DSP.

[0011] The source of the switch tube Q2 is connected to the VBUS pin of the type C interface, the source of the switch tube Q3 is connected to the charging module, the drain of the switch tube Q2 is connected to the source of the switch tube Q3, and is connected to the drain of the switch tube Q4 through the resistor R4, the source of the switch tube Q2 is connected to the base through C3, and the source of the switch tube Q3 is connected to the base through C4.

[0012] The source of the switch tube Q5 is grounded, the drain is connected to the VBUS pin of the type C interface, and the gate is connected to the ground resistor R9 and the mode switching pin of the DSP through the resistor R8.

[0013] The present invention is further improved, the USB DM / DP switching circuit includes a switching chip U1 for switching CC signals and a switching chip U2 for switching USB_DM / DP signals, wherein:

[0014] The switching chip U1 is provided with HSD2-pin 6 and HSD2+pin 7 for deceiving the system into entering the host mode, wherein the HSD2-pin 6 or HSD2+pin 7 is provided with a grounding resistor respectively, and the resistance value of the grounding resistor is 5.1k ohms, and also includes D+pin 1 and D-pin 2 connected to the charging module, SEL pin 10 connected to the mode switching pin of the DSP, OE pin 8 and GND pin 3 grounded respectively, VCC pin 9 connected to the power supply, HSD1-pin 4 and HSD1+pin 5 connected to the two CC pins of the type C interface;

[0015] The structure of the switching chip U2 is the same as that of the switching chip U1, wherein the D+ pin 1 and D- pin 2 of the switching chip U2 are respectively connected to the DSP, the HSD1- pin 4 and HSD1+ pin 5 of the switching chip U2 are respectively connected to the DP and DN pins of the type C interface, and the HSD2- pin 6 or HSD2+ pin 7 of the switching chip U2 are respectively connected to the HUB expansion module.

[0016] The present invention is further improved in that a common mode inductor L1 is provided between the HSD1- pin 4 and the HSD1+ pin 5 of the switching chip U2, and a common mode inductor L2 is provided between the HSD2- pin 6 or the HSD2+ pin 7 of the switching chip U2.

[0017] The present invention is further improved, the type C interface includes pins A1-A12 arranged on one side of the type C interface, and pins B1-B12 arranged on the other side of the type C interface, wherein the pins A1, A12, B1 and B12 are grounded, pins A2-3, A8, A10, A11, pins B2-3, B8, B10, B11 are suspended, pins A4, A9 and pins B4, B9 are VBUS pins, connected to the VBUS_TYPEC signal line, pin A5 is the CC1 pin, pin B5 is the CC2 pin, pin A6 is the DP1 pin, pin B6 is the DP2 pin, pin A7 is the DN1 pin, pin B7 is the DN2 pin, pin A6 of the type C interface is short-circuited with pin B6, connected to the USB_DP_TYPEC signal line, and pin A7 is short-circuited with pin B7, connected to the USB_DM_TYPEC signal line.

[0018] The present invention is further improved, the USB_DP_TYPEC signal line and the USB_DM_TYPEC signal line are respectively provided with charging lines connected to the charging module through resistors, and the CC1 pin, CC2 pin, USB_DP_TYPEC signal line and the USB_DM_TYPEC signal line are respectively provided with a grounded TVS tube.

[0019] Compared with the prior art, the beneficial effects of the present invention are: there is no need to modify the USB driver and charging part of the original system, only a few control pins need to be added to complete the host and device state switching of the type C interface, and at the same time it is compatible with the fast charging protocol that comes with the charger, and has the advantages of simple design, low cost, and simple software modification and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a schematic diagram of the structure of the present invention;

[0021] Figure 2 This is a schematic diagram of the type C interface circuit of the present invention;

[0022] Figure 3 To insert the detection circuit schematic;

[0023] Figure 4 This is the schematic diagram of the VBUS power path management circuit;

[0024] Figure 5 This is the schematic diagram of the USB DM / DP switching circuit. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0026] like Figure 1 As shown, the present invention includes a type C interface, a USB mode switching module, a DSP, a power management module, a charging IC connected to the power management module, and a battery connected to the charging IC, wherein the DSP is respectively connected to the USB mode switching module and the power management module, the power management module supplies power for the entire circuit, and the USB mode switching module is respectively connected to the charging IC and the type C interface.

[0027] It also includes a USB expansion module, which is connected to the DSP and the USB mode switching module respectively. The USB expansion module includes a hub HUB, more than two USB interfaces respectively connected to the hub HUB, and a boost unit and an overcurrent protection unit, wherein the hub HUB is respectively connected to the DSP and the USB mode switching module, the boost unit and the overcurrent protection unit respectively provide stable power for the hub HUB and the USB interface, the input end of the boost unit is electrically connected to the output end of the power management module, the output end of the boost unit is electrically connected to the input end of the overcurrent protection unit, the output end of the overcurrent protection unit is electrically connected to the USB interface, and the boost unit is also connected to the DSP through a signal line.

[0028] The type C interface is used for software download, debugging, data transmission and charging functions. The battery powers the entire system. The charging IC of the charging module provides charging, USB HOST 5V power supply and current path management functions. The power management module provides various power supplies required by the platform. The DPS is responsible for controlling peripheral devices and performing USB communication. The USB mode switching module provides USB insertion detection, power paths for USB host and device modes, and switching between USB signals and CC signals. The USB expansion module is responsible for expanding the USB signal given by the DSP into multiple USB signals.

[0029] The present invention defaults to device mode (slave device mode) in the shutdown state and software download state. The USB signal is connected to the type C interface by default, and the shutdown charging and download functions can be performed. After startup, it can be controlled to switch from the default to the host mode (master device mode), and the HUB expansion USB interface is used to connect peripherals. When the type C port is inserted into the computer, the USB signal is automatically switched back to the type C to connect the computer for data transmission and charging. When the type C port is connected to the charger, the USB signal automatically switches to the type C for charging (if the charging IC and the charger both support fast charging, the fast charging state can be entered at this time). In this example, several buttons can be added to the software application interface, and the host and device states of the USB can be easily switched through the buttons.

[0030] The present invention re-sets the type C interface and USB mode switching module, does not need to modify the USB driver and charging part of the original software system, the DSP, power management module, and charging module do not make any hardware changes, and only needs to add a few control pins to complete the host and device state switching of the type C interface, and is compatible with the fast charging protocol that comes with the charger, with the advantages of simple design, low cost, simple software modification and maintenance. The USB expansion module is compatible with the finished hubs on the market.

[0031] The core part of the present invention is described in detail below.

[0032] like Figure 2As shown, the type C interface of this example includes pins A1-A12 arranged on one side of the type C interface, and pins B1-B12 arranged on the other side of the type C interface, wherein pin A1, pin A12, pin B1 and pin B12 are grounded, pins A2-3, A8, A10, A11, pin B2-3, B8, B10, B11 are suspended, pins A4, A9 and pins B4, B9 are VBUS pins connected to the VBUS_TYPEC signal line, pin A5 is the CC1 pin, pin B5 is the CC2 pin, pin A6 is the DP1 pin, pin B6 is the DP2 pin, pin A7 is the DN1 pin, and pin B7 is the DN2 pin.

[0033] The purpose of using the Type C interface in this example is to cooperate with the fast charging function of the charging IC to meet the requirements of fast charging with high voltage and high current.

[0034] In this example, pin A6 and pin B6 of the type C interface are short-circuited to connect the USB_DP_TYPEC signal line, and pin A7 and pin B7 are short-circuited to connect the USB_DM_TYPEC signal line, which can avoid the problem of positive and negative insertion of type C. The bifurcation of DM and DP on the PCB wiring is as short as possible, and the signal transmission is more stable. The USB_DP_TYPEC signal line and the USB_DM_TYPEC signal line are respectively provided with charging lines connected to the charging IC through resistors, and the USB signal is branched to the charging IC through resistors to carry fast charging protocol signals. The CC1 pin, CC2 pin, USB_DP_TYPEC signal line and USB_DM_TYPEC signal line are respectively provided with a grounded TVS tube for EOS (electrical overstress) protection.

[0035] A capacitor C1 and a surge diode ED1 are connected to the VBUS signal line of type C. The function of capacitor C1 is to eliminate the pulse on VBUS to make the VBUS voltage as stable as possible, and the function of surge diode ED1 is to eliminate the surge on VBUS.

[0036] like Figure 3-5 As shown, the USB mode switching module of this example includes an insertion detection circuit, a VBUS power path management circuit and a USB DM / DP switching circuit, wherein the input end of the insertion detection circuit is connected to the type C interface, and the output end is connected to the DSP input end, the input ends of the VBUS power path management circuit and the USB DM / DP switching circuit are respectively connected to the DSP output end, and the USB DM / DP switching circuit is also respectively connected to the type C interface and the USB expansion module. The working principles of these three parts are described in detail below.

[0037] like Figure 3As shown, the insertion detection circuit includes a switch tube Q1, a resistor R1, a resistor R2, a resistor R3 and a capacitor C2, wherein the source of the switch tube Q1 is grounded, and the drain is respectively connected to one end of the resistor R1, the grounded capacitor C2 and the detection pin of the DSP, the other end of the resistor R1 is connected to a 1.8V power supply, the gate of the switch tube Q1 is respectively connected to one end of the resistor R2 and the resistor R3, the other end of the resistor R3 is grounded, and the other end of the resistor R2 is connected to the VBUS pin of the type C interface.

[0038] This circuit provides a trigger signal TYPEC_PLUG_IN_DETECT to the DSP to report whether the Type C port is plugged into a computer or a charger. TYPEC_PLUG_IN_DETECT is low level, indicating that a computer or charger is plugged in, and TYPEC_PLUG_IN_DETECT is high level, indicating that the USB device is unplugged.

[0039] Resistor R1 is connected to VDD_1V8 voltage to provide a stable 1.8V pull-up level for TYPEC_PLUG_IN_DETECT, and capacitor C2 is used to decouple and filter TYPEC_PLUG_IN_DETECT. VBUS_TYPEC voltage is the VBUS voltage received when the type C interface is connected to a computer or USB. Considering that the charging IC (referred to as charging IC) of the charging module has a fast charging function, the VBUS_TYPEC voltage will rise to 12V (QC3.0 protocol). At this time, resistor R3 is grounded to divide VBUS_TYPEC, so that the gate voltage Vgs of the switch tube Q1 will not exceed its maximum operating voltage range. Resistor R2 acts as a current limiter to prevent large current pulses from being generated on the gate of the switch tube Q1.

[0040] When a computer or charger is plugged in, VBUS_TYPEC is high, and the voltage after voltage division by R2 and R3 is added to the gate of Q1, making the Vgs voltage high, and the source and drain of Q1 are connected to ground, so that the TYPEC_PLUG_IN_DETECT level is low. The DSP can determine that a computer or charger is plugged in by detecting that the level on TYPEC_PLUG_IN_DETECT is low. When the USB cable is unplugged, VBUS_TYPEC is low, the Vgs level of Q1 is low, Q1 is cut off, and TYPEC_PLUG_IN_DETECT is high. The DSP can determine that the computer or charger is unplugged by detecting that the level on TYPEC_PLUG_IN_DETECT is high.

[0041] like Figure 4 As shown, the VBUS power path management circuit of this example includes switch tubes Q2-Q5 and their peripheral resistors and capacitors, and a diode D1, wherein:

[0042] The drain of the switch tube Q4 is respectively connected to the gate of the switch tube Q2, the gate of the switch tube Q3, one end of the capacitor C3, one end of the capacitor C4 and the charging IC; the source of the switch tube Q4 is grounded; the gate is respectively connected to one end of the ground resistor R7, one end of the resistor R14 and one end of the resistor R6; the other end of the resistor R14 is connected to the cathode of the diode D1; the anode of the diode D1 is connected to the host mode enable pin of the DSP;

[0043] The source of the switch tube Q2 is connected to the VBUS pin of the type C interface, the source of the switch tube Q3 is connected to the charging IC, the drain of the switch tube Q2 is connected to the source of the switch tube Q3, and is connected to the drain of the switch tube Q4 through the resistor R4, the source of the switch tube Q2 is connected to the base through C3, and the source of the switch tube Q3 is connected to the base through C4.

[0044] The source of the switch tube Q5 is grounded, the drain is connected to one end of the resistor R6 and connected to the VBUS pin of the type C interface through the resistor R5, and the gate is connected to the ground resistor R9 and the mode switching pin of the DSP through the resistor R8.

[0045] The working principle of the VBUS power path management circuit is:

[0046] When the gate of NMOS switch Q4 is low, switch Q4 is turned off. At this time, the USB cable is inserted, VBUS_TYPEC has a 5V power supply, and the voltage will be conducted from the drain of switch Q2 to the source through the body diode. Because resistor R4 connects the source and gate of switch Q2 and switch Q3, at this time, Vgs of switch Q3 = 0V, switch Q3 is turned off, and VBUS has no voltage. Similarly, when there is a 5V power supply on VBUS, because Vgs of switch Q2 = 0V, Q2 is turned off, and there is no voltage on VBUS_TYPEC. Control the gate of NMOS switch Q4 to a high level, turn on the source and drain of switch Q4 to ground, and make the gates of switch Q2 and switch Q3 low. If one of VBUS_TYPEC and VBUS has a high voltage, switch Q2 and switch Q3 will be turned on, and the VBUS power supply path will be established.

[0047] The TYPEC_HOST_EN pin is controlled by the DSP. When the OTG (On-The-Go, mainly used for connection between various devices or mobile devices for data exchange) function of the type C interface needs to be turned on, the TYPEC_HOST_EN pin can be controlled to a high level to turn on the switch tube Q4, so that the gates of the switch tubes Q2 and Q3 are at a low level, ready to establish the VBUS power path, and at the same time, the USB_TYPE_SEL pin needs to be controlled to a low level to switch the CC and USB_DM / DP signals to the type C socket (see the working principle of the USBDM / DP switching circuit). At this time, if an OTG device is inserted, the CC will identify the device type and notify the charging IC to provide a 5V voltage, notifying the DSP to start the USB handshake protocol.

[0048] Because the voltage on VBUS_TYPEC will reach 12V in the fast charging state, the voltage added to the gate of Q4 will be around 3V after being divided by resistors R5, R6 and R7. The role of D1 is to prevent this 3V voltage from flowing back to DSP.

[0049] The USB_TYPE_SEL pin is controlled by the DSP. When the USB_TYPE_SEL pin is at a high voltage, the switch tube Q5 is turned on, and the drain of the switch tube Q5 is at a low level. Because the drain of the switch tube Q5 is connected to the gate of the switch tube Q4 through the resistor R6, the gate of the switch tube Q4 is at a low level at this time, and the switch tube Q4 is turned off, thereby turning off the switch tubes Q2 and Q3, and the VBUS power supply path is closed (at the same time, when USB_TYPE_SEL is high, CC will switch to a 5.1k resistor to ground to trick the system into entering the host mode, and the USB_DM / DP signal will switch to the HUB module to form the HUB expansion multi-USB port mode, see the working principle of the USB DM / DP switching circuit). Resistor R9 is pulled down to ground by default, keeping USB_TYPE_SEL at a low level by default.

[0050] like Figure 5 As shown, the USB DM / DP switching circuit in this example includes a switching chip U1 for switching CC signals and a switching chip U2 for switching USB_DM / DP signals, wherein:

[0051] The switching chip U1 is provided with HSD2- pin 6 and HSD2+ pin 7 for tricking the system into entering host mode, wherein the HSD2- pin 6 or HSD2+ pin 7 is respectively provided with a grounding resistor, and the resistance of the grounding resistor is 5.1k ohms. It also includes D+ pin 1 and D- pin 2 connected to the charging IC, SEL pin 10 connected to the mode switching pin of DSP, OE pin 8 and GND pin 3 respectively grounded to ground, VCC pin 9 connected to the power supply, and HSD1- pin 4 and HSD1+ pin 5 connected to the two CC pins of the type C interface.

[0052] The structure of the switching chip U2 is the same as that of the switching chip U1, wherein the D+ pin 1 and D- pin 2 of the switching chip U2 are respectively connected to the DSP, the HSD1- pin 4 and HSD1+ pin 5 of the switching chip U2 are respectively connected to the DP and DN pins of the type C interface, and the HSD2- pin 6 or HSD2+ pin 7 of the switching chip U2 are respectively connected to the HUB expansion module.

[0053] Preferably, a common mode inductor L1 is provided between the HSD1-pin 4 and the HSD1+pin 5 of the switching chip U2, and a common mode inductor L2 is provided between the HSD2-pin 6 or the HSD2+pin 7 of the switching chip U2. The common mode inductor L1 and the common mode inductor L2 are used to eliminate the common mode interference on the USB DM / DP and ensure the quality of the USB signal.

[0054] In this example, decoupling filter capacitors C5 and C6 with one end grounded are provided on the VSYS_PWR power line to filter the power supply pins of the switch chips U1 and U2. Current limiting resistors are also provided on the SEL pins of the switch chips U1 and U2 to prevent instantaneous large currents from being generated on the USB_TYPE_SEL pins.

[0055] This example works like this:

[0056] Switching chip U1 and switching chip U2 use system power supply. Once the system is equipped with a battery, VSYS_PWR will have voltage output to ensure that switching chips U1 and U2 can work even when the power is off. Switching chip U1 is used to switch the CC signal of type C, and switching chip U2 is used to switch the USB_DM / DP signal. In the off state, the 8th pin OE of switching chip U1 is grounded, and the 10th pin SEL is pulled down to ground through R9 (see the VBUS power path management circuit principle section). The CC signal is cut by U1 to the 4th and 5th pins of U1 and connected to the type C interface. Similarly, the USB3_HS_DM / DP signal is cut by switching chip U2 to the 4th and 5th pins of U2 and connected to the type C interface, which can maintain the download function of the original system.

[0057] After the system is powered on, DPS can control USB_TYPE_SEL to output high level and switch the CC signal to the 6th and 7th pins of U1 and ground it through a 5.1K resistor to trick the system into entering host mode. At the same time, because USB_TYPE_SEL is high, the switching chip U2 will switch the USB DM / DP signal to the 6th and 7th pins of U2 and provide it to the USB expansion module. The system can mount a variety of devices. When the system is powered on, plug in the charger or connect to the computer. After the DSP detects that the TYPEC_PLUG_IN_DETECT level becomes low, it sets USB_TYPE_SEL to low, controls U1 and U2 to switch the CC and USB_DM / DP signals to the type C socket, and the DSP can determine the type of connected device through the CC signal and perform fast charging protocol or data connection protocol through USB_DM / DP.

[0058] Because only one of CC1 and CC2 needs to be connected to ground through a 5.1k resistor to trick the system into entering host mode, R12 is reserved in this example and R11 is a 5.1k resistor.

[0059] The present invention uses a simple circuit to realize the host and device state switching of the type C interface. In the host state, it can be connected to a USB HUB to expand multiple USB interfaces and simultaneously connect multiple USB peripherals; in the device state, it can be connected to a charger for charging and a computer for software downloading, data transmission and debugging, thereby meeting the diversified design requirements of products.

[0060] The specific implementation modes described above are preferred implementation modes of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the specific implementation modes, and all equivalent changes made according to the present invention are within the protection scope of the present invention.

Claims

1. A switching circuit for switching between host and device modes of type C, characterized in that: The device comprises a type C interface, a USB mode switching module, a DSP, a power management module, a charging module connected to the power management module, and a battery connected to the charging module, wherein the DSP is respectively connected to the USB mode switching module and the power management module, the power management module supplies power to the entire circuit, and the USB mode switching module is respectively connected to the charging module and the type C interface. The USB mode switching module includes a switching chip U1 for switching CC signals and a switching chip U2 for switching USB_DM / DP signals. The switching chip U1 is provided with HSD2-pin 6 and HSD2+pin 7 for deceiving the system into entering host mode, wherein the HSD2-pin 6 or HSD2+pin 7 is provided with a grounding resistor respectively, and also includes D+pin 1 and D-pin 2 connected to the charging module, SEL pin 10 connected to the mode switching pin of DSP, OE pin 8 and GND pin 3 grounded respectively, VCC pin 9 connected to the power supply, HSD1-pin 4 and HSD1+pin 5 connected to the two CC pins of the type C interface, The structure of the switch chip U2 is the same as that of the switch chip U1, wherein the D+ pin 1 and D- pin 2 of the switch chip U2 are respectively connected to the DSP, the HSD1- pin 4 and HSD1+ pin 5 of the switch chip U2 are respectively connected to the DP and DN pins of the type C interface, and the HSD2- pin 6 or HSD2+ pin 7 of the switch chip U2 are respectively connected to the HUB expansion module. In the shutdown state, the 8th pin OE of the switching chip U1 is grounded, and the 10th pin SEL is pulled down to ground through the resistor R9. The CC signal is switched by the switching chip U1 to the 4th and 5th pins of the switching chip U1 and connected to the type C interface. Similarly, the USB3_HS_DM / DP signal is switched by the switching chip U2 to the 4th and 5th pins of the switching chip U2 and connected to the type C interface, which can maintain the download function of the original system. After the system is powered on, DPS controls the USB_TYPE_SEL pin to output a high level, switches the CC signal to the 6th and 7th pins of the switching chip U1, and grounds it through a resistor to trick the system into entering host mode. At the same time, because USB_TYPE_SEL is high, the switching chip U2 will switch the USB DM / DP signal to the 6th and 7th pins of U2 and provide it to the device. When the system is powered on, insert the charger or connect it to the computer. After the DSP detects that the TYPEC_PLUG_IN_DETECT level becomes low through the pin, it sets USB_TYPE_SEL to low. The control chips U1 and U2 switch the CC and USB_DM / DP signals to the type C interface. The DSP can determine the type of connected device through the CC signal and perform fast charging protocol or data connection protocol through USB_DM / DP.

2. The switching circuit for switching between host and device modes of type C according to claim 1, characterized in that: It also includes a USB expansion module, which is connected to the DSP and the USB mode switching module respectively, and expands the USB signal given by the DSP into multiple USB signals.

3. The switching circuit for switching between host and device modes of type C according to claim 2, characterized in that: The USB expansion module includes a hub HUB, more than two USB interfaces respectively connected to the hub HUB, and also includes a boost unit and an overcurrent protection unit, wherein the hub HUB is respectively connected to the DSP and the USB mode switching module, the boost unit and the overcurrent protection unit respectively provide stable power for the hub HUB and the USB interface, the input end of the boost unit is electrically connected to the output end of the power management module, the output end of the boost unit is electrically connected to the input end of the overcurrent protection unit, the output end of the overcurrent protection unit is electrically connected to the USB interface, and the boost unit is also connected to the DSP through a signal line.

4. The switching circuit for switching between host and device modes of type C according to claim 2 or 3, characterized in that: The USB mode switching module includes an insertion detection circuit, a VBUS power path management circuit and a USB DM / DP switching circuit, wherein the input end of the insertion detection circuit is connected to the type C interface, and the output end is connected to the DSP input end, the input ends of the VBUS power path management circuit and the USB DM / DP switching circuit are respectively connected to the DSP output end, and the USB DM / DP switching circuit is also respectively connected to the type C interface and the USB expansion module.

5. The switching circuit for switching between host and device modes of type C according to claim 4, characterized in that: The insertion detection circuit includes a switch tube Q1, a resistor R1, a resistor R2, a resistor R3 and a capacitor C2, wherein the source of the switch tube Q1 is grounded, and the drain is respectively connected to one end of the resistor R1, the grounded capacitor C2 and the detection pin of the DSP, the other end of the resistor R1 is connected to a 1.8V power supply, the gate of the switch tube Q1 is respectively connected to one end of the resistor R2 and the resistor R3, the other end of the resistor R3 is grounded, and the other end of the resistor R2 is connected to the VBUS pin of the type C interface.

6. The switching circuit for switching between host and device modes of type C according to claim 4, characterized in that: The VBUS power path management circuit includes switch tubes Q2-Q5 and peripheral resistors and capacitors, and a diode D1, wherein: The drain of the switch tube Q4 is connected to the gate of the switch tube Q2, the gate of the switch tube Q3 and the charging IC respectively, the source of the switch tube Q4 is grounded, and the gate is connected to one end of the ground resistor R7, one end of the resistor R14 and one end of the resistor R6 respectively, the other end of the resistor R14 is connected to the cathode of the diode D1, and the anode of the diode D1 is connected to the host mode enable pin of the DSP. The source of the switch tube Q2 is connected to the VBUS pin of the type C interface, the source of the switch tube Q3 is connected to the charging module, the drain of the switch tube Q2 is connected to the source of the switch tube Q3, and is connected to the drain of the switch tube Q4 through the resistor R4, the source of the switch tube Q2 is connected to the base through C3, and the source of the switch tube Q3 is connected to the base through C4. The source of the switch tube Q5 is grounded, the drain is connected to one end of R6 and connected to the VBUS pin of the type C interface through the resistor R5, and the gate is connected to the ground resistor R9 and the mode switching pin of the DSP through the resistor R8.

7. The switching circuit for switching between host and device modes of type C according to claim 6, characterized in that: The switching chip U1 for switching the CC signal and the switching chip U2 for switching the USB_DM / DP signal are arranged in the USB DM / DP switching circuit, and the resistance value of the grounding resistor is 5.1k ohms.

8. The switching circuit for switching between host and device modes of type C according to claim 7, characterized in that: A common mode inductor L1 is provided between the HSD1-pin 4 and the HSD1+pin 5 of the switching chip U2, and a common mode inductor L2 is provided between the HSD2-pin 6 or the HSD2+pin 7 of the switching chip U2.

9. The switching circuit for switching between host and device modes of type C according to claim 2 or 3, characterized in that: The type C interface includes pins A1-A12 arranged on one side of the type C interface, and pins B1-B12 arranged on the other side of the type C interface, wherein pins A1, A12, B1 and B12 are grounded, pins A2-3, A8, A10, A11, B2-3, B8, B10 and B11 are suspended, pins A4, A9 and pins B4 and B9 are VBUS pins connected to the VBUS_TYPEC signal line, pin A5 is a CC1 pin, pin B5 is a CC2 pin, pin A6 is a DP1 pin, pin B6 is a DP2 pin, pin A7 is a DN1 pin, and pin B7 is a DN2 pin, pin A6 of the type C interface is short-circuited with pin B6 to connect the USB_DP_TYPEC signal line, and pin A7 is short-circuited with pin B7 to connect the USB_DM_TYPEC signal line.

10. The switching circuit for switching between host and device modes of type C according to claim 9, characterized in that: The USB_DP_TYPEC signal line and the USB_DM_TYPEC signal line are respectively provided with charging lines connected to the charging module through resistors, and the CC1 pin, the CC2 pin, the USB_DP_TYPEC signal line and the USB_DM_TYPEC signal line are respectively provided with a grounded TVS tube.