CN113127392A - UART-based multi-machine communication method, system and computer readable storage medium - Google Patents

UART-based multi-machine communication method, system and computer readable storage medium Download PDF

Info

Publication number
CN113127392A
CN113127392A CN202110311789.2A CN202110311789A CN113127392A CN 113127392 A CN113127392 A CN 113127392A CN 202110311789 A CN202110311789 A CN 202110311789A CN 113127392 A CN113127392 A CN 113127392A
Authority
CN
China
Prior art keywords
host
communication
data packet
management host
target
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.)
Granted
Application number
CN202110311789.2A
Other languages
Chinese (zh)
Other versions
CN113127392B (en
Inventor
李洪海
孙铭梁
郭延东
贺利萍
肖文青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xinlongpeng Technology Co ltd
Original Assignee
Shenzhen Xinlongpeng Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xinlongpeng Technology Co ltd filed Critical Shenzhen Xinlongpeng Technology Co ltd
Priority to CN202110311789.2A priority Critical patent/CN113127392B/en
Publication of CN113127392A publication Critical patent/CN113127392A/en
Application granted granted Critical
Publication of CN113127392B publication Critical patent/CN113127392B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/36Handling requests for interconnection or transfer for access to common bus or bus system
    • G06F13/362Handling requests for interconnection or transfer for access to common bus or bus system with centralised access control
    • G06F13/366Handling requests for interconnection or transfer for access to common bus or bus system with centralised access control using a centralised polling arbiter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a multi-machine communication method, a system and a computer readable storage medium based on UART, belonging to the field of communication technology, wherein the multi-machine communication method comprises the steps of setting any one of a plurality of hosts as a management host and the rest hosts as target hosts; the management host initializes the communication priority to be low priority and polls the target host to issue a token; after the target host obtains the token, the data packet is packaged, and the data packet is sent to the management host with the token attached; the management host receives the token and the data packet sent by the target host, analyzes the data packet, if no first communication information exists, the management host continues to issue the token to the target host, otherwise, the management host backups a first polling position and forwards the first communication information; the managing host continues to poll the target host to issue a token. Compared with the related art, the method and the device have the effect of solving the problem that the multi-host system is limited in hardware resources and difficult to realize communication by the two-wire UART.

Description

UART-based multi-machine communication method, system and computer readable storage medium
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a UART-based multi-machine communication method, system, and computer readable storage medium.
Background
The host refers to a main body part of the computer except for input and output devices, and is also a control box for placing a motherboard and other main components, and generally includes a CPU, a memory, a motherboard, an optical drive, a power supply, and other input and output controllers and interfaces. In network technology, a host is a terminal device that transmits and receives information. The UART is a two-wire communication interface and is widely used for information exchange between processing units.
In the actual communication process, the terminal device is divided into a master and a slave according to the role of the terminal device in the communication process, the master generally plays a main role and issues commands, and the slave mainly receives commands. Generally, the slave is passive, the master actively sends a signal, the slave receives the signal, and the master and the slave generally communicate through the UART. Common situations are dual-machine communication and master-slave multi-machine communication.
Smaller multi-machine systems have limited host resources and are difficult to implement more sophisticated communication mechanisms or to communicate using ethernet. However, when the multi-computer system includes more than two hosts and point-to-point information exchange is required between the hosts, if a common two-wire UART is used for communication, more hardware resources of each host need to be consumed, but the hardware resources of the hosts are limited and difficult to implement.
Disclosure of Invention
In order to solve the problem that the hardware resources of a multi-host system are limited and communication is difficult to realize by a two-wire UART, the invention provides a UART-based multi-computer communication method, a system and a computer readable storage medium.
In a first aspect, the present application provides a multi-machine communication method based on UART, which adopts the following technical solution:
a UART-based multi-machine communication method comprises,
setting any host in a plurality of hosts as a management host and the rest hosts as target hosts, and performing communication connection between the management host and the plurality of target hosts by using a master-slave UART topological structure;
defining that the target host can only send information to the management host when the target host holds the token, and the management host can only send information to the target host when the management host holds the token;
the management host initializes the communication priority of the management host to be low priority and polls the target host to issue a token;
after any target host obtains the token, packing a data packet according to communication requirements, attaching the token to the data packet and sending the data packet to a management host;
the management host receives the token and the data packet, analyzes the data packet, if the data packet is empty, continues polling the target host to issue the token, otherwise backups the current first polling position, increases the communication priority of the management host, and forwards the first communication information in the data packet to the target host indicated by the data packet; and the number of the first and second groups,
and after the first communication information is forwarded, the management host reduces the communication priority of the management host, and continuously polls the target host according to the first polling position to issue a token.
By adopting the technical scheme, after a plurality of hosts to be communicated are divided into the management host and the target host, the management host and the target host are in communication connection in a master-slave mode UART topological structure, the management host issues tokens to the target host and schedules the communication of the target host, if the target host has communication requirements, a data packet containing first communication information is sent to the management host, the management host forwards the first communication information to the target host to be communicated, the point-to-point communication between the target hosts is realized, the dependence on host hardware resources is reduced, and therefore the problem that the hardware resources of a multi-host system are limited and the communication is difficult to realize in a two-wire system UART can be solved; after the management host finishes forwarding the data, the management host continues to poll the next target host according to the backup first polling position, so that the first communication information required to be sent by each target host can be forwarded.
Optionally, the method for packaging data packets according to communication requirements includes,
the target host judges whether the communication requirement exists, if so, the target host packs first communication information and an address of a communication object to be sent into a data packet, and sets the priority of the data packet to be high priority, otherwise, packs an empty data packet, and sets the priority of the empty data packet to be low priority, wherein the priority level of the data packet is used for the management host to judge whether the data packet is empty, and the address is used for the management host to obtain the target host indicated by the data packet.
By adopting the technical scheme, when the target host has a communication requirement, the first communication information and the address are packaged into the data packet, when the communication requirement does not exist, the data packet is empty, and the communication priority of the data packet can be set according to the communication requirement, so that the management host can judge whether the first communication information needs to be forwarded according to the communication priority level of the data packet.
Optionally, the communication method further comprises,
when the management host holds the token, the management host judges whether the management host has a communication requirement, if not, the management host continues polling operation, if yes, the polling operation is suspended, the communication priority of the management host is increased, the current second polling position is backed up, and second communication information is sent to a target host to be communicated; and the number of the first and second groups,
after the second communication information is sent, the management host adjusts the communication priority of the management host to be low priority, and continuously polls the target host from the second polling position to issue the token.
By adopting the technical scheme, when the management host needs to communicate with the target host, the management host can pause the polling work after taking the token, and continue polling after sending the second communication information to the target host to be communicated, so that the work between the management host and each target host is realized, the management host and the target host can communicate, and the problem that the hardware resource of a multi-host system is limited and the communication is difficult to realize by a two-wire UART (universal asynchronous receiver/transmitter) is further solved.
Optionally, when the management host holds the token, if the received data packet has the first communication information and the management host has a communication requirement, the management host first forwards the first communication information to the target host indicated by the data packet, and then communicates with the target host to be communicated according to the communication requirement of the management host.
By adopting the technical scheme, when the management host has the communication requirement and needs to forward the first communication information, the first communication information is forwarded first, and then the communication of the management host is carried out, so that the communication can be carried out orderly.
Optionally, the method for the target host to determine whether there is a communication demand includes determining whether there is a first communication state instruction waiting, if so, there is a communication demand, otherwise, there is no communication demand.
By adopting the technical scheme, whether the target host has the communication requirement or not can be judged according to the first communication state instruction, so that the effect of judging the communication requirement of the target host is realized.
Optionally, the method for the management host to determine whether the management host has a communication requirement includes determining whether a second communication state instruction is waiting, if so, then there is a communication requirement, otherwise, there is no communication requirement.
By adopting the technical scheme, whether the management host has the communication requirement or not can be judged according to the second communication state instruction, so that the effect of judging the communication requirement of the management host is realized.
Optionally, the management host and the target host are addressed uniformly to obtain respective addresses.
In a second aspect, the present application provides a UART-based multi-level communication system, which adopts the following technical solutions:
a multi-computer communication system based on UART comprises a management host and a plurality of target hosts, wherein a sending interface of the management host is in communication connection with a receiving interface of each target host, and a receiving interface of the management host is in communication connection with a sending interface of each target host;
the management host can send information to the management host when holding a token, and is used for polling the target host to issue the token after initializing the communication priority of the management host as low priority, receiving a data packet and the token sent by any one target host, analyzing the data packet, if the data packet is empty, continuing polling the target host to issue the token, otherwise backing up the current first polling position, increasing the communication priority of the management host, forwarding the first communication information in the data packet to the target host indicated by the data packet, after the first communication information is forwarded, decreasing the communication priority of the management host, and continuing polling the target host according to the first polling position to issue the token;
the target host can send information to the management host only when holding the token, and is used for packing a data packet according to communication requirements after obtaining the token, and sending the data packet to the management host with the token attached.
By adopting the technical scheme, the management host and the target host are in communication connection through the sending interface and the receiving interface, the management host issues a token to the target host and schedules the communication of the target host, if the target host has a communication requirement, a data packet containing first communication information is sent to the management host, the management host forwards the first communication information to the target host to be communicated, the point-to-point communication between the target hosts is realized, the dependency on the hardware resources of the host is reduced, and therefore the problem that the hardware resources of a multi-host system are limited and the communication is difficult to realize through a two-wire UART (universal asynchronous receiver/transmitter) can be solved; after the management host finishes forwarding the data, the management host continues to poll the next target host according to the backup first polling position, so that the first communication information required to be sent by each target host can be forwarded.
Optionally, the management host and the target host are addressed uniformly to obtain respective addresses, when the target host has a communication requirement, the packed data packet includes first communication information and an address, and the address is used for the management host to obtain the target host indicated by the data packet.
By adopting the technical scheme, the management host and the target host have respective addresses, so that the target host to be communicated can be conveniently obtained according to the addresses.
In a third aspect, the present application provides a computer-readable storage medium, which adopts the following technical solutions:
a computer-readable storage medium storing a computer program that can be loaded by a processor and executes a communication method according to any one of the first aspects.
Drawings
Fig. 1 is a first flowchart of a UART-based multi-machine communication method according to an embodiment of the present application.
Fig. 2 is a second flowchart of a UART-based multi-machine communication method according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a communication connection between a management host and a target host according to an embodiment of the present application.
Fig. 4 is a third flowchart of a UART-based multi-machine communication method according to an embodiment of the present application.
Fig. 5 is a fourth flowchart of a UART-based multi-machine communication method according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a target host according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
The present application is described in further detail below with reference to figures 1-6.
The UART is a two-wire communication interface, widely used for information exchange between processing units, and commonly used is dual-machine communication and master-slave multi-machine communication. The master-slave mode multi-machine communication process comprises that the master machine can receive any information, and the slave machine only receives an address sent by the master machine; the host sends address information according to the address of the slave needing communication, and then enters an address receiving state to receive the response signal of the slave; all the slaves are in a receiving state, after receiving the address sent by the master, the slaves compare whether the received address is consistent with the local address, if so, the slave is selected, and the master is communicated with the local; the selected slave machine sends a response signal to the host machine and then enters a data receiving state, and the unselected slave machines are still in an address receiving state; after receiving the response signal, the host sends data information to the selected slave; and after the selected slave machine correctly receives the required data information, sending a response signal to the host machine, and re-entering the address receiving state.
When the system includes more than two hosts and point-to-point information exchange is required between the hosts, if the communication is realized by a common two-wire UART structure, a large amount of hardware resources are consumed, and the hardware resources of the hosts are limited, so that the communication requirement is difficult to meet. On the other hand, the smaller multi-machine system is difficult to apply more complicated communication mechanism or ethernet communication.
The embodiment of the application discloses a multi-computer communication method based on UART. Referring to fig. 1 and 2, the multi-machine communication method includes:
101. any host in the multiple hosts is set as a management host, the rest hosts are set as target hosts, and the management host and the multiple target hosts are in communication connection by a master-slave UART topological structure.
The plurality of hosts are hosts that need to communicate peer-to-peer with each other. In the embodiment, the MCUs are taken as an example, a plurality of MCUs are arranged in one system, the MCUs communicate through serial ports, but input and output interfaces of the MCUs are limited, so that any one of the MCUs is selected as a management host, and other MCUs are selected as target hosts.
Referring to fig. 3, a specific manner of performing communication connection between the management host and the plurality of target hosts in a master-slave UART topology is as follows:
and the sending interface of the management host is in communication connection with the receiving interface of each target host, and the receiving interface of the management host is in communication connection with the sending interface of each target host.
The management host and the target host are only provided with one receiving interface and one sending interface to participate in communication, so that the utilization of hardware resources of the management host and the target host is greatly reduced, and the problem that the multi-host system is limited in hardware resources and difficult to realize communication by a two-wire system UART is further solved.
102. It is defined that the target host can only send information to the management host if it holds the token, and that the management host can only send information to the target host if it holds the token.
The token passing protocol is introduced, the target host can only send information to the management host under the condition of holding the token, the management host can only send information to the target host, the information sending of the target host and the management host is limited, and communication disorder can be avoided to a certain extent.
103. The management host initializes its own communication priority to a low priority and polls the target host to issue a token.
And sequencing all target hosts, and realizing polling by the management host according to the sequence. The target hosts can be sorted in any mode, but all the target hosts only appear once in the sequence of one period and cannot repeatedly appear.
104. After any target host obtains the token, the data packet is packaged according to the communication requirement, and the data packet is attached with the token and sent to the management host.
It should be noted that the data packet includes the first communication information and the address, but when the target host has no communication requirement, the first communication information and the address in the data packet are both empty. The management host and the target host are uniformly addressed to obtain respective addresses, and the management host obtains communication objects according to the addresses in the data packets. When each target host needs to communicate with other target hosts or the management host, the first communication information needing to be sent and the address of the communication object are packaged together, and the token is attached to the first communication information and sent to the management host.
It should be noted that, the target host generally sends the packet first and then sends the token.
105. And the management host receives the token and the data packet, analyzes the data packet, continues polling the target host to issue the token if the data packet is empty, otherwise backups the current first polling position, increases the communication priority of the management host, and forwards the first communication information in the data packet to the target host indicated by the data packet.
The data packet is parsed to see if the data packet has the first communication information and the address. It should be noted that the communication destination of the data packet sent by the target host may be any other target host, and may also be the management host itself. If the communication object of the data packet is the management host, the first communication information does not need to be forwarded.
106. And after the first communication information is forwarded, the management host reduces the communication priority of the management host, and continuously polls the target host according to the first polling position to issue the token.
If the polling is performed according to the sequence of the target host No. 1, the target host No. 2, the target host No. 3, the target host No. 4 and the target host No. 5, and the first polling position backed up by the management host is the target host No. 4, the first polling object when the management host continues polling is the target host No. 5.
When the communication priority of the management host is low, the management host is in a state of polling the target host to issue a token, and when the communication priority is high, the management host is in a communication state, and at this time, the polling state is suspended.
In the embodiment of the multi-machine communication method, the target host can communicate with any other target host through the management host, the target host can also communicate with the management host to realize point-to-point communication, and the management host and the target hosts are in communication connection by adopting a master-slave UART (universal asynchronous receiver/transmitter) topological structure, so that the utilization of hardware resources can be greatly reduced.
Referring to fig. 4, as a further embodiment of the multi-machine communication method, the multi-machine communication method further includes step 107 and step 108.
107. When the management host holds the token, the management host judges whether the management host has a communication requirement, if not, the polling work is continued, if yes, the polling work is suspended, the communication priority of the management host is increased, the current second polling position is backed up, and the second communication information is sent to the target host to be communicated.
The method for judging whether the management host has the communication requirement comprises the steps of judging whether a second communication state instruction waits, if so, judging that the communication requirement exists, and if not, judging that the communication requirement does not exist.
When the management host needs to communicate with the external host, the management host generates a second communication state instruction, and when the management host does not have a token, the generated second communication state instruction waits.
108. After the second communication information is sent, the management host adjusts the communication priority of the management host to be low priority, and continuously polls the target host from the second polling position to issue the token.
When the polling object before the management host holds the token is the target host No. 3, and the token returned by the target host No. 3 is received, the management host has a communication requirement, the backup second polling position is the target host No. 3, and after the second communication information is sent, the token is continuously polled and issued from the target host No. 4.
The management host can forward the first communication information to realize point-to-point communication between the target hosts, and can also actively send the second communication information to the target hosts to realize communication between the management host and the target hosts.
In a further embodiment of the multi-machine communication method, when the management host holds the token, if the received data packet has the first communication information and the management host has the communication requirement, the management host firstly forwards the first communication information to the target host indicated by the data packet, and then communicates with the target host to be communicated according to the communication requirement of the management host.
In other embodiments, the management host may communicate with the target host to be communicated according to its own communication requirement, and then forward the first communication information to the target host indicated by the packet.
Referring to fig. 5, as an embodiment for packing the data packet according to the communication requirement, step 1041, step 1042 and step 1043 are included.
1041. The target host judges whether the target host has communication requirements.
The method for judging whether the target host needs to communicate includes judging whether a first communication state instruction waits, if so, judging that the communication needs exist, and if not, judging that the communication needs do not exist.
When the target host needs to communicate with the external host, the target host generates a second communication state instruction, and when the target host has no token, the generated second communication state instruction waits.
1042. If yes, the target host packs the first communication information needing to be sent and the address of the communication object into a data packet, and sets the priority of the data packet to be high.
1043. Otherwise, packing the empty data packet, and setting the priority of the empty data packet as low priority.
The priority level of the management data packet is used for the management host to judge whether the data packet is empty, when the priority level of the data packet is high, the data packet comprises first communication information and an address, and when the priority level of the data packet is low, the data packet is empty. The address is used for the management host to obtain the target host indicated by the data packet. It should be noted that the address may be an address of a target host, and may also be an address of a management host.
Step 1042 and step 1043 only perform one step.
The method for judging whether the communication requirement exists includes judging whether a communication state instruction waits, if so, judging that the communication requirement exists, and otherwise, judging that the communication requirement does not exist.
Generally, when the management host and the target host need to communicate, a communication status command is generated, so the method for determining whether there is a communication demand is applicable to both the management host and the target host.
As a further embodiment of the communication method, the method further includes that when the management host holds the token, if the received data packet has the first communication information and the management host has a communication demand, the management host firstly forwards the first communication information to the target host indicated by the data packet, and then communicates with the target host to be communicated according to the communication demand.
Referring to fig. 1, the embodiment of the present application further discloses a multi-machine communication system based on UART, which includes a management host and a plurality of target hosts, wherein a sending interface of the management host is in communication connection with a receiving interface of each target host, and a receiving interface of the management host is in communication connection with a sending interface of each target host;
the management host can send information to the management host when the management host holds the token, and is used for polling the target host to issue the token after initializing the communication priority of the management host to be low priority, receiving a data packet and the token sent by any target host, analyzing the data packet, if the data packet is empty, continuing polling the target host to issue the token, otherwise backing up the current first polling position, increasing the communication priority of the management host, forwarding the first communication information in the data packet to the target host indicated by the data packet, after the first communication information is forwarded, decreasing the communication priority of the management host, and continuing polling the target host according to the first polling position to issue the token;
the target host can send information to the management host only when holding the token, and is used for packing the data packet according to the communication requirement after obtaining the token, and sending the data packet with the token to the management host.
The management host and the target host are uniformly addressed to obtain respective addresses, when the target host has a communication requirement, the packed data packet comprises first communication information and the addresses, and the addresses are used for the management host to obtain the target host indicated by the data packet.
In the implementation mode of the multi-host communication system, the management host and the target host are in communication connection through the sending interface and the receiving interface, the management host issues a token to the target host and schedules communication of the target host, if the target host has a communication requirement, a data packet containing first communication information is sent to the management host, the management host forwards the first communication information to the target host to be communicated, point-to-point communication between the target hosts is realized, the dependence on host hardware resources is reduced, and therefore the problem that the multi-host system hardware resources are limited and communication is difficult to realize through a two-wire UART (universal asynchronous receiver/transmitter) can be solved; after the management host finishes forwarding the data, the management host continues to poll the next target host according to the backup first polling position, so that the first communication information required to be sent by each target host can be forwarded.
Referring to fig. 6, as an embodiment of the target host, the target host includes a judging unit, a packing unit, and a transmitting unit;
the judging unit is used for judging whether the target host has a communication requirement or not by judging whether a first communication state instruction waits or not;
the device comprises a packing unit, a sending unit and a sending unit, wherein the packing unit is used for packing first communication information to be sent and an address of a communication object into a data packet by a target host if the target host has a communication requirement, setting the priority of the data packet to be high, and otherwise packing an empty data packet and setting the priority of the empty data packet to be low;
and the sending unit is used for sending the data packet to the management host by attaching the token after obtaining the token.
As a further implementation manner of the management host, the method further includes that when the management host holds the token, the management host judges whether the management host has a communication demand, if not, the management host continues polling operation, if yes, the polling operation is suspended, the communication priority of the management host is increased, a current second polling position is backed up, and second communication information is sent to a target host to be communicated; after the second communication information is sent, the management host adjusts the communication priority of the management host to be low priority, and continuously polls the target host from the second polling position to issue the token.
It should be noted that, when the management host needs to communicate with the external host, the management host itself may generate the second communication state instruction, and when the management host has no token, the generated second communication state instruction may wait. Therefore, the management host judges whether a second communication state instruction waits, and then can know whether a communication demand exists.
Further, when the management host holds the token, if the received data packet has the first communication information and the management host has a communication requirement, the management host firstly forwards the first communication information to the target host indicated by the data packet, and then communicates with the target host to be communicated according to the communication requirement of the management host.
Referring to fig. 7, a computer-readable storage medium storing a computer program capable of being loaded by a processor and executing a communication method such as any one of UART-based multi-machine communication methods is also disclosed in an embodiment of the present application.
The computer-readable storage medium includes, for example: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to perform all or part of the above described functions. For the specific working processes of the system and the module described above, reference may be made to the corresponding processes in the foregoing method embodiments, which are not described herein again.
The above embodiments are preferred embodiments of the present application, and the protection scope of the present application is not limited by the above embodiments, so: all equivalent changes made according to the structure, shape and principle of the present application shall be covered by the protection scope of the present application.

Claims (10)

1. A multi-machine communication method based on UART is characterized in that: comprises the steps of (a) preparing a mixture of a plurality of raw materials,
setting any host in a plurality of hosts as a management host and the rest hosts as target hosts, and performing communication connection between the management host and the plurality of target hosts by using a master-slave UART topological structure;
defining that the target host can only send information to the management host when the target host holds the token, and the management host can only send information to the target host when the management host holds the token;
the management host initializes the communication priority of the management host to be low priority and polls the target host to issue a token;
after any target host obtains the token, packing a data packet according to communication requirements, attaching the token to the data packet and sending the data packet to a management host;
the management host receives the token and the data packet, analyzes the data packet, if the data packet is empty, continues polling the target host to issue the token, otherwise backups the current first polling position, increases the communication priority of the management host, and forwards the first communication information in the data packet to the target host indicated by the data packet; and the number of the first and second groups,
and after the first communication information is forwarded, the management host reduces the communication priority of the management host, and continuously polls the target host according to the first polling position to issue a token.
2. The UART-based multi-machine communication method as claimed in claim 1, wherein: the method for packaging data packets according to communication requirements comprises the following steps,
the target host judges whether the communication requirement exists, if so, the target host packs first communication information and an address of a communication object to be sent into a data packet, and sets the priority of the data packet to be high priority, otherwise, packs an empty data packet, and sets the priority of the empty data packet to be low priority, wherein the priority level of the data packet is used for the management host to judge whether the data packet is empty, and the address is used for the management host to obtain the target host indicated by the data packet.
3. The UART-based multi-machine communication method according to claim 1 or 2, wherein: the method of communication further comprises the step of,
when the management host holds the token, the management host judges whether the management host has a communication requirement, if not, the management host continues polling operation, if yes, the polling operation is suspended, the communication priority of the management host is increased, the current second polling position is backed up, and second communication information is sent to a target host to be communicated; and the number of the first and second groups,
after the second communication information is sent, the management host adjusts the communication priority of the management host to be low priority, and continuously polls the target host from the second polling position to issue the token.
4. The UART-based multi-machine communication method as claimed in claim 3, wherein: when the management host holds the token, if the received data packet has first communication information and the management host has a communication requirement, the management host firstly forwards the first communication information to the target host indicated by the data packet, and then communicates with the target host to be communicated according to the communication requirement of the management host.
5. The UART-based multi-machine communication method as claimed in claim 2, wherein: the method for judging whether the target host has the communication requirement comprises the steps of judging whether a first communication state instruction waits, if so, judging that the communication requirement exists, and if not, judging that the communication requirement does not exist.
6. A URAT based multi-machine communication method according to claim 3, wherein: the method for judging whether the management host has the communication requirement comprises the steps of judging whether a second communication state instruction waits, if so, judging that the communication requirement exists, and if not, judging that the communication requirement does not exist.
7. The UART-based multi-machine communication method as claimed in claim 2, wherein: and the management host and the target host are uniformly addressed to obtain respective addresses.
8. A multi-machine communication system based on UART is characterized in that: the system comprises a management host and a plurality of target hosts, wherein a sending interface of the management host is in communication connection with a receiving interface of each target host, and a receiving interface of the management host is in communication connection with a sending interface of each target host;
the management host can send information to the management host when holding a token, and is used for polling the target host to issue the token after initializing the communication priority of the management host as low priority, receiving a data packet and the token sent by any one target host, analyzing the data packet, if the data packet is empty, continuing polling the target host to issue the token, otherwise backing up the current first polling position, increasing the communication priority of the management host, forwarding the first communication information in the data packet to the target host indicated by the data packet, after the first communication information is forwarded, decreasing the communication priority of the management host, and continuing polling the target host according to the first polling position to issue the token;
the target host can send information to the management host only when holding the token, and is used for packing a data packet according to communication requirements after obtaining the token, and sending the data packet to the management host with the token attached.
9. The UART-based multi-machine communication system according to claim 8, wherein: the management host and the target host are uniformly addressed to obtain respective addresses, when the target host has a communication requirement, the packed data packet comprises first communication information and the addresses, and the addresses are used for the management host to obtain the target host indicated by the data packet.
10. A computer-readable storage medium characterized by: computer program which can be loaded by a processor and which executes the multi-machine communication method according to any one of claims 1 to 7.
CN202110311789.2A 2021-03-24 2021-03-24 UART-based multi-computer communication method, system and computer readable storage medium Active CN113127392B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110311789.2A CN113127392B (en) 2021-03-24 2021-03-24 UART-based multi-computer communication method, system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110311789.2A CN113127392B (en) 2021-03-24 2021-03-24 UART-based multi-computer communication method, system and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113127392A true CN113127392A (en) 2021-07-16
CN113127392B CN113127392B (en) 2024-03-08

Family

ID=76774071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110311789.2A Active CN113127392B (en) 2021-03-24 2021-03-24 UART-based multi-computer communication method, system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113127392B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104156333A (en) * 2014-08-12 2014-11-19 成都联星微电子有限公司 FPGA-based UART multi-interface extension system and method
CN105656741A (en) * 2016-01-05 2016-06-08 深圳警翼数码科技有限公司 Bluetooth serial port data transmission method between police ring or police palm and law enforcement recorder
CN106911544A (en) * 2017-01-20 2017-06-30 深圳市沃特玛电池有限公司 Communication system and the means of communication
CN107483308A (en) * 2017-08-17 2017-12-15 中国科学院合肥物质科学研究院 A kind of ethernet communication method based on timeslice token mechanism

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104156333A (en) * 2014-08-12 2014-11-19 成都联星微电子有限公司 FPGA-based UART multi-interface extension system and method
CN105656741A (en) * 2016-01-05 2016-06-08 深圳警翼数码科技有限公司 Bluetooth serial port data transmission method between police ring or police palm and law enforcement recorder
CN106911544A (en) * 2017-01-20 2017-06-30 深圳市沃特玛电池有限公司 Communication system and the means of communication
CN107483308A (en) * 2017-08-17 2017-12-15 中国科学院合肥物质科学研究院 A kind of ethernet communication method based on timeslice token mechanism

Also Published As

Publication number Publication date
CN113127392B (en) 2024-03-08

Similar Documents

Publication Publication Date Title
US9882667B2 (en) Interface device and method for exchanging user data
US7948999B2 (en) Signaling completion of a message transfer from an origin compute node to a target compute node
US8478834B2 (en) Low latency, high bandwidth data communications between compute nodes in a parallel computer
US10621138B2 (en) Network communications using pooled memory in rack-scale architecture
US8018951B2 (en) Pacing a data transfer operation between compute nodes on a parallel computer
US20080281998A1 (en) Direct Memory Access Transfer Completion Notification
US7836143B2 (en) Message communications of particular message types between compute nodes using DMA shadow buffers
US8037213B2 (en) Replenishing data descriptors in a DMA injection FIFO buffer
US7779173B2 (en) Direct memory access transfer completion notification
US7809875B2 (en) Method and system for secure communication between processor partitions
US8959172B2 (en) Self-pacing direct memory access data transfer operations for compute nodes in a parallel computer
CN104899170A (en) Distributed intelligent platform management bus (IPMB) connection method and ATCA (Advanced Telecom Computing Architecture) machine frame
US7889657B2 (en) Signaling completion of a message transfer from an origin compute node to a target compute node
US20090031325A1 (en) Direct Memory Access Transfer completion Notification
CN113419983A (en) Serial server and implementation method thereof
CN109426643A (en) USB interface request scheduling method, device and equipment
CN113127392A (en) UART-based multi-machine communication method, system and computer readable storage medium
CN106708701B (en) Central maintenance device and method based on ARINC659 bus
CN113347115B (en) Message processing method and device, electronic equipment and medium
CN112615739B (en) Method and system for adapting OCP3.0 network card in multi-host application environment
CN111371799B (en) Method, device and equipment for controlling data receiving and transmitting of MCTP (Multi-channel media Port) controller
West et al. Real-Time USB Networking and Device I/O
CN113204438B (en) Inter-core communication method and system of AMP (analog to digital) system
US11847089B2 (en) Electronic device and method for sharing data lanes of a network interface device between two or more computing devices
CN117909269A (en) Network control method, system, device, equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant