Interface module, interface switching control method and embedded device
By designing interface modules in embedded devices and using multiplexed switch modules and main control modules to switch the communication pins of serial ports, USB and USB disks, the problem that embedded devices cannot support multiple communication protocols at the same time is solved, reducing the problem of Cost and resource waste improve communication flexibility.
Patent Information
- Application Number
- CN202111583995.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-12-22
AI Technical Summary
Embedded devices need to communicate with external devices in different communication modes during development, but usually only one output interface is available, and the switching of multiple communication functions cannot be achieved, resulting in high costs and waste of resources.
An interface module is designed, including a multiplexed switch module and a main control module. By selectively controlling the connection between the serial port, USB and USB disk communication pins, the communication type is judged based on the voltage value of the external device, and different communication protocols are realized. Switch.
The embedded device communicates with external devices with different communication functions through one interface, reducing costs and resource waste and improving customer experience.
Smart Images

Figure CN114416609B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded devices, and in particular to an interface module, an interface switching control method and an embedded device. Background Art
[0002] At present, when developing embedded devices, it is often necessary to communicate with external devices with different communication modes. The output interface of the embedded device is required to have the functions of serial communication, USB communication and U disk communication. These three functions generally require three output interfaces, but embedded devices often have only one output interface. Therefore, how to enable the embedded device to communicate with external devices with different communication functions through one output interface is an urgent problem to be solved. Summary of the invention
[0003] The present invention provides an interface module, an interface switching control method and an embedded device, which can communicate with external devices with different communication functions through one interface.
[0004] A first aspect of the present invention provides an interface module, which is applied to an embedded device. The interface module includes an interface, a multiplexing switch module, and a main control module. The interface is used to electrically connect to an external device to enable communication between the embedded device and the external device. The main control module includes a serial port pin, a USB communication pin, and a U disk communication pin; the multiplexing switch module is electrically connected to the main control module, and includes a first switch, a second switch, and a third switch corresponding to the serial port pin, the USB communication pin, and the U disk communication pin. The main control module is used to selectively control one of the first switch, the second switch, and the third switch to be turned on to control one of the serial port pin, the USB communication pin, and the U disk communication pin to be electrically connected to the interface.
[0005] A second aspect of the present invention provides a switching control method of an interface, which is applied to the aforementioned interface module, wherein the interface module includes an interface, a multiplexing switch module, and a main control module, wherein the main control module includes a serial port pin, a USB communication pin, and a U disk communication pin; the multiplexing switch module is electrically connected to the main control module, and includes a first switch, a second switch, and a third switch corresponding to the serial port pin, the USB communication pin, and the U disk communication pin. The switching control method is executed by the main control module, and the switching control method includes:
[0006] When an external device is electrically connected to the output interface, obtaining a voltage value of the interface;
[0007] The first switch or one of the second switch and the third switch is controlled to be closed according to the voltage value.
[0008] A third aspect of the present invention provides an embedded device, comprising a main body and an interface module arranged on the main body, wherein the embedded device communicates with an external device via the interface module, and the interface module is the above-mentioned interface module.
[0009] The above-mentioned interface module, interface switching control method and embedded device, when the interface is electrically connected to an external device, the main control module selectively controls one of the first switch, the second switch and the third switch to be turned on to control one of the serial port pin, the USB communication pin, and the U disk communication pin to be electrically connected to the interface, and communication with external devices with different communication functions can be carried out through one interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without creative work.
[0011] Figure 1 A structural block diagram of an interface module provided in accordance with an embodiment of the present invention.
[0012] Figure 2 A schematic diagram of an interface module application scenario provided in accordance with an embodiment of the invention.
[0013] Figure 3 The present invention provides a flowchart of a method for controlling the switching of an interface.
[0014] Figure 4 A structural block diagram of an embedded device provided for another embodiment of the invention. DETAILED DESCRIPTION
[0015] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0016] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0017] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0018] In the existing embedded device development technology, it is generally changed to a dedicated device line and three different detection ports are set. When an external device is connected to the embedded device through different detection ports, the different detection ports inform the main control IC chip which type of communication external device is connected.
[0019] The existing technology requires the replacement of dedicated communication lines, which results in excessively high costs and serious waste of main control IC chip resources, and the customer experience is not friendly enough.
[0020] See also Figure 1-2 , are respectively a structural block diagram of an interface module 10 provided in an embodiment of the present invention and a schematic diagram of an application scenario of the interface module 10. The interface module 10 is applied to an embedded device 100, and the interface module 10 includes an interface 11, a multiplexing switch module 12, and a main control module 13. The main control module 13 controls different switches in the multiplexing switch module 12 to connect with the interface 11, so as to realize communication connection with external devices 200 of different communication types through one interface 11.
[0021] The interface 11 includes two communication pins, a power supply, and a ground, with a total of 4 transmission lines. In the present embodiment, the interface 11 adopts a TYPE-C plug. In some other embodiments, the interface 11 may also adopt a USB plug or a Micro-USB plug. The interface 11 is used to connect to an external device 200. Thereby, the embedded device 100 is connected to the external device 200. The external device 200 may be provided with an interface corresponding to the interface 11, such as a TYPE-C female socket. The embedded device 100 supports USB communication protocol, serial port communication protocol, and U disk communication protocol, and the corresponding communication protocol can be selected to realize communication interaction with the corresponding external device 200, that is, the embedded device 100 can communicate with external devices 200 of different communication protocols through an interface 11.
[0022] The multiplexing switch module 12 includes a first switch 121, a second switch 122, and a third switch 123 corresponding to the serial port pin 131, the USB communication pin 132, and the USB disk communication pin 133. In this embodiment, the multiplexing switch module 12 can be a one-to-many analog switch integrated chip. In some other embodiments, the multiplexing switch module 12 can be a circuit constructed by discrete devices.
[0023] The main control module 13 is used to selectively control one of the first switch 121, the second switch 122, and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11. In this embodiment, the main control module 13 includes a serial port pin 131, a USB communication pin 132, and a U disk communication pin 133. The main control module 13 is used to selectively control one of the first switch 121, the second switch 122, and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11. The following describes in detail the circumstances under which the main control module 13 selects the first switch 121 to be turned on to control the serial port pin 131 to be electrically connected to the interface 11, the circumstances under which the main control module 13 selects the second switch 122 to be turned on to control the USB communication pin 132 to be electrically connected to the interface 11, and the circumstances under which the main control module 13 selects the third switch 123 to be turned on to control the USB disk communication pin to be electrically connected to the interface 11.
[0024] The main control module 13 also includes an identification circuit 134 and a controller 135. The identification circuit 134 is used to obtain the voltage value of the interface 11 and send it to the controller 135. The controller 135 determines whether the external device 200 is a serial port communication according to the voltage value, and when it is determined that the external device 200 is a serial port communication, a corresponding serial port control signal is generated to electrically connect the serial port pin 131 to the interface 11, so that the external device 200 and the embedded device 100 can communicate and interact through the serial port communication protocol. Among them, the identification circuit 134 can be a voltage acquisition circuit. Specifically, when the voltage value does not reach the first preset value, the controller 135 generates a serial port control signal. The serial port control signal is used to control the first switch 121 to be turned on, so that the serial port pin 131 is turned on with the interface 11 through the first switch 121. More specifically, when the voltage value is close to 0V, the controller 135 generates a serial port control signal. In this embodiment, the first preset value is 5V. Since the first external device 201 will not supply power to the embedded device 100 when the embedded device 100 is connected to the first external device 201 through the interface 11, the voltage at the power supply end of the interface 11 is weak, close to 0V, that is, it does not reach the first preset value. Therefore, when the voltage value does not reach the first preset value, indicating that the communication type of the first external device 201 is serial communication, the first switch 121 is turned on to electrically connect the serial port pin 131 to the interface 11. It can be understood that when the voltage value reaches the first preset value, indicating that the communication type of the external device 200 is USB communication mode or U disk communication mode, the second switch 122 or the third switch 123 is turned on to electrically connect the USB communication pin 132 or the U disk communication pin 133 to the interface 11. It can be understood that although the communication type of the external device 200 is USB communication mode or U disk communication mode, the external device 200 can be provided with a socket corresponding to the interface 11. For example, the external device 200 is a laptop with a TYPE-C socket, and the interface 11 is a TYPE-C plug.
[0025] Specifically, when the voltage value reaches the first preset value, it indicates that the embedded device 100 and the external device 200 perform bidirectional communication through the USB communication protocol, or perform unidirectional communication through the U disk communication protocol. The USB communication mode and the U disk communication mode cannot be distinguished by the voltage value. In order to further distinguish whether the embedded device 100 and the external device 200 perform bidirectional communication or unidirectional communication, a detection signal can be sent to the external device 200 and it can be determined whether the external device 200 and the embedded device 100 perform bidirectional communication or unidirectional communication by judging whether the external device 200 returns the corresponding detection signal. Among them, bidirectional communication is a USB communication mode. Unidirectional communication is a U disk communication mode. In this embodiment, when the voltage value reaches the first preset value, the main control module 13 sends a heartbeat signal to the external device 200, and when a feedback signal corresponding to the heartbeat information is received within a preset time, the controller 135 generates a USB communication control signal, and the USB communication control signal is used to control the second switch 122 to be turned on, so that the external device 200 and the embedded device 100 can realize communication interaction through the USB communication protocol. That is to say, when the heartbeat signal returned by the external device 200 is received, it is proved that the embedded device 100 and the external device 200 are in a two-way communication connection mode, that is, a USB communication mode. Therefore, it is determined that the connected external device 200 is the second external device 202. The main control module 13 controls the second switch 122 to be turned on to control the USB communication pin 132 to be electrically connected to the interface 11, so as to realize the two-way communication between the embedded device 100 and the second external device 202.
[0026] When the voltage value reaches the first preset value, the main control module 13 sends a heartbeat signal to the external device 200. When the feedback signal corresponding to the heartbeat information is not received within the preset time, the controller 135 generates a U disk control signal, so that the external device 200 and the embedded device 100 can communicate and interact through the U disk communication protocol. When the heartbeat signal of the external device 200 is not received, it is proved that the embedded device 100 and the external device 200 are in a one-way communication mode, and only the external device 200 can access the information stored in the embedded device 100. Determine that the external device 200 is the third external device 203 (U disk communication mode). The main control module 13 selects the third switch 123 to be turned on to control the U disk communication pin to be electrically connected to the interface 11. In this embodiment, when the embedded device 100 is used as a U disk mode, the external device 200 can communicate big data with the embedded device 100.
[0027] In the above-mentioned interface module 10, when the interface 11 is electrically connected to the external device 200, the main control module 13 selectively controls one of the first switch 121, the second switch 122 and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11, thereby enabling the embedded device 100 to communicate with external devices 200 of different communication types through one interface 11.
[0028] Please see Figure 3 , Figure 3 According to another embodiment of the present invention, a switching control method of an interface 11 is provided. The interface module 10 includes an interface 11, a multiplexing switch module 12, and a main control module 13. The main control module 13 includes a serial port pin 131, a USB communication pin 132, and a U disk communication pin 133. The multiplexing switch module 12 is electrically connected to the main control module 13, and includes a first switch 121, a second switch 122, and a third switch 123 corresponding to the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133. The switching control method is executed by the main control module 13, and the switching control method includes the following steps.
[0029] Step S10, when the external device 200 is electrically connected to the output interface 11, the voltage value of the interface 11 is obtained. Specifically, the main control module 13 also includes an identification circuit 134 and a controller 135. When the external device 200 is electrically connected to the output interface 11, the identification circuit 134 is used to obtain the voltage value of the interface 11 and send it to the controller 135.
[0030] Step S20, when the voltage value does not reach the first preset value, control the first switch 121 to close. Specifically, when the controller 135 determines that the voltage value does not reach the first preset value, control the first switch 121 to close. The controller 135 determines whether the external device 200 is a serial port communication according to the voltage value, and when it is determined that the external device 200 is a serial port communication, generates a corresponding serial port control signal to electrically connect the serial port pin 131 to the interface 11. Specifically, when the voltage value does not reach the first preset value, it means that the embedded device 100 and the external device 200 communicate through the serial port communication protocol. The controller 135 generates a serial port control signal. The serial port control signal is used to control the first switch 121 to be turned on, so that the serial port pin 131 is turned on with the interface 11 through the first switch 121. More specifically, when the voltage value is zero, the controller 135 generates a serial port control signal. In this embodiment, the first preset value is 5V. Since the first external device 201 does not supply power to the embedded device 100 when the embedded device 100 is connected to the first external device 201 (serial communication mode), the line of the power supply end of the interface 11 is 0V. Therefore, when the voltage value is 0V, it proves that the communication type of the first external device 201 is a serial port. Then the first switch 121 is turned on to electrically connect the serial port pin 131 to the interface 11.
[0031] Step S30, when the voltage value reaches the first preset value, a heartbeat signal is sent to the external device 200. Specifically, when the voltage value reaches the first preset value, it indicates that the embedded device 100 and the external device 200 perform USB bidirectional communication, or it indicates that the embedded device 100 and the external device 200 perform USB unidirectional communication. In order to further distinguish whether the embedded device 100 and the external device 200 perform unidirectional communication or bidirectional communication, the embedded device 100 also sends a heartbeat signal to the connected external device 200 through the controller 135.
[0032] Step S40, when the feedback signal of the heartbeat signal is received within the preset time, the second switch 122 is controlled to be closed. When the heartbeat signal returned by the external device 200 is received, it indicates that the embedded device 100 and the external device 200 are in a two-way communication connection mode, and the controller 135 generates a USB communication control signal, which is used to control the second switch 122 to be turned on to control the USB communication pin 132 to be electrically connected to the interface 11. In this way, the embedded device 100 and the second external device 202 can perform two-way communication.
[0033] Step S50, when the feedback signal of the heartbeat signal is not received within the preset time, the third switch 123 is controlled to be closed. When the voltage value reaches the first preset value, the main control module 13 sends a heartbeat signal to the external device 200, and when the feedback signal corresponding to the heartbeat information is not received within the preset time, the controller 135 generates a U disk control signal. When the heartbeat signal of the external device 200 is not received, it is proved that the embedded device 100 and the external device 200 are in a one-way communication mode, and the external device 200 accesses the information stored in the embedded device 100. The external device 200 is the third external device 203 (U disk communication mode). The U disk control signal is used to control the third switch 123 to be turned on to control the U disk communication pin to be electrically connected to the interface 11. In this embodiment, when the embedded device 100 is used as a U disk mode, the external device 200 can communicate big data with the embedded device 100.
[0034] In the above embodiment, when the interface 11 is electrically connected to the external device 200, the main control module 13 selectively controls one of the first switch 121, the second switch 122 and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11, thereby enabling the embedded device 100 to communicate with external devices 200 of different communication types through one interface 11.
[0035] Please see Figure 4 , Figure 4 Another embodiment of the present invention provides an embedded device 100, which includes a main body 20 and an interface module 10 disposed on the main body 20. The embedded device 100 communicates with an external device 200 through the interface module 10, and the interface module 10 is the above-mentioned interface module 10.
[0036] In this embodiment, the main body 20 may be various types of embedded devices, including a shell for fixing and accommodating the interface module 10 , and the shell may be made of plastic.
[0037] Specifically, the interface module 10 includes an interface 11, a multiplexing switch module 12, and a main control module 13. The main control module 13 controls different switches in the multiplexing switch module 12 to connect with the interface 11, thereby realizing communication connection with external devices 200 of different communication types through one interface 11.
[0038] The interface 11 includes two communication pins, a power supply, and a ground, with a total of four transmission lines. In this embodiment, the interface 11 adopts a TYPE-C interface 11. In some other embodiments, the interface 11 may also adopt a USB interface 11 or a Micro-USB interface 11. The interface 11 is used to connect to an external device 200. Thereby, the embedded device 100 is connected to the external device 200.
[0039] The multiplexing switch module 12 includes a first switch 121, a second switch 122, and a third switch 123 corresponding to the serial port pin 131, the USB communication pin 132, and the USB disk communication pin 133. In this embodiment, the multiplexing switch module 12 can be a one-to-many analog switch integrated chip. In some other embodiments, the multiplexing switch module 12 can be a circuit constructed by discrete devices.
[0040] The main control module 13 is used to selectively control one of the first switch 121, the second switch 122, and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11. In this embodiment, the main control module 13 includes a serial port pin 131, a USB communication pin 132, and a U disk communication pin 133. The main control module 13 is used to selectively control one of the first switch 121, the second switch 122, and the third switch 123 to be turned on to control one of the serial port pin 131, the USB communication pin 132, and the U disk communication pin 133 to be electrically connected to the interface 11.
[0041] It should be noted that the serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof herein are intended to cover non-exclusive inclusion, so that the process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, device, article or method including the element.
[0042] Obviously, a person skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.
[0043] The above are only preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the protection scope of the present application.
Claims
1. An interface module, which is applied to an embedded device, characterized in that: The interface module includes an interface, a multiplexing switch module, and a main control module. The interface is used to be electrically connected to an external device so that the embedded device can communicate with the external device. The main control module includes a serial port pin, a USB communication pin, and a U disk communication pin. The multiplexing switch module is electrically connected to the main control module and includes a first switch, a second switch, and a third switch corresponding to the serial port pin, the USB communication pin, and the U disk communication pin. The main control module is used to selectively control one of the first switch, the second switch, and the third switch to be turned on to control one of the serial port pin, the USB communication pin, and the U disk communication pin to be electrically connected to the interface. When the external device is electrically connected to the interface, the main control module obtains the voltage value of the interface. The main control module controls the first switch, or one of the second switch and the third switch to close according to the voltage value, specifically including: when the voltage value does not reach the first preset value, the main control module controls the first switch to close; when the voltage value reaches the first preset value, the main control module sends a heartbeat signal to the external device; when the main control module receives a feedback signal of the heartbeat signal within a preset time, the main control module controls the second switch to close; when the main control module does not receive a feedback signal of the heartbeat signal within the preset time, the main control module controls the third switch to close.
2. The interface module according to claim 1, characterized in that: The main control module also includes an identification circuit and a controller. The identification circuit is used to obtain the voltage value of the interface and send it to the controller. The controller determines whether the external device is a serial port communication based on the voltage value, and when it is determined that the external device is a serial port communication, generates a corresponding serial port control signal to electrically connect the serial port pin to the interface.
3. The interface module according to claim 2, characterized in that: When the voltage value does not reach the first preset value, the controller generates a serial port control signal for controlling the first switch to close.
4. The interface module according to claim 2, characterized in that: When it is determined that the external device is not a serial port communication device, the controller generates a USB control signal.
5. The interface module according to claim 4, characterized in that: The USB control signal includes a USB disk control signal and a USB communication control signal. When the voltage value reaches the first preset value, the main control module sends a heartbeat signal to the external device. When no feedback signal corresponding to the heartbeat information is received within a preset time, the controller generates the USB disk control signal to control the third switch to close.
6. The interface module according to claim 5, characterized in that: When a feedback signal corresponding to the heartbeat information is received within a preset time, the controller generates the USB communication control signal for controlling the second switch to close.
7. A method for controlling the switching of an interface, applied to the interface module according to any one of claims 1 to 6, characterized in that: The interface module includes an interface, a multiplexing switch module, and a main control module. The main control module includes a serial port pin, a USB communication pin, and a U disk communication pin; the multiplexing switch module is electrically connected to the main control module, and includes a first switch, a second switch, and a third switch corresponding to the serial port pin, the USB communication pin, and the U disk communication pin. The switching control method is executed by the main control module, and the switching control method includes: When an external device is electrically connected to the output interface, obtaining a voltage value of the interface; Controlling the first switch, or one of the second switch and the third switch to close according to the voltage value specifically includes: When the voltage value does not reach the first preset value, controlling the first switch to close; When the voltage value reaches a first preset value, sending a heartbeat signal to an external device; When a feedback signal of the heartbeat signal is received within a preset time, controlling the second switch to close; When no feedback signal of the heartbeat signal is received within a preset time, the third switch is controlled to be closed.
8. An embedded device, comprising a main body and an interface module disposed on the main body, wherein the embedded device communicates with an external device through the interface module, wherein: The interface module is the interface module as described in any one of claims 1-6.
Citation Information
Patent Citations
Circuit capable of reusing universal serial bus (USB) / universal asynchronous receiver / transmitter (UART) interfaces and electronic device using same
CN102750252A
Terminal equipment compatible with multiple communication interfaces and control method of terminal equipment
CN112231249A