CN212515784U - RS-485 signal line polarity self-adaptation realization device based on double UARTs - Google Patents

RS-485 signal line polarity self-adaptation realization device based on double UARTs Download PDF

Info

Publication number
CN212515784U
CN212515784U CN202021197666.8U CN202021197666U CN212515784U CN 212515784 U CN212515784 U CN 212515784U CN 202021197666 U CN202021197666 U CN 202021197666U CN 212515784 U CN212515784 U CN 212515784U
Authority
CN
China
Prior art keywords
uart
mcu
external
transceiver
circuit
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.)
Active
Application number
CN202021197666.8U
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.)
Mingzhi Electrical Appliances Taicang Co ltd
Original Assignee
Mingzhi Electrical Appliances Taicang 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 Mingzhi Electrical Appliances Taicang Co ltd filed Critical Mingzhi Electrical Appliances Taicang Co ltd
Priority to CN202021197666.8U priority Critical patent/CN212515784U/en
Application granted granted Critical
Publication of CN212515784U publication Critical patent/CN212515784U/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Dc Digital Transmission (AREA)

Abstract

The utility model relates to a RS-485 signal line polarity self-adaptation realizes device based on two UART, including RS485 transceiver and MCU, the device still including the converting circuit who is used for receiving RS-485 antipolarity signal, this converting circuit connects between the UART of double-circuit UART wherein all the way and RS-485 transceiver. Compared with the prior art, the utility model has the advantages of the wiring is swift, labour saving and time saving.

Description

RS-485 signal line polarity self-adaptation realization device based on double UARTs
Technical Field
The utility model relates to a RS-485 bus especially relates to a RS-485 signal line polarity self-adaptation realization device based on two UART.
Background
The RS-485 bus is a common communication line and has wide application in the industries of instruments, illumination and the like. In general application, the RS-485 signal is converted with a CMOS signal or a TTL signal through a transceiver and then connected to the MCU. When an actual RS-485 control system is wired, if the two signal wires A and B are reversely connected, normal communication cannot be realized. However, when the field is wired, the field is generally not wired, and the problem can not be found until the field is powered on. Therefore, if the connection is wrong, the power is required to be cut off again and then the correction is carried out, which is very troublesome.
In practical applications, the MCU is often used for RS-485 communication. Because the RS-485 uses differential signals for transmission, and the common MCU uses CMOS or TTL signals, the RS-485 transceiver is needed to be used for converting the signals. A typical RS-485 signal transceiver architecture is shown in fig. 1.
In the schematic diagram of the transceiver in fig. 1, A, B is connected to the RS-485 bus, and R, RE, DE, D are connected to the MCU. Since reception and transmission are not performed simultaneously, RE and DE are active at low level and active at high level respectively when the device is designed, so that in some cases, two signals can be connected together to realize switching input and output of one control signal. R is the output of the transceiver converting the RS-485 signal into the COMS or TTL level and is used for being connected with a UART input port (RXD) of the MCU, and D is the input of the transceiver converting the CMOS or TTL level into the RS-485 signal and is used for being connected with an output signal (TXD) of the UART in the MCU. A typical wiring diagram of the MCU with the RS-485 transceiver is shown in fig. 2.
During actual wiring construction, when the two signal lines A, B of the RS-485 bus are connected in reverse, the R signal received by the MCU is reversed regardless of isolation, and the signal output by the MCU is also a reversed signal when being applied to the bus.
If the reverse signal is received, the MCU cannot analyze correct data, and communication fails.
In the prior art, for preventing misconnection, there are 4 common solutions:
1) the wiring terminal capable of preventing wrong connection (such as an aviation socket and the like) is adopted, when equipment is produced, signals needing to be connected are connected to an external terminal through a lead, and the equipment manufacturer ensures that errors do not occur. During actual assembly, the terminal is directly connected, and wrong connection can be avoided. This approach is only used in more expensive equipment or applications requiring frequent plugging and unplugging, as it requires the addition of more costly terminals, which is not practical in conventional products.
2) The codes of all signals are printed on the wires, and the codes are unified with the codes on the equipment. Thus, the assembly is carried out according to the code number, and the assembly is not easy to be mistaken. Because the cable printed with the code limits the use of the conducting wire, the cable manufacturer rarely produces the cable, needs to order the cable and has higher cost; in addition, the codes of various manufacturers may not be uniform, and the actual use is limited.
3) Before assembly, each wire is labeled with self-adhesive paper or a material thereof, and the code number of the label is unified with the code number on the equipment. Therefore, the assembly is carried out according to the identification during assembly, and the assembly is not easy to be mistakenly assembled. This is the most common method, but requires an additional step of affixing a label for each assembly. In addition, in the threading and dragging process during assembly, sometimes the mark also falls off, and the mark needs to be reprocessed, so that the time is wasted.
4) Several wires with different colors are adopted, and before assembly, each color corresponds to one signal for assembly. This method is also relatively common, but is often subject to error. In order to prevent wrong connection, the wiring is required to be checked, and the labor hour is wasted.
SUMMERY OF THE UTILITY MODEL
The utility model aims at providing a RS-485 signal line polarity self-adaptation realizing device based on two UART in order to overcome the defects that exist in the prior art.
The purpose of the utility model can be realized through the following technical scheme:
the device also comprises a conversion circuit used for receiving the RS-485 reversed polarity signal, and the conversion circuit is connected between one path of UART and the RS-485 transceiver of the double-path UART.
Preferably, the device further comprises a first UART interface and a second UART interface, the conversion circuit is a polarity conversion circuit arranged outside the MCU, the first UART interface and the second UART interface are both arranged in the MCU, the first UART interface is directly connected with the RS485 transceiver, and the second UART interface is connected with the RS485 transceiver through the polarity conversion circuit arranged outside the MCU.
Preferably, the device further comprises a first UART interface and a second UART interface both arranged in the MCU, the conversion circuit is a polarity switching circuit arranged inside the MCU, the first UART interface is directly connected with the RS485 transceiver, and the second UART interface is connected with the RS485 transceiver through the polarity switching circuit inside the MCU.
Preferably, the second UART interface includes a receiving circuit of the second UART and a transmitting circuit of the second UART, the internal polarity switching circuit includes an internal polarity switching circuit of the transmitting port and an internal polarity switching circuit of the receiving port, the transmitting circuit of the second UART is connected to the RS485 transceiver through the internal polarity switching circuit of the transmitting port, and the receiving circuit of the second UART is connected to the RS485 transceiver through the internal polarity switching circuit of the receiving port.
Preferably, the device further comprises a first UART interface and a second UART interface which are both arranged in the MCU, wherein the first UART interface is directly connected with the RS485 transceiver, and the second UART interface comprises a UART transmitting circuit with a polarity switching function and a UART receiving circuit with a polarity switching function which are respectively connected with the RS485 transceiver.
Preferably, the device further comprises an MCU internal UART interface with a polarity switching function and an MCU external UART controller, wherein the MCU internal UART interface is directly connected with the RS485 transceiver, one end of the MCU external UART controller is connected with the MCU through a connecting bus, and the other end of the MCU external UART controller is connected with the RS485 transceiver.
Preferably, the device further comprises an MCU internal UART interface and an MCU external UART controller, the conversion circuit is an MCU external polarity switching circuit, the MCU external polarity switching circuit is arranged between the MCU internal UART interface and the RS485 transceiver or between one end of the MCU external UART controller and the RS485 transceiver, and the other end of the MCU external UART controller is connected with the MCU.
Preferably, the device comprises a first external UART controller and a second external UART controller with polarity switching function, one end of the first external UART controller and one end of the second external UART controller are respectively connected with the RS485 transceiver, and the other end of the first external UART controller and the other end of the second external UART controller are connected with the MCU through a unified bus or respective independent buses.
Preferably, the device still include first MCU outside UART controller, the outside UART controller of second MCU, converting circuit be the outside polarity converting circuit of MCU, first MCU outside UART controller one end pass through MCU outside polarity switching circuit and be connected with RS485 transceiver, the outside UART controller one end of second MCU directly be connected with RS485 transceiver, the outside UART controller other end of first MCU, the outside UART controller other end of second MCU pass through unified bus or independent bus and MCU are connected separately.
Preferably, the device further comprises an isolation circuit, and the isolation circuit is arranged between the RS485 transceiver and the MCU.
Compared with the prior art, the utility model has the advantages of it is following:
1) at present, a wiring method for distinguishing forward input and reverse input exists, after wiring errors occur, especially in an environment with difficult operation, such as a lighting system, error correction is very difficult and the cost is quite high due to the fact that the space position and wiring are complex, and the utility model well solves the problems;
2) when the cable is wired or maintained on site, two wires do not need to be distinguished, wiring is rapid, and time and labor are saved;
3) because two lines do not need to be distinguished, the requirements of color codes and the like on the wires are avoided, and the purchase, the storage and the management are convenient.
Drawings
FIG. 1 is a typical RS-485 transceiver circuit;
FIG. 2 is a diagram of typical MCU connections to an RS-485 transceiver;
FIG. 3 is a schematic diagram of a circuit using external polarity switching;
FIG. 4 is a schematic diagram of a circuit using internal polarity switching;
FIG. 5 is a schematic diagram of an internal polarity switching circuit using separate control for receive and transmit;
FIG. 6 is a schematic diagram of a UART receiving and transmitting circuit including polarity switching;
FIG. 7 is a schematic diagram of an external UART controller circuit;
FIG. 8 is a schematic diagram of an external UART controller and a polarity switching circuit;
FIG. 9 is another schematic diagram of an external UART controller and a polarity switching circuit;
FIG. 10 is a schematic diagram of an external dual UART controller circuit;
FIG. 11 is another schematic diagram of an external dual UART controller circuit;
FIG. 12 is a schematic diagram of an external dual UART controller and a polarity switching circuit;
FIG. 13 is another schematic diagram of an external dual UART controller and a polarity switching circuit;
fig. 14 is a schematic diagram of a polarity switching circuit external to the strip isolation circuit.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, of the embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by a person skilled in the art without creative efforts shall fall within the protection scope of the present invention.
The utility model relates to a RS-485 signal line polarity self-adaptation realization device based on two UART supports RS-485 signal A and B to exchange, solves the trouble that connects the reverse to arouse. When the utility model is adopted, the two communication lines A, B of the RS-485 can be judged by the MCU without being distinguished. The utility model discloses a double-circuit UART receives, and UART uses the forward to receive all the way, and another way UART uses reverse receipt, as shown in figure 3. The utility model discloses can be used to DMX power, DMX controller or other situations that use RS-485.
The method comprises the following implementation steps:
1. firstly, forbidding at least one path of UART output (preventing two outputs from being simultaneously output to a transmitting input pin of RS-485) and enabling the input of two paths of UARTs;
2. in the process of receiving data, if a forward UART receives a correct data frame, the polarity is confirmed to be correct; if the reverse UART receives a correct data frame, the polarity is determined to be opposite.
3. If the polarity is correct, enabling a sending pin of the forward UART, and sending data by using the forward UART; if the polarity is opposite, the transmitting pin of the reverse UART is used, and the transmission of the reverse UART is used when data is transmitted.
4. After the polarity is determined, the current polarity can be maintained or the reception of the positive polarity and the negative polarity can be continued according to the requirement.
In fig. 3, a is an external polarity conversion circuit or a switching circuit. The polarity switching circuit may use an MCU internal circuit, in addition to an external circuit, as shown in fig. 4.
In fig. 4, a is an internal polarity switching circuit, b is an internal polarity control signal, c is a receiving circuit of the UART2, and d is a transmitting circuit of the UART 2.
In addition, the input and output of the polarity switching circuit of UART2 may also be controlled separately, as shown in fig. 5. In fig. 5, a is an internal polarity switching circuit of the transmitting port, b is a transmitting port internal polarity control signal, c is a receiving circuit of the UART2, d is a transmitting circuit of the UART2, e is an internal receiving circuit polarity switching circuit, and f is a receiving port internal polarity control signal.
For the internal polarity switching, it is also possible to use a configuration in which the switching circuit of the transmitting circuit is included in the transmitting circuit and the switching circuit of the receiving circuit includes the UART interface in the receiving circuit, as shown in fig. 6. In fig. 6, a is a UART transmitting circuit having a polarity switching function, and b is a UART receiving circuit having a polarity switching function. c is a transmission polarity switching circuit of UART2, d is the other part of the transmission circuit of UART2 than the polarity switching circuit, e is a reception polarity switching circuit of UART2, and f is the other part of the reception circuit of UART2 than the polarity switching circuit.
For the dual-path UART, one path may be UART inside the MCU, and the other path is external UART controller, as shown in fig. 7. In fig. 7, a is a connection bus externally connecting the UART and the MCU, which may include a data bus, a control bus, an address bus or no address bus. b is an external UART controller. In this case, at least one of the internal and external UARTs may have a polarity switching capability.
If both the internal and external UARTs do not have a polarity switching function, the external UART circuit in fig. 7 can also be designed directly to receive only the reverse polarity signal, and can also implement the corresponding function.
If both the internal and external UARTs do not have the polarity switching function and cannot receive the reverse polarity signal, a polarity switching circuit or a polarity converting circuit may be connected in series between the external or internal UART and the RS-485 transceiver, as shown in fig. 8 and 9.
In fig. 8 and 9, a is a connection bus between the external UART controller and the MCU, which may include a data bus, a control bus, an address bus or no address bus. b is an external UART controller. c is an external polarity conversion circuit or a polarity switching circuit, and d is a control signal sent by the MCU.
For dual UARTs, an external UART controller may also be used, as shown in fig. 10 and 11. In fig. 10, a is a connection bus externally connecting the UART and the MCU, which may include a data bus, a control bus, an address bus or no address bus. b is a first external UART controller, and c is a second UART controller. In fig. 11, a is a bus connected to a first UART controller, b is a first external UART controller, c is a second UART controller, and d is a bus connected to a second UART controller. In this case, at least one path of the external UART may switch the polarity.
When two external UART controllers are used, a UART controller that cannot control the polarity may also be used, and in this case, a polarity converting circuit or a polarity switching circuit is additionally added, as shown in fig. 12 and 13. In fig. 13, d is a bus connected to the second UART controller. In fig. 12, a is a connection bus connecting the external UART controller and the MCU; in fig. 13, a is a connection bus externally connecting the first UART controller and the MCU, and d is a connection bus externally connecting the second UART controller and the MCU. These buses may include data buses, control buses, may or may not include address buses. In fig. 12 and 13, b is a first external UART controller and c is a second UART controller. e is an external polarity conversion circuit or a polarity switching circuit, and f is a control signal sent by the MCU.
For all the circuits, an isolation circuit can be added, and the safety of data transmission is further improved. As with the circuit of fig. 3, with the addition of an isolation circuit as shown in fig. 14. Other circuits increase isolation similarly.
During the polarity analysis, only one path of UART can be enabled, and when the polarity analysis is opposite to the polarity of the current UART, the current UART is closed, and the other path of UART is enabled to continue receiving.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope of the present invention, and these modifications or replacements should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. The device is characterized by further comprising a conversion circuit for receiving RS-485 reversed polarity signals, wherein the conversion circuit is connected between one path of UART and the RS-485 transceiver of a double-path UART.
2. The device of claim 1, further comprising a first UART interface and a second UART interface, wherein the conversion circuit is a polarity conversion circuit disposed outside the MCU, the first UART interface and the second UART interface are both disposed in the MCU, the first UART interface is directly connected to the RS485 transceiver, and the second UART interface is connected to the RS485 transceiver through the polarity conversion circuit disposed outside the MCU.
3. The device of claim 1, further comprising a first UART interface and a second UART interface both disposed in the MCU, wherein the conversion circuit is an internal polarity switching circuit disposed inside the MCU, the first UART interface is directly connected to the RS485 transceiver, and the second UART interface is connected to the RS485 transceiver through the internal polarity switching circuit inside the MCU.
4. The apparatus of claim 3, wherein the second UART interface comprises a receiving circuit of the second UART and a transmitting circuit of the second UART, the internal polarity switching circuit comprises an internal polarity switching circuit of a transmitting port and an internal polarity switching circuit of a receiving port, the transmitting circuit of the second UART is connected to the RS485 transceiver through the internal polarity switching circuit of the transmitting port, and the receiving circuit of the second UART is connected to the RS485 transceiver through the internal polarity switching circuit of the receiving port.
5. The device of claim 1, further comprising a first UART interface and a second UART interface both disposed in the MCU, wherein the first UART interface is directly connected to the RS485 transceiver, and the second UART interface comprises a UART transmitting circuit with a polarity switching function and a UART receiving circuit with a polarity switching function, both of which are connected to the RS485 transceiver.
6. The device for realizing the polarity self-adaptation of the RS-485 signal line based on the dual UART according to claim 1, further comprising an MCU internal UART interface with a polarity switching function and an MCU external UART controller, wherein the MCU internal UART interface is directly connected with the RS485 transceiver, one end of the MCU external UART controller is connected with the MCU through a connecting bus, and the other end of the MCU external UART controller is connected with the RS485 transceiver.
7. The device of claim 1, further comprising an MCU internal UART interface and an MCU external UART controller, wherein the conversion circuit is an MCU external polarity switching circuit, the MCU external polarity switching circuit is arranged between the MCU internal UART interface and the RS485 transceiver, or between one end of the MCU external UART controller and the RS485 transceiver, and the other end of the MCU external UART controller is connected to the MCU.
8. The device of claim 1, wherein the device comprises a first external UART controller and a second external UART controller with a polarity switching function, one end of the first external UART controller and one end of the second external UART controller are respectively connected to the RS485 transceiver, and the other end of the first external UART controller and the other end of the second external UART controller are connected to the MCU through a unified bus or separate buses.
9. The device of claim 1, further comprising a first MCU external UART controller and a second MCU external UART controller, wherein the conversion circuit is an MCU external polarity conversion circuit, one end of the first MCU external UART controller is connected with the RS485 transceiver through the MCU external polarity conversion circuit, one end of the second MCU external UART controller is directly connected with the RS485 transceiver, and the other end of the first MCU external UART controller and the other end of the second MCU external UART controller are connected with the MCU through a unified bus or respective independent buses.
10. The dual UART-based RS-485 signal line polarity adaptation implementation device of any one of claims 1-9, wherein the device further comprises an isolation circuit, and the isolation circuit is disposed between the RS485 transceiver and the MCU.
CN202021197666.8U 2020-06-24 2020-06-24 RS-485 signal line polarity self-adaptation realization device based on double UARTs Active CN212515784U (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202021197666.8U CN212515784U (en) 2020-06-24 2020-06-24 RS-485 signal line polarity self-adaptation realization device based on double UARTs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202021197666.8U CN212515784U (en) 2020-06-24 2020-06-24 RS-485 signal line polarity self-adaptation realization device based on double UARTs

Publications (1)

Publication Number Publication Date
CN212515784U true CN212515784U (en) 2021-02-09

Family

ID=74438726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202021197666.8U Active CN212515784U (en) 2020-06-24 2020-06-24 RS-485 signal line polarity self-adaptation realization device based on double UARTs

Country Status (1)

Country Link
CN (1) CN212515784U (en)

Similar Documents

Publication Publication Date Title
US6411912B1 (en) Voltage level bus translator and safety interlock system for battery modules
RU2586580C2 (en) Conflict detection in eia-485 buses
US4608562A (en) Address personalization of a remotely attached device
CN212515784U (en) RS-485 signal line polarity self-adaptation realization device based on double UARTs
CN111711552B (en) Terminal resistor access circuit, servo driver and control system
CN109050444A (en) CAN circuit structure and its vehicle diagnostic equipment
CN212695990U (en) Communication type switching circuit and air conditioning equipment
CN113900397A (en) Device for realizing reverse connection self-adaptive switching of RS-485 signal line
CN113836063A (en) RS-485 signal line polarity self-adaptation realization device based on double UARTs
CN212160411U (en) Device for realizing reverse connection self-adaptive switching of RS-485 signal line
US6466989B1 (en) Automatic network connection device for wiring to network cable
CN210924279U (en) Matrix driving device
CN102426452A (en) Vehicle-mounted system with long-distance diagnostic function
KR100812816B1 (en) Potable diagnosis device for automobilec
CN213240849U (en) RS-485 signal polarity identification device
CN213581051U (en) Connection device and failure diagnosis system
CN218383712U (en) Bus driving module, communication system and household appliance
CN220232439U (en) Vehicle USB and OBD data conversion device
CN220041090U (en) Interface circuit and interface chip
CN209803317U (en) Intelligent electric meter and control circuit and detection tool thereof
CN114064533B (en) RS-485 signal polarity identification method
CN216623239U (en) USB-to-serial port circuit and wireless communication test system
CN217739841U (en) Embedded artificial intelligence computer motherboard
CN112148321B (en) Anti-interference upgrading system and method for automobile intelligent electronic equipment microcontroller
CN111190845B (en) Communication circuit and method compatible with multiple devices

Legal Events

Date Code Title Description
GR01 Patent grant
GR01 Patent grant