JP2011091742A - Communication device - Google Patents
Communication device Download PDFInfo
- Publication number
- JP2011091742A JP2011091742A JP2009245466A JP2009245466A JP2011091742A JP 2011091742 A JP2011091742 A JP 2011091742A JP 2009245466 A JP2009245466 A JP 2009245466A JP 2009245466 A JP2009245466 A JP 2009245466A JP 2011091742 A JP2011091742 A JP 2011091742A
- Authority
- JP
- Japan
- Prior art keywords
- communication
- baud rate
- bit
- start bit
- unit
- 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
Links
Images
Abstract
Description
本発明は、通信装置に関する。 The present invention relates to a communication device.
周知のように、UART(Universal Asynchronous Receiver Transmitter)インタフェースを備えるデバイス間でシリアル通信を行う場合、送信側デバイスのボーレートと同じボーレートを受信側デバイスで設定する必要がある。送信側デバイスのボーレートが既知の場合には手動操作によって受信側デバイスのボーレートを設定すれば良いが、不明の場合には受信側デバイスにおいてボーレートの自動設定を行う必要がある。 As is well known, when serial communication is performed between devices having a UART (Universal Asynchronous Receiver Transmitter) interface, it is necessary to set a baud rate that is the same as the baud rate of the transmitting device on the receiving device. When the baud rate of the transmission side device is known, the baud rate of the reception side device may be set by manual operation. When the baud rate is unknown, it is necessary to automatically set the baud rate at the reception side device.
従来では、ボーレートの自動設定を行う方法として、受信側デバイスにおいて受信可能なタイミングが見つかるまで何度もボーレートを変えることで適切なボーレートを探索する方法(下記特許文献1〜3参照)や、受信側デバイスにおいて受信したシリアル信号を測定してボーレートを算出する方法(下記特許文献4参照)などがある。
Conventionally, as a method for automatically setting a baud rate, a method for searching for an appropriate baud rate by changing the baud rate many times until a receivable timing is found at a receiving device (see
なお、シリアル信号に含まれるスタートビットの期間を測定すればボーレートを算出することが可能であるが、転送経路の条件により、スタートビットの立下り遅延時間と立上り遅延時間の差が大きくなると、スタートビット期間の測定精度が低下し、ひいてはボーレートの算出精度が低下する虞がある。 Note that the baud rate can be calculated by measuring the start bit period included in the serial signal.However, if the difference between the start bit fall delay time and the rise delay time increases due to transfer path conditions, the start bit There is a possibility that the measurement accuracy of the bit period is lowered, and consequently the calculation accuracy of the baud rate is lowered.
これに対して、特許文献4の技術では、スタートビットの立下りから立上りの期間を測定するための第1のカウンタ及び第2のカウンタと、転送速度を測定するコマンドの1フレーム最後の立下り時間と立上り時間を測定するための第3のカウンタ及び第4のカウンタとを有し、スタートビットの立下りから転送データの最後の立下り、或いはスタートビットの立上りから転送データの最後の立上りの期間で転送速度(ボーレート)を算出することにより、ボーレートの算出精度の向上を図っている。
On the other hand, in the technique of
特許文献1〜3の技術では、受信可能なタイミングが見つかるまで何度もボーレートを変える必要があるため、ボーレートを設定するまでの時間が長くなるという問題があった。また、予め決められたボーレートにしか対応できず、任意のボーレート設定には対応できないという問題があった。特許文献4の技術では上述した特許文献1〜3の問題は生じないが、ボーレートを算出するための回路構成が複雑化するという問題があった。このような回路構成の複雑化を回避するために、スタートビットの期間のみ測定することでボーレートを算出する方法を採用すると、結局、ボーレートの算出精度が低下するという問題を解決することができない。
In the techniques of
本発明は、上述した事情に鑑みてなされたものであり、ボーレートの算出精度を向上させることが可能な通信装置を提供することを目的とする。 The present invention has been made in view of the above-described circumstances, and an object of the present invention is to provide a communication device capable of improving the accuracy of baud rate calculation.
上記目的を達成するために、本発明に係る通信装置は、1フレーム内に開始ビット及び終了ビットを含むシリアル信号を送受信する通信部と、通信相手装置から送信される前記シリアル信号に含まれる前記開始ビット及び前記終了ビットを検出する検出部と、前記検出部にて前記開始ビットが検出された場合に計時動作を開始する一方、前記検出部にて前記終了ビットが検出された場合に前記計時動作を終了する計時部と、前記計時部の計時結果に基づいてボーレートを算出し、当該算出したボーレートを前記通信部に設定する設定部と、を備えることを特徴とする。 In order to achieve the above object, a communication device according to the present invention includes a communication unit that transmits and receives a serial signal including a start bit and an end bit in one frame, and the serial signal transmitted from a communication partner device. A detection unit for detecting a start bit and the end bit; and a timing operation when the detection unit detects the start bit, while the timing unit detects the end bit. And a setting unit configured to calculate a baud rate based on a timing result of the timing unit and to set the calculated baud rate in the communication unit.
また、上記の通信装置において、前記1フレーム内において、前記開始ビットの区間はローレベルに、前記終了ビットの区間はハイレベルに、前記開始ビットと前記終了ビットとの間の区間はローレベルに設定されたシリアル信号が前記通信相手装置から送信される場合、前記検出部は、前記シリアル信号の立下りエッジを前記開始ビットとして検出する一方、前記シリアル信号の立上がりエッジを前記終了ビットとして検出することを特徴とする。 In the communication apparatus, in the one frame, the section of the start bit is at a low level, the section of the end bit is at a high level, and the section between the start bit and the end bit is at a low level. When the set serial signal is transmitted from the communication counterpart device, the detection unit detects the falling edge of the serial signal as the start bit, and detects the rising edge of the serial signal as the end bit. It is characterized by that.
また、上記の通信装置において、前記設定部は、複数のフレームの各々について得られる前記計時部の計時結果に基づいて前記ボーレートの平均値を算出し、当該算出したボーレートの平均値を前記通信部に設定することを特徴とする。
また、上記の通信装置において、前記通信部は、UART(Universal Asynchronous Receiver Transmitter)インタフェースであることを特徴とする。
Further, in the communication device, the setting unit calculates an average value of the baud rate based on a time measurement result of the time measuring unit obtained for each of a plurality of frames, and calculates the average value of the calculated baud rate as the communication unit. It is characterized by setting to.
In the communication apparatus, the communication unit is a UART (Universal Asynchronous Receiver Transmitter) interface.
本発明では、通信相手装置から送信されるシリアル信号に含まれる開始ビットから終了ビットまでの、複数ビットに亘る区間の時間測定結果(計時部の計時結果)からボーレートを算出するため、ボーレートの算出精度を向上することができる。 In the present invention, the baud rate is calculated in order to calculate the baud rate from the time measurement result (time measurement result of the time measurement unit) in a section extending over a plurality of bits from the start bit to the end bit included in the serial signal transmitted from the communication partner device. Accuracy can be improved.
以下、本発明の一実施形態について、図面を参照しながら説明する。
図1は、本実施形態における通信装置1のブロック構成図である。本実施形態における通信装置1は、通信相手装置2(例えばパーソナルコンピュータ等)とシリアル通信を行うもの(例えばモデム等)であり、UARTインタフェース11、外部割込回路12、タイマ13及びCPU(Central Processing Unit)14を備えている。なお、図1では、説明の便宜上、通信相手装置2の内部ブロックとしてUARTインタフェース21のみを図示している。
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block configuration diagram of a
通信装置1において、UARTインタフェース11(通信部)は、通信相手装置2のUARTインタフェース21との間で、1フレーム内にスタートビット(開始ビット)及びストップビット(終了ビット)を含むUART信号(シリアル信号)を送受信するものである。具体的には、このUARTインタフェース11は、CPU14から入力される送信データ(パラレルデータ)をシリアル変換することで送信用のUART信号を生成する一方、受信したUART信号をパラレル変換することで受信データ(パラレルデータ)を生成してCPU14へ出力する。なお、UARTインタフェース11には、シリアル通信に必要なボーレート等の設定情報を設定するための設定レジスタ11aが設けられている。
In the
外部割込回路12(検出部)は、通信相手装置2のUARTインタフェース21からUARTインタフェース11へ送信されるUART信号が分岐して入力されており、このUART信号に含まれるスタートビット及びストップビットを検出するものである。具体的には、この外部割込回路12は、UART信号の立下りエッジをスタートビットとして検出する一方、UART信号の立上がりエッジをストップビットとして検出する。なお、この外部割込回路12は、UART信号の立下りエッジを検出したタイミングと、立上がりエッジを検出したタイミングで、ハイレベルのパルス信号をタイマ13へ出力する。
The external interrupt circuit 12 (detection unit) branches and receives a UART signal transmitted from the
タイマ13(計時部)は、外部割込回路12にてスタートビットが検出された場合に計時動作を開始する一方、外部割込回路12にてストップビットが検出された場合に計時動作を終了するものである。具体的には、このタイマ13は、外部割込回路12から最初のパルス信号が入力されたタイミングでタイムカウンタを起動し、次のパルス信号が入力されたタイミングでタイムカウンタを停止し、その時のタイムカウンタの値(タイムカウント値)をCPU14へ出力する。
The timer 13 (timer unit) starts a timekeeping operation when a start bit is detected by the
CPU14(設定部)は、通信装置1の通信動作を統括制御するものであり、具体的には送信データを生成してUARTインタフェース11へ出力したり、UARTインタフェース11から入力される受信データを基に所定の信号処理を行う。また、このCPU14は、タイマ13から入力されるタイムカウント値(計時結果)に基づいて、通信相手装置2から送信されたUART信号のボーレートを算出し、当該算出したボーレートをUARTインタフェース11の設定レジスタ11aに設定するボーレート自動設定機能を有している。
The CPU 14 (setting unit) performs overall control of communication operations of the
次に、上記のように構成された本実施形態における通信装置1の動作、特にボーレート設定動作について詳細に説明する。まず、ボーレート設定動作の説明に入る前に、その前提となるUART信号のフォーマットについて説明する。図2(a)は、通常通信時(通信接続の確立後)において、通信装置1と通信相手装置2との間で送受信されるUART信号のフォーマットを示し、図2(b)は、通信接続の確立時において、通信相手装置2から通信装置1へ送信されるUART信号のフォーマットを示している。
Next, the operation of the
図2(a)に示すように、通常通信時では、1フレーム内にスタートビット(1ビット)、データビット(8ビット)、ストップビット(1ビット)を含むUART信号が通信装置1と通信相手装置2との間で送受信される。なお、UART通信では、スタートビットの区間をローレベル(「0」)に、ストップビットの区間をハイレベル(「1」)に設定するように規定されている。
As shown in FIG. 2A, during normal communication, a UART signal including a start bit (1 bit), a data bit (8 bits), and a stop bit (1 bit) in one frame is transmitted to the
一方、図2(b)に示すように、通信接続の確立時では、「パリティ無し、データ=00hex」という条件で生成されたUART信号、つまり、1フレーム内において、スタートビットの区間はローレベルに、ストップビットの区間はハイレベルに、スタートビットとストップビットとの間の区間はローレベルに設定されたUART信号が通信相手装置2から送信される。この場合、1フレーム中、9ビットがローレベルの区間となる。
On the other hand, as shown in FIG. 2B, at the time of establishing the communication connection, the UART signal generated under the condition of “no parity, data = 00 hex”, that is, the start bit section is low level in one frame. The
通信装置1は、図2(b)に示したように、通信接続の確立時に通信相手装置2から送信されるUART信号の1フレーム内のローレベル区間の時間を測定し、その測定結果に基づいてボーレートを算出する。図3は、通信接続の確立時における通信装置1のボーレート設定動作を示すフローチャートである。
As shown in FIG. 2B, the
図3に示すように、まず、通信装置1の外部割込回路12は、通信相手装置2から送信されるUART信号を監視し、立下りエッジを検出したか否かを判定する(ステップS1)。このステップS1において、「Yes」の場合、外部割込回路12は、立下りエッジを検出したタイミングで、ハイレベルのパルス信号をタイマ13へ出力し、タイマ13はパルス信号が入力されたタイミングでタイムカウンタを起動する(ステップS2)。
As shown in FIG. 3, first, the external interrupt
そして、外部割込回路12は、通信相手装置2から送信されるUART信号を引き続き監視し、立上がりエッジを検出したか否かを判定する(ステップS3)。このステップS3において、「Yes」の場合、外部割込回路12は、立上がりエッジを検出したタイミングで、ハイレベルのパルス信号をタイマ13へ出力し、タイマ13はパルス信号が入力されたタイミングでタイムカウンタを停止する(ステップS4)。ここで、タイマ13は、その時のタイムカウント値をCPU14へ出力する。
Then, the external interrupt
そして、CPU14は、タイマ13から入力されるタイムカウント値に基づいて、通信相手装置2から送信されたUART信号のボーレートを算出する(ステップS5)。具体的には、タイムカウント値は、図2(b)に示すUART信号における1フレーム内のローレベル区間(9ビット分の区間)の時間を示す値であるため、そのローレベル区間の時間の逆数を9で割ることでボーレートを算出することができる。CPU14は、このように算出したボーレートをUARTインタフェース11の設定レジスタ11aに設定する(ステップS6)。
Then, the
図4は、上述した通信装置1のボーレート設定動作をタイミングチャートで表したものである。この図4に示すように、UART信号の立下りエッジが検出されたタイミングで、パルス信号が外部割込回路12からタイマ13へ出力されてタイムカウンタが起動し、その後、UART信号の立上がりエッジが検出されたタイミングで、再度、パルス信号が外部割込回路12からタイマ13へ出力されてタイムカウンタが停止し、CPU14によってボーレートが算出されて、設定レジスタ11aにボーレートが設定される。
FIG. 4 is a timing chart showing the baud rate setting operation of the
以上説明したように、本実施形態の通信装置1では、従来のようなスタートビットの区間だけでなく、複数ビットに亘る区間の時間測定結果からボーレートを算出するため、ボーレートの算出精度を向上することができる。また、その区間の時間を測定するために、UART信号の立下りエッジ及び立上がりエッジを検出する外部割込回路12と、計時動作を行うタイマ13とを設けるだけで良いので、回路構成を単純化することができる。すなわち、本実施形態の通信装置1によれば、ボーレートの算出精度の向上と、回路構成の単純化とを両立することが可能となる。
As described above, in the
なお、本発明は上記実施形態に限定されず、以下のような変形例が挙げられる。
(1)上記実施形態では、通信相手装置2から送信されるUART信号に含まれる1フレーム内のローレベル区間のみを測定して得られるタイムカウント値を基にボーレートを算出する場合を例示したが、複数のフレームの各々について得られるタイムカウント値に基づいてボーレートの平均値を算出し、当該算出したボーレートの平均値をUARTインタフェース11に設定する機能をCPU14に設けても良い。これにより、ボーレートの算出精度をさらに向上することができる。
In addition, this invention is not limited to the said embodiment, The following modifications are mentioned.
(1) In the above embodiment, the case where the baud rate is calculated based on the time count value obtained by measuring only the low level section in one frame included in the UART signal transmitted from the
(2)上記実施形態では、1フレーム内に開始ビット及び終了ビットを含むシリアル信号を送受信する通信部としてUARTインタフェース11を備える通信装置1を例示したが、1フレーム内に開始ビット及び終了ビットを含むようなシリアル信号を送受信するものであれば、他のインタフェースを用いても良い。また、UART信号のフォーマットは、図2に限定されるものではない。特に、通信接続の確立時に、通信相手装置2から通信装置1へ送信するUART信号における1フレーム内のローレベル区間は長い方が望ましい。
(2) In the above embodiment, the
1…通信装置、11…UARTインタフェース(通信部)、11a…設定レジスタ、12…外部割込回路(検出部)、13…タイマ(計時部)、14…CPU(Central Processing Unit:設定部)、2…通信相手装置、21…UARTインタフェース
DESCRIPTION OF
Claims (4)
通信相手装置から送信される前記シリアル信号に含まれる前記開始ビット及び前記終了ビットを検出する検出部と、
前記検出部にて前記開始ビットが検出された場合に計時動作を開始する一方、前記検出部にて前記終了ビットが検出された場合に前記計時動作を終了する計時部と、
前記計時部の計時結果に基づいてボーレートを算出し、当該算出したボーレートを前記通信部に設定する設定部と、
を備えることを特徴とする通信装置。 A communication unit for transmitting and receiving a serial signal including a start bit and an end bit in one frame;
A detection unit for detecting the start bit and the end bit included in the serial signal transmitted from a communication partner device;
A timing unit that starts a timing operation when the detection unit detects the start bit, and ends the timing operation when the detection unit detects the end bit;
A baud rate is calculated based on the time measurement result of the time measuring unit, and a setting unit that sets the calculated baud rate in the communication unit;
A communication apparatus comprising:
前記検出部は、前記シリアル信号の立下りエッジを前記開始ビットとして検出する一方、前記シリアル信号の立上がりエッジを前記終了ビットとして検出することを特徴とする請求項1記載の通信装置。 Within the one frame, the start bit interval is set to low level, the end bit interval is set to high level, and the interval between the start bit and the end bit is set to low level. When sent from the other device,
The communication device according to claim 1, wherein the detection unit detects a falling edge of the serial signal as the start bit, and detects a rising edge of the serial signal as the end bit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009245466A JP2011091742A (en) | 2009-10-26 | 2009-10-26 | Communication device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009245466A JP2011091742A (en) | 2009-10-26 | 2009-10-26 | Communication device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011091742A true JP2011091742A (en) | 2011-05-06 |
Family
ID=44109548
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009245466A Pending JP2011091742A (en) | 2009-10-26 | 2009-10-26 | Communication device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2011091742A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015064355A (en) * | 2013-09-25 | 2015-04-09 | ドクトル・ヨハネス・ハイデンハイン・ゲゼルシヤフト・ミツト・ベシユレンクテル・ハフツングDr. Johannes Heidenhain Gesellschaft Mitbeschrankter Haftung | Position measuring device, and method of inspecting operation clock signal |
US10673478B2 (en) | 2018-07-25 | 2020-06-02 | Kabushiki Kaisha Toshiba | Asynchronous communication device |
JP2020198514A (en) * | 2019-05-31 | 2020-12-10 | 株式会社富士通ゼネラル | Communication device, baud rate automatic setting method and communication system |
CN113557688A (en) * | 2019-04-24 | 2021-10-26 | 欧姆龙株式会社 | Serial data communication device |
-
2009
- 2009-10-26 JP JP2009245466A patent/JP2011091742A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015064355A (en) * | 2013-09-25 | 2015-04-09 | ドクトル・ヨハネス・ハイデンハイン・ゲゼルシヤフト・ミツト・ベシユレンクテル・ハフツングDr. Johannes Heidenhain Gesellschaft Mitbeschrankter Haftung | Position measuring device, and method of inspecting operation clock signal |
US10673478B2 (en) | 2018-07-25 | 2020-06-02 | Kabushiki Kaisha Toshiba | Asynchronous communication device |
CN113557688A (en) * | 2019-04-24 | 2021-10-26 | 欧姆龙株式会社 | Serial data communication device |
US11960432B2 (en) | 2019-04-24 | 2024-04-16 | Omron Corporation | Serial data communication device and serial data communication method |
JP2020198514A (en) * | 2019-05-31 | 2020-12-10 | 株式会社富士通ゼネラル | Communication device, baud rate automatic setting method and communication system |
JP7251324B2 (en) | 2019-05-31 | 2023-04-04 | 株式会社富士通ゼネラル | Communication device, automatic baud rate setting method, and communication system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102374869B1 (en) | Method and device for sensor synchronization | |
JP2015018564A5 (en) | ||
JP2017514230A5 (en) | ||
JP2011091742A (en) | Communication device | |
WO2014138581A1 (en) | Dynamic pause period calculation for serial data transmission | |
JP2011035473A (en) | Baud rate error detection circuit and baud rate error detection method | |
KR20150128658A (en) | Dithering circuit for serial data transmission | |
JP2009303178A (en) | Data receiver, method of receiving data, and data receiving program | |
CN103559164A (en) | Method and device for identifying serial port baud rate | |
CN110535621B (en) | Serial port communication baud rate correction device and correction method thereof | |
JP2007259233A (en) | Ber monitoring circuit | |
TWI581104B (en) | Host devices and methods for transmitting data | |
TWI782634B (en) | Chip baud rate detecting method and electronic device | |
JP2009118315A (en) | Communication system, transmitting device, receiving device, communication apparatus, semiconductor device, and communication scheme | |
JP2009130923A (en) | Packet communication system | |
JP2007259094A (en) | Serial communication device | |
CN107810495B (en) | UART with wire activity detector | |
JP2005333513A (en) | Communication system | |
JP2004328103A (en) | Error detector circuit | |
JP6163895B2 (en) | Receive clock extraction circuit | |
JP4157064B2 (en) | Synchronization start signal detection device, detection method thereof, and program thereof | |
JP2006332984A (en) | Communication system and communication method | |
JP2018152643A (en) | Data receiving circuit of start-stop synchronization serial data communication device | |
JP2005234943A (en) | Communication apparatus | |
JP4899884B2 (en) | Device having communication function and adjustment program |