CN104360974A - Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART) - Google Patents

Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART) Download PDF

Info

Publication number
CN104360974A
CN104360974A CN201410593284.XA CN201410593284A CN104360974A CN 104360974 A CN104360974 A CN 104360974A CN 201410593284 A CN201410593284 A CN 201410593284A CN 104360974 A CN104360974 A CN 104360974A
Authority
CN
China
Prior art keywords
uart
data
baud
measurement module
count value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410593284.XA
Other languages
Chinese (zh)
Inventor
迟朋
刘精轶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
The perseverance space Big Dipper (Beijing) development in science and technology Co., Ltd
Original Assignee
SHANGHAI JIALILUE NAVIGATION CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHANGHAI JIALILUE NAVIGATION CO Ltd filed Critical SHANGHAI JIALILUE NAVIGATION CO Ltd
Priority to CN201410593284.XA priority Critical patent/CN104360974A/en
Publication of CN104360974A publication Critical patent/CN104360974A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Information Transfer Systems (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a method and a device for automatically adjusting the Baud rate of a universal asynchronous receiver/transmitter (UART). The method comprises the following steps: sending a preset character with a specific frame format to a central processing unit (CPU) by an upper computer; powering on and resetting the CPU, receiving the preset character, and starting a measurement module to count the pulse width of the preset character according to a work clock of the universal asynchronous receiver/transmitter (UART), so that a corresponding serial Baud rate is configured by a configuration module according to a count value to obtain an adjusted Baud rate, and feeding back the upper computer to confirm the character; receiving the confirmed character by the upper computer to confirm that the automatic Baud rate adjustment of the UART is completed after the verification is correct. The purposes that the Baud rate of the UART is automatically adjusted on an original chip, extra chip pins do not need to be added and the spending is saved are achieved.

Description

A kind of asynchronous serial port UART auto-baud method of adjustment and device
Technical field
The present invention relates to the technical field of baud rate adjustment, particularly relate to a kind of asynchronous serial port UART auto-baud method of adjustment and device.
Background technology
UART (Universal Asynchronous Receiver/Transmitter, asynchronous serial port) is commonly used to transmit data, tune-up data, performs and moves program boot.The interface of UART is non-source sync cap, does not have clock signal, and therefore the Transmission bit rate of UART needs communicating pair to arrange unanimously.
CPU (Central Processing Unit, central processing unit) crystal oscillator frequency initial configuration need boot start process in realize, but because boot is normally solidificated in ROM (Read Only Memory, read-only memory), corresponding ROM is also referred to as boot ROM, therefore, the boot after this solidification is not easy to configure different Configuration of baud rate programs to different frequency device.
At present, can by arranging specialized chip pin instruction external crystal-controlled oscillation frequency, boot reads the parameter of this specialized chip pin and configures corresponding baud rate accordingly.But this mode needs to increase extra chip pin, increases extra expense.
Summary of the invention
The object of this invention is to provide a kind of asynchronous serial port UART auto-baud method of adjustment and device, to realize carrying out the adjustment of UART auto-baud on original chip, do not need to increase extra chip pin, the object of paring down expenses.
For solving the problems of the technologies described above, the invention provides following technical scheme.
A kind of asynchronous serial port UART auto-baud method of adjustment, comprising:
Host computer sends the preset characters with particular frame format to central processor CPU;
Described CPU electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate according to count value, baud rate after being adjusted, and to described host computer feedback acknowledgment character;
Described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct.
Preferably, described startup measurement module counts according to the pulsewidth of work clock to described preset characters of asynchronous serial port UART, comprising:
The data that asynchronous clock domain synchronous processing device CDC sync in described measurement module is received in the data bit of described preset characters by the pin RXD of the reception data of described UART synchronously process, wherein, described data are 8 bit binary data or hexadecimal data;
Counter Counter2 in described measurement module is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Described Counter1 is after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt and ready signal ready when terminating counting.
Preferably, described in make configuration module configure corresponding serial port baud rate according to count value, the baud rate after being adjusted, comprising:
Described configuration module, when described ready signal ready being detected, obtains count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud; Wherein, div=cnt*16/n.
Preferably, the preset characters described in particular frame format comprises 1 start bit, 8 data bit, 1 even parity bit and 1 position of rest.
Preferably, when the data in the data bit of 8 in described preset characters are 0x55, counter Counter2 in described measurement module is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and counting adds one when the pulsewidth that described RXD receives described data is rising edge, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtain count value n, comprise:
Carry out resetting or resetting after reception described reset signal reset or reset signal restart;
When the pulsewidth that described RXD receives described data 0x55 is rising edge, counting adds one, and generates count enable signal en and be sent to counter Counter1 in described measurement module; Wherein, the pulsewidth rising edge of described data 0x55 has 5;
Receive 5 rising edges of the pulsewidth of described data 0x55 at described RXD after, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and to obtain count value n be 5.
Preferably, described host computer receives after described acknowledge character determined the adjustment of UART auto-baud after checking is correct, also comprises:
Described host computer starts to transmit data to described CPU.
A kind of asynchronous serial port UART auto-baud regulating device, comprising: host computer and central processor CPU;
Described host computer, for sending the preset characters with particular frame format to described CPU; The acknowledge character receiving described CPU feedback has determined that UART auto-baud adjusts after checking is correct;
Described CPU, for electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate according to count value, baud rate after being adjusted, and to described host computer feedback acknowledgment character.
Preferably, described host computer comprises PC.
Preferably, described CPU comprises: be provided with asynchronous clock domain synchronous processing device CDC sync, the measurement module of counter Counter1 sum counter Counter2;
Described CDC sync, the data received in the data bit of described preset characters for the pin RXD of the reception data by described UART synchronously process, and wherein, described data are 8 bit binary data or hexadecimal data;
Described Counter2, for after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Described Counter1, for after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt ready signal ready when terminating counting.
Preferably, described CPU comprises configuration module;
Described configuration module, for when described described ready signal ready detected, obtain count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud; Wherein, div=cnt*16/n.
A kind of asynchronous serial port UART auto-baud method of adjustment provided by the present invention and device, described CPU electrification reset, receive the preset characters with particular frame format that described host computer sends to described CPU, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate and baud rate after being adjusted according to count value, and described host computer receives the baud rate after described adjustment and to described CPU feedback acknowledgment character, described CPU receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct, thus realize on original chip, carry out the adjustment of UART auto-baud, do not need to increase extra chip pin, the object of paring down expenses.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only embodiments of the invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to the accompanying drawing provided.
The process flow diagram of the asynchronous serial port UART auto-baud method of adjustment that Fig. 1 provides for the embodiment of the present invention one;
The partial process view of the asynchronous serial port UART auto-baud method of adjustment that Fig. 2 provides for the embodiment of the present invention two;
The oscillogram of the clock signal uart_clk that Fig. 3 provides for the embodiment of the present invention two and data;
The process flow diagram that the CPU that Fig. 4 provides for the embodiment of the present invention two is concise and to the point;
The partial process view of the asynchronous serial port UART auto-baud method of adjustment that Fig. 5 provides for the embodiment of the present invention three;
The structural drawing of CPU in the asynchronous serial port UART auto-baud adjusting gear that Fig. 6 provides for the embodiment of the present invention four.
Embodiment
Core of the present invention is to provide a kind of asynchronous serial port UART auto-baud method of adjustment and device, to realize carrying out the adjustment of UART auto-baud on original chip, does not need to increase extra chip pin, the object of paring down expenses.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment one
Please refer to Fig. 1, the process flow diagram of the asynchronous serial port UART auto-baud method of adjustment that Fig. 1 provides for the embodiment of the present invention one, the method comprises:
Step S101: host computer sends the preset characters with particular frame format to central processor CPU;
Step S102: described CPU electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, and makes configuration module configure corresponding serial port baud rate according to count value, and to described host computer feedback acknowledgment character;
Step S103: described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct;
Based on the asynchronous serial port UART auto-baud method of adjustment that the embodiment of the present invention provides, described CPU electrification reset, receive the preset characters with particular frame format that described host computer sends to described CPU, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate and baud rate after being adjusted according to count value, and to described host computer feedback acknowledgment character, described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct, thus realize on original chip, carry out the adjustment of UART auto-baud, do not need to increase extra chip pin, the object of paring down expenses.
Embodiment two
Based on the asynchronous serial port UART auto-baud method of adjustment disclosed in the invention described above embodiment one, the pulsewidth of work clock to described preset characters of the described startup measurement module foundation asynchronous serial port UART that the embodiment of the present invention two essentially discloses in middle step S102 counts, as shown in Figure 2, and composition graphs 5, preferably adopt following steps to realize:
Step S201: the data that the asynchronous clock domain synchronous processing device CDC sync in described measurement module is received in the data bit of described preset characters by the pin RXD of the reception data of described UART synchronously process;
In step s 201, described data are 8 bit binary data or hexadecimal data.
Step S202: the counter Counter2 in described measurement module after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Step S203: described Counter1 after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt and ready signal ready when terminating counting.
Wherein, for step S202 and step S203, composition graphs 3, Fig. 3 is the oscillogram of described uart_clk and described data, in figure, start shows that measurement module starts to start, at each rising edge place of described data waveform, described Counter2 counting adds one, and the periodicity of the described Counter1 pair of described uart_clk waveform corresponding to the rising edge of described data waveform counts.
Based on above-mentioned asynchronous serial port UART auto-baud method of adjustment preferably and disclosed in the embodiment of the present invention one, the configuration module that makes that the embodiment of the present invention three discloses in step S102 configures corresponding serial port baud rate according to count value, baud rate after being adjusted, preferably adopts following steps to realize:
Step S301: described configuration module, when described ready signal ready being detected, obtains count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud;
In step S301, div=cnt*16/n, when described configuration module detects described ready signal ready for " 1 ", namely detects the ready signal ready that Counter1 sends, obtain the count value cnt in counter Counter2 and count value n, according to div=cnt*16/n and f baud=f uart_clk/ 16/div obtains the baud rate f after adjustment baud, when described configuration module detects described ready signal ready for " 0 ", the ready signal ready namely detected is for time empty, and described CPU restarts measurement module, again performs subsequent step.
Based on above-mentioned asynchronous serial port UART auto-baud method of adjustment preferably and disclosed in the embodiment of the present invention one, preferably, also comprise after step s 103:
Step S501: described host computer starts to transmit data to described CPU.
In the process that step S501 performs, need execution to move program boot transceiving data, and jump to master routine performing data transmission.
Based on above-mentioned preferably all, it should be noted that, perform in step S102 in the process of described host computer feedback acknowledgment character, described upper seat in the plane comprises character " ACK " to the acknowledge character that described CPU feeds back, and this character " ACK " is acknowledge character.
Comprehensive the above, concise and to the point process is the outline flowchart of described CPU with reference to figure 4, Fig. 4, and process step is as follows:
S1: electrification reset;
S2: receive the preset characters that described host computer sends, starts measurement module;
S3: the pulsewidth of work clock to described preset characters according to asynchronous serial port UART counts, obtains described ready signal ready when terminating counting;
S4: judge whether described ready is " 1 ", if so, enters S4; If not, enter S2;
S5: obtain described count value cnt and described count value n, configure the serial port baud rate of described UART, the baud rate f after being adjusted baud;
S6: to described host computer feedback acknowledgment character " ACK ";
S7: described host computer receives after described acknowledge character " ACK " determined after checking is correct, performs and moves program boot transceiving data;
S8: jump to master routine performing data transmission.
Based on the asynchronous serial port UART auto-baud method of adjustment that the embodiment of the present invention provides, described CPU electrification reset, receive the preset characters with particular frame format that described host computer sends to described CPU, by described RXD, the data received in the data bit of described preset characters synchronously process described CDC sync, described Counter2 is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to described Counter1, when described RXD receives described data, stop counting and send described count enable signal en to described Counter1, and obtain count value n.
Further, described Counter1 is after reset or resetting, according to described uart_clk, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtain count value cnt and ready signal ready when terminating counting, described configuration module, when described ready signal ready being detected, obtains count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud, and to described host computer feedback acknowledgment character.
Further, described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct, described host computer starts to transmit data to described CPU afterwards, thus realize on original chip, carry out the adjustment of UART auto-baud, do not need to increase extra chip pin, the object of paring down expenses.
Embodiment three
Based on the asynchronous serial port UART auto-baud method of adjustment disclosed in the invention described above embodiment one and the embodiment of the present invention two, preferably, the described preset characters with particular frame format comprises 1 start bit, 8 data bit, 1 even parity bit and 1 position of rest.
Based on the asynchronous serial port UART auto-baud method of adjustment disclosed in the invention described above embodiment one and the embodiment of the present invention two, when the data in the data bit of 8 in described preset characters are 0x55, the embodiment of the present invention three discloses step S202: the counter Counter2 in described measurement module is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtain count value n, as shown in Figure 5, preferred employing following steps realize:
Step S401: carry out resetting or resetting after reception described reset signal reset or reset signal restart;
Step S402: counting adds one when the pulsewidth that described RXD receives described data 0x55 is rising edge, and generate count enable signal en and be sent to counter Counter1 in described measurement module;
Wherein, the pulsewidth rising edge of described data 0x55 has 5;
Step S403: receive 5 rising edges of the pulsewidth of described data 0x55 at described RXD after, stops counting and send described count enable signal en to the counter Counter1 in described measurement module, and to obtain count value n is 5.
Based on the asynchronous serial port UART auto-baud method of adjustment that the embodiment of the present invention provides, described CPU electrification reset, what receive that described host computer sends to described CPU has 1 start bit, 8 data bit, the preset characters of 1 even parity bit and 1 position of rest, by described RXD, the data 0x55 received in the data bit of described preset characters synchronously processes described CDC sync, described Counter2 is after reception reset signal reset or reset signal restart, when the pulsewidth that described RXD receives described data 0x55 is rising edge, counting adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, receive 5 rising edges of the pulsewidth of described data 0x55 at described RXD after, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and to obtain count value n be 5.
Further, described Counter1 is after reset or resetting, according to described uart_clk, the uart_clk periodicity receiving described data 0x55 when receiving described count enable signal en is counted, and obtain count value cnt and ready signal ready when terminating counting, configuration module is made to configure corresponding serial port baud rate and baud rate after being adjusted according to count value, and to described host computer feedback acknowledgment character, described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct, thus the chip pin that the adjustment of UART auto-baud does not need increase extra is carried out in realization on original chip, the object of paring down expenses.
Embodiment four
Asynchronous serial port UART auto-baud method of adjustment disclosed in the invention described above embodiment one to embodiment three, the embodiment of the present invention four also corresponding said method discloses a kind of asynchronous serial port UART auto-baud adjusting gear, comprising:
Host computer and central processor CPU;
Described host computer, for sending the preset characters with particular frame format to described CPU; Receive the baud rate after the adjustment that described CPU obtains; Receive described acknowledge character and determined that UART auto-baud adjusts after checking is correct;
Described CPU, for electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate according to count value, baud rate after being adjusted, and to described host computer feedback acknowledgment character.
Preferably, the described host computer in said apparatus comprises PC;
Preferably, with reference to figure 6, the described CPU in said apparatus comprises: be provided with asynchronous clock domain synchronous processing device CDC syncF100, the measurement module of counter Counter1F200 sum counter Counter2F300;
Described CDC syncF100, the data received in the data bit of described preset characters for the pin RXD of the reception data by described UART synchronously process, and wherein, described data are 8 bit binary data or hexadecimal data;
Described Counter2F300, for after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Described Counter1F200, for after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt and ready signal ready when terminating counting.
Preferably, the described CPU in said apparatus comprises configuration module;
Described configuration module, for when described described ready signal ready detected, obtain count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud; Wherein, div=cnt*16/n.
A kind of asynchronous serial port UART auto-baud adjusting gear that the embodiment of the present invention provides, described CPU electrification reset, receive the preset characters with particular frame format that described host computer sends to described CPU, by described RXD, the data received in the data bit of described preset characters synchronously process described CDC sync, described Counter2 is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to described Counter1, when described RXD receives described data, stop counting and send described count enable signal en to described Counter1, and obtain count value n.
Further, described Counter1 is after reset or resetting, according to described uart_clk, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtain count value cnt and ready signal ready when terminating counting, described configuration module when described described ready signal ready detected, obtain count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, and div=cnt*16/n, the baud rate f after being adjusted baudand to described host computer feedback acknowledgment character, described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct, described host computer starts to transmit data to described CPU afterwards, thus the chip pin that the adjustment of UART auto-baud does not need increase extra is carried out in realization on original chip, the object of paring down expenses.
Above a kind of asynchronous serial port UART auto-baud method of adjustment provided by the present invention and device are described in detail.Apply specific case herein to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping.It should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention, can also carry out some improvement and modification to the present invention, these improve and modify and also fall in the protection domain of the claims in the present invention.

Claims (10)

1. an asynchronous serial port UART auto-baud method of adjustment, is characterized in that, comprising:
Host computer sends the preset characters with particular frame format to central processor CPU;
Described CPU electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate according to count value, baud rate after being adjusted, and to described host computer feedback acknowledgment character;
Described host computer receives described acknowledge character and determined that UART auto-baud adjusts after checking is correct.
2. the method for claim 1, is characterized in that, described startup measurement module counts according to the pulsewidth of work clock to described preset characters of asynchronous serial port UART, comprising:
The data that asynchronous clock domain synchronous processing device CDC sync in described measurement module is received in the data bit of described preset characters by the pin RXD of the reception data of described UART synchronously process, wherein, described data are 8 bit binary data or hexadecimal data;
Counter Counter2 in described measurement module is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Described Counter1 is after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt and ready signal ready when terminating counting.
3. method as claimed in claim 2, is characterized in that, described in make configuration module configure corresponding serial port baud rate according to count value, the baud rate after being adjusted, comprising:
Described configuration module, when described ready signal ready being detected, obtains count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud; Wherein, div=cnt*16/n.
4. method as claimed in claim 3, is characterized in that, described in there is particular frame format preset characters comprise 1 start bit, 8 data bit, 1 even parity bit and 1 position of rest.
5. method as claimed in claim 4, it is characterized in that, when the data in the data bit of 8 in described preset characters are 0x55, counter Counter2 in described measurement module is after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and counting adds one when the pulsewidth that described RXD receives described data is rising edge, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtain count value n, comprise:
Carry out resetting or resetting after reception described reset signal reset or reset signal restart;
When the pulsewidth that described RXD receives described data 0x55 is rising edge, counting adds one, and generates count enable signal en and be sent to counter Counter1 in described measurement module; Wherein, the pulsewidth rising edge of described data 0x55 has 5;
Receive 5 rising edges of the pulsewidth of described data 0x55 at described RXD after, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and to obtain count value n be 5.
6. as the method in Claims 1 to 5 as described in any one, it is characterized in that, described host computer receives after described acknowledge character determined the adjustment of UART auto-baud after checking is correct, also comprises:
Described host computer starts to transmit data to described CPU.
7. an asynchronous serial port UART auto-baud regulating device, is characterized in that, comprising: host computer and central processor CPU;
Described host computer, for sending the preset characters with particular frame format to described CPU; The acknowledge character receiving described CPU feedback has determined that UART auto-baud adjusts after checking is correct;
Described CPU, for electrification reset, receive described preset characters, the pulsewidth of work clock to described preset characters starting measurement module foundation asynchronous serial port UART counts, configuration module is made to configure corresponding serial port baud rate according to count value, baud rate after being adjusted, and to described host computer feedback acknowledgment character.
8. device as claimed in claim 7, it is characterized in that, described host computer comprises PC.
9. device as claimed in claim 7, it is characterized in that, described CPU comprises: be provided with asynchronous clock domain synchronous processing device CDC sync, the measurement module of counter Counter1 sum counter Counter2;
Described CDC sync, the data received in the data bit of described preset characters for the pin RXD of the reception data by described UART synchronously process, and wherein, described data are 8 bit binary data or hexadecimal data;
Described Counter2, for after reception reset signal reset or reset signal restart, counting is started when described RXD receives described data, and described RXD counting when the pulsewidth receiving described data is rising edge adds one, and generate count enable signal en and be sent to counter Counter1 in described measurement module, when described RXD receives described data, stop counting and send described count enable signal en to the counter Counter1 in described measurement module, and obtaining count value n;
Described Counter1, for after reset or resetting, the operating clock signals uart_clk inputted according to described UART, the uart_clk periodicity receiving described data when receiving described count enable signal en is counted, and obtains count value cnt ready signal ready when terminating counting.
10. device as claimed in claim 9, it is characterized in that, described CPU comprises configuration module;
Described configuration module, for when described described ready signal ready detected, obtain count value cnt and count value n, according to f baud=f uart_clk/ 16/div configures the serial port baud rate of described UART, the baud rate f after being adjusted baud; Wherein, div=cnt*16/n.
CN201410593284.XA 2014-10-29 2014-10-29 Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART) Pending CN104360974A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410593284.XA CN104360974A (en) 2014-10-29 2014-10-29 Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410593284.XA CN104360974A (en) 2014-10-29 2014-10-29 Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART)

Publications (1)

Publication Number Publication Date
CN104360974A true CN104360974A (en) 2015-02-18

Family

ID=52528237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410593284.XA Pending CN104360974A (en) 2014-10-29 2014-10-29 Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART)

Country Status (1)

Country Link
CN (1) CN104360974A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106130856A (en) * 2016-08-17 2016-11-16 天津市英贝特航天科技有限公司 A kind of self adaptation baud rate RS485 communications protocol
CN107450935A (en) * 2016-05-30 2017-12-08 北京信威通信技术股份有限公司 A kind of BOOTROM of chip starts collocation method and device
CN109525350A (en) * 2018-10-12 2019-03-26 福建星云电子股份有限公司 Module synchronization control method based on asynchronous serial port synchronisation source
CN109669899A (en) * 2018-11-23 2019-04-23 中科曙光信息产业成都有限公司 The method and serial port device of automatic adjusument serial communication baud rate
CN111211869A (en) * 2020-01-02 2020-05-29 深圳震有科技股份有限公司 Method for automatically adapting baud rate, intelligent terminal and storage medium
CN111274194A (en) * 2018-12-05 2020-06-12 锐迪科(重庆)微电子科技有限公司 Data processing apparatus and control method thereof
CN111400216A (en) * 2019-01-03 2020-07-10 珠海格力电器股份有限公司 UART module, UART module transmission parameter adjusting method and system-on-chip
CN112202528A (en) * 2020-08-17 2021-01-08 北京海泰方圆科技股份有限公司 Communication baud rate correction method and device, electronic equipment and storage medium
CN113448907A (en) * 2021-08-31 2021-09-28 北京智联安科技有限公司 Low-power-consumption serial asynchronous transceiver, data receiving method and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1293852A (en) * 1998-03-16 2001-05-02 艾利森公司 Automatic speed detection for asynchronous serial communications
CN1353828A (en) * 1999-03-30 2002-06-12 西门子能量及自动化公司 Programmable controller method, system and apparatus
US20050041594A1 (en) * 2003-08-06 2005-02-24 Jha Mithilesh Kumar Automatic baud rate determination
CN102306136A (en) * 2011-08-03 2012-01-04 宁波三星电气股份有限公司 Baud rate self-adaption method based on input capture function of singlechip
CN103036823A (en) * 2012-12-14 2013-04-10 中船重工(武汉)凌久电子有限责任公司 Baud rate fast self-adaptive method based on field programmable gate array (FPGA), processor and receiving end
CN103412615A (en) * 2013-08-22 2013-11-27 中国航天科工集团第三研究院第八三五七研究所 Glitch-free self-adaptive clock switching method for UART (Universal Asynchronous Receiver Transmitter) interface chip

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1293852A (en) * 1998-03-16 2001-05-02 艾利森公司 Automatic speed detection for asynchronous serial communications
CN1353828A (en) * 1999-03-30 2002-06-12 西门子能量及自动化公司 Programmable controller method, system and apparatus
US20050041594A1 (en) * 2003-08-06 2005-02-24 Jha Mithilesh Kumar Automatic baud rate determination
CN102306136A (en) * 2011-08-03 2012-01-04 宁波三星电气股份有限公司 Baud rate self-adaption method based on input capture function of singlechip
CN103036823A (en) * 2012-12-14 2013-04-10 中船重工(武汉)凌久电子有限责任公司 Baud rate fast self-adaptive method based on field programmable gate array (FPGA), processor and receiving end
CN103412615A (en) * 2013-08-22 2013-11-27 中国航天科工集团第三研究院第八三五七研究所 Glitch-free self-adaptive clock switching method for UART (Universal Asynchronous Receiver Transmitter) interface chip

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450935A (en) * 2016-05-30 2017-12-08 北京信威通信技术股份有限公司 A kind of BOOTROM of chip starts collocation method and device
CN106130856A (en) * 2016-08-17 2016-11-16 天津市英贝特航天科技有限公司 A kind of self adaptation baud rate RS485 communications protocol
CN109525350A (en) * 2018-10-12 2019-03-26 福建星云电子股份有限公司 Module synchronization control method based on asynchronous serial port synchronisation source
CN109525350B (en) * 2018-10-12 2020-04-10 福建星云电子股份有限公司 Module synchronization control method based on asynchronous serial port synchronization source
CN109669899A (en) * 2018-11-23 2019-04-23 中科曙光信息产业成都有限公司 The method and serial port device of automatic adjusument serial communication baud rate
CN109669899B (en) * 2018-11-23 2020-07-28 中科曙光信息产业成都有限公司 Method for adaptively adjusting serial port communication baud rate and serial port device
CN111274194A (en) * 2018-12-05 2020-06-12 锐迪科(重庆)微电子科技有限公司 Data processing apparatus and control method thereof
CN111400216A (en) * 2019-01-03 2020-07-10 珠海格力电器股份有限公司 UART module, UART module transmission parameter adjusting method and system-on-chip
CN111211869A (en) * 2020-01-02 2020-05-29 深圳震有科技股份有限公司 Method for automatically adapting baud rate, intelligent terminal and storage medium
CN112202528A (en) * 2020-08-17 2021-01-08 北京海泰方圆科技股份有限公司 Communication baud rate correction method and device, electronic equipment and storage medium
CN113448907A (en) * 2021-08-31 2021-09-28 北京智联安科技有限公司 Low-power-consumption serial asynchronous transceiver, data receiving method and medium

Similar Documents

Publication Publication Date Title
CN104360974A (en) Method and device for automatically adjusting Baud rate of universal asynchronous receiver/transmitter (UART)
JP7258199B2 (en) Multiphase clock data recovery circuit calibration
KR102522742B1 (en) Multiphase clock data recovery for 3-phase interface
EP3170090B1 (en) Systems and methods for chip to chip communication
CN110687993B (en) Controlling power delivery by tunneling messages over USB
JP2017516353A (en) Method for transmitting additional information in-band over an inter-integrated circuit (I2C) bus
CN104461972B (en) A kind of method and apparatus of data signal samples
US20170104607A1 (en) Methods to avoid i2c void message in i3c
CN115202496A (en) Navigation system and clock calibration method thereof
CN104168080A (en) Method and apparatus for baud rate self adaption, and equipment
CN111052006A (en) Control device and control method
KR20140049488A (en) Transmission interface device capable of calibrating transmission frequency automatically and method thereof
US9608800B2 (en) Frequency aided clock recovery based on low speed information exchange mechanism
CN108027744B (en) Data transmission method and mobile terminal
CN103092256A (en) Clock frequency adjusting circuit and clock frequency adjusting method thereof
US9772650B2 (en) Solving unstable universal asynchronous receive transmit (UART) communication between a power manager and a universal serial bus (USB)-bridge device
CN106201956B (en) Apparatus and method for automatically correcting clock of amorphous oscillator
CN102929330A (en) Circuit and method for generating USB external clock
US8953662B1 (en) Method and apparatus for baud rate tracking
El Kouche et al. WSN platform Plug-and-Play (PnP) customization
JP2002222024A (en) Microcomputer
CN103336712A (en) Control method for single frequency network adapters of digital television
TW202022627A (en) Universal serial bus device and operation method thereof
CN108268087B (en) Semiconductor device, semiconductor system, and method of operating semiconductor device
TW201807591A (en) Device and method for adjusting USB clock frequency

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190710

Address after: 100097 Jinyuan Times Business Center (Block C) 2E, No. 2 Courtyard, Lanindichang East Road, Haidian District, Beijing

Applicant after: The perseverance space Big Dipper (Beijing) development in science and technology Co., Ltd

Address before: 201203 West Side of Second Floor, 125 Songtao Road, Zhangjiang High-tech Park, Shanghai

Applicant before: Shanghai Jialilue Navigation Co., Ltd.

WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150218