Communication conversion circuit and equipment
The introduction of a flexible communication conversion circuit in MCU systems allows for software-based correction of TX/RX port connection errors, ensuring reliable communication without hardware redesign, thus enhancing development efficiency.
Patent Information
- Application Number
- CN202422391806.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2034-09-30
AI Technical Summary
In MCU application systems, the reverse connection of the serial port TX and RX causes the hardware to fail to communicate, and the hardware needs to be redesigned to correct the error, resulting in delays in product development progress and inflexibility.
A flexible conversion circuit is added to the serial port circuit of the MCU, and the directionless connection between the external serial port receiving end and the transmitting end is realized through the 74HC4052 analog switch integrated circuit, and the hardware connection error is corrected using software configuration.
The reverse error of serial port connection is corrected without changing the hardware, which improves design flexibility and efficiency, and avoids product development delays and poor hardware connection risks.
Smart Images

Figure CN223108357U_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and more particularly, to a communication conversion circuit and device. Background Art
[0002] Generally, in the design of an MCU application system, using a serial port for communication is a basic communication method. When designing the hardware interface, it needs to be cross-connected with an external serial port. If not careful, it is very easy to make mistakes, such as reversing the TX and RX of the serial port, resulting in the hardware being unable to communicate with the outside, and requiring a re-design to correct the error, which delays the product development progress. Summary of the Invention
[0003] To solve the above technical problems, this application provides a communication conversion circuit and device. By adding a flexible conversion circuit to the serial port circuit design of the MCU, it realizes a non-directional connection between the external serial port receiving end and the sending end, making up for the problem that the application system cannot be used due to incorrect hardware access.
[0004] Specifically, the technical solution of this application is as follows:
[0005] In a first aspect, this application discloses a communication conversion circuit, including: an MCU, a conversion circuit, and an output port;
[0006] The sending end and receiving end of the MCU are connected to the output port through the conversion circuit;
[0007] There are at least two connection groups between the conversion circuit and the output port;
[0008] When the external device serial port is correctly connected to the output port, the first connection group between the output port and the conversion circuit works normally; when the external device serial port is reversely connected to the output port, the second connection group between the output port and the conversion circuit works normally; so that the external device serial port can correctly connect to receive the sending end and receiving end of the MCU.
[0009] In some embodiments, the conversion circuit is a 74HC4052 analog switch integrated circuit.
[0010] In some embodiments, the sending end (C_TX) of the MCU is connected to the A-channel common input / output pin (AN) of the conversion circuit;
[0011] The receiving end (C_RX) of the MCU is connected to the B-channel common input / output pin (BN) of the conversion circuit.
[0012] In some embodiments, the output port includes a first output end and a second output end;
[0013] The first output terminal is connected to the first independent input / output pin (A0) of the A path of the conversion circuit, and the second output terminal is connected to the first independent input / output pin (B0) of the B path of the conversion circuit to form the first connection group;
[0014] The first output terminal is connected to the second independent input / output pin (B1) of the B path of the conversion circuit, and the second output terminal is connected to the second independent input / output pin (A1) of the A path of the conversion circuit to form the second connection group.
[0015] In some embodiments, when the serial port transmitting end (TX) of an external device is connected to the first output terminal and the serial port receiving end (RX) of the external device is connected to the second output terminal; the first connection group works normally;
[0016] When the serial port transmitting end (TX) of an external device is connected to the second output terminal and the serial port receiving end (RX) of the external device is connected to the first output terminal; the second connection group works normally.
[0017] In some embodiments, when the serial port transmitting end (TX) of an external device is connected to the first output terminal and the serial port receiving end (RX) of the external device is connected to the second output terminal; the enable input pin (E) of the conversion circuit is at a low level, the first selection input pin (S0) is at a low level, and the second selection input pin (S1) is at a low level;
[0018] When the serial port transmitting end (TX) of an external device is connected to the second output terminal and the serial port receiving end (RX) of the external device is connected to the first output terminal; the enable input pin (E) of the conversion circuit is at a low level, the first selection input pin (S0) is at a high level, and the second selection input pin (S1) is at a low level.
[0019] In some embodiments, the external device where the external device serial port is located is grounded together with the device where the communication conversion circuit is located.
[0020] In a second aspect, the present application also discloses a device, and the device at least includes a communication conversion circuit described in any one of the above embodiments.
[0021] Compared with the prior art, the present application has at least one of the following beneficial effects:
[0022] Through a new connection design of the MCU serial port circuit, a conversion circuit is added thereto, and at least two connection groups are provided between the conversion circuit and the output port, so that whether the transmitting end and the receiving end of the external device serial port are connected correctly or reversely, it can be ensured that one of the connection groups can work properly. When errors such as the reverse connection of C_TX and C_RX or the reverse connection of the external device interface wiring occur during hardware design, they can all be corrected through software configuration without changing the hardware, which is quite flexible and convenient. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above characteristics, technical features, advantages and their implementation manners of the present application will be further described below in a clear and understandable manner in combination with the drawings in the preferred embodiments.
[0024] Figure 1 FIG. shows a schematic structural diagram of an embodiment of a communication conversion circuit of the present application;
[0025] Figure 2 FIG. shows a schematic diagram of the pins of one of the common 74HC4052 analog switch integrated circuits;
[0026] Figure 3 FIG. shows a schematic circuit connection diagram of another embodiment of a communication conversion circuit of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0027] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are set forth in order to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, and circuits are omitted to avoid unnecessary details from interfering with the description of the present application.
[0028] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or groups.
[0029] For the sake of simplicity of the drawings, only the parts related to the invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, for the sake of simplicity and easy understanding of the drawings, in some figures, components with the same structure or function are only schematically shown one of them, or only one of them is marked. In this article, "one" not only means "only this one", but also means "more than one" situation.
[0030] It should also be further understood that the term "and / or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0031] In this text, it should be noted that unless otherwise clearly specified and defined, the terms "installed", "connected", and "linked" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific situations.
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will describe the specific implementation manners of this application with reference to the accompanying drawings. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to these drawings, and other implementation manners can also be obtained.
[0033] Generally, when designing an MCU application system, using a serial port for communication is a basic communication method. When designing the hardware interface, it needs to be cross-connected with an external serial port. If not careful, it is very easy to make mistakes, such as reversing the TX and RX of the serial port, resulting in the hardware being unable to communicate with the outside, and it is necessary to redesign to correct the error, which delays the product development progress.
[0034] The current existing technical drawback is that it cannot completely correct the error of the reversed hardware serial port connection through software configuration of the hardware connection, and it has to redesign the hardware or solve this problem through manual hardware jump connection.
[0035] The current similar implementation scheme is to design the application circuit through the method of hardware jump connection. When a hardware error occurs, the error is corrected by changing the jump connection.
[0036] These drawbacks are, first, a waste of limited product development time, causing delays in product development, and second, lack of flexibility. It is necessary to correct the error by changing the hardware circuit connection. If the connection of the hardware circuit is achieved through jump connection, there will be potential problems such as poor connection contact in the future.
[0037] This application designs a simple external circuit of the MCU. By adding a flexible conversion circuit in the middle, without caring about the specific TX and RX of the serial port, it can be docked with the external serial port at will. During application, the correct connection can be completed by software configuration according to the actual docking method, which is convenient and flexible.
[0038] An embodiment of a communication conversion circuit provided by the present application includes: an MCU, a conversion circuit, and an output port. Figure 1 The figure shows a schematic structural diagram of an embodiment of a communication conversion circuit of the present application.
[0039] Refer to the attached Figure 1 The sending end and the receiving end of the MCU are connected to the output port through the conversion circuit.
[0040] There are at least two connection groups between the conversion circuit and the output port.
[0041] When the serial port of an external device is correctly connected to the output port, the first connection group between the output port and the conversion circuit works normally; when the serial port of the external device is reversely connected to the output port, the second connection group between the output port and the conversion circuit works normally; so that the serial port of the external device can correctly connect to the sending end and the receiving end of the MCU.
[0042] Specifically, an MCU (Microcontroller Unit; microcontroller unit), also known as a single-chip microcomputer. The MCU is equipped with a serial device interface, and serial communication can transmit data with only one receiving line and one sending line. Although serial communication is slower than parallel communication that transmits data byte by byte, the serial port can achieve data transmission with only two lines.
[0043] Typical serial port communication is completed with 3 lines, namely the ground wire, transmit TX, and receive RX. Since serial port communication is asynchronous, the port can send data on one line while receiving data on another line. The parameters that need to be set for serial port communication mainly include baud rate, data bits, stop bits, and parity check, etc. For two ports that need to perform serial port communication, these parameters must match, which is also a prerequisite for enabling serial port communication.
[0044] The output port, as the connection end to the serial port of an external device, generally appears as a pluggable connector. The conversion circuit is arranged between the MCU and the output port for intermediate connection.
[0045] In some embodiments of this embodiment, the transmitter (C_TX) and receiver (C_RX) of the MCU generally refer to the transmit (Transmit) and receive (Receive) pins of serial communication. The functions of these pins are to implement serial communication between the MCU and other devices. The TX pin is used to send data to another device, while the RX pin is used to receive data from another device. During serial communication, these two pins need to be cross-connected, that is, the TX of one device should be connected to the RX of another device, and vice versa. It should be noted that for different MCU models and different serial ports, such as USART and UART serial ports, the allocation of TX and RX pins may be different. Therefore, the specific pin allocation needs to refer to the data manual or pin definition diagram of the corresponding MCU.
[0046] For example, for a common MCU, its transmitter (C_TX) generally corresponds to the transmit pin of a certain serial port. For example, the transmit pin (C_TX) of the USART1 format serial port is PA9. The receiver (C_RX) corresponds to the receive pin of the same serial port. For example, the receive pin (C_RX) of the USART1 format serial port is PA10.
[0047] In another embodiment disclosed in this application, based on the above embodiment, further limitations are made on the connections between the MCU, the conversion circuit, and the output port.
[0048] Among them, the connections between the MCU and the conversion circuit include the following: The transmitter (C_TX) of the MCU is connected to the A-channel common input / output pin (AN) of the conversion circuit. The receiver (C_RX) of the MCU is connected to the B-channel common input / output pin (BN) of the conversion circuit.
[0049] There are at least two connection groups between the conversion circuit and the output port:
[0050] The first output terminal is connected to the A-channel first independent input / output pin (A0) of the conversion circuit, and the second output terminal is connected to the B-channel first independent input / output pin (B0) of the conversion circuit, forming the first connection group. The first connection group is used to support the positive connection between the external device serial port and the output port.
[0051] The first output terminal is connected to the B-channel second independent input / output pin (B1) of the conversion circuit, and the second output terminal is connected to the A-channel second independent input / output pin (A1) of the conversion circuit, forming the second connection group. The second connection group is used to support the reverse connection between the external device serial port and the output port.
[0052] In an embodiment of the present embodiment, the conversion circuit is a 74HC4052 analog switch integrated circuit. Specifically, 74HC4052 is a multiplexer using analog switches. It has 16 pins and can be used as a dual four-to-one analog switch. It contains two independent 4-channel analog multiplexers / demultiplexers with common selection logic. Each multiplexer has four independent input / output terminals (such as A0 to A3), a common input / output terminal (such as AN), and selection input terminals (S0 and S1). In addition, there is an active-low enable input terminal (E).
[0053] Optionally, as shown in the attached Figure 2 to the specification, Figure 2 the schematic diagram of the pins of a common 74HC4052 analog switch integrated circuit is shown, including: the shared input / output pins (AN, BN) of each of the A and B paths, that is, the common terminals of the A and B paths, four groups of independent input / output pins of the A and B paths (A0, B0; A1, B1; A2, B2; A3, B3), the enable input pin (E), the first selection input pin (S0), the second selection input pin (S1); and the positive power supply voltage input pin (VC C) ), the negative power supply voltage input pin (VEE), and the ground pin (GND).
[0054] Its working principle is as follows: When the enable input terminal (E) is at a low level, according to the selection of the selection input terminals (S0 and S1), one of the switches is activated (low impedance state), allowing the signal to pass through. When E is at a high level, all switches are in a high impedance state, cutting off the signal path. This device has a supply voltage between VCC and GND, and the analog input / output can vary between VCC and VEE, but the voltage of VCC - VEE generally does not exceed 10V. In use, VEE is usually connected to GND.
[0055] Regarding the selection of the four groups of independent input / output pins of the A and B paths, the truth table of the multiplexing is as follows:
[0056]
[0057]
[0058] Among them, "L" represents a low level, which usually refers to the ground (GND) or a voltage level close to 0 volts. And "H" represents a high level. This usually refers to the supply voltage (VCC) or a relatively high voltage level. "H" represents an undefined level state.
[0059] In another embodiment disclosed in the present application, on the basis of the above embodiment, the 74HC4052 conversion circuit will connect the appropriate connection group according to the connection situation of the external serial port to connect the conversion circuit and the output port. So that in the case where the external device serial port is directly connected or inversely connected to the output port, the sending end and the receiving end of the external device serial port can be correctly connected to the sending end and the receiving end of the MCU.
[0060] Specifically, the serial port specification is attached Figure 2 , the output port P1 includes a first output terminal P11 and a second output terminal P12;
[0061] In an embodiment of this embodiment, when the sending end (TX) of the external device serial port is connected to the first output terminal P11 and the receiving end (RX) of the external device serial port is connected to the second output terminal P12; that is, when the external device serial port is directly connected to the output port. The first connection group works properly.
[0062] The first connection group is: the first output terminal is connected to the A-channel first independent input / output pin (A0) of the conversion circuit, and the second output terminal is connected to the B-channel first independent input / output pin (B0) of the conversion circuit.
[0063] At this time, the enable input pin (E) of the conversion circuit is at a low level, the first selection input pin (S0) is at a low level, and the second selection input pin (S1) is at a low level.
[0064] In another embodiment of this embodiment, when the sending end (TX) of the external device serial port is connected to the second output terminal P12 and the receiving end (RX) of the external device serial port is connected to the first output terminal P11; that is, when the external device serial port is directly connected to the output port. The second connection group works properly.
[0065] The second connection group is: the first output terminal is connected to the B-channel second independent input / output pin (B1) of the conversion circuit, and the second output terminal is connected to the A-channel second independent input / output pin (A1) of the conversion circuit.
[0066] At this time, the enable input pin (E) of the conversion circuit is at a low level, the first selection input pin (S0) is at a high level, and the second selection input pin (S1) is at a low level.
[0067] When an external device's serial port is detected to be connected, the pin levels of E, S0, and S1 of the conversion circuit are configured through software to make the specified connection group connected, so that the serial port in the MCU application system can be flexibly connected to the outside. This application makes the correct connection through software configuration to make up for the problem that the application system cannot be used due to errors in hardware design. This application uses a simple circuit. Without caring about whether the serial port needs to be cross-connected or corresponding connected, the hardware serial port can be freely designed, and then flexibly configured through software to correctly and reliably meet the communication requirements.
[0068] Another embodiment of a communication conversion circuit provided by this application is as shown in the attached Figure 3 description. Figure 3 It shows the circuit connection diagram of another embodiment of a communication conversion circuit of this application. The specific connections of the MCU, integrated circuit 74HC4052, and output port P1 are as follows: The serial ports C_TX and C_RX of the MCU are connected to the final output port through the integrated circuit 74HC4052 in the middle, that is, C_TX is connected to AN of 74HC4052, and C_RX is connected to BN. 74HC4052 is an analog switch and multiplexing integrated circuit, and the multiplexing truth table is as Figure 2 shown, where AN and BN are the common terminals of 74HC4052. When designing the hardware, pin 1 of the serial port output port P1 is connected to A0 of the integrated circuit 74HC4052, and pin 2 of P1 is connected to B0, forming a connection group. Then, pin 1 of the serial port output port P1 is connected to B1 of the integrated circuit 74HC4052, and pin 2 of P1 is connected to A1, forming a second connection group. These two groups are cross-connected, as Figure 3 shown.
[0069] During operation, the external serial port line is connected to port P1. When the TX of the external serial port is connected to pin 2 of P1 and the RX is connected to pin 1 of P1, the enable E# of 74HC4052 is configured to be at a low level through software, and SO and S1 are at low levels, selecting the correct connection of AN, BN, A0, and B0 to the serial port of the MCU. When the TX of the external serial port is connected to pin 1 of P1 and the RX is connected to pin 2 of P1, the enable E# of 74HC4052 is configured to be at a low level through software, SO is at a high level, and S1 is at a low level to select the correct connection of AN, BN, A1, and B1 to the serial port of the MCU. Of course, the system where the external serial port is located needs to share the ground with this system. Specifically, sharing the ground means connecting the grounding terminals of multiple devices to a common grounding point to ensure that all devices have a common reference ground potential electrically.
[0070] When errors such as the reverse connection of C_TX and C_RX or the reverse connection of the external device's serial port wiring occur during hardware design, they can all be corrected through software configuration without changing the hardware, which is quite flexible and simple.
[0071] Optionally, in some other embodiments of the present application, when connecting the MCU to the 74HC4052 conversion circuit, or connecting the 74HC4052 conversion circuit to the output port P1, other conventional devices such as resistors may be introduced to stabilize the communication conversion circuit and achieve the expected effect.
[0072] Based on the same inventive concept, the present application also discloses a device, which at least includes a communication conversion circuit described in any one of the above embodiments.
[0073] A communication conversion circuit and a device of the present application have the same inventive concept, and the technical details of the embodiments of the two can be mutually applicable. To avoid repetition, they will not be elaborated here.
[0074] In the present application, "connection" includes direct or indirect connection between objects: the connected objects can be directly connected through a medium (for example, wires, traces, etc.), or can be indirectly connected through other components, or can be internally connected. "Coupling" includes signal connection between objects, which can be directly achieved through a medium (for example, wires, traces, etc.), or can be achieved through other components.
[0075] In the present disclosure, unless otherwise clearly defined and limited, ordinal numbers, such as "first", "second", etc., are only used to distinguish and describe related objects, and cannot be understood as indicating or implying the relative importance or order between related objects. In addition, ordinal numbers do not represent the quantity of related objects.
[0076] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each program module is used as an example. In actual applications, the above functions can be allocated to different program modules according to needs, that is, the internal structure of the device is divided into different program units or modules to complete all or part of the functions described above. Each program module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in a processing unit. The above integrated units can be implemented in the form of hardware or in the form of software program units. In addition, the specific names of each program module are only for the convenience of mutual distinction and do not limit the protection scope of the present application.
[0077] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailedly described or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0078] In the embodiments provided in the present application, it should be understood that the disclosed devices and equipment can be implemented in other ways. Exemplarily, the device embodiments described above are merely illustrative. Exemplarily, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation. Exemplarily, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0079] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0080] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they know the basic creative concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the 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 equivalent technologies, the present application is also intended to include these changes and variations.
Claims
1. A communication conversion circuit, characterized in that, Including: MCU, conversion circuit and output port; The transmitting end and receiving end of the MCU are connected to the output port through the conversion circuit; There are at least two connection groups between the conversion circuit and the output port; When the external device serial port is connected to the output port in the correct phase, the first connection group between the output port and the conversion circuit works normally; when the external device serial port is connected to the output port in the reverse phase, the second connection group between the output port and the conversion circuit works normally; So that the external device serial port can correctly connect to receive the transmitting end and receiving end of the MCU.
2. The communication conversion circuit according to claim 1, wherein: The conversion circuit is a 74HC4052 analog switch integrated circuit.
3. A communication conversion circuit according to claim 2, characterized in that: The transmitting end of the MCU is connected to the A-channel common input / output pin of the conversion circuit; The receiving end of the MCU is connected to the B-channel common input / output pin of the conversion circuit.
4. A communication conversion circuit according to claim 2, characterized in that: The output port includes a first output end and a second output end; The first output end is connected to the A-channel first independent input / output pin of the conversion circuit, and the second output end is connected to the B-channel first independent input / output pin of the conversion circuit to form the first connection group; The first output end is connected to the B-channel second independent input / output pin of the conversion circuit, and the second output end is connected to the A-channel second independent input / output pin of the conversion circuit to form the second connection group.
5. A communication conversion circuit according to claim 4, characterized in that: When the transmitting end of the external device serial port is connected to the first output end and the receiving end of the external device serial port is connected to the second output end; the first connection group works normally; When the transmitting end of the external device serial port is connected to the second output end and the receiving end of the external device serial port is connected to the first output end; the second connection group works normally.
6. A communication conversion circuit according to claim 4, characterized in that: When the transmitting end of the external device serial port is connected to the first output end and the receiving end of the external device serial port is connected to the second output end; the enable input pin of the conversion circuit is at low level, the first selection input pin is at low level, and the second selection input pin is at low level; When the transmitting end of the external device serial port is connected to the second output end and the receiving end of the external device serial port is connected to the first output end; the enable input pin of the conversion circuit is at low level, the first selection input pin is at high level, and the second selection input pin is at low level.
7. A communication conversion circuit according to claim 1, characterized in that: The external device where the external device serial port is located is grounded together with the device where the communication conversion circuit is located.
8. A device, characterized in that, The device at least includes a communication conversion circuit according to any one of claims 1-7.