CN115499032A - One-to-many UART communication method - Google Patents

One-to-many UART communication method Download PDF

Info

Publication number
CN115499032A
CN115499032A CN202211066874.8A CN202211066874A CN115499032A CN 115499032 A CN115499032 A CN 115499032A CN 202211066874 A CN202211066874 A CN 202211066874A CN 115499032 A CN115499032 A CN 115499032A
Authority
CN
China
Prior art keywords
uart
pin
data
external
main control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211066874.8A
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.)
Shanghai Basewin Intelligent Technology Co ltd
Original Assignee
Shanghai Basewin Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Basewin Intelligent Technology Co ltd filed Critical Shanghai Basewin Intelligent Technology Co ltd
Priority to CN202211066874.8A priority Critical patent/CN115499032A/en
Publication of CN115499032A publication Critical patent/CN115499032A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B1/00Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
    • H04B1/38Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
    • H04B1/40Circuits
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B1/00Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
    • H04B1/38Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
    • H04B1/40Circuits
    • H04B1/401Circuits for selecting or indicating operating mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B1/00Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
    • H04B1/38Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
    • H04B1/40Circuits
    • H04B1/44Transmit/receive switching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2212/00Encapsulation of packets

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a one-to-many UART communication method, which comprises the following steps: a one-to-many UART communication method, comprising: connecting a UART transmitting pin of a main control module with UART receiving pins of a plurality of external modules; the main control module is used for sending the UART communication data to UART receiving pins of the external modules through the UART sending pins of the main control module; further comprising: connecting a UART receiving pin of the main control module with UART transmitting pins of a plurality of external modules; the external module is used for transmitting the UART communication data to a UART receiving pin of the main control module through the UART transmitting pin connection of the external module; the method can realize that the main control end communicates with a plurality of external UART interface modules through one UART.

Description

One-to-many UART communication method
Technical Field
The invention belongs to the technical field of UART communication, and particularly relates to a one-to-many UART communication method.
Background
With the increasing functions of the embedded device, the number of external modules connected to the main control chip of the embedded device is also increasing. An Asynchronous Receiver Transmitter/Transmitter (UART) is a relatively common hardware interface, and its simple and easy-to-use characteristics make it a first choice when designing a communication interface between a module and a module. However, because the UART itself can only be one-to-one, if a plurality of UART devices are externally connected to the main control chip, a plurality of UART interfaces are required to be provided to connect the UART interface module. The UART resources on the main control chip are limited, the number of the UART resources is about 4, and the number of the UART resources is only 2.
Therefore, how to solve the problem that the master control chip UART is not enough, the master control end communicates with a plurality of external UART interface modules through one UART, which becomes a key problem of current research.
Disclosure of Invention
In view of the above problems, the present invention provides a one-to-many UART communication method that at least solves some of the above technical problems, and provides a technical solution for a main control chip to communicate with a plurality of UART interface modules through a UART.
The embodiment of the invention provides a one-to-many UART communication method, which comprises the following steps: connecting a UART transmitting pin of a main control module with UART receiving pins of a plurality of external modules; the main control module is used for sending UART communication data to the UART receiving pins of the external modules through the UART sending pins of the main control module;
further comprising: connecting a UART receiving pin of a main control module with UART transmitting pins of a plurality of external modules; the external module is used for sending the UART communication data to the UART receiving pin of the main control module through the UART sending pin connection of the external module.
Further, performing a layer of protocol encapsulation on the UART communication data sent by the main control module, wherein the corresponding encapsulation area comprises a data head and a data main body of the UART communication data;
wherein the data header comprises a header identification, a data attribution identification and a data length.
Further, the header identification is set to 2 bytes; setting the data attribution identification to be 1 byte; setting the data length to 2 bytes; the data body is set to a plurality of bytes.
Furthermore, a UART receiving pin of the main control module is connected with UART transmitting pins of a plurality of external modules through a tri-state buffer gate;
when the UART transmitting pin of the external module does not transmit UART communication data, the gateway select of the external module is pulled down through the tri-state buffer gate, so that a TX link of the external module is in a high-impedance state;
when the UART sending pin of the external module needs to send data, the gate select of the external module is pulled high through the tri-state buffer door, so that the TX link of the external module is in a conducting state, the UART sending pin of the external module sends UART communication data, and after the data are sent, the gate select of the external module is pulled low through the tri-state buffer door, so that the TX link of the external module is in a high-resistance state.
Furthermore, at the same time, only one UART transmitting pin of the external module can transmit UART communication data to the UART receiving pin of the main control module.
Further, connecting the function multiplexing pins of the plurality of external modules with each other;
the functional multiplexing pins comprise a TX state pin and a TX select pin;
the TX state pin is used for reading whether other external modules send UART communication data to a UART receiving pin of the main control module;
the TX select pin is used for indicating the external module to send UART communication data to the UART receiving pin of the main control module.
Further, the function multiplexing pin defaults to a TX state function, and at this time, the function multiplexing pin is configured as an input and is pulled down to a low level through a hardware pull-down resistor;
when the external module needs to send UART communication data, the function multiplexing pin is a TX select function, and is configured to output and output a high level; and after the UART communication data is sent, configuring the function multiplexing pin as a TX state function, and converting the function multiplexing pin into a low level state.
Further, performing a layer of protocol encapsulation on the UART communication data sent by the external module, wherein the corresponding encapsulation area comprises a data head and a data main body of the UART communication data; the data head comprises a head mark, a data attribution mark and a data length;
setting the header identification to 2 bytes; setting the data attribution identification to be 1 byte; setting the data length to be 2 bytes; the data body is set to a plurality of bytes.
Compared with the prior art, the one-to-many UART communication method recorded in the invention has the following beneficial effects:
1. the main control module can realize the communication with a plurality of UART interface modules through one UART.
2. The main control module can realize communication only by using TX/RX of UART standard without adding other hardware interfaces.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic design diagram of a one-to-many UART communication method according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a data transmission flow of the external module according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of a tri-state buffer gate according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Referring to fig. 1, an embodiment of the invention provides a one-to-many UART communication method, including: connecting a UART transmitting pin of a main control module with UART receiving pins of a plurality of external modules; the UART transmitting pin of the main control module is the TX pin of the UART chip in the main control module part in fig. 1; the UART receiving pin of the external module is the RX pin in the external module part in FIG. 1; the main control module is used for sending the UART communication data to UART receiving pins of the plurality of external modules through a UART sending pin of the main control module; the TX pin of the main control module is used as output, the RX pins of other external modules are used as input, one output corresponds to multiple inputs, and there is no conflict in hardware. In order to specify to which external module the data is specifically sent, a layer of protocol encapsulation may be performed on the UART communication data sent by the main control module, which is specifically shown in table 1:
TABLE 1
Figure BDA0003828019840000041
The embodiment of the invention provides a one-to-many UART communication method, which also comprises the steps of connecting a UART receiving pin of a main control module with UART transmitting pins of a plurality of external modules; the UART receiving pin of the main control module refers to an RX pin of a UART chip in the main control module part in fig. 1; the UART transmitting pin of the external module refers to the TX pin in the external module part in figure 1; the external module is used for transmitting the UART communication data to a UART receiving pin of the main control module through the UART transmitting pin connection of the external module;
in the process of receiving the UART communication data sent by the external module, if the main control module is configured as RX (receiving pin) and other external modules are configured as TX (sending pin) according to the standard configuration of UART, the multiple outputs will affect each other and cannot work normally. In order to solve the problem, a tri-state gate buffer circuit is added, and when the external module does not transmit UART communication data, the gate select of the external module is pulled down through the tri-state buffer circuit, so that a TX link of the external module is set to be in a high-impedance state; when the UART sending pin of the external module needs to send data, the gate select of the external module is pulled up through the tri-state buffer gate, so that the TX link of the external module is in a conducting state, the UART sending pin of the external module sends UART communication data, and after the data sending is finished, the gate select of the external module is pulled down through the tri-state buffer gate, so that the TX link of the external module is in a high-impedance state.
In addition, only one UART transmitting pin of the external module can transmit UART communication data to the UART receiving pin of the main control module at the same time, so that a function multiplexing pin, namely a TX state/select pin, is added for ensuring the synchronization of data transmission states among the external modules. The functional multiplexing pins comprise a TX state pin and a TX select pin; the TX state pin is used for reading whether other external modules send UART communication data to a UART receiving pin of the main control module or not; the TX select pin is used for indicating the external module to send UART communication data to the UART receiving pin of the main control module. The function multiplexing pin defaults to a low level state, and at the moment, the function multiplexing pin is configured to be a TX state pin (namely configured to be in an input state); when the external module needs to send UART communication data, the corresponding function multiplexing pin is configured as a TX select pin (namely configured in an output state), and a high level is output; and after the UART communication data is transmitted, configuring the functional multiplexing pin as a TX state pin, and converting the functional multiplexing pin into a low level state.
When a plurality of external modules send data to the main control module, the output conflict problem among the modules needs to be handled, and the flows of configuration of a TX state/select pin, control of a tri-state buffer gate, data sending and the like are realized according to the flow shown in fig. 2; when the external module does not send data to the main control module, the three-state buffer gate access needs to be closed, and the function multiplexing pin is configured to be in an input state (namely, a TX state pin); if a certain external module (hereinafter referred to as the external module) needs to send data to the main control module, it needs to check whether other external modules are sending data to the main control module, specifically, the TX state/select pin states of other external modules are read, if the external module is at a high level, it indicates that other external modules are sending data to the main control module, and at this time, the external module needs to repeatedly read the TX state/select pin states of other external modules, and until a low level is read, it indicates that other external modules do not send data to the main control module, and at this time, the external module can send data to the main control module;
the specific operation of the external module for sending data is as follows: firstly, configuring a self TX state/select pin into an output state (namely TX select function), converting the output state into a high level state, then pulling up the GateSelect enabling tri-state buffer gate, and pulling down the GateSelect to close the tri-state buffer gate after data transmission is finished.
In addition, in order to determine which external module sends the data specifically, a layer of protocol encapsulation needs to be performed on the UART communication data sent by the external module, and the format of the protocol encapsulation specifically refers to table 2:
TABLE 2
Figure BDA0003828019840000061
In the embodiment of the invention, the multiplexing of the multi-channel TX signals is mainly realized by adopting a tri-state buffer gate. As shown in fig. 3, the tri-state buffer gate is a key circuit for multiplexing multiple TX signals, and only one TX buffer output of an external module is enabled at a time by control signals 1,2,3, etc., and the others are set to a high impedance state.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (8)

1. A one-to-many UART communication method, comprising: connecting a UART transmitting pin of a main control module with UART receiving pins of a plurality of external modules; the main control module is used for sending UART communication data to UART receiving pins of the external modules through UART sending pins of the main control module;
further comprising: connecting a UART receiving pin of the main control module with UART transmitting pins of a plurality of external modules; the external module is used for sending the UART communication data to the UART receiving pin of the main control module through the UART sending pin connection of the external module.
2. The one-to-many UART communication method according to claim 1, wherein the UART communication data sent by the main control module is encapsulated by one layer of protocol, and the corresponding encapsulation area comprises a data header and a data body of the UART communication data;
wherein the data header comprises a header identification, a data attribution identification and a data length.
3. The one-to-many UART communication method of claim 2, wherein the header flag is set to 2 bytes; setting the data attribution identification to be 1 byte; setting the data length to 2 bytes; the data body is set to a plurality of bytes.
4. The one-to-many UART communication method according to claim 1, wherein the UART receiving pin of the main control module is connected with the UART transmitting pins of the plurality of external modules through the tri-state buffer gate;
when the UART transmitting pin of the external module does not transmit UART communication data, pulling down the gateway select of the external module through the tri-state buffer gate to enable a TX link of the external module to be in a high-impedance state;
when the UART sending pin of the external module needs to send data, the gate select of the external module is pulled high through the tri-state buffer door, so that the TX link of the external module is in a conducting state, the UART sending pin of the external module sends UART communication data, and after the data are sent, the gate select of the external module is pulled low through the tri-state buffer door, so that the TX link of the external module is in a high-resistance state.
5. The one-to-many UART communication method of claim 1, wherein only one UART transmitting pin of the external module can transmit UART communication data to the UART receiving pin of the main control module at the same time.
6. The one-to-many UART communication method according to claim 5, wherein the function multiplexing pins of the plurality of external modules are connected to each other;
the functional multiplexing pins comprise a TX state pin and a TX select pin;
the TX state pin is used for reading whether other external modules send UART communication data to a UART receiving pin of the main control module;
the TX select pin is used for indicating the external module to send UART communication data to the UART receiving pin of the main control module.
7. The one-to-many UART communication method according to claim 6, wherein the function multiplexing pin defaults to a TX state function, and is configured as an input and is pulled down to a low level by a hardware pull-down resistor;
when the external module needs to send UART communication data, the function multiplexing pin is a TX select function, and the function multiplexing pin is configured to output and output a high level; and after UART communication data transmission is finished, configuring the function multiplexing pin as a TX state function, and converting the function multiplexing pin into a low level state.
8. The one-to-many UART communication method according to claim 1, wherein the UART communication data transmitted by the external module is encapsulated by one layer of protocol, and the corresponding encapsulation area comprises a data header and a data body of the UART communication data; the data head comprises a head mark, a data attribution mark and a data length;
setting the header identification to 2 bytes; setting the data attribution identification to be 1 byte; setting the data length to be 2 bytes; the data body is set to a plurality of bytes.
CN202211066874.8A 2022-09-01 2022-09-01 One-to-many UART communication method Pending CN115499032A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211066874.8A CN115499032A (en) 2022-09-01 2022-09-01 One-to-many UART communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211066874.8A CN115499032A (en) 2022-09-01 2022-09-01 One-to-many UART communication method

Publications (1)

Publication Number Publication Date
CN115499032A true CN115499032A (en) 2022-12-20

Family

ID=84468719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211066874.8A Pending CN115499032A (en) 2022-09-01 2022-09-01 One-to-many UART communication method

Country Status (1)

Country Link
CN (1) CN115499032A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201562020U (en) * 2009-08-18 2010-08-25 哈尔滨九洲电气股份有限公司 Multi-contact switch detecting device based on RS485 bus detection method
CN203405813U (en) * 2013-08-26 2014-01-22 四川和通科技有限公司 UART interface multiplex extension device used for concentrator and collector
CN103605306A (en) * 2013-11-18 2014-02-26 四川长虹电器股份有限公司 Communication device based on UART communication interface extension
CN106021152A (en) * 2016-05-12 2016-10-12 柳州桂通科技股份有限公司 Master-slave serial device concentrator and asynchronous duplex one-to-many serial communication method
CN106453383A (en) * 2016-11-07 2017-02-22 深圳拓邦股份有限公司 UART (universal asynchronous receiver/transmitter)-based master-slave multi-processor communication system and method
CN107229589A (en) * 2017-06-21 2017-10-03 上海景格信息科技有限公司 TTL communication bus submodule expanded circuits
US20170329737A1 (en) * 2016-05-11 2017-11-16 Qualcomm Incorporated Two-wire line-multiplexed uart to four-wire high-speed uart bridging with integrated flow control
CN110580037A (en) * 2019-09-27 2019-12-17 华勤通讯技术有限公司 UART communication system and vehicle-mounted equipment
CN112395230A (en) * 2020-12-21 2021-02-23 太原智林信息技术股份有限公司 UART interface extension circuit based on programmable logic device
CN113111021A (en) * 2021-04-14 2021-07-13 山东英信计算机技术有限公司 UART master-slave line communication control circuit and method
CN213934874U (en) * 2020-09-30 2021-08-10 北京机电工程研究所 RS485 serial bus communication equipment based on monitoring technology
CN114168519A (en) * 2021-11-19 2022-03-11 沈阳航天新光集团有限公司 Working robot control system based on serial bus communication technology

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201562020U (en) * 2009-08-18 2010-08-25 哈尔滨九洲电气股份有限公司 Multi-contact switch detecting device based on RS485 bus detection method
CN203405813U (en) * 2013-08-26 2014-01-22 四川和通科技有限公司 UART interface multiplex extension device used for concentrator and collector
CN103605306A (en) * 2013-11-18 2014-02-26 四川长虹电器股份有限公司 Communication device based on UART communication interface extension
US20170329737A1 (en) * 2016-05-11 2017-11-16 Qualcomm Incorporated Two-wire line-multiplexed uart to four-wire high-speed uart bridging with integrated flow control
CN106021152A (en) * 2016-05-12 2016-10-12 柳州桂通科技股份有限公司 Master-slave serial device concentrator and asynchronous duplex one-to-many serial communication method
CN106453383A (en) * 2016-11-07 2017-02-22 深圳拓邦股份有限公司 UART (universal asynchronous receiver/transmitter)-based master-slave multi-processor communication system and method
CN107229589A (en) * 2017-06-21 2017-10-03 上海景格信息科技有限公司 TTL communication bus submodule expanded circuits
CN110580037A (en) * 2019-09-27 2019-12-17 华勤通讯技术有限公司 UART communication system and vehicle-mounted equipment
CN213934874U (en) * 2020-09-30 2021-08-10 北京机电工程研究所 RS485 serial bus communication equipment based on monitoring technology
CN112395230A (en) * 2020-12-21 2021-02-23 太原智林信息技术股份有限公司 UART interface extension circuit based on programmable logic device
CN113111021A (en) * 2021-04-14 2021-07-13 山东英信计算机技术有限公司 UART master-slave line communication control circuit and method
CN114168519A (en) * 2021-11-19 2022-03-11 沈阳航天新光集团有限公司 Working robot control system based on serial bus communication technology

Similar Documents

Publication Publication Date Title
EP1899832B1 (en) Software layer for communication between rs-232 to i2c translation ic and a host
CN101005376A (en) Device and method for realizing service plate main control plate communication
CN101335516A (en) Impedance adjusting circuit and semiconductor memory device having the same
CN201434881Y (en) RS485 interface circuit and electric energy meter employing same
US20150326504A1 (en) Apparatus and method for encoding mdio into sgmii transmissions
CN105635176A (en) Network data transmission method based on RapidIO
CN105159194A (en) Switching circuit and switching method for switching data receiving/sending operation of RS-485 serial port
CN214225912U (en) Serial port level internal selection switching equipment and system
CN107908584B (en) Multi-path RS-485 communication network
CN113765582A (en) System and method for realizing one-way transmission data of domestic-design redundant optical port
CN210639609U (en) RS232 and RS485 adaptive multiplexing circuit, module and equipment
CN115499032A (en) One-to-many UART communication method
CN209472629U (en) RS422 communication and CAN communication equipment based on PCIE bus
US7414998B2 (en) Data communication with a responder device arranged to send non-bluetooth data via a bluetooth inquiry process
CN109194322B (en) RS485 high-speed communication capacitive isolation circuit and performance test method thereof
CN113111021A (en) UART master-slave line communication control circuit and method
CN107070547A (en) A kind of CPCI type gigabit Ethernet devices with failure monitoring ability
CN102545953B (en) UART (Universal Asynchronous Receiver/Transmitter) function extension circuit and control method thereof
CN206363306U (en) A kind of terminal and its serial communication circuit
CN214900831U (en) Hardware multiplexing circuit based on UART communication
CN210270888U (en) Single-bus communication circuit
CN209118135U (en) A kind of automobile-used CAN bus telecommunication circuit of electrical salf-walking
CN112579490A (en) Programmable electronic building block connecting bus
CN101751599A (en) Circuit for improving test speed of contact type intelligent card chip
CN204719747U (en) The compatible equipment of Serial Peripheral Interface (SPI), Serial Peripheral Interface (SPI) and main process equipment

Legal Events

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