Terminal communication circuit and control method thereof

By designing the terminal communication circuit, using the communication port module to respond to the level of the control interface in output mode and input mode, and using transistors and voltage divider modules for voltage regulation and signal transmission, it solves the problem that only one GPIO interface cannot communicate with the four-wire UART interface. solve the problem and realize the saving of interface resources.

CN118801873APending Publication Date: 2024-10-18CHINA MOBILE M2M +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410459434.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-16
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

The existing technology cannot complete communication with the four-wire UART interface when there is only one GPIO interface, resulting in a waste of interface resources.

Method used

By designing a terminal communication circuit and using the communication port module to respond to the level of the control interface respectively in output mode and input mode, normal communication between a communication port module and four interfaces is achieved, including the first node control module, the second The node control module, the first switch module and the second switch module use transistors and voltage dividing modules for voltage regulation and signal transmission.

Benefits of technology

It achieves normal communication with four interfaces when there is only one communication port, saving interface resources and avoiding waste of interface resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118801873A_ABST
    Figure CN118801873A_ABST
Patent Text Reader

Abstract

The invention discloses a terminal communication circuit and a control method thereof. The circuit comprises a communication port module; the first node control module responds to a first level of a first control interface and transmits a high level of a first power supply end to a first node under the condition that the working mode of the communication port module is an output mode; the second node control module responds to the high level of the first node and transmits the high level of a second power supply end to the second node; the first switch module responds to the first level of the first control interface and the second level of the second control interface and transmits the high level of the second node to the receiving interface; and the second switch module is used for transmitting the fourth level of the sending interface to the communication port module in response to the third level of the second control interface under the condition that the working mode of the communication port module is the input mode. According to the embodiment of the invention, one communication port module can be used for normal communication with four interfaces, and interface resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of terminals, and in particular, relates to a terminal communication circuit and a control method thereof. Background Art

[0002] At present, microcontroller units (MCU) or communication chips have different numbers of different types of peripheral interfaces, which are used to communicate and exchange data with peripherals. The UART interface physically has four interfaces for data communication.

[0003] The related technology usually requires four GPIO lines when communicating with the UART interface. When there is only one GPIO interface, it is impossible to complete the communication with the four-wire UART interface. Even if there are four GPIO lines, it also causes a waste of interface resources. Summary of the invention

[0004] The embodiment of the present application provides a terminal communication circuit and a control method thereof, which can use one communication port module to communicate normally with four interfaces, thereby saving interface resources.

[0005] In the first aspect, an embodiment of the present application provides a terminal communication circuit, which includes: a communication port module, which is electrically connected to a first node; a first node control module, which is electrically connected to a first control interface, a first node, a first power supply terminal and a ground terminal, respectively, and the first node control module is used to transmit a high level of the first power supply terminal to the first node in response to a first level of the first control interface when the working mode of the communication port module is an output mode; a second node control module, which is electrically connected to the first node, a second power supply terminal, a ground terminal and a second node, respectively, and the second node control module is used to transmit a high level of the second power supply terminal to the first node in response to a high level of the first node when the working mode of the communication port module is an output mode. The first switch module is electrically connected to the first control interface, the second control interface, the second node and the receiving interface respectively, and the first switch module is used for transmitting the high level of the second node to the receiving interface in response to the first level of the first control interface and the second level of the second control interface when the working mode of the communication port module is the output mode; the second switch module is used for transmitting the fourth level of the sending interface to the communication port module in response to the third level of the second control interface when the working mode of the communication port module is the input mode.

[0006] According to the implementation scheme of the first aspect of the present application, the first node control module includes: a first voltage divider module, a first end of the first voltage divider module is electrically connected to the ground end; a first N-type transistor, a control end of the first N-type transistor is electrically connected to the first control interface, a first end of the first N-type transistor is electrically connected to the second end of the first voltage divider module, and the second end of the first N-type transistor is electrically connected to the first node; a second voltage divider module, a first end of the second voltage divider module is electrically connected to the first power supply end; a first P-type transistor, a control end of the first P-type transistor is electrically connected to the first control interface, a first end of the first P-type transistor is electrically connected to the second end of the second voltage divider module, and the second end of the first P-type transistor is electrically connected to the first node.

[0007] According to any of the aforementioned embodiments of the first aspect of the present application, the second node control module includes: a third voltage-dividing module, a first end of the third voltage-dividing module is electrically connected to the second power supply end; a second N-type transistor, a control end of the second N-type transistor is electrically connected to the first node, a first end of the second N-type transistor is electrically connected to the second end of the third voltage-dividing module, and a second end of the second N-type transistor is electrically connected to the second node; a fourth voltage-dividing module, a first end of the fourth voltage-dividing module is electrically connected to the ground end; a second P-type transistor, a control end of the second P-type transistor is electrically connected to the first node, a first end of the second P-type transistor is electrically connected to the second end of the fourth voltage-dividing module, and a second end of the second P-type transistor is electrically connected to the second end of the second N-type transistor at the second node.

[0008] According to any of the aforementioned embodiments of the first aspect of the present application, the first switch module includes: a third P-type transistor, the control end of the third P-type transistor is electrically connected to the first control interface, and the first end of the third P-type transistor is electrically connected to the second node; a third N-type transistor, the control end of the third N-type transistor is electrically connected to the second control interface, the first end of the third N-type transistor is electrically connected to the second end of the third P-type transistor, and the second end of the third N-type transistor is electrically connected to the receiving interface.

[0009] According to any of the aforementioned embodiments of the first aspect of the present application, the second switch module includes: a fourth P-type transistor, the control end of the fourth P-type transistor is electrically connected to the second control interface, and the first end of the fourth P-type transistor is electrically connected to the sending interface; a fifth voltage divider module, the first end of the fifth voltage divider module is electrically connected to the second end of the fourth P-type transistor, and the second end of the fifth voltage divider module is electrically connected to the communication port module.

[0010] According to any of the aforementioned embodiments of the first aspect of the present application, the terminal communication circuit also includes: a regulation subcircuit, which is electrically connected to the first node, the third power supply terminal, the fourth power supply terminal and the second control interface respectively, and the regulation subcircuit adjusts the level of the second control interface in response to the level of the first node, the level provided by the third power supply terminal and the level provided by the fourth power supply terminal.

[0011] According to any of the aforementioned embodiments of the first aspect of the present application, the regulating subcircuit includes: a third node control module, the third node control module is electrically connected to the second control interface, the third power supply end, the fourth power supply end and the third node, respectively; a comparison module, the first input end of the comparison module is connected to the third node, the second input end of the comparison module is electrically connected to the first node, and the output end of the comparison module is electrically connected to the second control interface; the third node control module transmits the level of the third power supply end to the first input end of the comparison module in response to the second level of the second control interface, or the third node control module transmits the level of the fourth power supply end to the first input end of the comparison module in response to the third level of the second control interface.

[0012] According to any of the aforementioned embodiments of the first aspect of the present application, the third node control module includes: a fourth N-type transistor, the control end of the fourth N-type transistor is electrically connected to the second control interface, and the first end of the fourth N-type transistor is electrically connected to the third power supply end; a sixth voltage divider module, the first end of the sixth voltage divider module is electrically connected to the second end of the fourth N-type transistor, and the second end of the sixth voltage divider module is electrically connected to the first input end of the comparison module; a fifth P-type transistor, the control end of the fifth P-type transistor is electrically connected to the second control interface, the first end of the fifth P-type transistor is electrically connected to the fourth power supply end, and the second end of the fifth P-type transistor is electrically connected to the second end of the sixth voltage divider module and the first input end of the comparison module.

[0013] According to any of the aforementioned implementations of the first aspect of the present application, the voltage provided by the first power supply terminal is smaller than the voltage provided by the third power supply terminal.

[0014] According to any of the aforementioned embodiments of the first aspect of the present application, the communication port module includes: a seventh voltage divider module, a first end of the seventh voltage divider module is electrically connected to the fifth power supply end; a third switch module, a first end of the third switch module is electrically connected to the second end of the seventh voltage divider module, and the second end of the third switch module is electrically connected to the first node; a fourth switch module, a first end of the fourth switch module is electrically connected to the second end and the first node of the third switch module; an eighth voltage divider module, a first end of the eighth voltage divider module is electrically connected to the second end of the fourth switch module, and the second end of the eighth voltage divider module is electrically connected to the ground end.

[0015] In a second aspect, an embodiment of the present application provides a control method for a terminal communication circuit, wherein the terminal communication circuit includes the terminal communication circuit as in the first aspect, and the control method for the terminal communication circuit includes: when the working mode of the communication port module is an output mode, providing a first level to the first control interface, and providing a second level to the second control interface, so that the first node control module responds to the first level of the first control interface and transmits the high level of the first power supply end to the first node; the second node control module responds to the high level of the first node and transmits the high level of the second power supply end to the second node; the first switch module responds to the first level of the first control interface and the second level of the second control interface and transmits the high level of the second node to the receiving interface; when the working mode of the communication port module is an input mode, providing a third level to the second control interface, so that the second switch module responds to the third level of the second control interface and transmits the fourth level of the sending interface to the communication port module.

[0016] There are two working modes in the communication port module in the terminal communication circuit of the embodiment of the present application, one is the input mode and the other is the output mode. When the communication port module is in the output mode, the first node control module, in response to the first level of the first control interface, adjusts the voltage of the first node, and then controls the second node control module to adjust the voltage of the second node; then the first switch module is controlled by the level of the first control interface and the level of the second control interface, so that the receiving interface can receive the level output by the communication port module when the communication port module is in the output mode. When the communication port module is in the input mode, the opening and closing of the second switch module can be controlled by controlling the second control interface, and when the second switch module is turned on, the sending interface sends a signal to the communication port module. Based on this, the communication port module realizes communication with the first control interface, the second control interface, the sending interface and the receiving interface. That is, the terminal communication circuit of the present application can communicate normally with four interfaces in the case of only one communication port, saving interface resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0018] Figure 1 It is a structural schematic diagram of a terminal communication circuit provided by the relevant technology;

[0019] Figure 2 This is a circuit connection diagram of a terminal communication circuit provided in an embodiment of the present application;

[0020] Figure 3is another circuit connection diagram of the terminal communication circuit provided in an embodiment of the present application;

[0021] Figure 4 This is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application;

[0022] Figure 5 This is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application;

[0023] Figure 6 This is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application;

[0024] Figure 7 It is a flow chart of a method for controlling a terminal communication circuit provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0026] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0027] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0028] In the embodiments of the present application, the term “electrically connected” may refer to a direct electrical connection between two components, or may refer to an electrical connection between two components via one or more other components.

[0029] It is obvious to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit or scope of the present application. Therefore, the present application is intended to cover modifications and changes of the present application that fall within the scope of the corresponding claims (technical solutions for protection) and their equivalents. It should be noted that the implementation methods provided in the embodiments of the present application can be combined with each other without contradiction.

[0030] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0031] At present, MCU or communication chips have different numbers of different types of peripheral interfaces, which are used to communicate and exchange data with peripherals, and the interfaces are divided into different types, such as SPI / UART / I2C / SDIO / ADC... These interfaces are mapped through the general purpose input and output (GPIO), that is, we see that the GPIO interface of the chip can be mapped to an I2C, a UART, an SPI interface, etc. at any time, provided that the chip itself maps these hardware interfaces to a GPIO interface. Some MCUs or communication chips do not have a UART hardware interface or the UART interface is insufficient, resulting in the use of GPIO to simulate the Universal Asynchronous Receiver / Transmitter (UART) protocol waveform for data communication.

[0032] In the related art, a UART interface is often physically composed of four interfaces for data communication. Figure 1 It is a structural diagram of a terminal communication circuit provided by the related technology. Figure 1 What is shown is the connection mode when chip 1 communicates with chip 2. A brief introduction to the interface:

[0033] The first interface is,UART_TX: This interface is used for data transmission, that is, data is sent out from this port.

[0034] The second interface is UART_RX: This interface is used to receive data, that is, data is received from this port, such as Figure 1, UART1_TX is electrically connected to UART2_RX, and data is sent from UART1_TX to UART2_RX.

[0035] The third interface is UART_CTS: This interface is an external signal used to control the UART_TX port to send data. For example, when UART1_RTS of chip 1 is set high, UART2_CTS of chip 2 becomes high, and UART2_TX of chip 2 cannot send data. When UART1_RTS of chip 1 is set low, UART2_CTS of chip 2 becomes low, and UART2_TX of chip 2 can send data.

[0036] The fourth interface is UART_RTS: This interface is used to control the external UART_TX to send data. For example, when UART1_RTS of chip 1 is set high, UART2_CTS of chip 2 becomes high, and UART2_TX of chip 2 cannot send data again. When UART1_RTS of chip 1 is set low, UART2_CTS becomes low, and UART2_TX can send data again.

[0037] Based on this, in the related technology, when two chips are communicating data, four GPIOs are often required. However, when the chip has only one GPIO interface, it is impossible to complete the communication with the four-wire UART interface. Even if there are four GPIO lines, it also causes a waste of interface resources.

[0038] In order to solve the above technical problems, the embodiment of the present application provides a terminal communication circuit and a control method thereof. The following first introduces a terminal communication circuit provided by the embodiment of the present application.

[0039] Figure 2 is a circuit connection diagram of a terminal communication circuit provided in an embodiment of the present application, such as Figure 2 As shown, the terminal communication circuit 100 may include: a communication port module 110 , a first node control module 120 , a second node control module 130 , a first switch module 140 and a second switch module 150 .

[0040] The communication port module 110 is electrically connected to the first node A; the first node control module 120 is electrically connected to the first control interface UART_RTS, the first node A, the first power supply terminal VDD1 and the ground terminal GND, respectively. The first node A control module 120 is used to transmit the high level of the first power supply terminal VDD1 to the first node A in response to the first level of the first control interface UART_RTS when the working mode of the communication port module 110 is the output mode.

[0041] The first level may be a high level or a low level. When the communication port module 110 is in output mode, the level of the first node A is determined by the first node control module 120 .

[0042] The second node B control module 130 is electrically connected to the first node A, the second power supply terminal VDD2, the ground terminal GND and the second node B, respectively. The second node B control module 130 is used to transmit the high level of the second power supply terminal VDD2 to the second node B in response to the high level of the first node A when the working mode of the communication port module 110 is the output mode.

[0043] The first switch module 140 is electrically connected to the first control interface UART_RTS, the second control interface UART_CTS, the second node B and the receiving interface UART_RX, respectively. The first switch module 140 is used to transmit the high level of the second node B to the receiving interface UART_RX in response to the first level of the first control interface UART_RTS and the second level of the second control interface UART_CTS when the working mode of the communication port module 110 is the output mode.

[0044] The control end of the second switch module 150 is electrically connected to the second control interface UART_CTS, the first end of the second switch module 150 is electrically connected to the transmitting interface UART_TX, and the second end of the second switch module 150 is electrically connected to the communication port module 110. The second switch module 150 is used to transmit the fourth level of the transmitting interface UART_TX to the communication port module 110 in response to the third level of the second control interface UART_CTS when the working mode of the communication port module 110 is the input mode.

[0045] The communication port module 110 in the terminal communication circuit 100 of the embodiment of the present application has two working modes, one is the input mode and the other is the output mode. When the communication port module 110 is in the output mode, the first node control module 120, in response to the first level of the first control interface UART_RTS, adjusts the voltage of the first node A, and then controls the second node control module 130 to adjust the voltage of the second node B; then the first switch module 140 is controlled by the level of the first control interface UART_RTS and the level of the second control interface UART_CTS, so that the receiving interface UART_RX can receive the level output by the communication port module 110 when the communication port module 110 is in the output mode.

[0046] When the communication port module 110 is in input mode, the second switch module 150 can be turned on and off by controlling the second control interface UART_CTS. When the second switch module 150 is turned on, the transmission interface UART_TX sends a signal to the communication port module 110. Based on this, the communication port module 110 realizes communication with the first control interface UART_RTS, the second control interface UART_CTS, the transmission interface UART_TX and the receiving interface UART_RX. That is, the terminal communication circuit 100 of the present application can communicate normally with four interfaces with only one communication port, saving interface resources.

[0047] Figure 3 is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application, such as Figure 3 As shown, in some embodiments, the voltage divider module can be a resistor, and the voltage divider modules in this application are all shown as resistors. The first node control module 120 can include: a first voltage divider module R1, a first N-type transistor N1, a second voltage divider module R2 and a first P-type transistor P1.

[0048] The first end of the first voltage divider module R1 is electrically connected to the ground terminal GND, the control end of the first N-type transistor N1 is electrically connected to the first control interface UART_RTS, the first end of the first N-type transistor N1 is electrically connected to the second end of the first voltage divider module R1, and the second end of the first N-type transistor N1 is electrically connected to the first node A; the first end of the second voltage divider module R2 is electrically connected to the first power supply terminal VDD1.

[0049] The control end of the first P-type transistor P1 is electrically connected to the first control interface UART_RTS, the first end of the first P-type transistor P1 is electrically connected to the second end of the second voltage divider module R2, and the second end of the first P-type transistor P1 is electrically connected to the first node A.

[0050] Continue to see Figure 3 The second node control module 130 may include: a third voltage dividing module R3, a second N-type transistor N2, a fourth voltage dividing module R4 and a second P-type transistor P2.

[0051] A first end of the third voltage dividing module R3 is electrically connected to the second power supply end VDD2;

[0052] The control end of the second N-type transistor N2 is electrically connected to the first node A, the first end of the second N-type transistor N2 is electrically connected to the second end of the third voltage dividing module R3, and the second end of the second N-type transistor is electrically connected to the second node B;

[0053] A first end of the fourth voltage dividing module R4 is electrically connected to the ground end GND;

[0054] The control end of the second P-type transistor P2 is electrically connected to the first node A, the first end of the second P-type transistor P2 is electrically connected to the second end of the fourth voltage divider module R4, and the second end of the second P-type transistor P2 is electrically connected to the second node B with the second end of the second N-type transistor N2.

[0055] Continue to see Figure 3 , the first switch module 140 may include: a third P-type transistor P3 and a third N-type transistor N3.

[0056] The control end of the third P-type transistor P3 is electrically connected to the first control interface UART_RTS, and the first end of the third P-type transistor P3 is electrically connected to the second node B.

[0057] The control end of the third N-type transistor N3 is electrically connected to the second control interface UART_CTS, the first end of the third N-type transistor N3 is electrically connected to the second end of the third P-type transistor P3, and the second end of the third N-type transistor N3 is electrically connected to the receiving interface UART_RX.

[0058] Continue to see Figure 3 For example, the communication port module 110 may include a GPIO. The GPIO may be set to an output mode, that is, when the GPIO is set to an output mode, an external pull-up resistor is required to output a high level. When a low level is desired, the internal pull-down resistor may be pulled down.

[0059] It should be noted that when the GPIO is set to output mode, the input will also be turned on, which means that the GPIO status at this time can be known by reading and writing GPIO.

[0060] For the baud rate of UART; after determining the baud rate, the GPIO status can be read in five times the baud rate time. For example: when the baud rate is 9600bps, the time for one BIT is 104us. We can collect the GPIO status once every 20us, and 4 out of 5 times are considered to be one BIT.

[0061] It is important to understand that when GPIO sends data, UART_RX needs to receive the data sent by GPIO, and the system cannot allow UART to send at the same time. Therefore, when GPIO is in output mode, UART_CTS needs to be pulled high. At this time, since UART_CTS is pulled high, UART_TX is not allowed to send, avoiding conflicts between sending and receiving. At the same time, since GPIO needs to send data outward, UART_RTS must be low.

[0062] Based on the above understanding, the communication process between GPIO and UART_RX in the embodiment of the present application is described:

[0063] For example, the voltage provided by the first power supply terminal VDD1 is 1.6V, and the voltage provided by the second power supply terminal VDD2 is 1.8V.

[0064] The first step is to set the GPIO to output mode. At this time, the level of GPIO output is affected by the pull-up resistor of the external circuit; and provide a low level to UART_RTS and a high level to UART_CTS.

[0065] Step 2: At this time, N1 is closed and P1 is open (because the N-type transistor is turned on at a high level and turned off at a low level; the P-type transistor is turned on at a low level and turned off at a high level), and the voltage at point A is VDD1 (taking 1.6V as an example) which is a high level.

[0066] Step 3. At this time, N2 is turned on, P2 is turned off (because point A is at a high level), and the voltage at point B is VDD2 (taking 1.8V as an example), which is a high level.

[0067] Step 4. At this time, since UART_RTS is at a low level, P3 is turned on, and since UART_CTS is at a high level, N3 is turned on. At this time, UART_RX receives a high level at point B (when point A is at a high level, UART_RX receives a high level).

[0068] Step 5. When the GPIO output is low, point A is at a low level. At this time, P2 is turned on, N2 is turned off, and the voltage at point B is 0V.

[0069] Step 6. Since UART_RTS is low, P3 is turned on, and since UART_CTS is high, N3 is turned on. At this time, UART_RX receives the low level at point B. (When point A is low, UART_RX receives the low level).

[0070] In summary, when GPIO outputs low level, UART_RX receives low level, and when GPIO outputs high level, UART_RX receives high level. The level range of point A in the whole receiving process is 0-VDD1 (1.6V).

[0071] Next, the communication process between GPIO and UART_RTS in the embodiment of the present application is described:

[0072] Step 1: UART_RTS is the active control signal of UART. When UART_RTS is low, it means that UART can receive data. (For the specific UART receiving process, please refer to the communication process between GPIO and UART_RX above).

[0073] Step 2: When UART_RTS is high, N1 is turned on and P1 is turned off. At this time, the level at point A is low.

[0074] Step 3: At this time, when GPIO sends a high level, it receives a low level. At this time, it can be determined that UART_RTS is high and sending is prohibited. At this time, GPIO will no longer send.

[0075] Step 4. At this time, P_MOS_3 is turned on and UART_RX is always at a high level.

[0076] Figure 4 is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application, such as Figure 4 As shown, the second switch module 150 may include: a fourth P-type transistor P4 and a fifth voltage dividing module R5.

[0077] The control end of the fourth P-type transistor P4 is electrically connected to the second control interface UART_CTS, and the first end of the fourth P-type transistor P4 is electrically connected to the transmission interface UART_TX. The first end of the fifth voltage divider module R5 is electrically connected to the second end of the fourth P-type transistor P4, and the second end of the fifth voltage divider module R5 is electrically connected to the communication port module 110.

[0078] Continue to see Figure 4 , the terminal communication circuit 100 may further include: a regulating subcircuit 410 .

[0079] The regulating subcircuit 410 is electrically connected to the first node A, the third power supply terminal VDD3, the fourth power supply terminal VDD4 and the second control interface UART_CTS respectively. The regulating subcircuit 410 adjusts the level of the second control interface UART_CTS in response to the level of the first node A, the level provided by the third power supply terminal VDD3 and the level provided by the fourth power supply terminal VDD4.

[0080] Continue to see Figure 4 The communication port module 110 may include: a seventh voltage dividing module R7, a third switch module S1, a fourth switch module S2 and an eighth voltage dividing module R8.

[0081] A first end of the seventh voltage-dividing module R7 is electrically connected to the fifth power supply end. A first end of the third switch module S1 is electrically connected to a second end of the seventh voltage-dividing module R7, and a second end of the third switch module S1 is electrically connected to a first node A. A first end of the fourth switch module S2 is electrically connected to a second end of the third switch module S1 and the first node A. A first end of the eighth voltage-dividing module R8 is electrically connected to a second end of the fourth switch module S2, and a second end of the eighth voltage-dividing module R8 is electrically connected to a ground terminal GND.

[0082] The following describes the communication process between GPIO and UART_TX:

[0083] Take VDD5=1.8V, R5=10K, R7=100K as an example.

[0084] The first step is to set the GPIO to input mode, close S1, and open S2 to pull the GPIO internally up to 1.8V.

[0085] Step 2. By default (UART_CTS is high), P4 is closed and UART_TX cannot communicate with GPIO. When communication is desired, P_MOS_4 needs to be turned on. At this time, UART_CTS needs to be set to a low level.

[0086] Step 3: When UART_TX sends 1.8V high level, point A is 1.8V high level.

[0087] Step 4: When UART_TX sends a low level, the level at point A is 1.8V / (100K+10K)*10K=0.163V(1.8V / (R7+R5)*R5) due to the voltage division of R5 / R7. At this time, GPIO recognizes it as a low level.

[0088] Therefore, during the communication between GPIO and UART_TX, the voltage level at point A ranges from 0.163V to 1.8V.

[0089] In summary, UART_TX can send high and low levels, and GPIO can receive normally.

[0090] Figure 5 is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application, such as Figure 5 As shown, the regulating subcircuit 410 may include: a third node control module 510 and a comparison module U1.

[0091] The third node control module 510 is electrically connected to the second control interface UART_CTS, the third power supply terminal VDD3, the fourth power supply terminal VDD4 and the third node C respectively.

[0092] A first input terminal of the comparison module U1 is connected to the third node C, a second input terminal of the comparison module U1 is electrically connected to the first node A, and an output terminal of the comparison module U1 is electrically connected to the second control interface UART_CTS.

[0093] The third node control module 510 transmits the level of the third power supply terminal VDD3 to the first input terminal of the comparison module U1 in response to the second level of the second control interface UART_CTS, or the third node control module 510 transmits the level of the fourth power supply terminal VDD4 to the first input terminal of the comparison module U1 in response to the third level of the second control interface UART_CTS.

[0094] Figure 6 is another circuit connection diagram of the terminal communication circuit provided in the embodiment of the present application, such as Figure 6As shown, the third node control module 510 may include: a fourth N-type transistor N4, a sixth voltage dividing module R6 and a fifth P-type transistor P5.

[0095] A control end of the fourth N-type transistor N4 is electrically connected to the second control interface UART_CTS, and a first end of the fourth N-type transistor N4 is electrically connected to the third power supply end VDD3.

[0096] A first end of the sixth voltage dividing module R6 is electrically connected to the second end of the fourth N-type transistor N4 , and a second end of the sixth voltage dividing module R6 is electrically connected to the first input end of the comparison module U1 .

[0097] The control end of the fifth P-type transistor P5 is electrically connected to the second control interface UART_CTS, the first end of the fifth P-type transistor P5 is electrically connected to the fourth power supply end VDD4, and the second end of the fifth P-type transistor P5 is electrically connected to the second end of the sixth voltage divider module R6 and the first input end of the comparison module U1.

[0098] It should be understood that, in some embodiments, the voltage provided by the first power supply terminal VDD1 is smaller than the voltage provided by the third power supply terminal VDD3 .

[0099] Based on the above understanding, the communication process between GPIO and UART_CTS is explained, taking VDD1 = 1.6V, VDD3 = 1.65V, VDD 4 = 0.1V, VDD5 = 1.8V as an example.

[0100] In order to set UART_CTS to high level in the default state, the system needs to be initialized.

[0101] In the first step, GPIO outputs a low level first. At this time, point A is 0V, UART_CTS is 0V, P5 is turned on, point C is VDD4=0.1V, and after the comparison module U1, UART_CTS becomes output high (the voltage at the positive input end is greater than the voltage at the negative input end, and the output is high).

[0102] At this time, N4 is turned on and P5 is turned off. The voltage level at point C is VDD3 = 1.65V. The UART_CTS output is still high.

[0103] Step 2: When point A receives data, the voltage level ranges from 0 to 1.6 V, which is always less than VDD3 = 1.65 V. Then UART_CTS is always output high.

[0104] Step 3. When you want UART_CTS to go low, just set the GPIO to input mode and set the pull-up resistor to 1.8V level.

[0105] At this time, point A becomes 1.8V, point C is 1.65V, and after passing through the comparison module U1, the output of the comparison module U1 becomes low level. At this time, P5 is turned on, N4 is turned off, point C becomes 0.1V, and UART_CTS continues to be low level (the voltage at the negative input terminal is greater than the voltage at the positive input terminal, and the output is low level).

[0106] Step 4: During the entire transmission process, the lowest level of UART_TX is 0.163V, which is greater than 0.1V at point C. At this time, UART_CTS continues to remain at a low level.

[0107] Step 5. If you want UART_CTS to become high, you need to set GPIO to output mode and output low level 0V.

[0108] At this time, point A becomes 0V, point C is 0.1V, and the output of the comparison module U1 becomes a high level.

[0109] In summary, GPIO can control the high and low level states of UART_CTS through different modes.

[0110] To sum up the above four arguments;

[0111] By controlling different modes of GPIO and assisting external circuits, communication between one GPIO and a four-wire UART can be achieved.

[0112] Based on the terminal communication circuit provided in the embodiment of the present application, the present application also provides a control method for the terminal communication circuit.

[0113] Figure 7 is a flow chart of a method for controlling a terminal communication circuit provided in an embodiment of the present application, such as Figure 7 As shown, the control method of the terminal communication circuit may include: S701-S702.

[0114] S701: When the working mode of the communication port module is the output mode, provide a first level to the first control interface and provide a second level to the second control interface.

[0115] The purpose of S701 is to enable the first node control module to respond to the first level of the first control interface and transmit the high level of the first power supply end to the first node; the second node control module to respond to the high level of the first node and transmit the high level of the second power supply end to the second node; the first switch module to respond to the first level of the first control interface and the second level of the second control interface and transmit the high level of the second node to the receiving interface.

[0116] S702: When the working mode of the communication port module is the input mode, provide a third electrical level to the second control interface.

[0117] The purpose of S702 is to enable the second switch module to transmit the fourth level of the sending interface to the communication port module in response to the third level of the second control interface.

[0118] Based on this, the communication port module realizes communication with the first control interface, the second control interface, the sending interface and the receiving interface. That is, the terminal communication circuit of the present application can communicate normally with four interfaces with only one communication port, saving interface resources.

[0119] It should be understood that the specific structures of the circuits provided in the drawings of the embodiments of the present application are merely examples and are not intended to limit the present application. In addition, the above embodiments provided in the present application may be combined with each other if there is no contradiction.

[0120] It should be clear that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. According to the embodiments described above in this application, these embodiments do not describe all the details in detail, nor do they limit the application to only the specific embodiments described. Obviously, many modifications and changes can be made based on the above description. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the application, so that technicians in the relevant technical field can make good use of the application and the modified use based on the application. The application is only limited by the claims and their full scope and equivalents.

[0121] Those skilled in the art should understand that the above embodiments are exemplary rather than restrictive. Different technical features appearing in different embodiments can be combined to achieve beneficial effects. Based on the study of the drawings, the specification and the claims, those skilled in the art should be able to understand and implement other variations of the disclosed embodiments. In the claims, the term "comprising" does not exclude other structures; the quantity involves "one" but does not exclude multiple; the terms "first" and "second" are used to indicate names rather than to indicate any specific order. Any figure marks in the claims should not be understood as limiting the scope of protection. The appearance of certain technical features in different dependent claims does not mean that these technical features cannot be combined to achieve beneficial effects.

Claims

1. A terminal communication circuit, It is characterized in that include: a communication port module, wherein the communication port module is electrically connected to the first node; a first node control module, the first node control module being electrically connected to the first control interface, the first node, the first power supply terminal and the ground terminal respectively, and the first node control module being used for transmitting the high level of the first power supply terminal to the first node in response to the first level of the first control interface when the working mode of the communication port module is the output mode; a second node control module, the second node control module being electrically connected to the first node, the second power supply terminal, the ground terminal and the second node respectively, and the second node control module being used for transmitting the high level of the second power supply terminal to the second node in response to the high level of the first node when the working mode of the communication port module is the output mode; a first switch module, the first switch module being electrically connected to the first control interface, the second control interface, the second node and the receiving interface respectively, and the first switch module being used for transmitting the high level of the second node to the receiving interface in response to the first level of the first control interface and the second level of the second control interface when the working mode of the communication port module is the output mode; A second switch module, wherein the control end of the second switch module is electrically connected to the second control interface, the first end of the second switch module is electrically connected to the sending interface, and the second end of the second switch module is electrically connected to the communication port module, and the second switch module is used to transmit the fourth level of the sending interface to the communication port module in response to the third level of the second control interface when the working mode of the communication port module is an input mode.

2. The terminal communication circuit according to claim 1, It is characterized in that The first node control module includes: A first voltage dividing module, wherein a first end of the first voltage dividing module is electrically connected to a ground end; a first N-type transistor, wherein a control end of the first N-type transistor is electrically connected to the first control interface, a first end of the first N-type transistor is electrically connected to a second end of the first voltage divider module, and a second end of the first N-type transistor is electrically connected to the first node; A second voltage dividing module, wherein a first end of the second voltage dividing module is electrically connected to the first power supply end; A first P-type transistor, wherein the control end of the first P-type transistor is electrically connected to the first control interface, the first end of the first P-type transistor is electrically connected to the second end of the second voltage divider module, and the second end of the first P-type transistor is electrically connected to the first node.

3. The terminal communication circuit according to claim 1, It is characterized in that The second node control module includes: a third voltage dividing module, wherein a first end of the third voltage dividing module is electrically connected to the second power supply end; a second N-type transistor, wherein a control end of the second N-type transistor is electrically connected to the first node, a first end of the second N-type transistor is electrically connected to a second end of the third voltage divider module, and a second end of the second N-type transistor is electrically connected to the second node; a fourth voltage dividing module, wherein a first end of the fourth voltage dividing module is electrically connected to the ground end; A second P-type transistor, wherein the control end of the second P-type transistor is electrically connected to the first node, the first end of the second P-type transistor is electrically connected to the second end of the fourth voltage divider module, and the second end of the second P-type transistor is electrically connected to the second node with the second end of the second N-type transistor.

4. The terminal communication circuit according to claim 1, It is characterized in that The first switch module comprises: a third P-type transistor, wherein a control end of the third P-type transistor is electrically connected to the first control interface, and a first end of the third P-type transistor is electrically connected to the second node; A third N-type transistor, wherein the control end of the third N-type transistor is electrically connected to the second control interface, the first end of the third N-type transistor is electrically connected to the second end of the third P-type transistor, and the second end of the third N-type transistor is electrically connected to the receiving interface.

5. The terminal communication circuit according to claim 1, It is characterized in that The second switch module includes: a fourth P-type transistor, wherein a control end of the fourth P-type transistor is electrically connected to the second control interface, and a first end of the fourth P-type transistor is electrically connected to the transmission interface; A fifth voltage-dividing module, wherein a first end of the fifth voltage-dividing module is electrically connected to a second end of the fourth P-type transistor, and a second end of the fifth voltage-dividing module is electrically connected to the communication port module.

6. The terminal communication circuit according to claim 1, It is characterized in that The terminal communication circuit also includes: A regulating subcircuit, wherein the regulating subcircuit is electrically connected to the first node, the third power supply terminal, the fourth power supply terminal and the second control interface respectively, and the regulating subcircuit adjusts the level of the second control interface in response to the level of the first node, the level provided by the third power supply terminal and the level provided by the fourth power supply terminal.

7. The terminal communication circuit according to claim 6, It is characterized in that The regulating subcircuit comprises: A third node control module, the third node control module is electrically connected to the second control interface, the third power supply end, the fourth power supply end and the third node respectively; a comparison module, wherein a first input terminal of the comparison module is connected to the third node, a second input terminal of the comparison module is electrically connected to the first node, and an output terminal of the comparison module is electrically connected to the second control interface; The third node control module transmits the level of the third power supply terminal to the first input terminal of the comparison module in response to the second level of the second control interface, or the third node control module transmits the level of the fourth power supply terminal to the first input terminal of the comparison module in response to the third level of the second control interface.

8. The terminal communication circuit according to claim 7, It is characterized in that The third node control module includes: a fourth N-type transistor, wherein a control end of the fourth N-type transistor is electrically connected to the second control interface, and a first end of the fourth N-type transistor is electrically connected to the third power supply end; a sixth voltage-dividing module, wherein a first end of the sixth voltage-dividing module is electrically connected to the second end of the fourth N-type transistor, and a second end of the sixth voltage-dividing module is electrically connected to the first input end of the comparison module; A fifth P-type transistor, wherein the control end of the fifth P-type transistor is electrically connected to the second control interface, the first end of the fifth P-type transistor is electrically connected to the fourth power supply end, and the second end of the fifth P-type transistor is electrically connected to the second end of the sixth voltage divider module and the first input end of the comparison module.

9. The terminal communication circuit according to claim 8, It is characterized in that The voltage provided by the first power supply end is smaller than the voltage provided by the third power supply end.

10. The terminal communication circuit according to claim 1, It is characterized in that The communication port module comprises: a seventh voltage dividing module, wherein a first end of the seventh voltage dividing module is electrically connected to the fifth power supply end; a third switch module, wherein a first end of the third switch module is electrically connected to a second end of the seventh voltage divider module, and a second end of the third switch module is electrically connected to the first node; a fourth switch module, wherein a first end of the fourth switch module is electrically connected to the second end of the third switch module and the first node; An eighth voltage-dividing module, wherein a first end of the eighth voltage-dividing module is electrically connected to a second end of the fourth switch module, and a second end of the eighth voltage-dividing module is electrically connected to a ground end.

11. A method for controlling a terminal communication circuit, It is characterized in that The terminal communication circuit comprises the terminal communication circuit according to any one of claims 1 to 10, and the control method comprises: In the case where the working mode of the communication port module is the output mode, a first level is provided to the first control interface, and a second level is provided to the second control interface, so that the first node control module transmits the high level of the first power supply end to the first node in response to the first level of the first control interface; the second node control module transmits the high level of the second power supply end to the second node in response to the high level of the first node; the first switch module transmits the high level of the second node to the receiving interface in response to the first level of the first control interface and the second level of the second control interface; When the working mode of the communication port module is the input mode, the third level is provided to the second control interface, so that the second switch module transmits the fourth level of the sending interface to the communication port module in response to the third level of the second control interface.