CN114661646A - Serial port switching control circuit - Google Patents

Serial port switching control circuit Download PDF

Info

Publication number
CN114661646A
CN114661646A CN202210329892.4A CN202210329892A CN114661646A CN 114661646 A CN114661646 A CN 114661646A CN 202210329892 A CN202210329892 A CN 202210329892A CN 114661646 A CN114661646 A CN 114661646A
Authority
CN
China
Prior art keywords
data
serial
serial port
control module
usb
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210329892.4A
Other languages
Chinese (zh)
Inventor
苏祺云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Kaadas Intelligent Technology Co Ltd
Original Assignee
Shenzhen Kaadas Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Kaadas Intelligent Technology Co Ltd filed Critical Shenzhen Kaadas Intelligent Technology Co Ltd
Priority to CN202210329892.4A priority Critical patent/CN114661646A/en
Publication of CN114661646A publication Critical patent/CN114661646A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

The application provides a serial ports switching control circuit, serial ports switching control circuit includes USB interface, signal conversion module, serial interface and control module. The USB interface is used for being electrically connected with an upper computer, and the USB interface is used for interacting USB data with the upper computer. The signal conversion module is electrically connected with the USB interface and is used for realizing the mutual conversion between the USB data and the first serial port data. The serial interface is used for being electrically connected with the terminal equipment and used for interacting second serial port data with the terminal equipment. The control module is respectively electrically connected with the signal conversion module and the serial interface, and is used for realizing the conversion between the first serial port data and the second serial port data so as to realize the data interaction between the upper computer and the terminal equipment. The serial port switching control circuit provided by the application can realize the conversion between the USB data and the second serial port data, thereby realizing the data interaction between the upper computer and the terminal equipment, having wide applicability and reducing the cost.

Description

Serial port switching control circuit
Technical Field
The application relates to the field of serial port communication, in particular to a serial port switching control circuit.
Background
With the development of science and technology, the smart lock has been favored by more and more consumers. The main control unit is the core component of intelligence lock product, and at present, the main control unit of intelligence lock product on the market is various, and each producer can select the main control unit of different models according to performance demand and manufacturing cost, and however, the main control unit of different models supports different data transmission rate. In the production process of the intelligent lock, a manufacturer needs to debug and test the intelligent lock through the interface board, and as the main controllers of the intelligent lock are various and the supported data transmission rates are different, the interface board and the intelligent lock which are configured differently need to be designed to be adapted, so that the intelligent lock is high in cost, long in development period and not beneficial to product popularization.
Disclosure of Invention
In view of the above, a main objective of the present application is to provide a serial port switching control circuit, which aims to solve the problem that the existing interface board cannot be adapted to a host controller supporting different data transmission rates.
In order to achieve the above object, the present application provides a serial port transfer control circuit, which includes a USB interface, a signal conversion module, a serial interface, and a control module. The USB interface is used for being electrically connected with an upper computer, and the USB interface is used for interacting USB data with the upper computer. The signal conversion module is electrically connected with the USB interface and is used for realizing the mutual conversion between the USB data and the first serial port data. The serial interface is used for being electrically connected with the terminal equipment, and the serial interface is used for interacting second serial port data with the terminal equipment. The control module is respectively electrically connected with the signal conversion module and the serial interface, and is used for determining the data transmission rate of the upper computer according to the data of the interaction between the USB interface and the upper computer and determining the data transmission rate of the terminal equipment according to the data of the interaction between the serial interface and the terminal equipment. The control module is further used for realizing conversion between the first serial port data and the second serial port data according to the data transmission rate of the upper computer and the terminal equipment so as to realize data interaction between the upper computer and the terminal equipment.
The serial ports switching control circuit that this application provided can be used for debugging terminal equipment, before the debugging, confirms host computer and terminal equipment's data transmission rate through control module, and the interconversion between the USB data that the rethread signal conversion module supported and the first serial ports data of host computer realization to and the data transmission rate according to host computer and terminal equipment through control module, realize the conversion between the second serial ports data that first serial ports data and terminal equipment supported, thereby realize the host computer with data interaction between the terminal equipment. Because the control module can support the conversion of various transmission rates of data, the serial port switching control circuit can be adapted to terminal equipment with various data transmission rates, the applicability is wide, and the debugging cost of the terminal equipment can be reduced.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
Fig. 1 is a schematic structural diagram of a serial port transfer control circuit provided in an embodiment of the present application.
Fig. 2 is a schematic circuit structure diagram of a USB interface in the serial port transfer control circuit shown in fig. 1.
Fig. 3 is a schematic circuit structure diagram of a signal conversion module in the serial port transfer control circuit shown in fig. 1.
Fig. 4 is a schematic circuit structure diagram of a control module in the serial port transfer control circuit shown in fig. 1.
Fig. 5 is a schematic circuit structure diagram of the serial interface, the detection module, and the wake-up module in the serial port transfer control circuit shown in fig. 1.
Fig. 6 is a schematic circuit structure diagram of a switch module in the serial port transfer control circuit shown in fig. 1.
Description of the main element symbols:
serial port switching control circuit 100
USB interface 10
Signal conversion module 20
Serial interface 50
Control module 30
Detection module 60
Switch module 40
Upper computer 200
Terminal device 300
Wake-up module 70
Switch unit 41
Drive circuit 42
Connection node 601
Electromagnetic relay K1
First conductive arm 412
Second conductive arm 413
Electromagnetic coil 411
Transistors Q1, Q2
Resistors R11, R13, R14, R15, R17,
R20、R21
Capacitor C5
Diodes D3, D4
USB-to-serial port chip U1
Control chip U3
The following detailed description will further illustrate the present application in conjunction with the above-described figures.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without inventive step, are within the scope of the present disclosure.
In the description of the present application, it should be noted that the terms "upper", "lower", "left", "right", and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience in describing the present application and simplifying the description, but do not indicate or imply that the referred devices or elements must have a specific orientation, be configured in a specific orientation, and operate, and thus, should not be construed as limiting the present application. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the field of data communication, data interaction between various electronic devices depends on data interfaces, and in the prior art, USB (Universal serial bus) interfaces and various serial interfaces are most widely applied, wherein the USB interfaces are widely applied to personal computers and mobile devices due to their functions of high data transmission rate, plug and play, hot plug support, and the like. The serial interface has the advantage of simple communication line, can realize two-way communication by only one pair of transmission lines, is favorable for reducing cost, and is widely applied to various electronic equipment, such as intelligent locks, televisions, projectors and the like. However, different electronic devices may have different types of data interfaces, for example, when a terminal device (e.g., a smart lock) is debugged by an upper computer, the upper computer is only configured with a USB interface, and the terminal device is only configured with a serial interface, which cannot directly communicate with each other, and therefore, to implement communication between the different types of data interfaces, conversion between the data interfaces is indispensable.
Referring to fig. 1, an embodiment of the present application provides a serial port transfer control circuit 100, where the serial port transfer control circuit 100 may be used to debug a terminal device 300. The serial port switching control circuit 100 includes a USB interface 10, a signal conversion module 20, a serial interface 50, and a control module 30.
Specifically, the USB interface 10 is used to be electrically connected to an upper computer 200 (for example, a personal computer, a notebook computer, etc.), and the USB interface 10 is used to interact USB data with the upper computer 200.
The signal conversion module 20 is electrically connected to the USB interface 10, and the signal conversion module 20 is configured to implement mutual conversion between the USB data and the first serial port data. Illustratively, the first serial data is serial data of a Transistor-Transistor Logic (TTL) level, and the signal conversion module 20 is a USB to TTL serial chip, and is configured to convert the USB data into the first serial data, or convert the first serial data into the USB data.
The serial interface 50 is used for electrically connecting with a terminal device 300 (such as a smart lock, a television, a projector, etc.), and the serial interface 50 is used for interacting with the terminal device 300 by using second serial port data.
The control module 30 is electrically connected to the signal conversion module 20 and the serial interface 50, respectively. Before the terminal device 300 is debugged, the control module 30 is configured to determine the data transmission rate of the upper computer 200 according to the data interacted between the USB interface 10 and the upper computer 200, and determine the data transmission rate of the terminal device 300 according to the data interacted between the serial interface 50 and the terminal device 300.
In this embodiment of the present application, a transmission rate of the first serial port data is defined as a first baud rate, and a transmission rate of the second serial port data is defined as a second baud rate. The conversion between the first serial port data and the second serial port data refers to converting a baud rate of transmission data, for example, the baud rate of the first serial port data is 9600bps, the baud rate of the second serial port data is 4800bps, and the control module 30 is configured to convert the first serial port data with the baud rate of 9600bps into the second serial port data with the baud rate of 4800bps, or convert the second serial port data with the baud rate of 4800bps into the first serial port data with the baud rate of 9600 bps. The baud rate is a physical quantity reflecting the frequency of signal waveform transformation in digital communication, and the baud rate represents the transmission rate of symbols, wherein each symbol can represent one or more data bits. When serial interface communication is carried out, the baud rates of the sending end and the receiving end can normally communicate only when the baud rates are relatively close to each other, and if the data transmission rates of the sending end and the receiving end are inconsistent, namely the first baud rate is inconsistent with the second baud rate, the situation that the serial interface communication of the two parties fails may occur.
In an application embodiment, the control module 30 may determine the data transmission rate of the upper computer 200 by:
the control module 30 outputs the first serial port test data to the signal conversion module 20. Specifically, the control module 30 outputs the first serial port test data at a plurality of preset baud rates (e.g., commonly used baud rates 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, etc.).
The signal conversion module 20 is further configured to convert the first serial port test data into USB test data, and output the USB test data to the upper computer 200 through the USB interface 10. After receiving the USB test data, the upper computer 200 feeds back USB feedback data corresponding to the USB test data to the USB interface 10.
The USB interface 10 receives the USB feedback data fed back by the upper computer 200, and outputs the USB feedback data to the signal conversion module 20.
The signal conversion module 20 is further configured to convert the USB feedback data into corresponding first serial port feedback data, and output the first serial port feedback data to the control module 30.
The control module 30 is further configured to compare the first serial port feedback data with the first serial port test data, and determine that the data transmission rate of the upper computer 200 is the first baud rate.
For example, the control module 30 may enumerate a preset baud rate in a preset order (e.g., from small to large), and communicate with the upper computer 200 at least once to determine the data transmission rate of the upper computer 200. For example, the control module 30 outputs the first serial port test data, for example, 01010101, at a baud rate of 2400bps, and if the data transmission rate of the upper computer 200 matches the baud rate of the first serial port test data output by the control module 30, the second serial port feedback data corresponding to the USB feedback data fed back by the upper computer should be 10101010. If the second serial port feedback data fed back by the upper computer 200 is 10101010, it may be determined that the data transmission rate of the upper computer 200 is 2400 bps. If the second serial port feedback data fed back by the upper computer 200 is not 10101010, the control module 30 outputs the first serial port test data 01010101 at another baud rate until the received second serial port feedback data is 10101010, and then the corresponding baud rate is determined as the data transmission rate of the upper computer 200.
Likewise, the control module 30 can determine the data transmission rate of the terminal device 300 in the same manner:
the control module 30 outputs the second serial port test number to the terminal device 300 through the serial port 50. Specifically, the control module 30 outputs the second serial port test data at a plurality of preset baud rates (for example, commonly used baud rates 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, and the like).
After receiving the second serial port test data, the terminal device 300 feeds back second serial port feedback data corresponding to the second serial port test data to the serial interface 50.
The serial interface 50 is further configured to receive second serial port feedback data fed back by the terminal device 300, and output the second serial port feedback data to the control module 30, where the second serial port feedback data corresponds to the second serial port test data.
The control module 30 is further configured to compare the second serial port feedback data with the second serial port test data, and determine that the data transmission rate of the terminal device 300 is a second baud rate.
In another embodiment, the control module 30 may also identify the baud rate by receiving the second serial port test data actively output by the serial interface 50. Specifically, the control module 30 starts edge triggered interrupt, and by detecting the pulse width of the bit data in the second serial port test data, the time occupied by a single pulse can be obtained, so as to recognize that the data transmission rate of the serial interface 50 is the second baud rate.
In the process of debugging the terminal device 300, the control module 30 is further configured to implement conversion between the first serial port data and the second serial port data according to the data transmission rates of the upper computer 200 and the terminal device 300, so as to implement data interaction between the upper computer 200 and the terminal device 300.
It should be noted that the serial port transfer control circuit 100 provided in the present application can implement bidirectional transmission of data between the upper computer 200 and the terminal device 300.
Specifically, when the upper computer 200 sends communication data (for example, a sleep signal, a wake-up signal, or the like) to the terminal device 300, the USB interface 10 is further configured to obtain USB communication data sent by the upper computer 200. The signal conversion module 20 is further configured to convert the USB communication data into first serial communication data, where a transmission rate of the first serial communication data is the first baud rate. The control module 30 is further configured to convert the first serial communication data into second serial communication data according to a data transmission rate of the upper computer 200 and a data transmission rate of the terminal device 300, where the transmission rate of the second serial communication data is the second baud rate. The serial interface 50 is further configured to send the second serial communication data to the terminal device 300, so as to implement data interaction between the upper computer 200 and the terminal device 300, that is, to implement that the upper computer 200 sends data to the terminal device 300.
When the terminal device 300 uploads communication data (for example, version information, hardware configuration information, operation detection data, and the like of the terminal device 300) to the upper computer 200, the serial interface 50 is further configured to obtain second serial communication data uploaded by the terminal device 300, where a transmission rate of the second serial communication data is the second baud rate. The control module 30 is further configured to convert the second serial communication data into first serial communication data according to a data transmission rate of the upper computer 200 and a data transmission rate of the terminal device 300, where the transmission rate of the first serial communication data is the first baud rate. The signal conversion module 20 is further configured to convert the first serial communication data into USB communication data. The USB interface 10 is further configured to send the USB communication data to the upper computer 200, so as to implement data interaction between the upper computer 200 and the terminal device 300, that is, to implement the terminal device 300 uploading data to the upper computer 200.
The application provides a serial ports switching control circuit 100 can be used for debugging terminal equipment 300, before the debugging, confirm host computer 200 and terminal equipment 300's data transmission rate through control module 30, the interconversion between USB data that rethread signal conversion module 20 realized host computer 200 and the first serial ports data, and according to host computer 200 and terminal equipment 300's data transmission rate through control module 30, realize the conversion between the second serial ports data that first serial ports data and terminal equipment supported, thereby realize host computer 200 with data interaction between the terminal equipment 300. Because the control module 30 can support the conversion of various transmission rates of data, the serial port switching control circuit 100 can be adapted to terminal devices with various data transmission rates, the applicability is wide, and the debugging cost of the terminal device 300 can be reduced.
In the embodiment of the present application, the serial port switching control circuit 100 further includes a detection module 60 and a switch module 40.
The detection module 60 is electrically connected to the serial interface 50 and the control module 30, respectively, and the detection module 60 is configured to detect whether the terminal device 300 is connected to the serial interface 50, and output a detection signal to the control module 30 when detecting that the terminal device 300 is connected to the serial interface 50.
The switch module 40 is electrically connected between the control module 30 and the serial interface 50, and is configured to turn on or off the electrical connection between the control module 30 and the serial interface 50.
The control module 30 is further configured to output a conducting signal to the switch module 40 in response to the detection signal, so as to control the switch module 40 to conduct the electrical connection between the control module 30 and the serial interface 50. Illustratively, the control module 30 is further configured to start a determining program for determining data transmission rates of the upper computer 200 and the terminal device 300 in response to the detection signal, and store data transmission rate information of the upper computer 200 and the terminal device 300 in a Random Access Memory (RAM) after determining the data transmission rates of the upper computer 200 and the terminal device 300. After the serial port transfer control circuit 100 is powered off and restarted, the program for determining the data transmission rate of the upper computer 200 and the terminal device 300 is executed again.
In the embodiment of the present application, the terminal device 300 is taken as an example of an intelligent lock, and the serial port transfer control circuit 100 is introduced. In the embodiment of the application, the debugging work of the intelligent lock comprises the steps of outputting a sleep signal to the intelligent lock, and detecting the power consumption and the cruising ability of the intelligent lock in a sleep mode.
In this embodiment, the control module 30 is further configured to receive and respond to the sleep signal sent by the upper computer 200, convert the sleep signal and output the sleep signal to the serial interface 50, and output a disconnection signal to the switch module 40, so that the switch module 40 disconnects the electrical connection between the control module 30 and the serial interface 50. The USB communication data output by the upper computer 200 comprises the sleep signal, the second serial port communication data received by the terminal device 300 comprises the converted sleep signal, and the terminal device 300 receives and responds to the converted sleep signal to enter a sleep mode. It should be noted that, after the serial port transfer control circuit 100 provided in the present application receives the sleep signal, the switch module 40 disconnects the electrical connection between the control module 30 and the serial interface 50, that is, disconnects the communication link between the terminal device 300 and other electronic devices, so that it is possible to prevent the leakage current or the sink current of other electronic devices (for example, the serial port transfer control circuit 100) from affecting the quiescent current of the terminal device 300 in the sleep mode, thereby improving the accuracy of detection.
In this embodiment, the serial port switching control circuit 100 further includes a wake-up module 70, and the wake-up module 70 is electrically connected to the serial port 50 and the control module 30, respectively. The wake-up module 70 is configured to receive and respond to the control signal output by the control module 30, and output a wake-up signal to the serial interface 50, where the wake-up signal is used to wake up the terminal device 300 after the terminal device 300 enters the sleep mode.
The circuit structure and the operation principle of each module of the serial port transfer control circuit 100 will be described in detail with reference to fig. 2 to 6.
As shown in fig. 2, in the embodiment of the present application, the USB interface 10 includes a USB data pin D +, a USB data pin D-, and a power pin VBUS, where the USB data pin D +, the USB data pin D-are used for interacting with the upper computer 200 to obtain USB data (e.g., the USB test data, the USB feedback data, and the USB communication data). The power supply pin VBUS is used for receiving the voltage provided by the upper computer 200 and used as a voltage source VBUS. In other embodiments, the serial port relay control circuit 100 may further include an internal power source, and the internal power source is used as the voltage source.
As shown in fig. 3, in the embodiment of the present application, the signal conversion module 20 includes a USB to serial chip U1, and the USB to serial chip U1 includes USB data pins D + and D-, and serial data pins TXD and RXD. The USB data pins D + and D-of the USB serial-to-serial port chip U1 are electrically connected to the USB data pins D + and D-of the USB interface 10 in a one-to-one correspondence manner.
As shown IN fig. 4, IN the embodiment of the present application, the control module 30 includes a control chip U3, and the control chip U3 includes a first serial data pin PA10/UART1_ RX and PA9/UART1_ TX, a second serial data pin PA2/UART2_ TX and PA3/UART2_ RX, a first control pin PA1/ADC _ IN1, a detection pin PA5/ADC _ IN4, and a second control pin PA4/ADC _ IN 4. The first serial port data pins PA10/UART1_ RX and PA9/UART1_ TX are electrically connected with the serial port data pins TXD and RXD of the USB serial port conversion chip U1 in a one-to-one correspondence manner. The first serial data pins PA10/UART1_ RX and PA9/UART1_ TX are used for exchanging first serial data (e.g., the first serial test data, the first serial feedback data, the first serial communication data) with the signal conversion module 20. The second serial data pins PA2/UART2_ TX and PA3/UART2_ RX are used for transmitting second serial data (e.g., the second serial test data, the second serial feedback data, the second serial communication data). The first control pin PA1/ADC _ IN1 is used to output an on signal KS to the switch module 40. The detection pin PA5/ADC _ IN4 is used for receiving the detection signal DETECT output by the detection module 60. The second control pin PA4/ADC _ IN4 is used to output a control signal IRQ to the wake-up module 70. For example, the control signal IRQ may be autonomously generated by the control module 30 after the terminal device 300 enters the sleep mode for a preset time period, or may be generated by the control module 30 based on USB communication data sent by the upper computer 200.
As shown in fig. 5, the serial interface 50 includes a serial data pin 1, a serial data pin 4, a power pin 6, and a feedback pin 7 electrically connected to the terminal device 300, respectively. The serial data pin 1 and the serial data pin 4 are used for interacting with the terminal device 300 to obtain the second serial data. The power pin 6 is configured to receive a voltage VIN input by the terminal device 300, and the feedback pin 7 is configured to output the wake-up signal to the terminal device 300.
The wake-up module 70 includes a diode D4 and a transistor Q2. Wherein the anode of the diode D4 is electrically connected to the feedback pin 7 of the serial interface 50, and the cathode of the diode D4 is electrically connected to the power pin 6 of the serial interface 50 through the resistor R13. The transistor Q2 is electrically connected between the cathode of the diode D4 and the ground, and the control terminal of the transistor Q2 is electrically connected to the control module 30 and is grounded through a resistor R15.
The transistor Q2 is turned on in response to the control signal IRQ outputted from the control module 30, so that the feedback pin 7 is at a low level through the diode D4 and the turned-on transistor Q2 to ground, thereby outputting the wake-up signal to the terminal device 300. Wherein the wake-up signal is a low level signal. It is understood that when the transistor Q2 is turned off when the control signal IRQ is not received, the feedback pin 7 is pulled high to a high state through the diode D4 and the resistor R13 electrically connected to the power pin 6 when the serial interface 50 is connected to the terminal device 300; in the case that the serial interface 50 is not connected to the terminal device 300, the feedback pin 7 is in a floating state.
The detection module 60 includes a first voltage division unit and a second voltage division unit connected in series between the power pin 6 and the ground terminal, and a connection node 601 between the first voltage division unit and the second voltage division unit is electrically connected to the control module 30.
The detection module 60 divides the voltage VIN input by the terminal device 300 through the first voltage dividing unit and the second voltage dividing unit to obtain the detection signal DETECT, and outputs the detection signal DETECT to the control module 30 through the connection node 601.
Specifically, in the embodiment of the present application, the first voltage dividing unit includes a resistor R11, the second voltage dividing unit includes a resistor R14, the resistor R14 is further provided with a capacitor C5 in parallel, and the capacitor C5 is used for filtering the detection signal DETECT. Of course, in other embodiments, the first voltage dividing unit and the second voltage dividing unit may also include other electronic components, for example, a plurality of resistors arranged in series and/or in parallel.
In operation, when the terminal device 300 is not connected to the serial interface 50, the power pin 6 of the serial interface 50 is in a floating state, and the connection node 601 is grounded through the resistor R14 and is in a low level state. When the terminal device 300 is connected to the serial interface 50, the power pin 6 of the serial interface 50 receives the voltage VIN input by the terminal device 300, and the resistors R13, R11, and R14 divide the voltage VIN, so that the connection node 601 is pulled high, and the detection signal DETECT is obtained and output to the control module 30, where the detection signal DETECT is a high-level signal.
As shown in fig. 6, the switch module 40 includes a switch unit 41 and a driving circuit 42 of the switch unit 41.
The switch unit 41 is electrically connected between the control module 30 and the serial interface 50, and the driving circuit 42 is configured to provide driving power to the switch unit 41, so that the switch unit 41 conducts the electrical connection between the control module 30 and the serial interface 50.
The driving circuit 42 is electrically connected to the control module 30, and the control module 30 is configured to output the conducting signal KS to conduct the driving circuit 42, so that the driving circuit 42 can provide driving power to the switching unit 41, and the switching unit 41 conducts the electrical connection between the control module 30 and the serial interface 50. When the control module 30 outputs the disconnection signal, the driving circuit 42 is in a disconnected state, and cannot provide driving power to the switching unit 41, so that the switching unit 41 disconnects the electrical connection between the control module 30 and the serial interface 50. It should be noted that, in other embodiments, when the switch unit 41 may also receive the driving power, the electrical connection between the control module 30 and the serial interface 50 is disconnected; when the driving power is not received, the electrical connection between the control module 30 and the serial interface 50 is conducted, which is not limited herein.
Specifically, the driving circuit 42 includes a transistor Q1, a resistor R17, and a diode D3 connected in series. The cathode of the diode D3 is electrically connected to the voltage source VBUS provided by the USB interface 10, the anode of the diode D3 is electrically connected to the first end of the resistor R17, the transistor Q1 is electrically connected between the second end of the resistor R17 and the ground terminal, the control end of the transistor Q1 is electrically connected to the first control pin PA1/ADC _ IN1 of the control module 30 through the resistor R20, and the control end of the transistor Q1 is further electrically connected to the ground terminal through the resistor R21.
In the present embodiment, the switch unit 41 includes an electromagnetic relay K1, and the electromagnetic relay K1 includes an electromagnetic coil 411, a movable contact pair (including a movable contact 2 and a movable contact 7), a first stationary contact pair (including a stationary contact 3 and a stationary contact 6), a second stationary contact pair (including a stationary contact 4 and a stationary contact 5), a first conductive arm 412, and a second conductive arm 413. The electromagnetic coil 411 is connected in parallel with the diode D3, that is, the first end 1 of the electromagnetic coil 411 is electrically connected to the cathode of the diode D3, and the second end 8 of the electromagnetic coil 411 is electrically connected to the anode of the diode D3. The movable contact 7 and the movable contact 2 are electrically connected with a second serial data pin PA2/UART2_ TX and a second serial data pin PA3/UART2_ RX of the control module 30 in a one-to-one correspondence manner. The static contact 3 and the static contact 6 are electrically connected with the serial data pins 4 and 1 of the serial interface 50 in a one-to-one correspondence manner. The static contact 4 and the static contact 5 are suspended. When the driving circuit 42 is turned on to energize the electromagnetic coil 411 of the electromagnetic relay K1, the first conductive arm 412 conducts the electrical connection between the movable contact 2 and the stationary contact 3, and the second conductive arm 413 conducts the electrical connection between the movable contact 7 and the stationary contact 6. When the electromagnetic coil 411 of the electromagnetic relay K1 is not energized, the first conductive arm 412 is switched to conduct the electrical connection between the movable contact 2 and the stationary contact 4, and the second conductive arm 413 is switched to conduct the electrical connection between the movable contact 7 and the stationary contact 5.
In operation, when the control terminal of the transistor Q1 receives the conducting signal KS, the transistor Q1 is conducted, so that the electromagnetic coil 411 of the electromagnetic relay K1 is energized, and the driving power is received, so that the movable contacts 2 and 7 are electrically connected with the fixed contacts 3 and 6 in a one-to-one correspondence manner, and the electrical connection between the control module 30 and the serial interface 50 is conducted. When the control terminal of the transistor Q1 receives the disconnection signal, the transistor Q1 is turned off, so that the electromagnetic coil 411 of the electromagnetic relay K1 is not energized and cannot receive the driving power, and the movable contacts 2 and 7 are switched to be electrically connected with the fixed contacts 4 and 5 in a one-to-one correspondence and in a floating state, thereby disconnecting the electrical connection between the control module 30 and the serial interface 50. In the embodiment of the present application, the transistor Q1 is a high-level turn-on transistor, the turn-on signal KS is a high-level signal, and the turn-off signal is a low-level signal.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.

Claims (10)

1. A serial port switching control circuit is characterized by comprising:
the USB interface is electrically connected with an upper computer and used for interacting USB data with the upper computer;
the signal conversion module is electrically connected with the USB interface and is used for realizing the mutual conversion between the USB data and the first serial port data;
the serial interface is used for being electrically connected with terminal equipment and interacting second serial port data with the terminal equipment; and
the control module is respectively electrically connected with the signal conversion module and the serial interface, and is used for determining the data transmission rate of the upper computer according to the data interacted between the USB interface and the upper computer and determining the data transmission rate of the terminal equipment according to the data interacted between the serial interface and the terminal equipment; the control module is further used for realizing conversion between the first serial port data and the second serial port data according to the data transmission rate of the upper computer and the terminal equipment so as to realize data interaction between the upper computer and the terminal equipment.
2. The serial port switching control circuit according to claim 1, wherein the control module is further configured to output first serial port test data to the signal conversion module, and output second serial port test data to the terminal device through the serial port;
the signal conversion module is also used for converting the first serial port test data into USB test data and outputting the USB test data to the upper computer through the USB interface;
the USB interface receives USB feedback data fed back by the upper computer, wherein the USB feedback data corresponds to the USB test data;
the signal conversion module is further configured to convert the USB feedback data into corresponding first serial port feedback data, and output the first serial port feedback data to the control module;
the serial interface is further used for receiving second serial port feedback data fed back by the terminal equipment and outputting the second serial port feedback data to the control module, wherein the second serial port feedback data corresponds to the second serial port test data;
the control module is further configured to compare the first serial port feedback data with the first serial port test data, determine that the data transmission rate of the upper computer is a first baud rate, compare the second serial port feedback data with the second serial port test data, and determine that the data transmission rate of the terminal device is a second baud rate.
3. The serial port switching control circuit according to claim 2, wherein the USB interface is further configured to obtain USB communication data sent by the upper computer;
the signal conversion module is further configured to convert the USB communication data into first serial communication data, where a transmission rate of the first serial communication data is the first baud rate;
the control module is further used for converting the first serial port communication data into second serial port communication data according to the data transmission rates of the upper computer and the terminal equipment, wherein the transmission rate of the second serial port communication data is the second baud rate;
the serial interface is further used for sending the second serial port communication data to the terminal equipment so as to achieve data interaction between the upper computer and the terminal equipment.
4. The serial port switching control circuit according to claim 2, wherein the serial interface is further configured to obtain second serial port communication data uploaded by the terminal device, where a transmission rate of the second serial port communication data is the second baud rate;
the control module is further configured to convert the second serial communication data into first serial communication data according to data transmission rates of the upper computer and the terminal device, where the transmission rate of the first serial communication data is the first baud rate;
the signal conversion module is also used for converting the first serial port communication data into USB communication data;
the USB interface is further used for sending the USB communication data to the upper computer so as to achieve data interaction between the upper computer and the terminal equipment.
5. The serial port switching control circuit as claimed in claim 3 or 4, further comprising:
the detection module is respectively electrically connected with the serial interface and the control module, and is used for detecting whether the terminal equipment is connected with the serial interface or not and outputting a detection signal to the control module when detecting that the terminal equipment is connected with the serial interface; and
the switch module is electrically connected between the control module and the serial interface and used for conducting or breaking the electrical connection between the control module and the serial interface;
the control module is further used for responding to the detection signal and outputting a conduction signal to the switch module so as to control the switch module to conduct the electric connection between the control module and the serial interface.
6. The serial port switching control circuit according to claim 5, wherein the control module is further configured to receive and respond to a sleep signal sent by the upper computer, convert and output the sleep signal to the serial interface, and output a disconnection signal to the switch module, so that the switch module disconnects the electrical connection between the control module and the serial interface; the USB communication data output by the upper computer comprises the sleep signal, the second serial port communication data received by the terminal equipment comprises the converted sleep signal, and the terminal equipment receives and responds to the converted sleep signal to enter a sleep mode.
7. The serial port switching control circuit as claimed in claim 6, further comprising:
the wake-up module is respectively and electrically connected with the serial interface and the control module; the wake-up module is used for receiving and responding to the control signal output by the control module and outputting a wake-up signal to the serial interface, wherein the wake-up signal is used for waking up the terminal equipment after the terminal equipment enters a sleep mode.
8. The serial port switching control circuit according to claim 6, wherein the switch module comprises a switch unit and a driving circuit;
the switch unit is electrically connected between the control module and the serial interface, and is also electrically connected with the driving circuit;
the driving circuit is also electrically connected with the control module and is further used for receiving and responding to the conducting signal and providing driving electric energy for the switch unit so that the switch unit conducts the electrical connection between the control module and the serial interface; the driving circuit is used for receiving and responding to the disconnection signal and suspending the supply of the driving power to the switch unit, so that the switch unit disconnects the electrical connection between the control module and the serial interface.
9. The serial port switching control circuit according to claim 5, wherein the serial interface comprises a power pin for receiving a voltage input by the terminal device;
the detection module comprises a first voltage division unit and a second voltage division unit which are connected in series between the power supply pin and a ground terminal, and a connection node between the first voltage division unit and the second voltage division unit is electrically connected with the control module;
the detection module divides the voltage input by the terminal equipment through the first voltage division unit and the second voltage division unit to obtain the detection signal, and outputs the detection signal through the connection node.
10. The serial port transfer control circuit according to claim 7, wherein the serial interface comprises a power pin and a feedback pin, the power pin is used for receiving power input by the terminal device, and the feedback pin is used for outputting the wake-up signal to the terminal device;
the wake-up module comprises:
the anode of the diode is electrically connected with the feedback pin of the serial interface, and the cathode of the diode is electrically connected with the power supply pin of the serial interface through a resistor;
the transistor is electrically connected between the cathode of the diode and a grounding end, and the control end of the transistor is electrically connected with the control module;
the transistor is conducted in response to a control signal output by the control module, so that the feedback pin is at a low level through the diode and the conducted transistor is grounded, and the wake-up signal is output to the terminal device; wherein the wake-up signal is a low level signal.
CN202210329892.4A 2022-03-31 2022-03-31 Serial port switching control circuit Pending CN114661646A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210329892.4A CN114661646A (en) 2022-03-31 2022-03-31 Serial port switching control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210329892.4A CN114661646A (en) 2022-03-31 2022-03-31 Serial port switching control circuit

Publications (1)

Publication Number Publication Date
CN114661646A true CN114661646A (en) 2022-06-24

Family

ID=82033328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210329892.4A Pending CN114661646A (en) 2022-03-31 2022-03-31 Serial port switching control circuit

Country Status (1)

Country Link
CN (1) CN114661646A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115718715A (en) * 2022-11-18 2023-02-28 深圳市精泰达科技有限公司 USB interface changes serial port card

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1967514A (en) * 2006-10-08 2007-05-23 深圳兆日技术有限公司 System and method to realize connection between terminal host computer and trusted platform module
CN105068776A (en) * 2015-08-06 2015-11-18 深圳市同城快跑科技有限公司 Customer display WiFi adapter
CN106705751A (en) * 2016-12-27 2017-05-24 西安电子工程研究所 Simulation system and method of portable fire control/power system
CN207083067U (en) * 2017-07-18 2018-03-09 山东亚华电子股份有限公司 A kind of intelligent nursing communication system extension set sleep state anti-jamming circuit
CN111782572A (en) * 2020-06-15 2020-10-16 北京航空航天大学杭州创新研究院 Baud rate self-adaptive USB serial port device and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1967514A (en) * 2006-10-08 2007-05-23 深圳兆日技术有限公司 System and method to realize connection between terminal host computer and trusted platform module
CN105068776A (en) * 2015-08-06 2015-11-18 深圳市同城快跑科技有限公司 Customer display WiFi adapter
CN106705751A (en) * 2016-12-27 2017-05-24 西安电子工程研究所 Simulation system and method of portable fire control/power system
CN207083067U (en) * 2017-07-18 2018-03-09 山东亚华电子股份有限公司 A kind of intelligent nursing communication system extension set sleep state anti-jamming circuit
CN111782572A (en) * 2020-06-15 2020-10-16 北京航空航天大学杭州创新研究院 Baud rate self-adaptive USB serial port device and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115718715A (en) * 2022-11-18 2023-02-28 深圳市精泰达科技有限公司 USB interface changes serial port card

Similar Documents

Publication Publication Date Title
US7673092B2 (en) PCI Express interface
CN101609440B (en) Bus system and method for recovering bus from lock state
US20090193157A1 (en) Link state detection system for network cable
CN108733609B (en) Switching circuit, intelligent switching device and switching method of double USB interfaces
CN104781754A (en) Reduction of idle power in a communication port
WO2021258255A1 (en) Dual-interface switch circuit and type-c hub
CN109726059A (en) A kind of server test system
CN101369948B (en) Communication system implementing low-power consumption
CN114661646A (en) Serial port switching control circuit
CN111948971A (en) Intelligent card management device and data switching method thereof
CN101163308B (en) Intelligent platform management controller
CN102445981B (en) Data transmission system and data transmission method
CN212649180U (en) Double-interface switching circuit and Type-C concentrator
US11928074B2 (en) USB active optical cable and plug capable of managing power consumption and status
CN114996196A (en) I2C communication drive circuit, micro display chip and electronic equipment
CN211375595U (en) Solid state disk recognition device
CN111625491A (en) Multi-machine serial communication device and method
CN109117192B (en) Switching device capable of waking up standby machine and waking device
CN111858459A (en) Processor and computer
CN109344016B (en) USB device capable of switching between host and device modes and switching method
CN100595715C (en) Signal processing circuit
CN113297119B (en) Wireless communication equipment of server
CN217467658U (en) PCIE keysets
US11513978B2 (en) Dual data ports with shared detection line
US11947484B2 (en) Universal serial bus (USB) hub with host bridge function and control method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination