CN105049151A - Method for controlling serial port communication and communication serial port - Google Patents

Method for controlling serial port communication and communication serial port Download PDF

Info

Publication number
CN105049151A
CN105049151A CN201510386068.2A CN201510386068A CN105049151A CN 105049151 A CN105049151 A CN 105049151A CN 201510386068 A CN201510386068 A CN 201510386068A CN 105049151 A CN105049151 A CN 105049151A
Authority
CN
China
Prior art keywords
baud rate
embedded
host computer
level signal
data
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
CN201510386068.2A
Other languages
Chinese (zh)
Other versions
CN105049151B (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.)
Ruixin Microelectronics Co., Ltd
Original Assignee
Fuzhou Rockchip Electronics 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 Fuzhou Rockchip Electronics Co Ltd filed Critical Fuzhou Rockchip Electronics Co Ltd
Priority to CN201510386068.2A priority Critical patent/CN105049151B/en
Publication of CN105049151A publication Critical patent/CN105049151A/en
Application granted granted Critical
Publication of CN105049151B publication Critical patent/CN105049151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0002Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy

Abstract

A method for controlling serial port communication is provided and solves the problem of setting a baud rate for serial port communication. The invention belongs to the technical field of digital communication, specifically to a method for automatically detecting an asynchronous serial port communication protocol. For one scheme, a host computer mode switching unit outputs a first characteristic level signal to an embedded device through a data sending request wire, and switches the host computer to a baud rate adaption mode. The mode switching unit of the embedded device monitors the signal on the data sending request wire. When the received signal is the first characteristic level signal, the embedded device is switched to the baud rate adaption mode to start the baud rate adaption method. A device for realizing the method is also provided.

Description

A kind of method for serial communication control and communication serial port
Technical field
The invention belongs to digital communication technology field, specifically a kind of automatic detection method of asynchronous serial communication agreement.
Background technology
The concept of serial communication is very simple, and serial ports step-by-step (bit) sends and receives byte.Although slower than the parallel communications by byte (byte), serial ports can receive data with another single line while use single line sends data.It is very simple and can realize telecommunication.During the parallel current state of such as IEEE488 definition, specified devices line overall length must not more than 20 meters, and the length of any two equipment rooms must not more than 2 meters; And for serial ports, length can reach 1200 meters.
When embedded device uses universal asynchronous receiving-transmitting transmitter (UART) to communicate in host computer (embedded device and host computer have UART), UART interface between embedded device and host computer PC is connected to altogether 5 lines, ground wire (GND) respectively, serial data output line (TX), serial data input line (RX), sends request of data line (RTS) and clear to send (CTS) line.
Realizing in process of the present invention, inventor finds that in prior art, there are the following problems: host computer and embedded device need before bringing into use universal asynchronous receiving-transmitting transmitter for embedded device and host computer arrange identical communication baud rate, and this measure is very inconvenient.Embedded device automatically cannot adapt to host computer and makes the electric quantity consumption of embedded device larger in addition.
Summary of the invention
For this reason, a kind of method providing serial communication to control and the serial ports realizing the method is needed
For achieving the above object, inventor provide a kind of method controlled for serial communication, comprise the following steps:
Host computer mode switch element exports fisrt feature low and high level signal by sending request of data alignment embedded device, and host computer is switched to baud rate adapt mode; The mode switch element of embedded device monitors the signal sent on request of data line, and when the signal judging to receive is fisrt feature low and high level signal, embedded device is switched to baud rate adapt mode, starts baud rate adaptation method;
Described baud rate adaptation method comprises the following steps:
The set of the NA baud rate of initialization is the set of the value of all possible baud rate, and receiving sequence generation unit exports a string feature detecting sequence;
S101, choose in the set of NA baud rate a baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate;
The data message that S103, host computer receive by the baud rate collection of host computer, and the data message received is sent with the baud rate of host computer;
The data message that S104, embedded device receive to attempt baud rate collection;
S105, judge that whether the data message that embedded device collects is consistent with feature detecting sequence,
If S106 is consistent, terminate this automatic adaptation, and using the baud rate of described trial baud rate as embedded device; If inconsistent, then return step S101, until the data message that collects of embedded device is consistent with feature detecting sequence or the set of baud rate do not attempted for empty.
Further, comprise step: before beginning baud rate adaptation method, position of rest and parity check are set and are respectively 1 and empty.
Further, described baud rate adaptation method also comprises step:
When detecting that the set of the baud rate of not attempting is for time empty, arrange after position of rest and parity check bit be respectively the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate, return step S101, until the data message that embedded device collects is consistent with feature detecting sequence; When the data message that embedded device collects and feature detecting sequence consistent time, using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
Further, it is characterized in that, also by following step adjustment serial port baud rate:
Embedded device operating clear to send alignment host computer sends second feature level signal, the mode switch element of host computer listens to the second feature level signal of embedded device, according to the baud rate of Configuration of baud rate host computer corresponding to second feature level signal.
Further, also comprise the steps:
The flow controlling unit monitoring serial ports amount of information of receiving and dispatching within the unit interval of embedded device, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, embedded device operating clear to send alignment host computer sends 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.
Further, also comprise step,
Start described claim 1 or baud rate adaptation method according to claim 3.
Further, also comprise step, the flow controlling unit monitoring serial ports amount of information of receiving and dispatching within the unit interval of embedded device, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, the method described in claim 4 is used to lower or raise the baud rate of host computer.
Further, the interface probe unit of embedded device sends characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Embedded device passes through serial data output line again to host computer transmission interface detectable signal, and above-mentioned interface detectable signal, after receiving above-mentioned interface detectable signal, returns by the host computer being in interface detection mode;
If embedded device receives arbitrary data, then think that host computer and embedded device are in connection status; If otherwise embedded device does not receive arbitrary data within the cycle of setting, then then or the serial ports not data that receive of reprocessing are set the baud rate of embedded device is reduced to 110bit/s.
Inventor also provides body weight serial ports, and described serial ports comprises mode switch element, sequence generating unit, gene comparision unit, baud rate administrative unit;
Described mode switch element is used for when needs start baud rate adapt mode, exports fisrt feature low and high level signal by sending request of data line; And for monitoring the signal sent on request of data line, when the signal judging to receive is fisrt feature low and high level signal, communication serial port serial communication equipment is switched to baud rate adapt mode;
Described sequence generating unit is for exporting a string feature for baud rate adaptation method detecting sequence;
Whether the data message that described gene comparision unit is used for judging to collect under baud rate adapt mode is consistent with feature detecting sequence;
It is the set of the value of all possible baud rate that described baud rate administrative unit is used for the set of the NA baud rate of initialization under baud rate adapt mode, a string feature detecting sequence that receiving sequence generation unit exports; In the set of NA baud rate, choose a baud rate as trial baud rate, send feature detecting sequence and to attempt the data message that baud rate collection receives to attempt baud rate;
Baud rate administrative unit is also for when mode switch element judges that the signal received is feature low and high level signal, after mode switch element is switched to baud rate adapt mode string communication serial port port communications equipment, the data message that baud rate administrative unit receives by current baud rate collection, and the data message received is sent with current baud rate.
Further, described baud rate administrative unit is also for being respectively 1 and sky by position of rest and parity check.
Further, described baud rate administrative unit is also for when the set of the baud rate of not attempting being detected for sky, position of rest and parity check bit being arranged respectively it is that after the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate; When the data message that embedded device collects and feature detecting sequence consistent time, using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
Further, described baud rate administrative unit also controls embedded device operating clear to send alignment host computer and sends second feature level signal; The mode switch element of the host computer of described host computer listens to the second feature level signal of embedded device, according to the baud rate of Configuration of baud rate host computer corresponding to second feature level signal.
Further, also comprise flow controlling unit, the amount of information that described flow controlling unit monitoring serial ports is received and dispatched within the unit interval, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, operation clear to send alignment host computer sends third feature level signal, after the mode switch element of host computer listens to the feature level signal of embedded device, the mode switch element of host computer is lowered or is raised the baud rate of host computer.
Further, also comprise interface probe unit, described interface probe unit is used for sending characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Interface probe unit passes through serial data output line again to host computer transmission interface detectable signal.If receive arbitrary data, then think that host computer and embedded device are in connection status; If embedded device does not receive arbitrary data within the cycle of setting, then the baud rate of embedded device is reduced to 110bit/s.
Be different from prior art, technique scheme finds host computer by sending request of data line (RTS), and host computer is switched to baud rate adapt mode.The method makes in the communication of embedded device and host computer, do not need the baud rate knowing embedded device and host computer, do not need for they arrange identical baud rate, but go by automatic baud rate coupling the baud rate identifying host computer, make communication more convenient yet.
Accompanying drawing explanation
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.
Embodiment
By describe in detail technical scheme technology contents, structural feature, realized object and effect, coordinate accompanying drawing to be explained in detail below in conjunction with specific embodiment.
Bit rate is a parameter weighing communication speed.It represents the number of the bit that each second transmits.Such as 300 bauds represent and send 300 bit each second.When we mention the clock cycle, just refer to bit rate, if such as agreement needs 4800 baud rates, namely clock is 4800Hz.Clock means serial communication sample rate on the data line.The bit rate of usual telephone wire is 14400bit/s, 28800bit/s and 36600bit/s.
The most important parameter of serial communication is bit rate, data bit, position of rest and parity check.Position of rest is last position for representing single bag, and its value is 1,1.5 and 2.Verification is a kind of simple error detection mode in serial communication, and it has five kinds of error detection modes: even (even), strange (odd), high (mark), low (space), empty (none).Usual position of rest and parity check are default setting, and namely position of rest is 1, and check digit is empty, namely do not do just verification.Before beginning baud rate adaptation method, position of rest and parity check are set and are respectively 1 and empty.
Inventor provides a kind of for serial communication control method, comprises the following steps:
Host computer mode switch element exports fisrt feature level signal by sending request of data line (RTS) to embedded device, and host computer is switched to baud rate adapt mode; The mode switch element of embedded device monitors the signal sent on request of data line, and when the signal judging to receive is fisrt feature level signal, embedded device is switched to baud rate adapt mode, starts baud rate adaptation method;
Please refer to Fig. 1, described baud rate adaptation method comprises the following steps:
The set of the NA baud rate of initialization is the set of the value of all possible baud rate, and receiving sequence generation unit exports a string feature detecting sequence;
S101, choose in the set of NA baud rate a baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate;
The data message that S103, host computer receive by the baud rate collection of host computer, and the data message received is sent with the baud rate of host computer;
The data message that S104, embedded device receive to attempt baud rate collection;
S105, judge that whether the data message that embedded device collects is consistent with feature detecting sequence,
If S106 is consistent, terminate this automatic adaptation, namely described trial baud rate equals the baud rate of host computer, and using the baud rate of described trial baud rate as embedded device;
If inconsistent, then return step S101, until the data message that collects of embedded device is consistent with feature detecting sequence or the set of baud rate do not attempted for empty.
The possible baud rate of serial communication be in 110bit/s, 300bit/s, 600bit/s, 1200bit/s, 2400bit/s, 4800bit/s, 9600bit/s, 14400bit/s, 19200bit/s, 38400bit/s, 57600bit/s, 115200bit/s, 230400bit/s, 380400bit/s, 460800bit/s and 921600bit/s one, the set of the value of described all possible baud rate and the above-mentioned baud rate enumerated.Described feature detecting sequence is the signal for communicating with host computer in baud rate adapt mode, is a string sequence of levels in the communications, if it meets send feature detecting sequence with different baud rates coding, then it shows as different sequence of levels.
In said method, host computer is switched to baud rate adapt mode, and embedded device finds host computer by sending request of data line (RTS), and enters baud rate adapt mode.。The method makes in the communication of embedded device and host computer, do not need the baud rate knowing embedded device and host computer, do not need manual for they arrange identical baud rate, but go by automatic baud rate coupling the baud rate identifying host computer, make communication more convenient yet.
In further embodiments, described baud rate adaptation method also comprises step:
When detecting that the set of the baud rate of not attempting is for time empty, position of rest and parity check bit being arranged respectively it is after the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate, repeat step S101 to S106, until the data message that embedded device collects is consistent with feature detecting sequence; When the data message that embedded device collects is consistent with feature detecting sequence, namely described trial baud rate equals the baud rate of host computer.Using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
The value of position of rest has three kinds of situations, and namely position of rest is 1,1.5 and 2; The value of verification has situation in 5, is namely verified as even parity check (even), odd (odd), high verification (mark), low verification (space), empty (none).Sky is no parity check.Position of rest value mode in 5 kinds of verification modes and 3, its combination has 15 kinds of situations.
When the set baud rate of not attempting being detected is for time empty, position of rest and parity check bit are arranged respectively it for the combination do not attempted, again travel through all possible baud rate, until find out the combined situation of the baud rate of host computer, position of rest, check digit.
Such scheme provides a kind of position of rest and check digit when not being default setting, identify the method for the baud rate of host computer, position of rest and check digit, get final product Auto-matching baud rate, position of rest and check digit, and do not need manually to arrange on host computer and embedded device before communicating.
In further embodiments, when embedded device needs amendment baud rate, embedded device operating clear to send alignment host computer sends second feature level signal, the mode switch element of host computer listens to the second feature level signal of embedded device, according to the baud rate of Configuration of baud rate host computer corresponding to second feature level signal.
Second feature level signal is one in the set of a stack features signal, the decoding that each feature level signal in this group is corresponding unique, baud rate, check bit sum position of rest that this decoding instruction is fixing.Such as in certain embodiments, 0x100000000, representing baud rate is 110bit/s, and position of rest is 1, and check digit is empty; Wherein the representative of the highest 2 stops value, and 3rd ~ 5 represent check digit value, and 6th ~ 9 represent baud rate value.Make the serial ports of host computer that directly baud rate is set by fixing decoding, complete serial communication and arrange, simple and convenient compared with additive method.
In further embodiments, when the Debugging message received by serial ports at embedded device is less, notice host computer reduces serial port baud rate, and adopts Auto-matching baud rate again.In certain embodiments, the flow controlling unit monitoring serial ports amount of information of receiving and dispatching within the unit interval of embedded device, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, embedded device operating clear to send alignment host computer sends 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.After the baud rate lowering host computer, Auto-matching baud rate again, identifies the baud rate after coupling downward automatically.
In certain embodiments, the feature of third feature level signal is identical with the feature of second feature level signal, and its function realized is also identical.
Such scheme embedded device receive information less time, adopt lower baud rate to communicate, reduce the power consumption of embedded device.
In another embodiment, whether embedded device is made regular check on the connection of host computer is effective.The interface probe unit of such as embedded device sends characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Embedded device passes through serial data output line again to host computer transmission interface detectable signal, and above-mentioned interface detectable signal, after receiving above-mentioned interface detectable signal, returns by the host computer being in interface detection mode;
If embedded device receives arbitrary data, then think that host computer and embedded device are in connection status; If otherwise embedded device does not receive arbitrary data within the cycle of setting, then the baud rate of embedded device is reduced to 110bit/s.Or the serial ports not data that receive of reprocessing are set then.
By the method for above-mentioned periodic detection, when not having host computer to communicate, the baud rate of embedded device is dropped to minimum, the power consumption of embedded device is reduced further.
Please refer to Fig. 2 ~ 3, inventor additionally provides a kind of communication serial port, for realizing the method for above-mentioned serial communication.This communication serial port can be applicable to embedded device, also can be applied in host computer.Described communication serial port comprises mode switch element, sequence generating unit, gene comparision unit, baud rate administrative unit; Said units may reside in communication serial port module in some cases, also may reside in the equipment containing communication serial port, and namely these unit can be by the software in equipment or hard-wired.
For sake of convenience, in communication process, the serial ports of following middle embedded device, is also described embedded device (side) sometimes, and the serial ports of host computer is also described to host computer (side).
Described mode switch element is used for when needs start baud rate adapt mode, exports fisrt feature level signal by sending request of data line.For monitoring the signal sent on request of data line, when the signal judging to receive is fisrt feature level signal, communication serial port is switched to baud rate adapt mode;
Described sequence generating unit is for exporting a string feature for baud rate adaptation method detecting sequence;
Whether the data message that described gene comparision unit is used for judging to collect under baud rate adapt mode is consistent with feature detecting sequence;
When the signal of baud rate administrative unit also for judging to receive when mode switch element is fisrt feature level signal, after mode switch element is switched to baud rate adapt mode communication serial port, under baud rate adapt mode, the set of the NA baud rate of initialization is the set of the value of all possible baud rate, a string feature detecting sequence that receiving sequence generation unit exports; In the set of NA baud rate, choose a baud rate as trial baud rate, send feature detecting sequence to attempt baud rate.
Baud rate administrative unit is also for when mode switch element is by sending request of data line and export fisrt feature level signal and after switching communication serial port to baud rate adapt mode, by the data message that current baud rate collection receives, and send the data message received with current baud rate.
In above-mentioned communication serial port, host computer by the feature level signal informed embed formula equipment on request of data line, and enters baud rate adapt mode.Embedded device finds host computer by sending request of data line (RTS), and enter baud rate adapt mode the method and make in the communication of embedded device and host computer, do not need the baud rate knowing embedded device and host computer, do not need manually for they arrange identical baud rate yet, but go by automatic baud rate coupling the baud rate identifying host computer, make communication more convenient.
Described baud rate administrative unit is also for being respectively 1 and sky by position of rest and parity check.
In other embodiment, described baud rate administrative unit is also for when the set of the baud rate of not attempting being detected for sky, position of rest and parity check bit being arranged respectively it is that after the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate; When the data message that embedded device collects is consistent with feature detecting sequence, namely attempt the baud rate that baud rate equals host computer.Using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
Such scheme provides a kind of position of rest and check digit when not being default setting, identify the method for the baud rate of host computer, position of rest and check digit, get final product Auto-matching baud rate, position of rest and check digit, and do not need manually to arrange on host computer and embedded device before communicating.
In other embodiment, described window communication equipment also comprises flow controlling unit, the amount of information that described flow controlling unit monitoring serial ports is received and dispatched within the unit interval, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, operation clear to send alignment host computer sends third feature level signal, after the mode switch element of host computer listens to the feature level signal of embedded device, the mode switch element of host computer is lowered or is raised the baud rate of host computer.
In certain embodiments, the feature of third feature level signal is identical with the feature of second feature level signal, and its function realized is also identical.Namely the method raising or lower baud rate namely can by the corresponding unique decoding of second feature level signal in embodiment described above, and the mode of fixing baud rate, check bit sum position of rest is shown in decoding, adjusts the serial ports of embedded device, and the serial ports of host computer.
Such scheme embedded device receive information less time, adopt lower baud rate to communicate, reduce the power consumption of embedded device.
In other embodiment, described window communication is established and is also comprised interface probe unit, described interface probe unit is used for sending characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Interface probe unit passes through serial data output line again to host computer transmission interface detectable signal.If receive arbitrary data, then think that host computer and embedded device are in connection status; Then or the serial ports not data that receive of reprocessing are set if embedded device does not receive arbitrary data within the cycle of setting, then the baud rate of embedded device is reduced to 110bit/s.
By the method for above-mentioned periodic detection, when not having host computer to communicate, the baud rate of embedded device is dropped to minimum, the power consumption of embedded device is reduced further.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or terminal equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or terminal equipment.When not more restrictions, the key element limited by statement " comprising ... " or " comprising ... ", and be not precluded within process, method, article or the terminal equipment comprising described key element and also there is other key element.In addition, in this article, " be greater than ", " being less than ", " exceeding " etc. be interpreted as and do not comprise this number; " more than ", " below ", " within " etc. be interpreted as and comprise this number.
Those skilled in the art should understand, the various embodiments described above can be provided as method, device or computer program.These embodiments can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.The hardware that all or part of step in the method that the various embodiments described above relate to can carry out instruction relevant by program has come, described program can be stored in the storage medium that computer equipment can read, for performing all or part of step described in the various embodiments described above method.Described computer equipment, includes but not limited to: personal computer, server, all-purpose computer, special-purpose computer, the network equipment, embedded device, programmable device, intelligent mobile terminal, intelligent home device, wearable intelligent equipment, vehicle intelligent equipment etc.; Described storage medium, includes but not limited to: the storage of RAM, ROM, magnetic disc, tape, CD, flash memory, USB flash disk, portable hard drive, storage card, memory stick, the webserver, network cloud storage etc.
The various embodiments described above describe with reference to the flow chart of method, equipment (system) and computer program according to embodiment and/or block diagram.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can being provided to the processor of computer equipment to produce a machine, making the instruction performed by the processor of computer equipment produce device for realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer equipment readable memory that works in a specific way of vectoring computer equipment, the instruction making to be stored in this computer equipment readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be loaded on computer equipment, make to perform sequence of operations step on a computing device to produce computer implemented process, thus the instruction performed on a computing device is provided for the step realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
Although be described the various embodiments described above; but those skilled in the art are once obtain the basic creative concept of cicada; then can make other change and amendment to these embodiments; so the foregoing is only embodiments of the invention; not thereby scope of patent protection of the present invention is limited; every utilize specification of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included within scope of patent protection of the present invention.

Claims (14)

1., for the method that serial communication controls, it is characterized in that, comprise the following steps:
Host computer mode switch element exports fisrt feature level signal by sending request of data alignment embedded device, and host computer is switched to baud rate adapt mode; The mode switch element of embedded device monitors the signal sent on request of data line, and when the signal judging to receive is fisrt feature level signal, embedded device is switched to baud rate adapt mode, starts baud rate adaptation method;
Described baud rate adaptation method comprises the following steps:
The set of the NA baud rate of initialization is the set of the value of all possible baud rate, and receiving sequence generation unit exports a string feature detecting sequence;
S101, choose in the set of NA baud rate a baud rate as trial baud rate;
S102, embedded device send feature detecting sequence to attempt baud rate;
The data message that S103, host computer receive by the baud rate collection of host computer, and the data message received is sent with the baud rate of host computer;
The data message that S104, embedded device receive to attempt baud rate collection;
S105, judge that whether the data message that embedded device collects is consistent with feature detecting sequence,
If S106 is consistent, terminate this automatic adaptation, and using the baud rate of described trial baud rate as embedded device; If inconsistent, then return step S101, until the data message that collects of embedded device is consistent with feature detecting sequence or the set of baud rate do not attempted for empty.
2. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
Comprise step: before beginning baud rate adaptation method, position of rest and parity check are set and are respectively 1 and empty.
3. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
Described baud rate adaptation method also comprises step:
When detecting that the set of the baud rate of not attempting is for time empty, arrange after position of rest and parity check bit be respectively the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate, return step S101, until the data message that embedded device collects is consistent with feature detecting sequence; When the data message that embedded device collects and feature detecting sequence consistent time, using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
4. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
Also by following step adjustment serial port baud rate:
Embedded device operating clear to send alignment host computer sends second feature level signal, the mode switch element of host computer listens to the second feature level signal of embedded device, according to the baud rate of Configuration of baud rate host computer corresponding to second feature level signal.
5. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
Also comprise the steps:
The flow controlling unit monitoring serial ports amount of information of receiving and dispatching within the unit interval of embedded device, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, embedded device operating clear to send alignment host computer sends 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. one as claimed in claim 5 is used for serial communication control method, it is characterized in that,
Also comprise step:
Start described claim 1 or baud rate adaptation method according to claim 3.
7. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
Also comprise step: the amount of information that the flow controlling unit of embedded device monitoring serial ports is received and dispatched within the unit interval, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, the method described in claim 4 is used to lower or raise the baud rate of host computer.
8. as claimed in claim 1 a kind of for serial communication control method, it is characterized in that,
The interface probe unit of embedded device sends characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Embedded device passes through serial data output line again to host computer transmission interface detectable signal, and above-mentioned interface detectable signal, after receiving above-mentioned interface detectable signal, returns by the host computer being in interface detection mode;
If embedded device receives arbitrary data, then think that host computer and embedded device are in connection status; If otherwise embedded device does not receive arbitrary data within the cycle of setting, then then or the serial ports not data that receive of reprocessing are set the baud rate of embedded device is reduced to 110bit/s.
9. a communication serial port, is characterized in that,
Comprise mode switch element, sequence generating unit, gene comparision unit, baud rate administrative unit;
Described mode switch element is used for when needs start baud rate adapt mode, exports fisrt feature level signal by sending request of data line; And for monitoring the signal sent on request of data line, when the signal judging to receive is fisrt feature level signal, communication serial port is switched to baud rate adapt mode;
Described sequence generating unit is for exporting a string feature for baud rate adaptation method detecting sequence;
Whether the data message that described gene comparision unit is used for judging to collect under baud rate adapt mode is consistent with feature detecting sequence;
Baud rate administrative unit is used for when the signal that mode switch element judges to receive is fisrt feature level signal, after mode switch element is switched to baud rate adapt mode communication serial port, under baud rate adapt mode, the set of the NA baud rate of initialization is the set of the value of all possible baud rate, a string feature detecting sequence that receiving sequence generation unit exports; In the set of NA baud rate, choose a baud rate as trial baud rate, send feature detecting sequence to attempt baud rate.
Baud rate administrative unit is also for when mode switch element is by sending request of data line and export fisrt feature level signal and after switching communication serial port to baud rate adapt mode, by the data message that current baud rate collection receives, and send the data message received with current baud rate.
10. a kind of communication serial port as claimed in claim 7, is characterized in that,
Described baud rate administrative unit is also for being respectively 1 and sky by position of rest and parity check.
11. a kind of communication serial ports as claimed in claim 7, is characterized in that,
Described baud rate administrative unit is also for when the set of the baud rate of not attempting being detected for sky, position of rest and parity check bit being arranged respectively it is that after the combination do not attempted, the set of the NA baud rate of initialization is the set of the value of all possible baud rate; When the data message that embedded device collects and feature detecting sequence consistent time, using the baud rate of described trial baud rate as embedded device, described position of rest and parity check bit are as the position of rest of embedded device and parity check bit.
12. a kind of communication serial ports as claimed in claim 7, is characterized in that,
Described baud rate administrative unit also controls embedded device operating clear to send alignment host computer and sends second feature level signal; The mode switch element of the host computer of described host computer listens to the second feature level signal of embedded device, according to the baud rate of Configuration of baud rate host computer corresponding to second feature level signal.
13. a kind of communication serial ports as claimed in claim 7, is characterized in that,
Also comprise flow controlling unit, the amount of information that described flow controlling unit monitoring serial ports is received and dispatched within the unit interval, when the data volume of receiving and dispatching in the unit interval is lower than the first settings or higher than the second settings, operation clear to send alignment host computer sends third feature level signal, after the mode switch element of host computer listens to the feature level signal of embedded device, the mode switch element of host computer is lowered or is raised the baud rate of host computer.
14. a kind of communication serial ports as claimed in claim 7, is characterized in that,
Also comprise interface probe unit, described interface probe unit is used for sending characteristic sequence signal with the cycle of setting by sending request of data alignment host computer, enters interface detection mode when host computer monitors described characteristic sequence signal; Interface probe unit passes through serial data output line again to host computer transmission interface detectable signal.If receive arbitrary data, then think that host computer and embedded device are in connection status; If embedded device does not receive arbitrary data within the cycle of setting, then the baud rate of embedded device is reduced to 110bit/s.
CN201510386068.2A 2015-07-03 2015-07-03 A kind of method and communication serial port for serial communication control Active CN105049151B (en)

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 true CN105049151A (en) 2015-11-11
CN105049151B 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)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649165A (en) * 2016-12-30 2017-05-10 湖南国科微电子股份有限公司 Method for establishingcommunication connection of embedded system and PC host
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
CN108153696A (en) * 2017-12-29 2018-06-12 广州市中海达测绘仪器有限公司 Embedded system serial port module matching process, 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
CN109274567A (en) * 2018-09-27 2019-01-25 潍柴动力股份有限公司 A kind of adaptive approach and system of baud rate
CN109597779A (en) * 2018-11-21 2019-04-09 Oppo(重庆)智能科技有限公司 A kind of serial-port inquiring method and equipment and computer storage medium
CN110647490A (en) * 2019-10-22 2020-01-03 深圳市康冠智能科技有限公司 Data transmission method, device, 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

Citations (3)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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

Cited By (11)

* Cited by examiner, † Cited by third party
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
CN108153696A (en) * 2017-12-29 2018-06-12 广州市中海达测绘仪器有限公司 Embedded system serial port module matching process, device, medium and computer equipment
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
CN109274567A (en) * 2018-09-27 2019-01-25 潍柴动力股份有限公司 A kind of adaptive approach and system of baud rate
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
CN110647490A (en) * 2019-10-22 2020-01-03 深圳市康冠智能科技有限公司 Data transmission method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
CN105049151B (en) 2019-01-08

Similar Documents

Publication Publication Date Title
CN100366029C (en) Communication controller, host-side controller, communication equipment, communication system and method
CN106030973B (en) Fast charge method, power supply adaptor and mobile terminal
JP2017527231A (en) Power saving mode for USB power carrier sourcing device
CN201945615U (en) A single-phase, cost-remote-controlled intelligent meter and automatic meter reading system
CN104657314A (en) System and method for serial bus interface
TWI461013B (en) Data processing apparatus and data processing method thereof for use in power line communications
CN101399635A (en) Baud rate adaptation method, apparatus and host for communication
CN106030962B (en) Fast charge method, power supply adaptor and mobile terminal
CN103944895A (en) Data fusing device of heterogeneous sensor network
CN109245199A (en) Charging method, charging unit, power supply provide equipment and terminal to be charged
CN104965147A (en) Low-voltage-user electric energy meter series detection system and detection method
CN101673968A (en) Electric equipment control device and method
CN201408476Y (en) Wireless remote meter reading control system based on ZigBee technique
AU2584700A (en) A method and an apparatus for storing and communicating battery information
CN101977082B (en) Optical receiving and transmitting module, optical transmitting device and optical transmitting method
CN109272733B (en) Multi-terminal multi-mode Internet of things communication terminal supporting multi-meter combined reading and meter reading method thereof
CN203933666U (en) A kind of CAN bus repeater
CN103023755B (en) The method of transfer of data and electronic equipment
CN104377781A (en) Adapter, charging system comprising same and charging method using same
CN204667140U (en) A kind of intelligent home control device
CN104796464A (en) Multi-protocol conversion warning condition information remote transmission system and method based on MODBUS
CN105208635A (en) System information reading method, scheduling method and device
CN105092961A (en) Ammeter system using mobile terminal for positioning
CN102393714A (en) Own coding household electrical appliance control system based on ZigBee and realization method thereof
CN201600774U (en) Double-channel automatic meter reading system

Legal Events

Date Code Title Description
PB01 Publication
C06 Publication
SE01 Entry into force of request for substantive examination
C10 Entry into 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