CN105049151B - A kind of method and communication serial port for serial communication control - Google Patents
A kind of method and communication serial port for serial communication control Download PDFInfo
- Publication number
- CN105049151B CN105049151B CN201510386068.2A CN201510386068A CN105049151B CN 105049151 B CN105049151 B CN 105049151B CN 201510386068 A CN201510386068 A CN 201510386068A CN 105049151 B CN105049151 B CN 105049151B
- Authority
- CN
- China
- Prior art keywords
- baud rate
- embedded device
- host computer
- sequence
- signal
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0001—Systems modifying transmission characteristics according to link quality, e.g. power backoff
- H04L1/0002—Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission rate
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0001—Systems modifying transmission characteristics according to link quality, e.g. power backoff
- H04L1/0015—Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
Landscapes
- Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Communication Control (AREA)
Abstract
Inventor provides a kind of method of serial communication control, solves the problems, such as that serial communication needs that baud rate is arranged.The invention belongs to digital communication technology field, specifically a kind of automatic detection method of asynchronous serial communication agreement.One of scheme is host computer mode switch element by sending request of data line to embedded device output fisrt feature level signal, and host computer is switched to baud rate adaptation pattern;The mode switch element of embedded device monitors the signal sent on request of data line, and when the signal for judge to receive is fisrt feature level signal, embedded device is switched to baud rate adaptation pattern, beginning baud rate adaptation method.The equipment that inventor additionally provides for realizing the method.
Description
Technical field
The invention belongs to digital communication technology field, specifically a kind of Auto-Sensing side of asynchronous serial communication agreement
Method.
Background technique
The concept of serial communication is very simple, and serial ports step-by-step (bit) sends and receives byte.Although than pressing byte (byte)
Parallel communications it is slow, but serial ports can using single line send data while with another single line reception data.It is very simple
List and it can be realized telecommunication.Such as IEEE488 when defining parallel prevailing state, it is specified that equipment line overall length must not exceed
20 meters, and the length of any two equipment room must not exceed 2 meters;And for serial ports, length is up to 1200 meters.
(the embedded device and upper when embedded device is communicated using universal asynchronous receiving-transmitting transmitter (UART) in host computer
Position machine has UART), it is ground wire respectively that the UART interface between embedded device and host computer PC, which is connected to 5 lines altogether,
(GND), serial data output line (TX), serial data input line (RX) send request of data line (RTS) and clear to send
(CTS) line.
In the implementation of the present invention, inventor exists in the prior art following problem: host computer and embedded
Equipment, which begins to use, needs that identical communication baud is arranged for embedded device and host computer before universal asynchronous receiving-transmitting transmitter
Rate, this measure are inconvenient.In addition embedded device can not adapt to host computer automatically compares the electric quantity consumption of embedded device
Greatly.
Summary of the invention
For this reason, it may be necessary to provide a kind of method of serial communication control and the serial ports for realizing this method
To achieve the above object, a kind of method for serial communication control is inventor provided, comprising the following steps:
Host computer mode switch element exports fisrt feature low and high level to embedded device by sending request of data line
Signal, and host computer is switched to baud rate adaptation pattern;The mode switch element of embedded device, which is monitored, sends request of data
Signal on line, when the signal for judging to receive is fisrt feature low and high level signal, embedded device is switched to baud rate
Adaptation pattern starts baud rate adaptation method;
The baud rate adaptation method the following steps are included:
The collection for initializing not tried baud rate is combined into the set of all values of possible baud rate, Receiving Order column-generation list
Member exports a string of features and detects sequence;
S101, a baud rate is chosen in the set of not tried baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate;
S103, host computer acquire the data information received by the baud rate of host computer, and with the transmission of the baud rate of host computer
The data information received;
S104, embedded device acquire the data information received to attempt baud rate;
S105, judge whether the collected data information of embedded device and feature detecting sequence are consistent,
S106 terminates this automatic adaptation if consistent, and using the trial baud rate as the baud of embedded device
Rate;If inconsistent, return step S101, until the collected data information of embedded device and feature detecting sequence are consistent or
The collection for the baud rate that do not attempted is combined into sky.
Further, comprising steps of before starting baud rate adaptation method, stop position is set and even-odd check is respectively 1
And sky.
Further, the baud rate adaptation method further comprises the steps of:
When the collection for detecting the baud rate that do not attempted is combined into sky, stop position is set and parity check bit is respectively not
After the combination tried, the collection for initializing not tried baud rate is combined into the set of all values of possible baud rate, return step
S101, until the collected data information of embedded device is consistent with feature detecting sequence;When the collected number of embedded device
It is believed that when breath is consistent with feature detecting sequence, using the trial baud rate as the baud rate of embedded device, the stop position
Stop position and parity check bit with parity check bit as embedded device.
Further, which is characterized in that serial port baud rate is also adjusted by following step:
Embedded device operating clear to send line sends second feature level signal, the pattern switching of host computer to host computer
Unit listens to the second feature level signal of embedded device, according on the corresponding Configuration of baud rate of second feature level signal
The baud rate of position machine.
Further, further include following step:
The information content that the flow controlling unit monitoring serial ports of embedded device is received and dispatched within the unit time, when in the unit time
The data volume of transmitting-receiving is lower than the first setting value or when being higher than the second setting value, and embedded device operating clear to send line is to host computer
Third feature level signal is sent, after the mode switch element of host computer listens to the feature level signal of embedded device, under
Adjust or raise the baud rate of host computer.
It further, further include step,
Start the claim 1 or baud rate adaptation method as claimed in claim 3.
It further, further include step, what the flow controlling unit monitoring serial ports of embedded device was received and dispatched within the unit time
Information content uses claim 4 when the data volume received and dispatched in the unit time is lower than the first setting value or is higher than the second setting value
The method is lowered or the baud rate of up-regulation host computer.
Further, the interface probe unit of embedded device is passed through with the period set sends request of data line to host computer
Characteristic sequence signal is sent, host computer monitors to enter interface detection mode when the characteristic sequence signal;Embedded device is again
By serial data output line to host computer transmission interface detectable signal, the host computer in interface detection mode is on receiving
After stating interface detectable signal, above-mentioned interface detectable signal is returned;
If embedded device receives arbitrary data, then it is assumed that host computer and embedded device are in connection status;It is no
If then embedded device does not receive arbitrary data within the period of setting, the baud rate of embedded device is reduced to
110bit/s, then or setting serial ports does not reprocess the data received.
Inventor also provides weight serial ports, and the serial ports includes that mode switch element, sequence generating unit, sequence are more single
Member, baud rate administrative unit;
The mode switch element is used for when needing to start baud rate adaptation pattern, by sending the output of request of data line
Fisrt feature low and high level signal;And for monitoring the signal on transmission request of data line, when the signal for judging to receive is the
When one feature low and high level signal, communication serial port serial communication equipment is switched to baud rate adaptation pattern;
The sequence generating unit is used to export a string of features for baud rate adaptation method and detects sequence;
The sequence comparing unit under baud rate adaptation pattern for judging collected data information and feature detecting
Whether sequence is consistent;
The collection that the baud rate administrative unit is used to initialize not tried baud rate under baud rate adaptation pattern is combined into
All set of the value of possible baud rate, a string of features for receiving sequence generating unit output detect sequence;Not tried
A baud rate is chosen in the set of baud rate as baud rate is attempted, and sends feature detecting sequence and to attempt baud rate to taste
Examination baud rate acquires the data information received;
Baud rate administrative unit is also used to be characterized low and high level signal when the signal that mode switch element judgement receives
When, after string communication serial port port communications equipment is switched to baud rate adaptation pattern by mode switch element, baud rate administrative unit is pressed
Current baud rate acquires the data information received, and sends the data information received with current baud rate.
Further, the baud rate administrative unit is also used to be respectively 1 and sky by stop position and even-odd check.
Further, the baud rate administrative unit is also used to when the collection for detecting the baud rate that do not attempted is combined into sky,
Stop position and parity check bit are respectively set after it is the combination that do not attempted, the collection for initializing not tried baud rate is combined into
All set of the value of possible baud rate;When the collected data information of embedded device is consistent with feature detecting sequence,
Using the trial baud rate as the baud rate of embedded device, the stop position and parity check bit are as embedded device
Stop position and parity check bit.
Further, the baud rate administrative unit also controls embedded device operating clear to send line and sends the to host computer
Two feature level signals;The mode switch element of the host computer of the host computer listens to the second feature level of embedded device
Signal, according to the baud rate of the corresponding Configuration of baud rate host computer of second feature level signal.
It further, further include flow controlling unit, what the flow controlling unit monitoring serial ports was received and dispatched within the unit time
Information content operates clear to send when the data volume received and dispatched in the unit time is lower than the first setting value or is higher than the second setting value
Line sends third feature level signal to host computer, and the mode switch element of host computer listens to the feature level of embedded device
After signal, the mode switch element of host computer is lowered or the baud rate of up-regulation host computer.
It further, further include interface probe unit, the interface probe unit is used for the period of setting by sending number
Characteristic sequence signal is sent to host computer according to request line, host computer monitors to enter interface detection mould when the characteristic sequence signal
Formula;Interface probe unit passes through serial data output line to host computer transmission interface detectable signal again.If receiving arbitrary number
According to, then it is assumed that host computer and embedded device are in connection status;Take office if embedded device does not receive within the period of setting
Meaning data, then be reduced to 110bit/s for the baud rate of embedded device.
It is different from the prior art, above-mentioned technical proposal finds host computer by sending request of data line (RTS), and will be upper
Machine-cut changes to baud rate adaptation pattern.This method to require no knowledge about embedded in the communication of embedded device and host computer
The baud rate of equipment and host computer does not need that identical baud rate is arranged for them yet, but is matched by automatic baud rate
The baud rate for removing identification host computer keeps communication more convenient.
Detailed description of the invention
Fig. 1 is a kind of method flow diagram of the embodiment of the present invention;
Fig. 2 is a kind of module diagram of the embodiment of the present invention;
Fig. 3 is a kind of module diagram of the embodiment of the present invention.
Specific embodiment
Technology contents, construction feature, the objects and the effects for detailed description technical solution, below in conjunction with specific reality
It applies example and attached drawing is cooperated to be explained in detail.
Bit rate is the parameter of a measurement communication speed.It indicates the number of the bit of transmission each second.Such as 300 wave
Spy indicates that each second sends 300 bit.When we mention the clock cycle, just refer to bit rate, for example, if agreement needs
4800 baud rates, i.e. clock are 4800Hz.Clock means the sample rate of serial communication on the data line.The ratio of usual telephone wire
Special rate is 14400bit/s, 28800bit/s and 36600bit/s.
The most important parameter of serial communication is bit rate, data bit, stop position and even-odd check.Stop position is intended to indicate that
Last position individually wrapped, value 1,1.5 and 2.Verification is a kind of simple error detection mode in serial communication, there is five
Kind error detection mode: even (even), odd (odd), high (mark), low (space), empty (none).Usual stop position and even-odd check
For default setting, i.e. stop position is 1, and check bit is sky, i.e., verifies without doing.Before starting baud rate adaptation method, setting
Stop position and even-odd check are respectively 1 and sky.
Inventor provides a kind of for serial communication control method, comprising the following steps:
Host computer mode switch element exports fisrt feature level to embedded device by sending request of data line (RTS)
Signal, and host computer is switched to baud rate adaptation pattern;The mode switch element of embedded device, which is monitored, sends request of data
Signal on line, when the signal for judging to receive is fisrt feature level signal, embedded device is switched to baud rate adaptation
Mode starts baud rate adaptation method;
Referring to FIG. 1, the baud rate adaptation method the following steps are included:
The collection for initializing not tried baud rate is combined into the set of all values of possible baud rate, Receiving Order column-generation list
Member exports a string of features and detects sequence;
S101, a baud rate is chosen in the set of not tried baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate;
S103, host computer acquire the data information received by the baud rate of host computer, and with the transmission of the baud rate of host computer
The data information received;
S104, embedded device acquire the data information received to attempt baud rate;
S105, judge whether the collected data information of embedded device and feature detecting sequence are consistent,
S106, terminate this automatic adaptation if consistent, the trial baud rate is equal to the baud rate of host computer, and will
The baud rate that baud rate is attempted as embedded device;
If inconsistent, return step S101, until the collected data information of embedded device and feature detect sequence
The collection for the baud rate that do not attempted unanimously or is combined into sky.
The possibility baud rate of serial communication be 110bit/s, 300bit/s, 600bit/s, 1200bit/s, 2400bit/s,
4800bit/s、9600bit/s、14400bit/s、19200bit/s、38400bit/s、57600bit/s、115200bit/s、
One kind in 230400bit/s, 380400bit/s, 460800bit/s and 921600bit/s, the possible baud of whole
The set of the value of rate is the above-mentioned baud rate enumerated.The feature detecting sequence is to be used in baud rate adaptation pattern and host computer
The signal of communication is a string of sequence of levels in the communications, detects sequence if meeting and sending feature with different baud rate codings
Column, then it shows as different sequence of levels.
In the above method, host computer is switched to baud rate adaptation pattern, and embedded device is by sending request of data line
(RTS) it finds host computer, and enters baud rate adaptation pattern.This method makes in the communication of embedded device and host computer, no
It needs to know the baud rate of embedded device and host computer, does not also need that identical baud rate manually is arranged for them, but
The baud rate that identification host computer is removed by the matching of automatic baud rate, keeps communication more convenient.
In further embodiments, the baud rate adaptation method further comprises the steps of:
When the collection for detecting the baud rate that do not attempted is combined into sky, it, which is respectively set, in stop position and parity check bit is
After the combination that do not attempted, the collection for initializing not tried baud rate is combined into the set of all values of possible baud rate, repeats
Step S101 to S106, until the collected data information of embedded device is consistent with feature detecting sequence;Work as embedded device
When collected data information is consistent with feature detecting sequence, the baud rate of attempting is to be equal to the baud rate of host computer.By institute
State the baud rate for attempting baud rate as embedded device, the stopping of the stop position and parity check bit as embedded device
Position and parity check bit.
The value of stop position is 1,1.5 and 2 there are three types of situation, i.e. stop position;The value of verification has situation in 5, i.e. school
It tests as even parity check (even), odd (odd), high verification (mark), low verification (space), empty (none).Sky is without school
It tests.Stop position value mode in 5 kinds of verification modes and 3, a combination thereof have 15 kinds of situations.
When the collection for detecting the baud rate that do not attempted is combined into sky, it, which is respectively set, in stop position and parity check bit is
The combination that do not attempted traverses all possible baud rate again, baud rate, stop position, check bit until finding out host computer
Combined situation.
Above scheme provides a kind of stop position and check bit when not being default setting, identify host computer baud rate,
The method of stop position and check bit, can Auto-matching baud rate, stop position and check bit, without before communicating upper
Manual setting on machine and embedded device.
In further embodiments, when embedded device needs to modify baud rate, embedded device operating clear to send
Line sends second feature level signal to host computer, and the mode switch element of host computer listens to the second feature of embedded device
Level signal, according to the baud rate of the corresponding Configuration of baud rate host computer of second feature level signal.
Second feature level signal is one in the set of one group of characteristic signal, each feature level signal in the group
Corresponding unique decoding, the fixed baud rate of decoding instruction, check bit sum stop position.Such as in certain embodiments,
0x100000000 represents baud rate as 110bit/s, and stop position 1, check bit is sky;Wherein highest 2 representatives stop taking
Value, the 3rd~5 represents check bit value, and the 6th~9 represents baud rate value.By fixed decoding so that the string of host computer
Baud rate is directly arranged in mouth, completes serial communication setting, simple and convenient compared with other methods.
In further embodiments, when the Debugging message received in embedded device by serial ports is less, host computer is notified
Serial port baud rate is reduced, and using Auto-matching baud rate again.In certain embodiments, the flow control list of embedded device
The information content that member monitoring serial ports is received and dispatched within the unit time, when the data volume received and dispatched in the unit time is lower than the first setting value or height
When the second setting value, embedded device operating clear to send line sends third feature level signal to host computer, host computer
After mode switch element listens to the feature level signal of embedded device, the baud rate of host computer is lowered or raised.It is lowering
After the baud rate of host computer, Auto-matching baud rate, automatic identification match the baud rate after lowering again.
In certain embodiments, the feature of third feature level signal is identical as the feature of second feature level signal,
The function of realization is also identical.
Above scheme embedded device receive information it is less when, communicated using lower baud rate, reduce insertion
The power consumption of formula equipment.
In another embodiment, embedded device inspects periodically whether the connection with host computer is effective.Such as it is embedded in
The interface probe unit of formula equipment sends characteristic sequence signal to host computer by sending request of data line with the period set, on
Position machine monitors to enter interface detection mode when the characteristic sequence signal;Embedded device pass through again serial data output line to
Host computer transmission interface detectable signal, the host computer in interface detection mode, will after receiving above-mentioned interface detectable signal
Above-mentioned interface detectable signal passback;
If embedded device receives arbitrary data, then it is assumed that host computer and embedded device are in connection status;It is no
If then embedded device does not receive arbitrary data within the period of setting, the baud rate of embedded device is reduced to
110bit/s.Then or setting serial ports does not reprocess the data received.
By the method for above-mentioned periodic detection, when no host computer is communicated, the baud rate of embedded device is dropped
To minimum, it is further reduced the power consumption of embedded device.
Fig. 2~3 are please referred to, inventor additionally provides a kind of communication serial port, for realizing the method for above-mentioned serial communication.It should
Communication serial port can be applied to embedded device, can also apply in host computer.The communication serial port include mode switch element,
Sequence generating unit, sequence comparing unit, baud rate administrative unit;Said units can reside in communication string in some cases
In mouth mold block, can also exist in the equipment containing communication serial port, i.e., these units can be through software in equipment or
Person is hard-wired.
For sake of convenience, in communication process, the serial ports of following middle embedded devices is also described embedded device sometimes
(side), the serial ports of host computer are also been described as host computer (side).
The mode switch element is used for when needing to start baud rate adaptation pattern, by sending the output of request of data line
Fisrt feature level signal.For monitoring the signal sent on request of data line, when the signal for judging to receive is fisrt feature
When level signal, communication serial port is switched to baud rate adaptation pattern;
The sequence generating unit is used to export a string of features for baud rate adaptation method and detects sequence;
The sequence comparing unit under baud rate adaptation pattern for judging collected data information and feature detecting
Whether sequence is consistent;
Baud rate administrative unit is also used to judge the signal received as fisrt feature level signal when mode switch element
When, after communication serial port is switched to baud rate adaptation pattern by mode switch element, initialized not under baud rate adaptation pattern
The collection of the baud rate of examination is combined into the set of all values of possible baud rate, and a string of features for receiving sequence generating unit output are detectd
Sequencing column;A baud rate is chosen in the set of not tried baud rate as baud rate is attempted, to attempt baud rate transmission
Feature detects sequence.
Baud rate administrative unit is also used to export fisrt feature level by sending request of data line when mode switch element
Signal and after switching communication serial port to baud rate adaptation pattern, is acquired the data information received, and by current baud rate to work as
Preceding baud rate sends the data information received.
In above-mentioned communication serial port, host computer notifies embedded device by the feature level signal on request of data line, and
Into baud rate adaptation pattern.Embedded device finds host computer by sending request of data line (RTS), and it is suitable to enter baud rate
In the communication for making embedded device and host computer with mode this method, the baud of embedded device and host computer is required no knowledge about
Rate does not need that identical baud rate is arranged for them manually yet, but removes identification host computer by the matching of automatic baud rate
Baud rate keeps communication more convenient.
The baud rate administrative unit is also used to be respectively 1 and sky by stop position and even-odd check.
In other embodiments, the baud rate administrative unit, which is also used to work as, detects the baud rate that do not attempted
Collection is when being combined into sky, and stop position and parity check bit are respectively set after it is the combination that do not attempted, not tried wave is initialized
The collection of special rate is combined into the set of all values of possible baud rate;When the collected data information of embedded device and feature are detected
When sequence is consistent, that is, attempt the baud rate that baud rate is equal to host computer.Using the trial baud rate as the wave of embedded device
The stop position and parity check bit of special rate, the stop position and parity check bit as embedded device.
Above scheme provides a kind of stop position and check bit when not being default setting, identify host computer baud rate,
The method of stop position and check bit, can Auto-matching baud rate, stop position and check bit, without before communicating upper
Manual setting on machine and embedded device.
In other embodiments, the window communication equipment further includes flow controlling unit, the flow control list
The information content that member monitoring serial ports is received and dispatched within the unit time, when the data volume received and dispatched in the unit time is lower than the first setting value or height
When the second setting value, operation clear to send line sends third feature level signal, the pattern switching list of host computer to host computer
After member listens to the feature level signal of embedded device, the mode switch element of host computer is lowered or the baud of up-regulation host computer
Rate.
In certain embodiments, the feature of third feature level signal is identical as the feature of second feature level signal,
The function of realization is also identical.The method for raising or lowering baud rate can be by second feature electricity in embodiment as described above
The corresponding unique decoding of ordinary mail number, decoding show the mode of fixed baud rate, check bit sum stop position, adjust embedded device
The serial ports of serial ports and host computer.
Above scheme embedded device receive information it is less when, communicated using lower baud rate, reduce insertion
The power consumption of formula equipment.
In other embodiments, it further includes interface probe unit that the window communication, which is set, the interface probe unit
For sending characteristic sequence signal to host computer by sending request of data line with the period of setting, host computer monitors the spy
Enter interface detection mode when levying sequence signal;Interface probe unit passes through serial data output line to host computer transmission interface again
Detectable signal.If receiving arbitrary data, then it is assumed that host computer and embedded device are in connection status;If embedded device
It does not receive arbitrary data within the period of setting, then the baud rate of embedded device is reduced to 110bit/s, then or set
It sets serial ports and does not reprocess the data received.
By the method for above-mentioned periodic detection, when no host computer is communicated, the baud rate of embedded device is dropped
To minimum, it is further reduced the power consumption of embedded device.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or the terminal device that include a series of elements not only include those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or end
The intrinsic element of end equipment.In the absence of more restrictions, being limited by sentence " including ... " or " including ... "
Element, it is not excluded that there is also other elements in process, method, article or the terminal device for including the element.This
Outside, herein, " being greater than ", " being less than ", " being more than " etc. are interpreted as not including this number;" more than ", " following ", " within " etc. understand
Being includes this number.
It should be understood by those skilled in the art that, the various embodiments described above can provide as method, apparatus or computer program production
Product.Complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in these embodiments
Form.The all or part of the steps in method that the various embodiments described above are related to can be instructed by program relevant hardware come
It completes, the program can store in the storage medium that computer equipment can be read, for executing the various embodiments described above side
All or part of the steps described in method.The computer equipment, including but not limited to: personal computer, server, general-purpose computations
It is machine, special purpose computer, the network equipment, embedded device, programmable device, intelligent mobile terminal, smart home device, wearable
Smart machine, vehicle intelligent equipment etc.;The storage medium, including but not limited to: RAM, ROM, magnetic disk, tape, CD, sudden strain of a muscle
It deposits, USB flash disk, mobile hard disk, storage card, memory stick, webserver storage, network cloud storage etc..
The various embodiments described above are referring to the method according to embodiment, equipment (system) and computer program product
Flowchart and/or the block diagram describes.It should be understood that can be realized by computer program instructions every in flowchart and/or the block diagram
The combination of process and/or box in one process and/or box and flowchart and/or the block diagram.It can provide these computers
Program instruction generates a machine to the processor of computer equipment, so that the finger executed by the processor of computer equipment
It enables and generates to specify in one or more flows of the flowchart and/or one or more blocks of the block diagram
The device of function.
These computer program instructions, which may also be stored in, to be able to guide computer equipment computer operate in a specific manner and sets
In standby readable memory, so that the instruction being stored in the computer equipment readable memory generates the manufacture including command device
Product, command device realization refer in one or more flows of the flowchart and/or one or more blocks of the block diagram
Fixed function.
These computer program instructions can also be loaded into computer equipment, so that executing on a computing device a series of
Operating procedure is to generate computer implemented processing, so that the instruction executed on a computing device is provided for realizing in process
The step of function of being specified in figure one process or multiple processes and/or block diagrams one box or multiple boxes.
Although the various embodiments described above are described, once a person skilled in the art knows basic wounds
The property made concept, then additional changes and modifications can be made to these embodiments, so the above description is only an embodiment of the present invention,
It is not intended to limit scope of patent protection of the invention, it is all to utilize equivalent structure made by description of the invention and accompanying drawing content
Or equivalent process transformation, being applied directly or indirectly in other relevant technical fields, similarly includes in patent of the invention
Within protection scope.
Claims (14)
1. a kind of method for serial communication control, which comprises the following steps:
Host computer mode switch element exports fisrt feature level signal to embedded device by sending request of data line, and will
Host computer is switched to baud rate adaptation pattern;The mode switch element of embedded device monitors the letter sent on request of data line
Number, when the signal for judging to receive is fisrt feature level signal, embedded device is switched to baud rate adaptation pattern, starts
Baud rate adaptation method;
The baud rate adaptation method the following steps are included:
The collection for initializing not tried baud rate is combined into the set of all values of possible baud rate, and it is defeated to receive sequence generating unit
A string of features detect sequence out;
S101, a baud rate is chosen in the set of not tried baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate, if feature detecting sequence meets with not
Same baud rate coding sends feature and detects sequence, then it shows as different sequence of levels;
S103, host computer acquire the data information received by the baud rate of host computer, and are received with the transmission of the baud rate of host computer
Data information;
S104, embedded device acquire the data information received to attempt baud rate;
S105, judge whether the collected data information of embedded device and feature detecting sequence are consistent,
S106 terminates this automatic adaptation if consistent, and using the trial baud rate as the baud rate of embedded device;If
It is inconsistent, then return step S101, until the collected data information of embedded device is consistent with feature detecting sequence or not
The collection for the baud rate tried is combined into sky.
2. a kind of method for serial communication control as described in claim 1, which is characterized in that
Comprising steps of stop position is arranged and even-odd check is respectively 1 and sky before starting baud rate adaptation method.
3. a kind of method for serial communication control as described in claim 1, which is characterized in that
The baud rate adaptation method further comprises the steps of:
When the collection for detecting the baud rate that do not attempted is combined into sky, stop position is set and parity check bit was not attempted respectively
Combination after, the collection for initializing not tried baud rate is combined into the set of all values of possible baud rates, return step S101,
Until the collected data information of embedded device is consistent with feature detecting sequence;When the collected data information of embedded device
When consistent with feature detecting sequence, using the trial baud rate as the baud rate of embedded device, the stop position and odd even
Stop position and parity check bit of the check bit as embedded device.
4. a kind of method for serial communication control as described in claim 1, which is characterized in that
Serial port baud rate is also adjusted by following step:
Embedded device operating clear to send line sends second feature level signal, the mode switch element of host computer to host computer
The second feature level signal for listening to embedded device, according to the corresponding Configuration of baud rate host computer of second feature level signal
Baud rate.
5. a kind of method for serial communication control as described in claim 1, which is characterized in that
Further include following step:
The information content received and dispatched within the unit time of flow controlling unit monitoring serial ports of embedded device, when being received and dispatched in the unit time
Data volume lower than the first setting value or be higher than the second setting value when, embedded device operating clear to send line to host computer send
Third feature level signal, after the mode switch element of host computer listens to the feature level signal of embedded device, lower or
Raise the baud rate of host computer.
6. as claimed in claim 5 a kind of for serial communication control method, which is characterized in that
It further comprises the steps of:
Start the claim 1 or baud rate adaptation method as claimed in claim 3.
7. a kind of method for serial communication control as described in claim 1, which is characterized in that
The information content that the flow controlling unit monitoring serial ports of embedded device is received and dispatched within the unit time is further comprised the steps of:, list is worked as
The data volume received and dispatched in the time of position uses method as claimed in claim 4 lower than the first setting value or when being higher than the second setting value
Lower or raise the baud rate of host computer.
8. a kind of method for serial communication control as described in claim 1, which is characterized in that
The interface probe unit of embedded device sends feature sequence to host computer by sending request of data line with the period set
Column signal, host computer monitor to enter interface detection mode when the characteristic sequence signal;Embedded device passes through serial ports number again
According to output line to host computer transmission interface detectable signal, the host computer in interface detection mode is receiving above-mentioned interface detection
After signal, above-mentioned interface detectable signal is returned;
If embedded device receives arbitrary data, then it is assumed that host computer and embedded device are in connection status;If otherwise
Embedded device does not receive arbitrary data within the period of setting, then the baud rate of embedded device is reduced to 110bit/
S, then or setting serial ports does not reprocess the data received.
9. a kind of communication serial port, which is characterized in that
Including mode switch element, sequence generating unit, sequence comparing unit, baud rate administrative unit;
The mode switch element is used for when needing to start baud rate adaptation pattern, by sending request of data line output first
Feature level signal;And for monitoring the signal sent on request of data line, when the signal for judging to receive is fisrt feature electricity
When ordinary mail, communication serial port is switched to baud rate adaptation pattern;
The sequence generating unit is used to export a string of features for baud rate adaptation method and detects sequence, the feature detecting
If sequence, which meets, sends feature detecting sequence with different baud rate codings, different sequence of levels is shown as;
The sequence comparing unit under baud rate adaptation pattern for judging collected data information and feature detecting sequence
It is whether consistent;
Baud rate administrative unit is used for when mode switch element judges the signal received as fisrt feature level signal, mode
After communication serial port is switched to baud rate adaptation pattern by switch unit, not tried baud is initialized under baud rate adaptation pattern
The collection of rate is combined into the set of all values of possible baud rate, and a string of features for receiving sequence generating unit output detect sequence;
A baud rate is chosen in the set of not tried baud rate as baud rate is attempted, and sends feature detecting to attempt baud rate
Sequence;
Baud rate administrative unit is also used to export fisrt feature level signal by sending request of data line when mode switch element
And after switching communication serial port to baud rate adaptation pattern, the data information received is acquired, and by current baud rate to work as prewave
Special rate sends the data information received.
10. a kind of communication serial port as claimed in claim 9, which is characterized in that
The baud rate administrative unit is also used to be respectively 1 and sky by stop position and even-odd check.
11. a kind of communication serial port as claimed in claim 9, which is characterized in that
The baud rate administrative unit is also used to when the collection for detecting the baud rate that do not attempted is combined into sky, by stop position and surprise
Even parity bit is respectively set after it is the combination that do not attempted, and the collection for initializing not tried baud rate is combined into all possible waves
The set of the value of special rate;When the collected data information of embedded device is consistent with feature detecting sequence, by the trial wave
The stop position and odd even of baud rate of the special rate as embedded device, the stop position and parity check bit as embedded device
Check bit.
12. a kind of communication serial port as claimed in claim 9, which is characterized in that
The baud rate administrative unit also controls embedded device operating clear to send line and sends second feature level to host computer
Signal;The mode switch element of the host computer of the host computer listens to the second feature level signal of embedded device, according to
The baud rate of the corresponding Configuration of baud rate host computer of second feature level signal.
13. a kind of communication serial port as claimed in claim 9, which is characterized in that
It further include flow controlling unit, the information content that the flow controlling unit monitoring serial ports is received and dispatched within the unit time works as list
The data volume received and dispatched in the time of position lower than the first setting value or when being higher than the second setting value, send out to host computer by operation clear to send line
It is upper after sending third feature level signal, the mode switch element of host computer to listen to the feature level signal of embedded device
The mode switch element of machine is lowered or the baud rate of up-regulation host computer.
14. a kind of communication serial port as claimed in claim 9, which is characterized in that
It further include interface probe unit, the interface probe unit is used for upward by sending request of data line with the period of setting
Position machine sends characteristic sequence signal, and host computer monitors to enter interface detection mode when the characteristic sequence signal;Interface detection
Unit passes through serial data output line to host computer transmission interface detectable signal again;If receiving arbitrary data, then it is assumed that on
Position machine and embedded device are in connection status;It, will if embedded device does not receive arbitrary data within the period of setting
The baud rate of embedded device is reduced to 110bit/s.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510386068.2A CN105049151B (en) | 2015-07-03 | 2015-07-03 | A kind of method and communication serial port for serial communication control |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510386068.2A CN105049151B (en) | 2015-07-03 | 2015-07-03 | A kind of method and communication serial port for serial communication control |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105049151A CN105049151A (en) | 2015-11-11 |
CN105049151B true CN105049151B (en) | 2019-01-08 |
Family
ID=54455381
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510386068.2A Active CN105049151B (en) | 2015-07-03 | 2015-07-03 | A kind of method and communication serial port for serial communication control |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105049151B (en) |
Families Citing this family (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017124996A1 (en) * | 2016-01-22 | 2017-07-27 | 林伟 | Signal processing and transmission method |
CN107729272A (en) * | 2016-08-10 | 2018-02-23 | 深圳多特医疗技术有限公司 | A kind of method that serial ports carries out automatic identification to the functional module of plug and play |
CN106649165A (en) * | 2016-12-30 | 2017-05-10 | 湖南国科微电子股份有限公司 | Method for establishingcommunication connection of embedded system and PC host |
CN108153696B (en) * | 2017-12-29 | 2020-04-10 | 广州市中海达测绘仪器有限公司 | Embedded system serial port module matching method, device, medium and computer equipment |
CN108845897A (en) * | 2018-05-25 | 2018-11-20 | 北京无线电测量研究所 | Serial communication adjustment method, device and storage medium |
CN108966251A (en) * | 2018-07-12 | 2018-12-07 | 四川虹美智能科技有限公司 | A kind of WiFi module baud rate collocation method, system and WiFi module |
CN109274567B (en) * | 2018-09-27 | 2021-10-08 | 潍柴动力股份有限公司 | Baud rate self-adaption method and system |
CN109597779A (en) * | 2018-11-21 | 2019-04-09 | Oppo(重庆)智能科技有限公司 | A kind of serial-port inquiring method and equipment and computer storage medium |
CN111400216A (en) * | 2019-01-03 | 2020-07-10 | 珠海格力电器股份有限公司 | UART module, UART module transmission parameter adjusting method and system-on-chip |
US11080224B2 (en) * | 2019-08-27 | 2021-08-03 | American Megatrends International, Llc | Method, baseboard management controller and system for establishing a serial-over-LAN connection |
CN110647490B (en) * | 2019-10-22 | 2021-09-07 | 深圳市康冠智能科技有限公司 | Data transmission method, device, equipment and computer storage medium |
CN113810154A (en) * | 2020-06-17 | 2021-12-17 | 国网信息通信产业集团有限公司 | Serial port communication self-adaption method and device and remote communication module |
CN112202528B (en) * | 2020-08-17 | 2021-06-29 | 北京海泰方圆科技股份有限公司 | Communication baud rate correction method and device, electronic equipment and storage medium |
CN112540641B (en) * | 2020-10-29 | 2024-04-12 | 珠海格力电器股份有限公司 | Clock precision correction method, device and storage medium |
CN113032320B (en) * | 2021-04-09 | 2022-10-18 | 山东大学 | Asynchronous serial port communication baud rate self-adaption method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5612961A (en) * | 1995-04-27 | 1997-03-18 | International Business Machines Corporation | Method and system for verification of the baud rate for an asynchronous serial device residing within a data processing system |
US6675215B1 (en) * | 2000-02-17 | 2004-01-06 | Microsoft Corporation | Automatic baud rate detection of null modem unimodem client connection |
US6895347B2 (en) * | 2002-10-15 | 2005-05-17 | Remote Data Systems, Inc. | Computerized methods for data loggers |
-
2015
- 2015-07-03 CN CN201510386068.2A patent/CN105049151B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN105049151A (en) | 2015-11-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105049151B (en) | A kind of method and communication serial port for serial communication control | |
US20160012693A1 (en) | Tamper Detection in AC-Powered Tags | |
CN108226598A (en) | A kind of oscilloscope signal interpretation method, device and oscillograph | |
CN107534548A (en) | Clock and data recovery for more wired links based on pulse | |
CN207442841U (en) | Electric energy meter communication failure detecting system | |
CN103812610B (en) | A kind of data communications method, terminal and information safety devices | |
CN105404450A (en) | Information processing method and electronic equipment | |
WO2016192159A1 (en) | Data transmission method and device | |
CN103957074A (en) | Data communication method based on intelligent terminal audio port | |
CN102646175A (en) | Safety certificating equipment and method based on audio signal communication | |
CN104321975A (en) | Wireless communication system and method | |
CN104239260A (en) | Data communication system and method and interface device | |
CN106233271B (en) | A kind of identifying system and device of USB OTG equipment | |
CN102510326A (en) | Full-duplex communication method based on single-core electric cables | |
CN206993113U (en) | Signal transmitting apparatus and system | |
CN104333479B (en) | Server power supply annexation detection method and detecting system | |
CN211554931U (en) | Embedded collector | |
CN104268109A (en) | Data interface communication method and device | |
CN206302017U (en) | A kind of smart jack and smart machine | |
CN203640725U (en) | Manual lifting underground real-time monitoring device | |
CN103248746A (en) | Mobile communication device, medical detection equipment and medical detection system | |
CN201691908U (en) | Electronic sphygmomanometer with CDMA2000 system | |
CN206004681U (en) | SIM card information intelligent detection equipment | |
CN105511355B (en) | A kind of oil/gas well aggregation of data acquiring and processing device | |
CN203893870U (en) | Switching device capable of connecting vibrating wire sensor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder |
Address after: 350003 building, No. 89, software Avenue, Gulou District, Fujian, Fuzhou 18, China Patentee after: Ruixin Microelectronics Co., Ltd Address before: 350003 building, No. 89, software Avenue, Gulou District, Fujian, Fuzhou 18, China Patentee before: Fuzhou Rockchips Electronics Co.,Ltd. |
|
CP01 | Change in the name or title of a patent holder |