Circuit compatible with UART function based on USB port and electronic equipment
By designing a USB port-compatible UART function circuit including MCU and port chip, using switching signals and switching circuits to realize hardware detection of interface function switching, the problem of failure to verify the success of MCU function switching in the prior art is solved, and the circuit design difficulty is reduced.
Patent Information
- Application Number
- CN202421403779.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2034-06-19
AI Technical Summary
In the prior art, the control chip MCU switches USB and UART functions through software, but cannot check whether the switching is successful, which increases the difficulty of circuit design.
Design a circuit based on USB port compatible UART function, including MCU and port chip, switch the electrical connection between the input and output of the signal, and use the switching circuit and current detection circuit to realize hardware detection of interface function switching.
Through the hardware architecture, timely detection of interface function switching is achieved to ensure the success of switching and reduce the difficulty of circuit design.
Smart Images

Figure CN222825896U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to the field of electronic technology, and in particular to a circuit and electronic equipment based on a USB port compatible with a UART function. Background Art
[0002] In the current highly integrated circuit, the wiring space is very limited. Therefore, if the USB port is to have the functions of USB data line and UART data line, it is generally implemented by using a switching IC circuit. However, the existing solution increases the difficulty of circuit design.
[0003] In the prior art, some control chips MCU already have the switching function between USB function and UART function, which can eliminate the need to add additional switching IC circuits on the circuit board. However, this type of switching is completely dependent on software control, and it is impossible to verify whether the switching is successful. Therefore, how to use a simple circuit to detect whether the MCU has switched successfully has become a technical problem that needs to be solved urgently. Utility Model Content
[0004] In order to solve the above problems, the utility model proposes a circuit and an electronic device based on a USB port compatible with a UART function.
[0005] In a first aspect, the utility model provides a circuit based on a USB port compatible with a UART function, comprising an MCU and a port chip, wherein the MCU comprises a switching signal output terminal, the port chip comprises a switching signal input terminal and a power supply terminal, the switching signal input terminal and the switching signal output terminal are electrically connected, and the MCU further comprises a control terminal and a detection terminal; the circuit based on a USB port compatible with a UART function further comprises:
[0006] A power supply, the power supply comprising a first power output terminal;
[0007] A switch circuit, the switch circuit comprising a controlled end, a power input end and a second power output end, the controlled end is electrically connected to the control end, the first power output end is electrically connected to the power input end, and the second power output end is electrically connected to the power end;
[0008] A current detection circuit, the current detection circuit includes a first voltage input terminal and the voltage output terminal, the first voltage input terminal is electrically connected to the second power supply output terminal, and the voltage output terminal is electrically connected to the detection terminal.
[0009] Beneficial effects:
[0010] By electrically connecting the switching signal input terminal and the switching signal output terminal, and then controlling the closing of the switch circuit through the control terminal, the power-on of the port chip is controlled, so that the MCU can issue a switching instruction to switch the function of the interface through the switching signal input terminal and the switching signal output terminal, and due to the setting of the current detection circuit, the current detected by the detection terminal of the MCU will be different, so that the switching success can be judged. Therefore, the utility model provides a hardware architecture that can help to timely detect whether the function switching of the interface is successful.
[0011] Further, the switch circuit includes an NPN transistor Q2 and a PNP transistor Q9;
[0012] The base of the NPN transistor Q2 is electrically connected to the control end, the emitter of the NPN transistor Q2 is grounded, and the collector of the NPN transistor Q2 is electrically connected to the base of the PNP transistor Q9 and the first power supply output end;
[0013] The emitter of the PNP transistor Q9 is electrically connected to the first power output terminal, and the collector of the PNP transistor Q9 is electrically connected to the power terminal.
[0014] Further, the switch circuit further includes a 17th resistor R17, a 20th capacitor C20 and a 52nd resistor R52;
[0015] The base of the NPN transistor Q2 is electrically connected to the first end of the 17th resistor R17, the first end of the 20th capacitor C20 and the first end of the 52nd resistor R52, the second end of the 52nd resistor R52 is electrically connected to the control end, and the second end of the 17th resistor R17 and the second end of the 20th capacitor C20 are grounded.
[0016] Further, the switch circuit further includes a tenth resistor R10 and a sixteenth resistor R16;
[0017] A first end of the sixteenth resistor R16 is electrically connected to the collector of the NPN transistor Q2, and a second end of the sixteenth resistor R16 is electrically connected to the base of the PNP transistor Q9;
[0018] The first end of the tenth resistor R10 is electrically connected to the second end of the sixteenth resistor R16 , and the second end of the tenth resistor R10 is electrically connected to the first power supply output end.
[0019] Further, the switch circuit further includes a ninth resistor R9, an eighteenth capacitor C18 and a fifty-seventh capacitor C57;
[0020] The first end of the ninth resistor R9, the first end of the eighteenth capacitor C18 and the first end of the fifty-seventh capacitor C57 are electrically connected to the power supply end;
[0021] The second end of the ninth resistor R9 is electrically connected to the collector of the PNP transistor Q9, and the second end of the eighteenth capacitor C18 and the second end of the fifty-seventh capacitor C57 are grounded.
[0022] Furthermore, the switch circuit further includes an eighth diode D8, an anode of the eighth diode D8 is electrically connected to the first end of the ninth resistor R9, and a cathode of the eighth diode D8 is electrically connected to the first power supply output end.
[0023] Further, the current detection circuit includes a twenty-fifth diode D25 and a first resistor R1;
[0024] An anode of the twenty-fifth diode D25 is electrically connected to the collector of the PNP transistor Q9, and a cathode of the twenty-fifth diode D25 is electrically connected to the detection end;
[0025] A first end of the first resistor R1 is electrically connected to the detection end, and a second end of the first resistor R1 is grounded.
[0026] Furthermore, the current detection circuit also includes a second voltage input terminal, and the second voltage input terminal is electrically connected to the first power supply output terminal.
[0027] Further, the current detection circuit also includes a one hundred and twenty-second resistor R122 and a fourth diode D4;
[0028] An anode of the fourth diode D4 is connected to a first end of the first 22nd resistor R122, a cathode of the fourth diode D4 is electrically connected to the detection end, and a second end of the first 22nd resistor R122 is grounded.
[0029] In a second aspect, the present invention provides an electronic device, comprising a circuit based on a USB port compatible with a UART function as described in the above embodiment. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The utility model is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0031] Figure 1 A schematic diagram of a module of a circuit based on a USB port compatible with a UART function provided by the utility model;
[0032] Figure 2 The utility model provides Figure 1 Circuit diagram of the current detection circuit in;
[0033] Figure 3 The utility model provides Figure 1 Circuit diagram of the switching circuit in . DETAILED DESCRIPTION
[0034] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some structures related to the present application are shown in the accompanying drawings, rather than all structures. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0035] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0036] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0037] In this specification, unless otherwise clearly specified and limited, a first feature being “above” or “below” a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being “above”, “above”, and “above” a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being “below”, “below”, and “below” a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.
[0038] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or mutual communication; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0039] like Figure 1-3 As shown, the utility model provides a circuit based on the USB port compatible with the UART function, including an MCU1 and a port chip 2, wherein the MCU1 includes a switching signal output terminal, the port chip 2 includes a switching signal input terminal and a power supply terminal 23, the switching signal input terminal and the switching signal output terminal are electrically connected, and the MCU1 also includes a control terminal 13 and a detection terminal 14; the circuit based on the USB port compatible with the UART function also includes:
[0040] A power supply 4, wherein the power supply 4 comprises a first power output terminal 41;
[0041] A switch circuit 3, the switch circuit 3 comprising a controlled terminal 31, a power input terminal 32 and a second power output terminal 33, the controlled terminal 31 is electrically connected to the control terminal 13, the first power output terminal 41 is electrically connected to the power input terminal 33, and the second power output terminal 32 is electrically connected to the power terminal 23;
[0042] The current detection circuit 5 includes a first voltage input terminal 51 and a voltage output terminal 53 , wherein the first voltage input terminal 51 is electrically connected to the second power supply output terminal 32 , and the voltage output terminal 53 is electrically connected to the detection terminal 14 .
[0043] The utility model controls the power-on of the port chip by electrically connecting the switching signal input terminal and the switching signal output terminal, and then controls the closing of the switch circuit through the control terminal, so that the MCU can issue a switching instruction to switch the function of the interface through the switching signal input terminal and the switching signal output terminal, and due to the setting of the current detection circuit, the current detected by the detection terminal of the MCU will be different, so that the switching success can be judged. Therefore, the utility model provides a hardware architecture that can help to timely detect whether the function switching of the interface is successful.
[0044] like Figure 3 As shown, preferably, the switch circuit 3 includes an NPN transistor Q2 and a PNP transistor Q9;
[0045] The base of the NPN transistor Q2 is electrically connected to the control terminal 13, the emitter of the NPN transistor Q2 is grounded, and the collector of the NPN transistor Q2 is electrically connected to the base of the PNP transistor Q9 and the first power output terminal 41;
[0046] The emitter of the PNP transistor Q9 is electrically connected to the first power output terminal 41 , and the collector of the PNP transistor Q9 is electrically connected to the power terminal 23 .
[0047] Preferably, the switch circuit 3 further includes a 17th resistor R17, a 20th capacitor C20 and a 52nd resistor R52;
[0048] The base of the NPN transistor Q2 is electrically connected to the first end of the 17th resistor R17, the first end of the 20th capacitor C20 and the first end of the 52nd resistor R52, the second end of the 52nd resistor R52 is electrically connected to the control end 13, and the second end of the 17th resistor R17 and the second end of the 20th capacitor C20 are grounded.
[0049] Preferably, the switch circuit 3 further includes a tenth resistor R10 and a sixteenth resistor R16;
[0050] A first end of the sixteenth resistor R16 is electrically connected to the collector of the NPN transistor Q2, and a second end of the sixteenth resistor R16 is electrically connected to the base of the PNP transistor Q9;
[0051] The first end of the tenth resistor R10 is electrically connected to the second end of the sixteenth resistor R16 , and the second end of the tenth resistor R10 is electrically connected to the first power output terminal 41 .
[0052] Preferably, the switch circuit 3 further includes a ninth resistor R9, an eighteenth capacitor C18 and a fifty-seventh capacitor C57;
[0053] The first end of the ninth resistor R9, the first end of the eighteenth capacitor C18 and the first end of the fifty-seventh capacitor C57 are electrically connected to the power supply terminal 23;
[0054] The second end of the ninth resistor R9 is electrically connected to the collector of the PNP transistor Q9, and the second end of the eighteenth capacitor C18 and the second end of the fifty-seventh capacitor C57 are grounded.
[0055] Preferably, the switch circuit 3 further includes an eighth diode D8 , an anode of the eighth diode D8 is electrically connected to the first end of the ninth resistor R9 , and a cathode of the eighth diode D8 is electrically connected to the first power output terminal 41 .
[0056] like Figure 2 As shown, the current detection circuit 5 includes a twenty-fifth diode D25 and a first resistor R1;
[0057] The anode of the twenty-fifth diode D25 is electrically connected to the collector of the PNP transistor Q9, and the cathode of the twenty-fifth diode D25 is electrically connected to the detection terminal 14;
[0058] A first end of the first resistor R1 is electrically connected to the detection end 14 , and a second end of the first resistor R1 is grounded.
[0059] Preferably, the current detection circuit 5 further includes a second voltage input terminal 52 , and the second voltage input terminal 52 is electrically connected to the first power output terminal 41 .
[0060] Preferably, the current detection circuit 5 further includes a one hundred and twenty-second resistor R122 and a fourth diode D4;
[0061] An anode of the fourth diode D4 is connected to a first end of the first 22nd resistor R122, a cathode of the fourth diode D4 is electrically connected to the detection end 14, and a second end of the first 22nd resistor R122 is grounded.
[0062] This embodiment also provides an electronic device, including a circuit based on a USB port compatible with a UART function as described in any of the above embodiments.
[0063] It should be noted that the terms "horizontal", "vertical" and the like do not mean that the components are absolutely horizontal or vertical, but can be slightly tilted; the terms "parallel", "vertical" and the like do not mean that the components are absolutely parallel or vertical, but can form a certain angle deviation. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted. In addition, the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the product of the present application is usually placed when used, which is only for the convenience of describing the embodiments of the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to the present application.
[0064] It is to be understood that the meaning of "plurality" herein is at least two, such as two, three, etc., unless there is a special limitation. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. The term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " herein generally indicates that the associated objects before and after are in an "or" relationship.
[0065] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A circuit based on a USB port compatible with UART function, comprising an MCU (1) and a port chip (2), wherein the MCU (1) comprises a switching signal output terminal, the port chip (2) comprises a switching signal input terminal and a power supply terminal (23), the switching signal input terminal and the switching signal output terminal are electrically connected, and characterized in that: The MCU (1) further comprises a control terminal (13) and a detection terminal (14); the circuit based on the USB port compatible with the UART function further comprises: A power supply (4), the power supply (4) comprising a first power output terminal (41); A switch circuit (3), the switch circuit (3) comprising a controlled terminal (31), a power input terminal (33) and a second power output terminal (32), the controlled terminal (31) being electrically connected to the control terminal (13), the first power output terminal (41) being electrically connected to the power input terminal (33), and the second power output terminal (32) being electrically connected to the power terminal (23); A current detection circuit (5), the current detection circuit (5) comprising a first voltage input terminal (51) and a voltage output terminal (53), the first voltage input terminal (51) being electrically connected to the second power supply output terminal (32), and the voltage output terminal (53) being electrically connected to the detection terminal (14).
2. A circuit based on USB port compatible with UART function according to claim 1, characterized in that: The switch circuit (3) comprises an NPN transistor Q2 and a PNP transistor Q9; The base of the NPN transistor Q2 is electrically connected to the control terminal (13), the emitter of the NPN transistor Q2 is grounded, and the collector of the NPN transistor Q2 is electrically connected to the base of the PNP transistor Q9 and the first power output terminal (41); The emitter of the PNP transistor Q9 is electrically connected to the first power output terminal (41), and the collector of the PNP transistor Q9 is electrically connected to the power terminal (23).
3. A circuit based on USB port compatible with UART function according to claim 2, characterized in that: The switch circuit (3) further includes a seventeenth resistor R17, a twentieth capacitor C20 and a fifty-second resistor R52; The base of the NPN transistor Q2 is electrically connected to the first end of the seventeenth resistor R17, the first end of the twentieth capacitor C20 and the first end of the fifty-second resistor R52, the second end of the fifty-second resistor R52 is electrically connected to the control end (13), and the second end of the seventeenth resistor R17 and the second end of the twentieth capacitor C20 are grounded.
4. A circuit based on USB port compatible with UART function according to claim 2, characterized in that: The switch circuit (3) further includes a tenth resistor R10 and a sixteenth resistor R16; A first end of the sixteenth resistor R16 is electrically connected to the collector of the NPN transistor Q2, and a second end of the sixteenth resistor R16 is electrically connected to the base of the PNP transistor Q9; The first end of the tenth resistor R10 is electrically connected to the second end of the sixteenth resistor R16, and the second end of the tenth resistor R10 is electrically connected to the first power output end (41).
5. The circuit based on USB port compatible with UART function according to claim 2, characterized in that: The switch circuit (3) further includes a ninth resistor R9, an eighteenth capacitor C18 and a fifty-seventh capacitor C57; The first end of the ninth resistor R9, the first end of the eighteenth capacitor C18 and the first end of the fifty-seventh capacitor C57 are electrically connected to the power supply terminal (23); The second end of the ninth resistor R9 is electrically connected to the collector of the PNP transistor Q9, and the second end of the eighteenth capacitor C18 and the second end of the fifty-seventh capacitor C57 are grounded.
6. The circuit based on USB port compatible with UART function according to claim 5, characterized in that: The switch circuit (3) further comprises an eighth diode D8, an anode of the eighth diode D8 being electrically connected to the first end of the ninth resistor R9, and a cathode of the eighth diode D8 being electrically connected to the first power supply output end (41).
7. The circuit based on USB port compatible with UART function according to claim 2, characterized in that: The current detection circuit (5) comprises a twenty-fifth diode D25 and a first resistor R1; The anode of the twenty-fifth diode D25 is electrically connected to the collector of the PNP transistor Q9, and the cathode of the twenty-fifth diode D25 is electrically connected to the detection terminal (14); The first end of the first resistor R1 is electrically connected to the detection end (14), and the second end of the first resistor R1 is grounded.
8. The circuit based on USB port compatible with UART function according to claim 7, characterized in that: The current detection circuit (5) further comprises a second voltage input terminal (52), wherein the second voltage input terminal (52) is electrically connected to the first power supply output terminal (41).
9. The circuit based on USB port compatible with UART function according to claim 8, characterized in that: The current detection circuit (5) further includes a one hundred and twenty-second resistor R122 and a fourth diode D4; The anode of the fourth diode D4 is connected to the first end of the first 22nd resistor R122, the cathode of the fourth diode D4 is electrically connected to the detection end (14), and the second end of the first 22nd resistor R122 is grounded.
10. An electronic device, characterized in that: It comprises a circuit based on a USB port compatible with a UART function as described in any one of claims 1 to 9.