JP2007259094A - Serial communication device - Google Patents

Serial communication device Download PDF

Info

Publication number
JP2007259094A
JP2007259094A JP2006081111A JP2006081111A JP2007259094A JP 2007259094 A JP2007259094 A JP 2007259094A JP 2006081111 A JP2006081111 A JP 2006081111A JP 2006081111 A JP2006081111 A JP 2006081111A JP 2007259094 A JP2007259094 A JP 2007259094A
Authority
JP
Japan
Prior art keywords
data
reception
baud rate
transmission
clock signal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006081111A
Other languages
Japanese (ja)
Inventor
Masahiro Kishi
岸  正弘
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Holdings 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 Fuji Electric Holdings Ltd filed Critical Fuji Electric Holdings Ltd
Priority to JP2006081111A priority Critical patent/JP2007259094A/en
Publication of JP2007259094A publication Critical patent/JP2007259094A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To enable reduction of both a communication time when transferring data and a transfer error occurrence frequency, by making it possible to properly adjust a baud rate according to a transmission data size, without transmitting/receiving a special command, and to reduce an initialization processing time by making unnecessary a series of operation for determining the baud rate. <P>SOLUTION: A start mark ST in the transfer data of a start-stop synchronization method is set to be a 2-bit alternating data. A detector 22 obtains a pulse width PW by measuring between a rise and a fall edge of the ST, a generator 23 generates a CK2 corresponding to the baud rate from the PW, and a reception controller 24 fetches the data from the CK2. A calculation setter 26 obtains an optimal baud rate corresponding to the size of a processing result data D4 in a data, and a generator 27 generates a CK3 corresponding to the optimal baud rate. A transmission controller 28 fetches D4 using CK3, and transmits the above ST with added stop mark thereafter. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、調歩同期方式でシリアル通信を行う際にボーレートを自動で調整することを可能としたシリアル通信装置に関する。   The present invention relates to a serial communication apparatus capable of automatically adjusting a baud rate when serial communication is performed in an asynchronous manner.

従来、複数の通信装置間でシリアル通信を行う場合、例えば、各通信装置が予め決められたボーレート(通信速度)で通信を行う構成や、送信側が受信側にボーレートを合わせる構成などがある。
例えば、マスタ装置と複数のスレーブ装置間で通信を行うシステムでは、前者の構成では、マスタ装置、各スレーブ装置の全てが予め決められたボーレートで通信を行う。後者の構成では、マスタ装置が複数のボーレートで順次スレーブ装置に対して問いかけを行い、返答があったボーレートをそのシステムのボーレートとする。つまり、スレーブ装置は自装置と同じボーレートでの問いかけ時に正しく受信することができ、この場合にマスタ装置ヘの返答が可能であり、スレーブ装置からの返答があったことでボーレートが決定されるようになっている。
Conventionally, when performing serial communication between a plurality of communication devices, there are, for example, a configuration in which each communication device performs communication at a predetermined baud rate (communication speed), a configuration in which a transmission side matches a baud rate with a reception side, and the like.
For example, in a system that communicates between a master device and a plurality of slave devices, in the former configuration, all of the master device and each slave device communicate at a predetermined baud rate. In the latter configuration, the master device sequentially asks the slave device at a plurality of baud rates, and the baud rate at which the response is made is used as the baud rate of the system. In other words, the slave device can receive correctly when making an inquiry at the same baud rate as its own device. In this case, a response to the master device is possible, and the baud rate is determined by the response from the slave device. It has become.

この種の従来のシリアル通信装置として、例えば特許文献1及び2に記載のものがある。これらは何れも特殊なATコマンドを送信側から受信側へ送信することによって、受信側がボーレートを把握し、この把握したボーレートで次からのデータを受信するようになっている。
特開2000−278356号公報 特開平10−294772号公報
As this type of conventional serial communication device, for example, there are those described in Patent Documents 1 and 2. In any of these, by transmitting a special AT command from the transmitting side to the receiving side, the receiving side grasps the baud rate and receives the next data at the grasped baud rate.
JP 2000-278356 A Japanese Patent Laid-Open No. 10-294772

しかし、従来のシリアル通信装置では、次のような問題があった。各通信装置が予め決められたボーレートで通信を行う構成の場合、固定のボーレートでなければ通信することができない。ボーレートを固定した場合、送信データサイズに応じてボーレートを調整することは不可能であり、また、送信データサイズが増大した場合に通信時間が長くなり、更に、固定ボーレートが高速通信レートである場合は転送エラーの発生頻度が高くなる。   However, the conventional serial communication device has the following problems. In a configuration in which each communication device performs communication at a predetermined baud rate, communication is not possible unless the baud rate is fixed. When the baud rate is fixed, it is impossible to adjust the baud rate according to the transmission data size, and when the transmission data size increases, the communication time becomes longer. Furthermore, the fixed baud rate is a high-speed communication rate. The frequency of occurrence of transfer errors increases.

次に、送信側が受信側にボーレートを合わせる構成の場合、ボーレート決定のために送受信側で一連の動作が必要となるので初期化処理に時間が掛かる。
上記特許文献1及び2においては、特殊なATコマンドを送受信してボーレートを把握する構成をとっているので、そのための余計な構成が必要となる。
本発明は、このような課題に鑑みてなされたものであり、特殊なコマンドを送受信することなしに、送信データサイズに応じてボーレートを適正に調整可能とすることによって、データ転送時の通信時間を短縮することができると共に転送エラーの発生頻度を低くすることができ、更に、ボーレート決定のための一連の動作を不要として初期化処理の時間を短縮するができるシリアル通信装置を提供することを目的としている。
Next, in a configuration in which the transmission side matches the baud rate with the reception side, a series of operations are required on the transmission / reception side to determine the baud rate, so that initialization processing takes time.
In Patent Documents 1 and 2 described above, a special AT command is transmitted and received to grasp the baud rate, so that an extra configuration for that is required.
The present invention has been made in view of such problems, and enables communication time during data transfer by appropriately adjusting the baud rate according to the transmission data size without transmitting / receiving special commands. And a serial communication device that can reduce the frequency of occurrence of transfer errors and can reduce the initialization processing time by eliminating the need for a series of operations for determining the baud rate. It is aimed.

上記目的を達成するために、本発明の請求項1によるシリアル通信装置は、スタートマーク部、データ部及びストップマーク部の順にフォーマット構成された送受信用のデータを用いる調歩同期方式でシリアル通信を行うシリアル通信装置において、前記スタートマーク部が2ビットの交番データとされた受信データにおける前記交番データの立下り及び立上りエッジ間を計測してパルス幅を求めるパルス幅検出手段と、前記パルス幅を用いて得られる通信速度に対応した周波数の受信クロック信号を生成する受信クロック生成手段と、前記受信クロック信号により受信データを取り込んで前記データ部を得る受信制御手段と、前記受信制御手段で得られたデータ部の処理結果であるデータのサイズを検出し、このサイズのデータをシリアル送信するに最適な通信速度を求める演算手段と、前記最適な通信速度に対応した周波数の送信クロック信号を生成する送信クロック生成手段と、前記送信クロック信号によって前記処理結果であるデータを取り込み、このデータの前に前記2ビットの交番データ構成のスタートマーク部を付加し、後にストップマーク部を付加して通信相手へ送信する送信制御手段とを備えたことを特徴とする。   To achieve the above object, a serial communication apparatus according to claim 1 of the present invention performs serial communication in an asynchronous manner using transmission / reception data formatted in the order of a start mark portion, a data portion, and a stop mark portion. In a serial communication device, pulse width detection means for measuring a pulse width by measuring a falling edge and a rising edge of the alternating data in received data in which the start mark portion is 2-bit alternating data, and using the pulse width A reception clock generation means for generating a reception clock signal having a frequency corresponding to the communication speed obtained in this manner, a reception control means for obtaining the data part by taking reception data by the reception clock signal, and the reception control means. Detects the data size that is the processing result of the data part, and serializes this size data A calculation means for obtaining an optimum communication speed for transmission, a transmission clock generation means for generating a transmission clock signal having a frequency corresponding to the optimum communication speed, and taking in the data as the processing result by the transmission clock signal. And a transmission control means for adding a start mark portion of the alternating data structure of 2 bits before data and adding a stop mark portion after the data and transmitting to the communication partner.

この構成によれば、従来のような特殊なATコマンドを送受信することなしに、送信データサイズに応じて通信速度を最適に調整可能とすることができる。これによって、データ転送時の通信時間を短縮することができると共に転送エラーの発生頻度を低くすることができる。更に、受信データのパルス幅を計測して通信速度に対応した周波数の受信クロック信号を生成してデータ受信を行うようにしたので、ボーレート決定のための一連の動作が不要となり、これによって従来のような初期化処理の時間を短縮するができる。   According to this configuration, it is possible to optimally adjust the communication speed according to the transmission data size without transmitting / receiving a special AT command as in the prior art. As a result, the communication time during data transfer can be shortened and the frequency of occurrence of transfer errors can be reduced. Furthermore, since the received data is received by measuring the pulse width of the received data and generating a reception clock signal having a frequency corresponding to the communication speed, a series of operations for determining the baud rate becomes unnecessary, thereby Such initialization processing time can be shortened.

また、本発明の請求項2によるシリアル通信装置は、請求項1において、前記送信制御手段は、前記スタートマーク部を2ビットを超える交番データとすることを特徴とする。
この構成によれば、パルス幅検出手段でパルス幅を計測する精度を更に高めることができるので、その分、受信データの通信速度も高精度に求めることができる。
The serial communication device according to claim 2 of the present invention is characterized in that, in claim 1, the transmission control means uses the start mark portion as alternating data exceeding 2 bits.
According to this configuration, the accuracy of measuring the pulse width by the pulse width detecting means can be further increased, and accordingly, the communication speed of the received data can be obtained with high accuracy.

以上説明したように本発明によれば、特殊なコマンドを送受信することなしに、送信データサイズに応じてボーレートを適正に調整可能とすることによって、データ転送時の通信時間を短縮することができると共に転送エラーの発生頻度を低くすることができ、更に、ボーレート決定のための一連の動作を不要として初期化処理の時間を短縮するができるという効果がある。   As described above, according to the present invention, the communication time during data transfer can be shortened by making it possible to appropriately adjust the baud rate according to the transmission data size without transmitting / receiving special commands. At the same time, the frequency of occurrence of transfer errors can be reduced, and further, a series of operations for determining the baud rate is unnecessary, and the initialization processing time can be shortened.

以下、本発明の実施の形態を、図面を参照して説明する。
図1は、本発明の実施の形態に係るシリアル通信装置をマスタ装置及び複数のスレーブ装置に適用した通信システムの構成を示すブロック図である。
図1に示す通信システムは、マスタ装置11と、第1〜第nのスレーブ装置12−1〜12−nとがシリアル通信回線13により接続されて構成されている。
シリアル通信回線13は、半2重、全2重通信用のものがあるが、ここでは送信データ用及び受信データ用の2本で構成される全2重回線であるとする。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing a configuration of a communication system in which a serial communication device according to an embodiment of the present invention is applied to a master device and a plurality of slave devices.
The communication system shown in FIG. 1 is configured by connecting a master device 11 and first to nth slave devices 12-1 to 12-n via a serial communication line 13.
There are serial communication lines 13 for half-duplex and full-duplex communication. Here, it is assumed that the serial communication line 13 is a full-duplex line composed of two lines for transmission data and reception data.

マスタ装置11及び各スレーブ装置12−1〜12−nは、図2に示すシリアル通信装置20を備えている。シリアル通信装置20は、受信バッファ21と、パルス幅検出部(パルス幅検出手段)22と、受信クロック生成部(受信クロック生成手段)23と、受信制御部(受信制御手段)24と、データ処理部25と、分周率演算設定部(演算手段)26と、送信クロック生成部(送信クロック生成手段)27と、送信制御部(送信制御手段)28とを備えて構成されている。受信制御部24は、スタートマーク除去部24a、データ部24b及びストップマーク除去部24cを有し、送信制御部28は、スタートマーク付加部28a、データ部28b及びストップマーク付加部28cを有する。   Each of the master device 11 and each of the slave devices 12-1 to 12-n includes a serial communication device 20 shown in FIG. The serial communication device 20 includes a reception buffer 21, a pulse width detection unit (pulse width detection unit) 22, a reception clock generation unit (reception clock generation unit) 23, a reception control unit (reception control unit) 24, and data processing. A unit 25, a division ratio calculation setting unit (calculation unit) 26, a transmission clock generation unit (transmission clock generation unit) 27, and a transmission control unit (transmission control unit) 28 are configured. The reception control unit 24 includes a start mark removal unit 24a, a data unit 24b, and a stop mark removal unit 24c, and the transmission control unit 28 includes a start mark addition unit 28a, a data unit 28b, and a stop mark addition unit 28c.

このシリアル通信装置20でシリアル通信回線13を介して受信される通信相手側からのデータ(受信データ)D1と、本シリアル通信装置20から通信相手側へ送信されるデータ(送信データ)D2とは、図3に示すフォーマット構成となっている。なお、受信データD1と送信データD2とを区別成しにシリアル転送データと表現する場合もある。
即ち、シリアル転送データは、通常、調歩同期方式でシリアル通信を行う際に使用される信号フォーマットと同じであり、転送の始まりを表すスタートマーク部STと、データ部DAと、転送の終わりを表すストップマーク部SPとが、この順に配列されて構成されている。
Data (received data) D1 from the communication partner side received via the serial communication line 13 by the serial communication device 20 and data (transmission data) D2 transmitted from the serial communication device 20 to the communication partner side are: The format configuration shown in FIG. In some cases, the received data D1 and the transmitted data D2 are expressed as serial transfer data to distinguish them.
That is, the serial transfer data is usually the same as the signal format used when serial communication is performed in an asynchronous manner, and represents the start mark portion ST indicating the start of transfer, the data portion DA, and the end of transfer. Stop mark portions SP are arranged in this order.

この特徴は、スタートマーク部STを「0」及び「1」の2ビットとした点にある。これは後述で説明するように、スタートマーク部STから立下りエッジe1と立上りエッジe2とを検出してパルス幅PWを計測するためのパターン構成である。この2ビットパターンは最小パターンであり、更に精度を高める必要がある場合、「0」と「1」の繰り返しを長くしてもよい。この特徴構成のスタートマーク部STは、後述する送信制御部28にて付加されるようになっている。   This feature is that the start mark portion ST has two bits of “0” and “1”. As will be described later, this is a pattern configuration for detecting the falling edge e1 and the rising edge e2 from the start mark portion ST and measuring the pulse width PW. This 2-bit pattern is the minimum pattern, and when it is necessary to further improve the accuracy, the repetition of “0” and “1” may be lengthened. The start mark portion ST having this characteristic configuration is added by a transmission control unit 28 described later.

受信バッファ21は、FiFo(First-In First-Out)メモリ等が用いられ、受信データD1のスタートマーク部STを検出してパルス幅PWを計測するために必要なバッファサイズを備え、基本クロック信号CK1によって受信データD1を順次バッファリングする。但し、バッファサイズとしては、通信時に使用されるボーレートの中で最も遅いボーレートにおけるスタートマーク部STの長さ分とする。   The reception buffer 21 uses a first-in first-out (FiFo) memory, has a buffer size necessary for detecting the start mark portion ST of the reception data D1 and measuring the pulse width PW, and has a basic clock signal. The received data D1 is sequentially buffered by CK1. However, the buffer size is the length of the start mark ST at the slowest baud rate used during communication.

但し、基本クロック信号CK1の周波数は、通信の安定度を考え、通信時に使用されるボーレートの中で最も速いボーレートの数百倍程度が望ましい。
パルス幅検出部22は、基本クロック信号CK1によって受信データD1を取り込み、この受信データD1に含まれるスタートマーク部STのパルス幅PWを、次のように計測する。立下りエッジe1と立上りエッジe2とを抽出し、これらのエッジe1とe2との間隔をカウンタ等で計測することでパルス幅PWを求め、これを受信クロック生成部23へ出力する。つまり、立下りエッジe1と立上りエッジe2とを抽出してパルス幅PWを求めるために、スタートマーク部STが「0」と「1」の2ビット構成とされている。
However, the frequency of the basic clock signal CK1 is preferably about several hundred times the fastest baud rate among the baud rates used during communication in consideration of communication stability.
The pulse width detection unit 22 takes in the reception data D1 by the basic clock signal CK1, and measures the pulse width PW of the start mark portion ST included in the reception data D1 as follows. The falling edge e1 and the rising edge e2 are extracted, and the pulse width PW is obtained by measuring the interval between the edges e1 and e2 with a counter or the like, and this is output to the reception clock generator 23. That is, in order to extract the falling edge e1 and the rising edge e2 and obtain the pulse width PW, the start mark portion ST has a 2-bit configuration of “0” and “1”.

受信クロック生成部23は、パルス幅PWを用いて基本クロック信号CK1を分周して受信クロック信号CK2を、次のように生成する。これは、調歩同期通信において1ビットデータ幅はボーレートのX倍とされているが、その1ビットデータ幅のボーレートの倍率Xでパルス幅PWを割り(PW/X)、この結果Nを分母としたN分の1を分周率1/Nとする。そして、その分周率1/Nで基本クロック信号CK1を分周し、これを受信クロック信号CK2として受信制御部24へ出力する。   The reception clock generator 23 divides the basic clock signal CK1 using the pulse width PW to generate the reception clock signal CK2 as follows. In asynchronous communication, the 1-bit data width is X times the baud rate, but the pulse width PW is divided by the magnification X of the baud rate of the 1-bit data width (PW / X). As a result, N is used as the denominator. 1 / N is the division ratio 1 / N. Then, the basic clock signal CK1 is divided by the division ratio 1 / N, and this is output to the reception control unit 24 as the reception clock signal CK2.

例えば、パルス幅PWが「112」であったとすると、調歩同期通信においては1ビットデータ幅がボーレートの16倍なので、112/16=7となって、分周率の1/7が求められる。従って、基本クロック信号CK1が1/7分周され、この分周によって受信クロック信号CK2が得られる。
但し、基本クロック信号CK1を20MHzとした場合、分周率1/Nは次の(1)〜(5)のようになる。
For example, if the pulse width PW is “112”, since the 1-bit data width is 16 times the baud rate in asynchronous communication, 112/16 = 7, and 1/7 of the division ratio is obtained. Therefore, the basic clock signal CK1 is divided by 1/7, and the reception clock signal CK2 is obtained by this division.
However, when the basic clock signal CK1 is 20 MHz, the frequency division ratio 1 / N is as shown in the following (1) to (5).

(1)受信データD1のボーレートが5Kbps時、スタートマーク部STのパルス幅PWは20M/5K=4000となるので、4000/16=250となって、分周率が1/250となる。
(2)受信データD1のボーレートが10Kbps時、スタートマーク部STのパルス幅PWは20M/10K=2000となるので、2000/16=125となって、分周率が1/125となる。
(1) When the baud rate of the received data D1 is 5 Kbps, the pulse width PW of the start mark portion ST is 20M / 5K = 4000, so 4000/16 = 250, and the division ratio is 1/250.
(2) When the baud rate of the received data D1 is 10 Kbps, the pulse width PW of the start mark portion ST is 20M / 10K = 2000, so 2000/16 = 125, and the division ratio is 1/125.

(3)受信データD1のボーレートが20Kbps時、スタートマーク部STのパルス幅PWは20M/20K=1000となるので、1000/16=62となって、分周率が1/62となる。
(4)受信データD1のボーレートが40Kbps時、スタートマーク部STのパルス幅PWは20M/40K=500となるので、500/16=31となって、分周率が1/31となる。
(3) When the baud rate of the reception data D1 is 20 Kbps, the pulse width PW of the start mark portion ST is 20M / 20K = 1000, so 1000/16 = 62 and the frequency division ratio is 1/62.
(4) When the baud rate of the reception data D1 is 40 Kbps, the pulse width PW of the start mark portion ST is 20M / 40K = 500, so 500/16 = 31, and the division ratio is 1/31.

(5)受信データD1のボーレートが80Kbps時、スタートマーク部STのパルス幅PWは20M/80K=250となるので、250/16=15となって、分周率が1/15となる。
受信制御部24は、受信クロック信号CK2によって受信バッファ21から受信データD1を取り込み、スタートマーク除去部24aでスタートマーク部STを除去し、ストップマーク除去部24cでストップマーク部SPを除去し、更にデータ部24bでデータ部DAを入力データD3としてデータ処理部25に入力する。
(5) When the baud rate of the received data D1 is 80 Kbps, the pulse width PW of the start mark portion ST is 20M / 80K = 250, so 250/16 = 15, and the division ratio is 1/15.
The reception control unit 24 takes in the reception data D1 from the reception buffer 21 by the reception clock signal CK2, removes the start mark part ST by the start mark removal unit 24a, removes the stop mark part SP by the stop mark removal unit 24c, and The data part DA is input to the data processing part 25 as the input data D3 by the data part 24b.

データ処理部25は、入力データD3を取り込んで所定の処理を行い、この処理結果のデータを出力データD4として、分周率演算設定部26及び送信制御部28へ出力する。
分周率演算設定部26は、出力データD4を保持し、この保持されたデータサイズのデータをシリアル通信回線13を介して通信相手へ送信するに最適なボーレートを求め、更に、基本クロック信号CK1を、その最適ボーレートでデータを送信する周波数に分周するための分周率1/Mを求め、これを設定して送信クロック生成部27へ出力する。
The data processing unit 25 takes in the input data D3, performs predetermined processing, and outputs the data of the processing result to the frequency division calculation setting unit 26 and the transmission control unit 28 as output data D4.
The division ratio calculation setting unit 26 holds the output data D4, obtains the optimum baud rate for transmitting the data of the held data size to the communication partner via the serial communication line 13, and further, the basic clock signal CK1. The frequency division ratio 1 / M for dividing the data to the frequency at which the data is transmitted at the optimum baud rate is obtained, set and output to the transmission clock generation unit 27.

送信クロック生成部27は、その分周率1/Mで基本クロック信号CK1を分周し、これを送信クロック信号CK3として送信制御部28へ出力する。
送信制御部28は、送信クロック信号CK3によって出力データD4をデータ部28bに取り込み、この取り込まれたデータ部DA(=D4)にスタートマーク付加部28aでスタートマーク部STを付加し、ストップマーク付加部28cでストップマーク部SPを付加し、これを送信データD2としてシリアル通信回線13を介して通信相手へ送信する。
The transmission clock generation unit 27 divides the basic clock signal CK1 by the division ratio 1 / M, and outputs this to the transmission control unit 28 as the transmission clock signal CK3.
The transmission control unit 28 captures the output data D4 in the data unit 28b by the transmission clock signal CK3, adds the start mark unit ST to the captured data unit DA (= D4) by the start mark appending unit 28a, and adds the stop mark. The stop mark part SP is added by the part 28c, and this is transmitted as transmission data D2 to the communication partner via the serial communication line 13.

このような構成のシリアル通信装置20が適用されたマスタ装置11と各スレーブ装置12−1〜12−n間のシリアル通信動作を、図4に示すフローチャートを参照して説明する。但し、マスタ装置11と第1のスレーブ装置12−1間の動作を説明する。また、第1のスレーブ装置12−1の基本クロック信号CK1の周波数は20MHzであるとする。   A serial communication operation between the master device 11 to which the serial communication device 20 having such a configuration is applied and each of the slave devices 12-1 to 12-n will be described with reference to a flowchart shown in FIG. However, the operation between the master device 11 and the first slave device 12-1 will be described. Further, it is assumed that the frequency of the basic clock signal CK1 of the first slave device 12-1 is 20 MHz.

ステップS1において、マスタ装置11からデータD1が20Kbpsのボーレートでシリアル通信回線13を介して第1のスレーブ装置12−1へ送信されたとする。
ステップS2において、第1のスレーブ装置12−1の受信バッファ21にて、そのマスタ装置11からのデータD1が基本クロック信号CK1によって順次取り込まれてバッファリングされる。
In step S1, it is assumed that the data D1 is transmitted from the master device 11 to the first slave device 12-1 via the serial communication line 13 at a baud rate of 20 Kbps.
In step S2, the data D1 from the master device 11 is sequentially fetched by the basic clock signal CK1 and buffered in the reception buffer 21 of the first slave device 12-1.

ステップS3において、そのバッファリング動作と同時に、パルス幅検出部22で、基本クロック信号CK1によって受信データD1が取り込まれ、この受信データD1のスタートマーク部STの立下りエッジe1と立上りエッジe2とが抽出され、これらエッジe1とe2の間隔がカウンタで計測されることによってパルス幅PW=「1000」が求められる。このパルス幅「1000」は受信クロック生成部23へ出力される。   In step S3, simultaneously with the buffering operation, the pulse width detector 22 receives the reception data D1 by the basic clock signal CK1, and the falling edge e1 and the rising edge e2 of the start mark portion ST of the reception data D1 are detected. The pulse width PW = “1000” is obtained by extracting and measuring the interval between the edges e1 and e2 with a counter. This pulse width “1000” is output to the reception clock generator 23.

ステップS4において、受信クロック生成部23で、そのパルス幅「1000」が1ビットデータ幅のボーレートの倍率「16」で除算され、この結果「62」が分母とされた分周率1/62で、20MHzの基本クロック信号CK1が分周され、これが受信クロック信号CK2として受信制御部24へ出力される。
ステップS5において、受信制御部24で、その受信クロック信号CK2によって受信バッファ21からの受信データD1が取り込まれ、スタートマーク除去部24aでスタートマーク部STが除去、ストップマーク除去部24cでストップマーク部SPが除去され、この除去後に、データ部24bからデータ部DAが入力データD3としてデータ処理部25へ出力される。
In step S4, the reception clock generation unit 23 divides the pulse width “1000” by the baud rate magnification “16” of the 1-bit data width, and the result “62” is the division ratio 1/62. , The 20 MHz basic clock signal CK1 is frequency-divided and output to the reception control unit 24 as the reception clock signal CK2.
In step S5, the reception control unit 24 takes in the reception data D1 from the reception buffer 21 by the reception clock signal CK2, removes the start mark part ST by the start mark removal part 24a, and stops the mark part by the stop mark removal part 24c. The SP is removed, and after this removal, the data part DA is output from the data part 24b to the data processing part 25 as input data D3.

ステップS6において、データ処理部25で、入力データD3が取り込まれた後、所定の処理が行われ、この処理結果のデータが出力データD4として、分周率演算設定部26及び送信制御部28へ出力される。
ステップS7において、分周率演算設定部26で、出力データD4が保持され、この保持されたデータサイズのデータをシリアル通信回線13を介して通信相手であるマスタ装置11へ送信するに最適なボーレート(例えば10KHz)が求められる。更に、20MHzの基本クロック信号CK1を、その最適ボーレート10KHzでデータ送信する周波数に分周するための分周率「1/125」が求められ、これが設定されて送信クロック生成部27へ出力される。
In step S6, after the input data D3 is taken in by the data processing unit 25, a predetermined process is performed, and the data of the processing result is output as the output data D4 to the division ratio calculation setting unit 26 and the transmission control unit 28. Is output.
In step S 7, the output data D 4 is held in the division ratio calculation setting unit 26, and the baud rate optimal for transmitting the data having the held data size to the master device 11 as the communication partner via the serial communication line 13. (For example, 10 KHz) is required. Further, a division ratio “1/125” for dividing the 20 MHz basic clock signal CK1 to a frequency for transmitting data at the optimum baud rate of 10 KHz is obtained, and this is set and output to the transmission clock generation unit 27. .

ステップS8において、送信クロック生成部27で、その分周率「1/125」で基本クロック信号CK1が分周され、これが送信クロック信号CK3として送信制御部28へ出力される。
ステップS9において、送信制御部28で、送信クロック信号CK3によって出力データD4がデータ部28bに取り込まれ、この取り込まれたデータ部DA(=D4)にスタートマーク付加部28aでスタートマーク部STが付加され、ストップマーク付加部28cでストップマーク部SPが付加され、これが送信データD2として10Kbpsのボーレートでシリアル通信回線13を介してマスタ装置11へ送信される。
In step S8, the transmission clock generator 27 divides the basic clock signal CK1 by the frequency division ratio “1/125”, and outputs this to the transmission controller 28 as the transmission clock signal CK3.
In step S9, the transmission control unit 28 takes the output data D4 into the data unit 28b by the transmission clock signal CK3, and the start mark adding unit 28a adds the start mark unit ST to the fetched data unit DA (= D4). Then, the stop mark adding portion 28c adds the stop mark portion SP, which is transmitted as transmission data D2 to the master device 11 through the serial communication line 13 at a baud rate of 10 Kbps.

このように、本実施の形態のシリアル通信装置20をマスタ装置11及び各スレーブ装置12−1〜12−nに用いることによって、従来のような特殊なATコマンドを送受信することなしに、送信データサイズに応じてボーレートを最適に調整可能とすることができる。これによって、データ転送時の通信時間を短縮することができると共に転送エラーの発生頻度を低くすることができる。更に、受信データのパルス幅PWを計測してボーレートに対応した周波数の受信クロック信号CK2を生成してデータ受信を行うようにしたので、ボーレート決定のための一連の動作が不要となり、これによって従来のような初期化処理の時間を短縮するができる。   In this way, by using the serial communication device 20 of the present embodiment for the master device 11 and the slave devices 12-1 to 12-n, transmission data can be transmitted without transmitting / receiving special AT commands as in the prior art. The baud rate can be adjusted optimally according to the size. As a result, the communication time during data transfer can be shortened and the frequency of occurrence of transfer errors can be reduced. Further, since the reception clock signal CK2 having a frequency corresponding to the baud rate is generated by measuring the pulse width PW of the reception data and the data reception is performed, a series of operations for determining the baud rate becomes unnecessary, thereby It is possible to shorten the initialization processing time.

本発明の実施の形態に係るシリアル通信装置をマスタ装置及び複数のスレーブ装置に適用した通信システムの構成を示すブロック図である。1 is a block diagram showing a configuration of a communication system in which a serial communication device according to an embodiment of the present invention is applied to a master device and a plurality of slave devices. 上記シリアル通信装置の構成を示すブロック図である。It is a block diagram which shows the structure of the said serial communication apparatus. 上記シリアル通信装置で送受信されるデータのフォーマット構成図である。It is a format block diagram of the data transmitted / received by the said serial communication apparatus. 上記シリアル通信装置が適用されたマスタ装置と各スレーブ装置間のシリアル通信動作を説明するためのフローチャートである。It is a flowchart for demonstrating the serial communication operation | movement between the master apparatus with which the said serial communication apparatus was applied, and each slave apparatus.

符号の説明Explanation of symbols

11 マスタ装置
12−1〜12−n スレーブ装置
13 シリアル通信回線
20 シリアル通信装置
21 受信バッファ
22 パルス幅検出部
23 受信クロック生成部
24 受信制御部
24a スタートマーク除去部
24b データ部
24c ストップマーク除去部
25 データ処理部
26 分周率演算設定部
27 送信クロック生成部
28 送信制御部
28a スタートマーク付加部
28b データ部
28c ストップマーク付加部
D1 受信データ
D2 送信データ
D3 入力データ
D4 出力データ
CK1 基本クロック信号
CK2 受信クロック信号
CK3 送信クロック信号
PW パルス幅
1/N,1/M 分周率
X 1ビットデータ幅のボーレートの倍率
DESCRIPTION OF SYMBOLS 11 Master apparatus 12-1 to 12-n Slave apparatus 13 Serial communication line 20 Serial communication apparatus 21 Reception buffer 22 Pulse width detection part 23 Reception clock generation part 24 Reception control part 24a Start mark removal part 24b Data part 24c Stop mark removal part 25 data processing unit 26 division ratio calculation setting unit 27 transmission clock generation unit 28 transmission control unit 28a start mark addition unit 28b data unit 28c stop mark addition unit D1 reception data D2 transmission data D3 input data D4 output data CK1 basic clock signal CK2 Receive clock signal CK3 Transmit clock signal PW Pulse width 1 / N, 1 / M Divide ratio X 1-bit data width baud rate multiplier

Claims (2)

スタートマーク部、データ部及びストップマーク部の順にフォーマット構成された送受信用のデータを用いる調歩同期方式でシリアル通信を行うシリアル通信装置において、
前記スタートマーク部が2ビットの交番データとされた受信データにおける前記交番データの立下り及び立上りエッジ間を計測してパルス幅を求めるパルス幅検出手段と、
前記パルス幅を用いて得られる通信速度に対応した周波数の受信クロック信号を生成する受信クロック生成手段と、
前記受信クロック信号により受信データを取り込んで前記データ部を得る受信制御手段と、
前記受信制御手段で得られたデータ部の処理結果であるデータのサイズを検出し、このサイズのデータをシリアル送信するに最適な通信速度を求める演算手段と、
前記最適な通信速度に対応した周波数の送信クロック信号を生成する送信クロック生成手段と、
前記送信クロック信号によって前記処理結果であるデータを取り込み、このデータの前に前記2ビットの交番データ構成のスタートマーク部を付加し、後にストップマーク部を付加して通信相手へ送信する送信制御手段と
を備えたことを特徴とするシリアル通信装置。
In a serial communication device that performs serial communication in an asynchronous manner using data for transmission / reception formatted in the order of a start mark portion, a data portion, and a stop mark portion,
Pulse width detection means for measuring a pulse width by measuring a falling edge and a rising edge of the alternating data in the reception data in which the start mark portion is 2-bit alternating data;
A reception clock generating means for generating a reception clock signal having a frequency corresponding to a communication speed obtained using the pulse width;
A reception control means for obtaining the data part by receiving the reception data by the reception clock signal;
Calculating means for detecting the size of the data which is the processing result of the data part obtained by the reception control means, and obtaining an optimum communication speed for serial transmission of data of this size;
Transmission clock generation means for generating a transmission clock signal having a frequency corresponding to the optimum communication speed;
Transmission control means for fetching data as a result of the processing by the transmission clock signal, adding a start mark portion of the two-bit alternating data structure before the data, and adding a stop mark portion after the data and transmitting it to the communication partner And a serial communication device comprising:
前記送信制御手段は、前記スタートマーク部を2ビットを超える交番データとすることを特徴とする請求項1に記載のシリアル通信装置。   2. The serial communication apparatus according to claim 1, wherein the transmission control means uses the start mark portion as alternating data having more than 2 bits.
JP2006081111A 2006-03-23 2006-03-23 Serial communication device Pending JP2007259094A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006081111A JP2007259094A (en) 2006-03-23 2006-03-23 Serial communication device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006081111A JP2007259094A (en) 2006-03-23 2006-03-23 Serial communication device

Publications (1)

Publication Number Publication Date
JP2007259094A true JP2007259094A (en) 2007-10-04

Family

ID=38632877

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006081111A Pending JP2007259094A (en) 2006-03-23 2006-03-23 Serial communication device

Country Status (1)

Country Link
JP (1) JP2007259094A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009272964A (en) * 2008-05-08 2009-11-19 Seiko Epson Corp Communication system, host, client, phone body of cellular phone, battery and communication method
US8654377B2 (en) 2008-11-20 2014-02-18 Sony Corporation Data communication device, communication control method, and program
JPWO2020003393A1 (en) * 2018-06-27 2021-02-25 株式会社Fuji Logic analyzer

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009272964A (en) * 2008-05-08 2009-11-19 Seiko Epson Corp Communication system, host, client, phone body of cellular phone, battery and communication method
US8654377B2 (en) 2008-11-20 2014-02-18 Sony Corporation Data communication device, communication control method, and program
JPWO2020003393A1 (en) * 2018-06-27 2021-02-25 株式会社Fuji Logic analyzer
JP7082197B2 (en) 2018-06-27 2022-06-07 株式会社Fuji Logic analyzer

Similar Documents

Publication Publication Date Title
JP6449518B2 (en) Low speed bus time stamp method and circuit
KR20100083766A (en) Serial data communication system and serial data communication method
US8842793B2 (en) Communication circuit and method of adjusting sampling clock signal
JP5794352B2 (en) Receiving device and method for detecting number of same-value bits in received bit string
KR20180082359A (en) Synchronization mechanism for high speed sensor interface
JP2011035473A (en) Baud rate error detection circuit and baud rate error detection method
TWI438605B (en) Method and device for aligning multi - channel data in transmission system
KR20180008748A (en) Method and apparatus for sensor synchronization
CN103891194B (en) Transmitting measured values equipment
JP2007282093A (en) Apparatus and method for clock signal generation
US20130287075A1 (en) Communication interface device
JP2007259094A (en) Serial communication device
JP4582932B2 (en) Synchronous correction circuit
JP6348163B2 (en) Control device and control system
JP4363444B2 (en) network
US20130016762A1 (en) Data communication system, method of optimizing preamble length, and communication apparatus
JP6583549B2 (en) COMMUNICATION DEVICE, COMMUNICATION SYSTEM, COMMUNICATION METHOD, AND COMMUNICATION PROGRAM
JP2007115036A (en) Asynchronous transfer device and asynchronous transfer method
JP2012160992A (en) Clock synchronous serial communication device and communication control method thereof
JP5383856B2 (en) Transmitter circuit
JP2008186185A (en) Serial data transmission method and system therefor
KR101212468B1 (en) Method and apparatus for synchronizing time
JP6360578B1 (en) Deskew circuit and deskew method
JP2008236178A (en) Serial data receiving circuit
JP5950049B2 (en) Reception circuit, transmission circuit, information processing apparatus, system, and transmission method

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20080201