Serial port communication circuit and serial port communication system
By designing a serial communication circuit and using the switch branch to disconnect the serial output port, the problem of additional power consumption of the serial communication interface in the low-power mode of the MCU is solved, and effective serial communication in the low-power state is realized.
Patent Information
- Application Number
- CN202421687439.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2034-07-16
AI Technical Summary
When the microcontroller unit (MCU) is in low power mode, the output port of the serial communication interface remains high, resulting in additional power consumption.
A serial communication circuit is designed, including a first switching branch, a second switching branch, a third switching branch and a controller. The controller outputs a high level in low power consumption mode and disconnects the serial port output port from other circuit structures through the first switching branch to avoid increasing power consumption.
When the MCU is in low power consumption mode, additional power consumption caused by the output port of the serial communication interface is avoided, and serial communication in the low power consumption state is realized.
Smart Images

Figure CN222994926U_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of electronic circuits, and particularly to a serial communication circuit and a serial communication system. Background Art
[0002] A microcontroller unit (MCU) is a microcomputer system integrating a processor core, a memory, and various input / output interfaces. In existing MCUs, a low-power mode is usually configured. In the low-power mode, various input / output interfaces of the MCU maintain a constant level.
[0003] In some MCUs, when in the low-power mode, the interface for serial communication, such as the output port in a Universal Asynchronous Receiver / Transmitter (UART) interface, will remain at a high level, and this high level will act on the device (such as a resistor) connected to the output port, thereby generating additional power consumption. Summary of the Utility Model
[0004] The embodiments of the present application provide a serial communication circuit and a serial communication system, which can achieve serial communication and do not generate additional power consumption when the controller is in the low-power mode.
[0005] In a first aspect, the embodiments of the present application provide a serial communication circuit, including:
[0006] A first switch branch, a second switch branch, a third switch branch, and a controller, wherein the controller includes a serial output port and a serial input port for implementing serial communication and a first digital output port for outputting a digital signal;
[0007] The first switch branch is connected between the serial output port and the second switch branch, and the first switch branch is also connected to the first digital output port. The second switch branch is also connected to an external device, and the third switch branch is connected between the serial input port and the external device;
[0008] The controller is configured to configure the first digital output port to output a control signal to the first switch branch when it is not in the low-power mode;
[0009] The first switch branch is configured to conduct when receiving the control signal to establish a connection between the serial output port and the second switch branch;
[0010] The second switch branch is configured to be turned on or off in response to a first level signal output from the serial port output port when it is connected to the serial port output port, so as to output a second level signal to the external device, wherein the second level signal and the first level signal are signals with opposite polarities;
[0011] The third switch branch is configured to be turned on or off in response to a third level signal output from the external device, so as to output a fourth level signal to the serial port input port, wherein the fourth level signal and the third level signal are signals with opposite polarities;
[0012] The controller is further configured to configure the serial port output port to output a high level when it is in the low power consumption mode;
[0013] The first switch branch is further configured to be turned off when the control signal is not received, so as to disconnect the connection between the serial port output port and the second switch branch.
[0014] In one or more embodiments, the first switch branch includes a first switch unit and a second switch unit;
[0015] The first switch unit is connected between the first digital output port and the second switch unit. The first switch unit is configured to be turned on when the control signal is received and configured to be turned off when the control signal is not received;
[0016] The second switch unit is connected between the serial port output port and the second switch branch. The second switch unit is configured to establish the connection between the serial port output port and the second switch branch in response to the conduction of the first switch unit, and is configured to disconnect the connection between the serial port output port and the second switch branch in response to the turn-off of the first switch unit.
[0017] In one or more embodiments, the first switch unit includes a first resistor, a second resistor and a first switch tube;
[0018] The first resistor and the second resistor are connected in series between the first digital output port and the ground. The connection point between the first resistor and the second resistor is connected to the first end of the first switch tube. The second end of the first switch tube is grounded, and the third end of the first switch tube is connected to the second switch unit.
[0019] In one or more embodiments, the second switch unit includes a relay and a first diode. The relay includes a coil and a pair of normally open contacts;
[0020] The first end of the coil is respectively connected to the first power supply and the cathode of the first diode. The second end of the coil is respectively connected to the anode of the first diode and the first switching unit. One of the pair of normally open contacts is connected to the serial port output port, and the other contact is connected to the second switching branch.
[0021] In one or more embodiments, the second switching branch includes a third resistor, a fourth resistor, a fifth resistor, a second diode, and a second switching transistor.
[0022] The third resistor is connected between the first switching branch and the cathode of the second diode. The anode of the second diode is connected to the first end of the second switching transistor. The fourth resistor is connected between the first switching branch and the first end of the second switching transistor. The fifth resistor is connected between the first end and the second end of the second switching transistor. The third end of the second switching transistor is connected to the external device, and the second end of the second switching transistor is grounded.
[0023] In one or more embodiments, the third switching branch includes a sixth resistor, a seventh resistor, an eighth resistor, a ninth resistor, a tenth resistor, a first electrostatic diode, a third diode, a first capacitor, and a third switching transistor.
[0024] The sixth resistor is connected between the serial port input port and the third end of the third switching transistor. The first capacitor is connected between the serial port input port and the ground. The seventh resistor is connected between the third end of the third switching transistor and the ground. The second end of the third switching transistor is connected to the second power supply. The ninth resistor is connected between the first end of the third switching transistor and the cathode of the third diode. The eighth resistor is connected between the first end of the third switching transistor and the anode of the third diode. The tenth resistor is connected between the cathode of the third diode and the second power supply. The first electrostatic diode is connected between the cathode of the third diode and the ground. The cathode of the third diode is also connected to the external device.
[0025] In a second aspect, an embodiment of the present application provides a serial communication system, including a first device and a second device.
[0026] Both the first device and the second device include the serial communication circuit as described above. The serial communication circuit of the first device is connected to the serial communication circuit of the second device to implement serial communication between the first device and the second device.
[0027] In one or more embodiments, the first device further includes a first interface, and the second device further includes a second interface. The first interface is connected to the second interface.
[0028] The first interface includes a first power terminal, a first serial input terminal, a first serial output terminal, and a first ground terminal. The first power terminal is connected to a third power supply. The first serial input terminal is connected to a third switching branch of the serial communication circuit in the first device. The first serial output terminal is connected to a second switching branch of the serial communication circuit in the first device. The first ground terminal is grounded.
[0029] The second interface includes a second power terminal, a second serial input terminal, a second serial output terminal, and a second ground terminal. The second power terminal is connected to the third power supply. The second serial input terminal is connected to a third switching branch of the serial communication circuit in the second device. The second serial output terminal is connected to a second switching branch of the serial communication circuit in the second device. The second ground terminal is grounded.
[0030] In one or more embodiments, the first device further includes a second capacitor and a second electrostatic diode, and the second device further includes a third capacitor and a third electrostatic diode.
[0031] Both the second capacitor and the second electrostatic diode are connected between the first power terminal and the ground. Both the third capacitor and the third electrostatic diode are connected between the second power terminal and the ground.
[0032] In one or more embodiments, the first device further includes a button.
[0033] The button is connected to a controller of the serial communication circuit in the first device. When the button is pressed, the controller of the serial communication circuit in the first device is woken up when in the low-power mode and outputs a wake-up signal. The wake-up signal is input to the controller of the serial communication circuit in the second device through serial communication, so that the controller of the serial communication circuit in the second device is woken up when in the low-power mode.
[0034] The beneficial effects of the present application are as follows: The serial communication circuit of the embodiment of the present application includes a first switch branch, a second switch branch, a third switch branch and a controller. Among them, the controller includes a serial output port and a serial input port for realizing serial communication, and a first digital output port for outputting digital signals. When the controller is not in the low-power mode, the controller configures the first digital output port to output a control signal to the first switch branch to make the first switch branch conduct. The connection between the serial output port and the second switch branch is established, and the second switch branch can conduct or turn off in response to the first level signal output by the serial output port to output a second level signal to an external device, where the second level signal and the first level signal are signals with opposite polarities. At the same time, the third switch branch can conduct or turn off in response to the third level signal output by the external device to output a fourth level signal to the serial input port, where the fourth level signal and the third level signal are signals with opposite polarities. Through the above process, the process of serial communication is realized. When the controller is in the low-power mode, the controller configures the serial output port to output a high level. At this time, since the first switch branch does not receive the control signal, the first switch branch turns off to disconnect the connection between the serial output port and the second switch branch. Thus, even if the serial output port is at a high level, since the connection between the serial output port and other circuit structures has been disconnected, the high level of the serial output port will not cause power consumption on other devices. It can be seen that no additional power consumption is generated when the controller is in the low-power mode. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations are not intended to limit the embodiments. Elements with the same reference numerals in the drawings represent similar elements.
[0036] Figure 1 is a schematic structural diagram of the serial communication circuit provided by the embodiment of the present application Figure 1 ;
[0037] Figure 2 is a schematic structural diagram of the serial communication circuit provided by the embodiment of the present application Figure 2 ;
[0038] Figure 3 is corresponding to Figure 2 the circuit structure shown;
[0039] Figure 4 is a schematic structural diagram of the serial communication system provided by the embodiment of the present application Figure 1 ;
[0040] Figure 5 is a schematic structural diagram of the serial communication system provided by the embodiment of the present application Figure 2 . Detailed implementation manners
[0041] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and detailedly described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] It should be noted that when an element is expressed as "connected" to another element, it can be directly connected to the other element, or there can be one or more intermediate elements therebetween.
[0043] In addition, the technical features involved in the various embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0044] Please refer to Figure 1 , Figure 1 which is a schematic structural diagram of the serial communication circuit provided by the embodiment of the present application. As Figure 1 shown, the serial communication circuit 100 includes a first switch branch 10, a second switch branch 20, a third switch branch 30 and a controller 40. In some embodiments, the serial communication circuit 100 is used to implement UART communication.
[0045] Among them, the controller 40 includes a serial output port TX1 for implementing serial communication, a serial input port RX1 and a first digital output port IO1 for outputting digital signals. In some embodiments, the controller 40 can adopt a microcontroller unit (MCU), and the first digital output port of the MCU is usually referred to as a general purpose input output (GPIO) port.
[0046] The first switch branch 10 is connected between the serial output port TX1 and the second switch branch 20. The first switch branch 10 is also connected to the first digital output port IO1. The second switch branch 20 is also connected to an external device 200. The third switch branch 30 is connected between the serial input port RX1 and the external device 200.
[0047] Specifically, the controller 40 is configured to configure the first digital output port IO1 to output a control signal to the first switch branch 10 when it is not in the low-power mode. In some embodiments, the control signal is a level signal. The first switch branch 10 is configured to conduct when receiving the control signal to establish a connection between the serial port output port TX1 and the second switch branch 20. The second switch branch 20 is configured to conduct or turn off in response to the first level signal output by the serial port output port TX1 when the second switch branch 20 is connected to the serial port output port TX1, so as to output a second level signal to the external device 200, wherein the second level signal and the first level signal are signals with opposite polarities, that is, when the first level signal is high, the second level signal is low; when the first level signal is low, the second level signal is high. The third switch branch 30 is configured to conduct or turn off in response to the third level signal output by the external device 200, so as to output a fourth level signal to the serial port input port RX1, wherein the fourth level signal and the third level signal are signals with opposite polarities, that is, when the third level signal is high, the fourth level signal is low; when the third level signal is low, the fourth level signal is high. The controller 40 is further configured to configure the serial port output port TX1 to output a high level when it is in the low-power mode. The first switch branch 10 is further configured to turn off when not receiving the control signal to disconnect the connection between the serial port output port TX1 and the second switch branch 20. It can be understood that the embodiments of the present application are applicable to the application scenario where the serial port output port TX1 of the controller 40 defaults to a high level when it is in the low-power mode.
[0048] In practical applications, when the controller 40 is not in the low-power mode, the controller 40 should normally execute the serial port communication function. In this case, the controller 40 configures the first digital output port IO1 to output a control signal to the first switch branch 10 to make the first switch branch 10 conduct. Subsequently, the connection between the serial port output port TX1 and the second switch branch 20 is established, and the second switch branch 20 can conduct or turn off in response to the first level signal output by the serial port output port TX1 to output a second level signal to the external device 200. At the same time, the third switch branch 30 can conduct or turn off in response to the third level signal output by the external device 200 to output a fourth level signal to the serial port input port RX1. Through the above process, the process of the controller 40 communicating with the external device 200 through the serial port is realized.
[0049] When the controller 40 is in the low-power mode, the controller 40 configures the serial port output port TX1 to output a high level, and the controller 40 can no longer output a control signal. At this time, since the first switch branch 10 does not receive a control signal, the first switch branch 10 is turned off to disconnect the connection between the serial port output port TX1 and the second switch branch 20. Thus, even if the serial port output port TX1 is at a high level, since the connection between the serial port output port TX1 and other circuit structures (such as the second switch branch 20) has been disconnected, the high level of the serial port output port TX1 will not cause power consumption on other devices. It can be seen that no additional power consumption is generated when the controller 40 is in the low-power mode.
[0050] Among them, the low-power mode of the controller 40 means that in the case where power consumption needs to be reduced, the controller 40 can enter a specific energy-saving mode to reduce energy consumption and extend the battery life or reduce the system heat. Different models of the controller 40 may provide various different low-power mode options. For example, the low-power mode may include a sleep mode or a standby mode. In the sleep mode, the controller 40 turns off the main clock and core modules and only maintains the operation of the minimum functions to minimize power consumption. In the standby mode, the controller 40 turns off the core clock but keeps some peripheral functions or timers running to quickly respond when needed.
[0051] In some embodiments, as Figure 2 shown, the first switch branch 10 includes a first switch unit 11 and a second switch unit 12.
[0052] Among them, the first switch unit 11 is connected between the first digital output port IO1 and the second switch unit 12, and the second switch unit 12 is connected between the serial port output port TX1 and the second switch branch 20.
[0053] Specifically, the first switch unit 11 is configured to conduct when receiving a control signal and to turn off when not receiving a control signal. The second switch unit 12 is configured to establish a connection between the serial port output port TX1 and the second switch branch 20 in response to the conduction of the first switch unit 11, and is configured to disconnect the connection between the serial port output port TX1 and the second switch branch 20 in response to the turn-off of the first switch unit 11. That is, when the control signal is output at the first digital output port IO1, the first switch unit 11 conducts, and the second switch unit 12 also conducts. The serial port output port TX1 is connected to the second switch branch 20 through the second switch unit 12, and thus the serial communication function can be realized. When the control signal is not output at the first digital output port IO1, the first switch unit 11 turns off, and the second switch unit 12 also turns off. The connection between the serial port output port TX1 and the second switch branch 20 is disconnected, so that the high level of the serial port output port TX1 does not consume power on other devices, thereby preventing the controller 40 from generating additional power consumption when in the low-power mode.
[0054] Please refer to Figure 3 , Figure 3 which exemplarily shows a circuit structure corresponding to the Figure 2 structure shown. As Figure 3 shown, the first switch unit 11 includes a first resistor R1, a second resistor R2, and a first switching transistor Q1.
[0055] Among them, the first resistor R1 and the second resistor R2 are connected in series between the first digital output port IO1 and the ground GND. The connection point between the first resistor R1 and the second resistor R2 is connected to the first end of the first switching transistor Q1. The second end of the first switching transistor Q1 is grounded to GND, and the third end of the first switching transistor Q1 is connected to the second switch unit 12.
[0056] Specifically, the first resistor R1 is used for current limiting. The first resistor R1 and the second resistor R2 divide the voltage of the control signal output from the first digital output port IO1, and the first switching transistor Q1 is driven to conduct through the voltage division of the control signal on the second resistor R2. The second resistor R2 can also discharge the charge when the first switching transistor Q1 turns off, ensuring reliable turn-off of the first switching transistor Q1.
[0057] Among them, in this embodiment, the first switching transistor Q1 is taken as an NPN-type triode as an example. The base of the NPN-type triode is the first end of the first switching transistor Q1, the emitter of the NPN-type triode is the second end of the first switching transistor Q1, and the collector of the NPN-type triode is the third end of the first switching transistor Q1.
[0058] In addition, the first switching transistor Q1 can be any controllable switch, for example, an insulated gate bipolar transistor (IGBT) device, an integrated gate-commutated thyristor (IGCT) device, a gate turn-off thyristor (GTO) device, a silicon controlled rectifier (SCR) device, a junction gate field effect transistor (JFET) device, a MOS controlled thyristor (MCT) device, etc.
[0059] In this embodiment, the second switching unit 12 includes a relay K1 and a first diode D1. The relay K1 includes a coil KM and a pair of normally open contacts SM.
[0060] Among them, the first end of the coil KM is respectively connected to the first power supply V1 and the cathode of the first diode D1. The second end of the coil KM is respectively connected to the anode of the first diode D1 and the first switching unit 11. One of the pair of normally open contacts SM is connected to the serial port output port TX1, and the other contact is connected to the second switching branch 20. In some embodiments, when the relay K1 uses a coil with a supply voltage of 24V, the voltage of the first power supply V1 is 24V.
[0061] Specifically, the first diode D1 is a freewheeling diode. When the first digital output port IO1 outputs a control signal, the control signal is input to the base of the first switching transistor Q1 to turn on the first switching transistor Q1 (corresponding to the conduction of the first switching unit 11). Subsequently, the first power supply V1, the coil KM, and the first switching transistor Q1 form a loop, the coil KM is energized, and a pair of normally open contacts SM are closed. The serial port output port TX1 is connected to the second switching unit 12 through a pair of normally open contacts SM.
[0062] When the first digital output port IO1 does not output a control signal, the first switching transistor Q1 is turned off (corresponding to the turn-off of the first switching unit 11). Subsequently, the loop where the first power supply V1 and the coil KM are located is disconnected, the coil KM loses power, a pair of normally open contacts SM are disconnected, and the connection between the serial port output port TX1 and the second switching unit 12 is disconnected.
[0063] In this embodiment, the second switching branch 20 includes a third resistor R3, a fourth resistor R4, a fifth resistor R5, a second diode D2, and a second switching transistor Q2.
[0064] Among them, the third resistor R3 is connected between the first switching branch 10 and the cathode of the second diode D2. The anode of the second diode D2 is connected to the first end of the second switching transistor Q2. The fourth resistor R4 is connected between the first switching branch 10 and the first end of the second switching transistor Q2. The fifth resistor R5 is connected between the first end and the second end of the second switching transistor Q2. The third end of the second switching transistor Q2 is connected to the external device 200, and the second end of the second switching transistor Q2 is grounded to GND.
[0065] Specifically, the fourth resistor R4 is used to configure the conduction duration of the second switching transistor Q2. The third resistor R3 and the second diode D2 are used to configure the turn-off duration of the second switching transistor Q2. The fifth resistor R5 can discharge the charge when the second switching transistor Q2 is turned off, ensuring reliable turn-off of the second switching transistor Q2.
[0066] When a pair of normally open contacts SM is closed, if the first level signal output by the serial port output port TX1 is high level, the second switching transistor Q2 is turned on, and the external device 200 is grounded through the second switching transistor Q2, and the external device 200 receives a low level correspondingly, that is, the second level signal is low level; if the first level signal output by the serial port output port TX1 is low level, the second switching transistor Q2 is turned off, and the external device 200 receives a high level correspondingly, that is, the second level signal is high level. It can be seen that the second level signal and the first level signal are signals with opposite polarities.
[0067] Among them, in this embodiment, the second switching transistor Q2 is taken as an NMOS transistor as an example. The gate of the NMOS transistor is the first end of the second switching transistor Q2, the source of the NMOS transistor is the second end of the second switching transistor Q2, and the drain of the NMOS transistor is the third end of the second switching transistor Q2.
[0068] In addition, the second switching transistor Q2 can be any controllable switch, for example, an insulated gate bipolar transistor (IGBT) device, an integrated gate-commutated thyristor (IGCT) device, a gate turn-off thyristor (GTO) device, a silicon controlled rectifier (SCR) device, a junction gate field effect transistor (JFET) device, a MOS controlled thyristor (MCT) device, etc.
[0069] In this embodiment, the third switching branch 30 includes a sixth resistor R6, a seventh resistor R7, an eighth resistor R8, a ninth resistor R9, a tenth resistor R10, a first static diode DW1, a third diode D3, a first capacitor C1 and a third switching transistor Q3.
[0070] Among them, the sixth resistor R6 is connected between the serial port input port RX1 and the third end of the third switching transistor Q3, the first capacitor C1 is connected between the serial port input port RX1 and the ground GND, the seventh resistor R7 is connected between the third end of the third switching transistor Q3 and the ground GND, the second end of the third switching transistor Q3 is connected to the second power supply V2, the ninth resistor R9 is connected between the first end of the third switching transistor Q3 and the cathode of the third diode D3, the eighth resistor R8 is connected between the first end of the third switching transistor Q3 and the anode of the third diode D3, the tenth resistor R10 is connected between the cathode of the third diode D3 and the second power supply V2, the first static diode DW1 is connected between the cathode of the third diode D3 and the ground GND, and the cathode of the third diode D3 is also connected to the external device 200.
[0071] Specifically, the sixth resistor R6 and the first capacitor C1 are used for filtering. The seventh resistor R7 is a pull-down resistor. The ninth resistor R9 is used to configure the conduction duration of the third switching transistor Q3. The eighth resistor R8 and the third diode D3 are used to configure the turn-off duration of the third switching transistor Q3. The tenth resistor R10 is a pull-up resistor. The first electrostatic diode DW1 is used to achieve electrostatic protection. The first electrostatic diode DW1 can absorb and shunt overvoltage when the voltage exceeds the set threshold, protecting other components in the circuit from damage. In some embodiments, the first electrostatic diode DW1 includes a TVS diode (bidirectional thyristor diode).
[0072] When the third-level signal output by the external device 200 is high, the third switching transistor Q3 is turned off (corresponding to the third switching branch 30 being turned off), and the pull-down effect of the seventh resistor R7 can make the serial port input port RX1 input a low level; when the third-level signal output by the external device 200 is low, the third switching transistor Q3 is turned on (corresponding to the third switching branch 30 being turned on), and the second power supply V2 is input to the serial port input port RX1 through the third switching transistor Q3 and the sixth resistor R6, so the serial port input port RX1 inputs a high level. It can be seen that the fourth-level signal and the third-level signal are signals with opposite polarities.
[0073] In the related art, when the MCU is in the low-power mode, the output port in its interface for serial communication (such as the UART interface) will remain high, and this high level will act on the devices (such as resistors) connected to this output port, thereby generating additional power consumption. Taking Figure 3 the shown circuit structure as an example, if the first switching unit 11 and the second switching unit 12 are not provided, the high level of the serial port output port TX1 will act on the fourth resistor R4 and the fifth resistor R5 to generate power consumption.
[0074] In the embodiments of the present application, by setting the first switching unit 11 and the second switching unit 12, and controlling both the first switching unit 11 and the second switching unit 12 to be turned off when the controller 40 is in the low-power mode, that is, controlling the first switching transistor Q1 to be turned off and a pair of normally open contacts SM to be disconnected, so as to disconnect the connection between the serial port output port TX1 and the second switching branch 20. Thus, even if the serial port output port TX1 is high, since the connection between the serial port output port TX1 and other circuit structures has been disconnected, the high level of the serial port output port TX1 will not generate power consumption on other devices. It can be seen that no additional power consumption is generated when the controller 40 is in the low-power mode.
[0075] Among them, in this embodiment, taking the third switching transistor Q3 as a PMOS transistor as an example. The gate of the PMOS transistor is the first end of the third switching transistor Q3, the source of the PMOS transistor is the second end of the third switching transistor Q3, and the drain of the PMOS transistor is the third end of the third switching transistor Q3.
[0076] In addition, the third switching transistor Q3 can be any controllable switch, for example, an insulated gate bipolar transistor (IGBT) device, an integrated gate-commutated thyristor (IGCT) device, a gate turn-off thyristor (GTO) device, a silicon controlled rectifier (SCR) device, a junction gate field effect transistor (JFET) device, a MOS controlled thyristor (MCT) device, etc.
[0077] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of the serial communication system provided by the embodiment of the present application. As Figure 4 shown, the serial communication system 1000 includes a first device 1001 and a second device 1002.
[0078] Among them, both the first device 1001 and the second device 1002 include the serial communication circuit 100 in any embodiment of the present application. The serial communication circuit 100 of the first device 1001 is connected to the serial communication circuit 100 of the second device 1002 to realize the serial communication between the first device 1001 and the second device 1002.
[0079] It can be understood that relative to the first device 1001, the second device 1002 can be corresponding to Figures 1-3 the external device 200 therein; similarly, relative to the second device 1002, the first device 1001 can be corresponding to Figures 1-3 the external device 200 therein.
[0080] In one embodiment, as Figure 2 shown, the first device 1001 further includes a first interface J1, and the second device 1002 further includes a second interface J2.
[0081] Among them, the first interface J1 includes a first power supply terminal J11, a first serial port input terminal J12, a first serial port output terminal J13 and a first ground terminal J14. The first power supply terminal J1 is connected to the third power supply V3, the first serial port input terminal J12 is connected to the third switching branch 30 of the serial communication circuit 100 in the first device 1001, the first serial port output terminal J13 is connected to the second switching branch 20 of the serial communication circuit 100 in the first device 1001, and the first ground terminal J14 is grounded to GND.
[0082] The second interface J2 includes a second power supply terminal J21, a second serial port input terminal J22, a second serial port output terminal J23, and a second ground terminal J24. The second power supply terminal J21 is connected to the third power supply V3. The second serial port input terminal J22 is connected to the third switch branch 30 of the serial communication circuit 100 in the second device 1002. The second serial port output terminal J23 is connected to the second switch branch 20 of the serial communication circuit 100 in the second device 1002. The second ground terminal J24 is grounded to GND.
[0083] The first interface J1 is connected to the second interface J2. Specifically, the first power supply terminal J11 is connected to the second power supply terminal J21; the first serial port input terminal J12 is connected to the second serial port output terminal J23; the first serial port output terminal J13 is connected to the second serial port input terminal J22; the first ground terminal J14 is connected to the second ground terminal J24.
[0084] In this embodiment, the first device 1001 further includes a second capacitor C2 and a second electrostatic diode DW2, and the second device 1002 further includes a third capacitor C3 and a third electrostatic diode DW3.
[0085] Among them, both the second capacitor C2 and the second electrostatic diode DW2 are connected between the first power supply terminal J11 and the ground GND. Both the third capacitor C3 and the third electrostatic diode DW3 are connected between the second power supply terminal J21 and the ground GND.
[0086] Specifically, both the second capacitor C2 and the third capacitor C3 are used for filtering. Both the second electrostatic diode DW2 and the third electrostatic diode DW3 are used to achieve electrostatic protection. The specific implementation is the same as that of the first electrostatic diode DW1 and will not be elaborated here.
[0087] In this embodiment, the first device 1001 further includes a button S1.
[0088] Among them, the button S1 is connected to the controller 40 of the serial communication circuit 100 in the first device 1001. Specifically, the controller 40 in the first device 1001 further includes a second digital output port IO2 for outputting digital signals, and the button S1 is connected to the second digital output port IO2.
[0089] When the controllers 40 in the first device 1001 and the second device 1002 are both in the low-power mode, if the button S1 is pressed and outputs a fifth-level signal (high level or low level) to the second digital output port IO2, the controller 40 in the first device 1001 is awakened. The serial port output port TX1 in the first device 1001 outputs a wake-up signal. At the same time, the first digital output port IO1 in the first device 1001 outputs a control signal to the first switch branch 10 in the first device 1001 to turn on the first switch branch 10 in the first device 1001. Subsequently, the wake-up signal is input to the controller 40 in the second device 1002 through the second switch branch 20, the first serial port output terminal J13, the second serial port input terminal J22, and the third switch branch 30 in the second device 1002 in the first device 1001 to awaken the controller 40 in the second device 1002.
[0090] The following is combined with Figure 3 with Figure 5 for description. And take the second device 1002 corresponding to Figures 1-3 the external device 200 shown as an example.
[0091] When the controllers 40 in the first device 1001 and the second device 1002 are not in the low-power mode, the controller 40 in the first device 1001 and the controller 40 in the second device 1002 should normally execute the serial communication function. In this case, whether it is the first device 1001 or the second device 1002, the following operations are performed: Configure the first digital output port IO1 to output a control signal to the first switch branch 10 to turn on the first switch branch 10.
[0092] Subsequently, when the first-level signal output by the serial port output port TX1 in the first device 1001 is high level, the second switch transistor Q2 in the first device 1001 is turned on, and the first serial port output terminal J13 is grounded to GND through the second switch transistor Q2 in the first device 1001, that is, the second serial port input terminal J22 is grounded to GND, and the corresponding second device 1002 receives a low level, that is, the second-level signal is low level. At this time, the third switch transistor Q3 in the second device 1002 is grounded to GND through the ninth resistor R9, the third switch transistor Q3 in the second device 1002 is turned on, and the serial port input port RX1 in the second device 1002 receives a high level because it is connected to the second power supply in the second device 1002 through the third switch transistor Q3 in the second device 1002.
[0093] When the first level signal output from the serial port output port TX1 in the first device 1001 is at a low level, the second switching transistor Q2 in the first device 1001 is turned off. The first serial port output terminal J13 is connected to the second power supply V2 in the second device 1002 through the second serial port input terminal J22 and the tenth resistor R10 in the second device 1002. Then, it is correspondingly defaulted that the second device 1002 receives a high level, that is, the second level signal is at a high level. At this time, the second power supply V2 in the second device 1002 is input to the third switching transistor Q3 in the second device 1002 through the tenth resistor R10 and the ninth resistor R9 in the second device 1002. The third switching transistor Q3 in the second device 1002 is turned off, and the serial port input port RX1 in the second device 1002 receives a low level due to the pull-down effect of the seventh resistor R7 in the second device 1002.
[0094] When the third level signal output from the serial port output port TX1 in the second device 1002 is at a high level, the second switching transistor Q2 in the second device 1002 is turned on. The second serial port output terminal J23 is grounded to GND through the second switching transistor Q2 in the second device 1002, that is, the first serial port input terminal J12 is grounded to GND. Correspondingly, the first device 1001 receives a low level, that is, the fourth level signal is at a low level. At this time, the third switching transistor Q3 in the first device 1001 is grounded to GND through the ninth resistor R9. The third switching transistor Q3 in the first device 1001 is turned on, and the serial port input port RX1 in the first device 1001 receives a high level because it is connected to the second power supply in the second device 1002 through the third switching transistor Q3 in the first device 1002.
[0095] When the third level signal output from the serial port output port TX1 in the second device 1002 is at a low level, the second switching transistor Q2 in the second device 1002 is turned off. The second serial port output terminal J23 is connected to the second power supply V2 in the first device 1001 through the first serial port input terminal J12 and the tenth resistor R10 in the first device 1001. Then, it is correspondingly defaulted that the first device 1001 receives a high level, that is, the fourth level signal is at a high level. At this time, the second power supply V2 in the first device 1001 is input to the third switching transistor Q3 in the first device 1001 through the tenth resistor R10 and the ninth resistor R9 in the first device 1001. The third switching transistor Q3 in the first device 1001 is turned off, and the serial port input port RX1 in the first device 1001 receives a low level due to the pull-down effect of the seventh resistor R7 in the first device 1001.
[0096] Through the above process, when the controller 40 in the first device 1001 outputs a high level, the controller 40 in the second device 1002 receives a high level; when the controller 40 in the first device 1001 outputs a low level, the controller 40 in the second device 1002 receives a low level; when the controller 40 in the second device 1002 outputs a high level, the controller 40 in the first device 1001 receives a high level; when the controller 40 in the second device 1002 outputs a low level, the controller 40 in the first device 1001 receives a low level. Thus, the serial communication process between the controller 40 in the first device 1001 and the controller 40 in the second device 1002 is realized.
[0097] When the controller 40 in the first device 1001 is in the low-power mode, the controller 40 in the first device 1001 configures the serial port output port TX1 in the first device 1001 to output a high level, and moreover, the first digital output port IO1 in the first device 1001 no longer outputs a control signal. At this time, since the first switch branch 10 in the first device 1001 does not receive a control signal, the first switch branch 10 in the first device 1001 is turned off to disconnect the connection between the serial port output port TX1 in the first device 1001 and the second switch branch 20 in the first device 1001. Thus, even if the serial port output port TX1 in the first device 1001 is at a high level, since the connection between the serial port output port TX1 in the first device 1001 and other circuit structures (such as the second switch branch 20 in the first device 1001) has been disconnected, the high level of the serial port output port TX1 in the first device 1001 will not cause power consumption on other devices. It can be seen that no additional power consumption is generated when the controller 40 in the first device 1001 is in the low-power mode. Based on the same analysis process, it can be determined that no additional power consumption is generated when the controller 40 in the second device 1002 is in the low-power mode.
[0098] When both the controller 40 in the first device 1001 and the controller 40 in the second device 1002 are in the low-power mode, if the button S1 is pressed, a fifth level signal (high level or low level) is output to the second digital output port IO2, and the controller 40 in the first device 1001 is awakened. The serial port output port TX1 in the first device 1001 outputs a wake-up signal. At the same time, the first digital output port IO1 in the first device 1001 outputs a control signal to the first switch branch 10 in the first device 1001 to make the first switch branch 10 in the first device 1001 conduct, that is, a pair of normally open contacts SM in the first device 1001 is closed.
[0099] Subsequently, the wake-up signal (either a high-level signal or a low-level signal, taking the high-level signal as an example here) is input to the second switching transistor Q2 in the first device 1001 through a pair of normally open contacts SM in the first device 1001 and the fourth resistor R4 in the first device 1001, so that the second switching transistor Q2 in the first device 1001 is turned on. The first serial port output terminal J13 is grounded to GND through the second switching transistor Q2 in the first device 1001, that is, the second serial port input terminal J22 is grounded to GND. At this time, the third switching transistor Q3 in the second device 1002 is grounded to GND through the ninth resistor R9, the third switching transistor Q3 in the second device 1002 is turned on, and the serial port input port RX1 in the second device 1002 receives a high level correspondingly because it is connected to the second power supply in the second device 1002 through the third switching transistor Q3 in the second device 1002, so that the controller 40 in the second device 1002 is awakened. It can be understood that in this embodiment, when the controller 40 in the second device 1002 is set to be in the low-power mode, if the serial port input port RX1 in the second device 1002 receives a high level, it will be awakened. Secondly, when the wake-up signal is configured as a low-level signal, it should be set that when the controller 40 in the second device 1002 is in the low-power mode, if the serial port input port RX1 in the second device 1002 receives a low level, it will be awakened. In addition, when the second device 1002 is in the low-power mode, the serial port input port RX1 in the second device 1002 should be configured as an interrupt input port so as to be able to receive the corresponding level signal and be awakened.
[0100] In the related art, a method of regularly waking up the controller 40 in the second device 1002 is usually adopted. And, after each wake-up of the controller 40 in the second device 1002, it is judged again whether to enter the low-power mode again, and it may enter the low-power mode again. Then, it will cause the controller 40 in the second device 1002 to be continuously awakened and continuously enter the low-power mode, which will also cause additional power consumption. In this application, by setting the button K1 and configuring the serial port input port RX1 as an interrupt input port, it is possible to wake up the controller 40 in the second device 1002 only when it is needed, without the need to wake up frequently as in the related art, which is beneficial to reducing power consumption.
[0101] The above are only the embodiments of this application, and do not limit the patent scope of this application accordingly. All equivalent structural or equivalent process transformations made by using the content of the specification and drawings of this application, or directly or indirectly applied in other related technical fields, are equally included in the patent protection scope of this application.
[0102] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; under the idea of the present application, the technical features in the above embodiments or different embodiments can also be combined, and the steps can be implemented in any order. Those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the various embodiments of the present application.
Claims
1. A serial communication circuit, characterized in that: include: A first switch branch, a second switch branch, a third switch branch and a controller, wherein the controller comprises a serial port output port and a serial port input port for realizing serial port communication and a first digital output port for outputting a digital signal; The first switch branch is connected between the serial port output port and the second switch branch, the first switch branch is also connected to the first digital output port, the second switch branch is also connected to an external device, and the third switch branch is connected between the serial port input port and the external device; The controller is configured to configure the first digital output port to output a control signal to the first switch branch when the controller is not in the low power consumption mode; The first switch branch is configured to be turned on upon receiving the control signal to establish a connection between the serial port output port and the second switch branch; The second switch branch is configured to be turned on or off in response to a first level signal output by the serial port output port when the second switch branch is connected to the serial port output port, so as to output a second level signal to the external device, wherein the second level signal is a signal with opposite polarity to the first level signal; The third switch branch is configured to be turned on or off in response to a third level signal output by the external device, so as to output a fourth level signal to the serial port input port, wherein the fourth level signal is a signal with opposite polarity to the third level signal; The controller is further configured to configure the serial output port to output a high level when the controller is in the low power consumption mode; The first switch branch is further configured to be turned off when the control signal is not received, so as to disconnect the connection between the serial port output port and the second switch branch.
2. The serial communication circuit according to claim 1, characterized in that: The first switch branch includes a first switch unit and a second switch unit; The first switch unit is connected between the first digital output port and the second switch unit, and the first switch unit is configured to be turned on when receiving the control signal, and configured to be turned off when not receiving the control signal; The second switch unit is connected between the serial port output port and the second switch branch. The second switch unit is configured to establish a connection between the serial port output port and the second switch branch in response to the first switch unit being turned on, and is configured to disconnect the connection between the serial port output port and the second switch branch in response to the first switch unit being turned off.
3. The serial communication circuit according to claim 2, characterized in that: The first switch unit includes a first resistor, a second resistor and a first switch tube; The first resistor and the second resistor are connected in series between the first digital output port and ground, a connection point between the first resistor and the second resistor is connected to a first end of the first switch tube, a second end of the first switch tube is grounded, and a third end of the first switch tube is connected to the second switch unit.
4. The serial communication circuit according to claim 2, characterized in that: The second switch unit includes a relay and a first diode, and the relay includes a coil and a pair of normally open contacts; The first end of the coil is connected to the first power supply and the cathode of the first diode respectively, the second end of the coil is connected to the anode of the first diode and the first switch unit respectively, one of the pair of normally open contacts is connected to the serial port output port, and the other contact is connected to the second switch branch.
5. The serial communication circuit according to claim 1, characterized in that: The second switch branch includes a third resistor, a fourth resistor, a fifth resistor, a second diode and a second switch tube; The third resistor is connected between the first switch branch and the cathode of the second diode, the anode of the second diode is connected to the first end of the second switch tube, the fourth resistor is connected between the first switch branch and the first end of the second switch tube, the fifth resistor is connected between the first end and the second end of the second switch tube, the third end of the second switch tube is connected to the external device, and the second end of the second switch tube is grounded.
6. The serial communication circuit according to claim 1, characterized in that: The third switch branch includes a sixth resistor, a seventh resistor, an eighth resistor, a ninth resistor, a tenth resistor, a first electrostatic diode, a third diode, a first capacitor and a third switch tube; The sixth resistor is connected between the serial port input port and the third end of the third switch tube, the first capacitor is connected between the serial port input port and the ground, the seventh resistor is connected between the third end of the third switch tube and the ground, the second end of the third switch tube is connected to the second power supply, the ninth resistor is connected between the first end of the third switch tube and the cathode of the third diode, the eighth resistor is connected between the first end of the third switch tube and the anode of the third diode, the tenth resistor is connected between the cathode of the third diode and the second power supply, the first electrostatic diode is connected between the cathode of the third diode and the ground, and the cathode of the third diode is also connected to the external device.
7. A serial communication system, characterized in that: comprising a first device and a second device; The first device and the second device both include the serial communication circuit as described in any one of claims 1 to 6, and the serial communication circuit of the first device is connected to the serial communication circuit of the second device to achieve serial communication between the first device and the second device.
8. The serial communication system according to claim 7, characterized in that: The first device further includes a first interface, the second device further includes a second interface, and the first interface is connected to the second interface; The first interface includes a first power terminal, a first serial port input terminal, a first serial port output terminal and a first ground terminal, the first power terminal is connected to a third power source, the first serial port input terminal is connected to a third switch branch of a serial port communication circuit in the first device, the first serial port output terminal is connected to a second switch branch of a serial port communication circuit in the first device, and the first ground terminal is grounded; The second interface includes a second power terminal, a second serial port input terminal, a second serial port output terminal and a second ground terminal, the second power terminal is connected to the third power supply, the second serial port input terminal is connected to the third switch branch of the serial port communication circuit in the second device, the second serial port output terminal is connected to the second switch branch of the serial port communication circuit in the second device, and the second ground terminal is grounded.
9. The serial communication system according to claim 8, characterized in that: The first device further includes a second capacitor and a second electrostatic diode, and the second device further includes a third capacitor and a third electrostatic diode; The second capacitor and the second electrostatic diode are both connected between the first power terminal and the ground, and the third capacitor and the third electrostatic diode are both connected between the second power terminal and the ground.
10. The serial communication system according to claim 7, characterized in that: The first device also includes a button; The button is connected to the controller of the serial port communication circuit in the first device, wherein when the button is pressed, the controller of the serial port communication circuit in the first device is awakened when in a low power consumption mode and outputs a wake-up signal, and the wake-up signal is input to the controller of the serial port communication circuit in the second device through serial port communication, so that the controller of the serial port communication circuit in the second device is awakened when in a low power consumption mode.