JP2015170199A - communication system - Google Patents
communication system Download PDFInfo
- Publication number
- JP2015170199A JP2015170199A JP2014045411A JP2014045411A JP2015170199A JP 2015170199 A JP2015170199 A JP 2015170199A JP 2014045411 A JP2014045411 A JP 2014045411A JP 2014045411 A JP2014045411 A JP 2014045411A JP 2015170199 A JP2015170199 A JP 2015170199A
- Authority
- JP
- Japan
- Prior art keywords
- slave
- data
- communication
- host device
- slave select
- 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
Landscapes
- Bus Control (AREA)
- Information Transfer Systems (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
Description
本発明は、1つのホストデバイスと複数のスレーブデバイスとの間で、クロック同期式シリアル通信を行う通信システムに関する。 The present invention relates to a communication system that performs clock synchronous serial communication between one host device and a plurality of slave devices.
従来より、1つのホストデバイスと複数のスレーブデバイスとの間でシリアル通信を行う通信方式として、SPI(Serial Peripheral Interface)などに代表されるクロック同期式シリアルデータ通信方式が知られている。この通信方式における、一般的な通信手順を説明すると、まず、ホストデバイスが、通信対象となるスレーブデバイスに、アクティブレベル(通常、Lowレベル)のスレーブセレクト信号を出力して、通信対象として選択する。次いで、ホストデバイスが、クロック信号を送信しつつ、そのクロック信号の立上りエッジ又は立下りエッジに同期するタイミングで、選択したスレーブデバイスに送信すべき送信データを出力する。一方、選択されたスレーブデバイスも、クロック信号に同期するタイミングで、ホストデバイスにて受信されるべき受信データを出力する。このようにして、ホストデバイスとスレーブデバイス間で、クロックに同期してデータの送受信が実行される。そして、すべてのデータの送受信が終了すると、ホストデバイスがスレーブセレクト信号を非アクティブレベルにし、通信を終了させる。 Conventionally, a clock synchronous serial data communication system represented by SPI (Serial Peripheral Interface) or the like is known as a communication system for performing serial communication between one host device and a plurality of slave devices. A general communication procedure in this communication method will be described. First, a host device outputs a slave select signal of an active level (usually, a low level) to a slave device to be a communication target, and selects it as a communication target. . Next, the host device outputs transmission data to be transmitted to the selected slave device at the timing synchronized with the rising edge or falling edge of the clock signal while transmitting the clock signal. On the other hand, the selected slave device also outputs received data to be received by the host device at a timing synchronized with the clock signal. In this manner, data transmission / reception is executed in synchronization with the clock between the host device and the slave device. When transmission / reception of all data is completed, the host device sets the slave select signal to an inactive level and terminates communication.
上述したように、従来は、スレーブセレクト信号をアクティブレベルとすることにより、通信対象となるスレーブデバイスを選択していた。そのため、ホストデバイスと、複数のスレーブデバイスとを、それぞれ独立した信号線によって接続する必要があった。その結果、ホストデバイスは、多数のスレーブセレクト端子(SS端子)を持つ必要があり、SS端子数の増加が1つの課題となっていた。 As described above, conventionally, the slave device to be communicated is selected by setting the slave select signal to the active level. Therefore, it is necessary to connect the host device and the plurality of slave devices by independent signal lines. As a result, the host device needs to have a large number of slave select terminals (SS terminals), and an increase in the number of SS terminals has been one problem.
さらに、多数のSS端子を持つことに起因して、SS端子と各スレーブデバイスとの誤接続、SS端子同士のショート、あるいはアクティブレベルに相当する電位へのショートなどが発生する虞があった。万一、いずれかの事象が実際に発生してしまうと、通信対象ではないスレーブデバイスとの通信が成立してしまい、そのスレーブデバイスが意図しない振る舞いをしてしまう可能性が生じるという問題があった。 Further, due to having a large number of SS terminals, there is a possibility that an erroneous connection between the SS terminals and each slave device, a short circuit between the SS terminals, or a short circuit to a potential corresponding to the active level may occur. If any of these events actually occurs, communication with a slave device that is not the target of communication is established, and the slave device may behave unintentionally. It was.
このような課題を解決可能な通信システムが、例えば特許文献1に開示されている。この特許文献1の通信システムでは、スレーブセレクト信号を送信する信号線を各スレーブデバイスで共通化するとともに、ホストデバイスからの送信データ中に、通信対象となるスレーブデバイスを示す情報を付加している。
A communication system capable of solving such a problem is disclosed in
しかしながら、特許文献1の通信システムのように、ホストデバイスからの送信データ中に通信対象を示す情報を付加すると、その分、送信可能なデータのビット数が減少してしまうという問題が生じる。
However, when information indicating a communication target is added to the transmission data from the host device as in the communication system of
さらに、特許文献1の通信システムでは、送信データ中の3ビットを利用して、通信対象を示す情報を付加している。しかし、そのビット数で区別可能な上限数以上のスレーブデバイスを接続する場合には、スレーブセレクト信号を送信する信号線の数を増やしている。この場合、上述したような、誤接続やショートなどにより、通信対象ではないスレーブデバイスとの通信が成立してしまう可能性が残る。
Furthermore, in the communication system of
本発明は、上述した点に鑑みてなされたものであり、送信可能なデータのビット数を減少させずに、スレーブセレクト信号を送信する信号線を共通化することが可能な通信システムを提供することを目的とする。 The present invention has been made in view of the above points, and provides a communication system capable of sharing a signal line for transmitting a slave select signal without reducing the number of bits of transmittable data. For the purpose.
上記目的を達成するために、本発明に係る通信システムは、1つのホストデバイス(10)と複数のスレーブデバイス(11、12、13)とが、クロック同期式シリアル通信を行うものであって、
ホストデバイスと複数のスレーブデバイスとの間には、
ホストデバイスから複数のスレーブデバイスへクロック信号を送信するための共通のクロック信号ライン(20)と、
クロック信号に同期して、ホストデバイスから複数のスレーブデバイスへデータを送信するための共通の第1通信ライン(21)と、
クロック信号に同期して、複数のスレーブデバイスからホストデバイスへデータを送信するための共通の第2通信ライン(22)と、
ホストデバイスが、通信相手となるスレーブデバイスを選択するスレーブセレクト信号を送信するためのスレーブセレクト信号ライン(23)とが接続されており、
スレーブセレクト信号ラインは、複数のスレーブデバイスに対して共通化されており、
複数のスレーブデバイスには、所定数のクロック信号が出力される間に、それぞれ異なるパターンで変化する2値データが予め割り当てられており、
ホストデバイスは、スレーブセレクト信号により、選択すべきスレーブデバイスに対応した2値データを出力することを特徴とする。
In order to achieve the above object, a communication system according to the present invention is one in which one host device (10) and a plurality of slave devices (11, 12, 13) perform clock synchronous serial communication,
Between the host device and multiple slave devices,
A common clock signal line (20) for transmitting a clock signal from the host device to a plurality of slave devices;
A common first communication line (21) for transmitting data from the host device to the plurality of slave devices in synchronization with the clock signal;
A common second communication line (22) for transmitting data from the plurality of slave devices to the host device in synchronization with the clock signal;
The host device is connected to a slave select signal line (23) for transmitting a slave select signal for selecting a slave device as a communication partner,
The slave select signal line is shared by multiple slave devices.
A plurality of slave devices are pre-assigned binary data that changes in different patterns while a predetermined number of clock signals are output.
The host device outputs binary data corresponding to the slave device to be selected in response to the slave select signal.
このように、本発明に係る通信システムでは、ホストデバイスは、送信データ中に、通信対象となるスレーブデバイスを示す情報を付加するのではなく、スレーブセレクト信号により、選択すべきスレーブデバイスに対応した2値データを出力する。このため、従来とは異なり、通信対象を示す情報の分だけ、送信可能なデータのビット数が減少してしまうことがない。さらに、複数のスレーブデバイスに対して、スレーブセレクト信号ラインを共通化しても、2値データにより、通信対象となるスレーブデバイスを確実に選択することが可能になる。 As described above, in the communication system according to the present invention, the host device does not add information indicating the slave device to be communicated to the transmission data, but corresponds to the slave device to be selected by the slave select signal. Output binary data. Therefore, unlike the prior art, the number of bits of data that can be transmitted does not decrease by the amount of information indicating the communication target. Furthermore, even if the slave select signal line is shared by a plurality of slave devices, the slave device to be communicated can be reliably selected by the binary data.
上述した構成において、ホストデバイスは、2値データとして、すべてスレーブセレクト信号のアクティブレベルとなるパターン以外のパターンを使用することが好ましい。このようにすると、例えばスレーブセレクト信号ラインが、アクティブレベルに相当する電位にショートしてしまった場合などに、容易にそのような異常の発生を検知し、必要な対応を取ることが可能となる。 In the above-described configuration, it is preferable that the host device uses a pattern other than the pattern that becomes the active level of the slave select signal as binary data. In this way, for example, when the slave select signal line is short-circuited to a potential corresponding to the active level, it is possible to easily detect the occurrence of such an abnormality and take necessary measures. .
例えば、複数のスレーブデバイスは、2値データとして、すべてアクティブレベルとなるパターンの2値データを受信した場合、通信動作を終了するようにしても良い。この場合、上述したような異常が発生しても、ホストデバイスが、通信対象ではないスレーブデバイスと誤って通信してしまうことを防止することができる。 For example, the plurality of slave devices may end the communication operation when receiving binary data having a pattern that is all in an active level as binary data. In this case, even if the above-described abnormality occurs, it is possible to prevent the host device from erroneously communicating with a slave device that is not a communication target.
さらに、ホストデバイスと、スレーブデバイスとの間で、データの送受信が同時に実行される場合、ホストデバイスは、スレーブデバイスからのデータを受信しないことに基づいて、故障が発生したことを検出するようにしても良い。これにより、ホストデバイスは、容易に、スレーブセレクト信号ラインが、アクティブレベルに相当する電位にショートした故障などが発生した場合に、その故障を検知することができるようになる。 Furthermore, when data transmission / reception is performed simultaneously between the host device and the slave device, the host device should detect that a failure has occurred based on not receiving data from the slave device. May be. As a result, the host device can easily detect the failure when the slave select signal line is short-circuited to a potential corresponding to the active level.
上記括弧内の参照番号は、本発明の理解を容易にすべく、後述する実施形態における具体的な構成との対応関係の一例を示すものにすぎず、なんら本発明の範囲を制限することを意図したものではない。 The reference numerals in the parentheses merely show an example of a correspondence relationship with a specific configuration in an embodiment described later in order to facilitate understanding of the present invention, and are intended to limit the scope of the present invention. Not intended.
また、上述した特徴以外の、特許請求の範囲の各請求項に記載した技術的特徴に関しては、後述する実施形態の説明及び添付図面から明らかになる。 Further, the technical features described in the claims of the claims other than the features described above will become apparent from the description of embodiments and the accompanying drawings described later.
以下、本発明の実施形態に係る通信システムについて、図面を参照しつつ説明する。図1は、本実施形態に係る通信システムの一例の構成を示す構成図である。 Hereinafter, a communication system according to an embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a configuration diagram illustrating a configuration example of a communication system according to the present embodiment.
図1に示すように、本実施形態に係る通信システムは、ホストデバイスとしてのマイコン10と、スレーブデバイスとしての複数のIC(IC−A11、IC−B12、IC−C13など)とを有する。そして、マイコン10と、複数のIC(IC−A11、IC−B12、IC−C13など)との間で、クロック同期式シリアル通信が行われるようになっている。
As shown in FIG. 1, the communication system according to the present embodiment includes a
マイコン10は、クロック信号Clockを出力するクロック出力端子、各IC11〜13に送信すべき送信データTxを出力する送信データ出力端子、各IC11〜13から出力され、マイコン10にて受信される受信データRxを入力する受信データ入力端子、及び、通信相手となるICを選択するためのスレーブセレクトデータを含むスレーブセレクト信号SSを出力するスレーブセレクト信号出力端子とを有する。
The
マイコン10のクロック出力端子は、クロック信号ライン20に接続されている。このクロック信号ライン20は、各IC11〜13のクロック信号入力端子に接続されている。すなわち、各IC11〜13に対して共通のクロック信号ライン20が設けられており、マイコン10からのクロック信号Clockは、この共通のクロック信号ライン20を介して、各IC11〜13に与えられる。
The clock output terminal of the
マイコン10の送信データ出力端子は、第1通信ライン21に接続されている。第1通信ライン21は、各IC11〜13のデータ入力端子に接続されている。また、マイコン10の受信データ入力端子は、第2通信ライン22に接続されている。第2通信ライン22は、各IC11〜13のデータ出力端子に接続されている。さらに、マイコン10のスレーブセレクト信号出力端子は、スレーブセレクト信号ライン23に接続されている。スレーブセレクト信号ライン23は、各IC11〜13のスレーブセレクト信号入力端子に接続されている。これら第1通信ライン21、第2通信ライン22、及びスレーブセレクト信号ライン23に関しても、図1に示されるように、クロック信号ライン20と同様に、各IC11〜13に対して共通化されている。
A transmission data output terminal of the
本実施形態に係る通信システムにおいて行われるシリアル通信は、マイコン10が常に通信の主導権を持つ。すなわち、マイコン10が各IC11〜13とシリアル通信を行う際は、図2に示すように、まずスレーブセレクト信号SSをアクティブレベル(本実施形態ではLowレベル)にして各IC11〜13をシリアル通信可能状態にする。なお、アクティブレベルは、Highレベルであっても良い。
In the serial communication performed in the communication system according to the present embodiment, the
次いで、マイコン10は、図2に示すように、送信データTxの出力を開始する。この送信データTxは、各種コマンドやデータ、アドレス(通信対象ICにおけるメモリやレジスタなどのアドレス)等を含む。例えば、マイコン10は、コマンドとして、通信対象ICが持つデータを読み出したい場合はリード命令を出力し、通信対象ICへデータを書き込みたい場合はライト命令を出力する。また、マイコン10は、コマンドとして、例えば通信対象ICが備える機能を実行させるための命令などを出力したりもする。
Next, the
上述した送信データTxの出力開始と同期して、マイコン10は、スレーブセレクト信号出力端子から、通信相手として選択すべきIC(IC−A11、IC−B12、IC−C13などの中のいずれか)に対応した2値データ(スレーブセレクトデータ)の出力を開始する。
In synchronization with the output start of the transmission data Tx described above, the
そして、マイコン10は、送信データTx及びスレーブセレクトデータの出力後に、各IC11〜13に対してクロック信号Clockを出力する。すると、各IC11〜13は、クロック信号Clockが立ち下がったタイミングで、送信データTx、スレーブセレクトデータの取り込みを行う。但し、各IC11〜13におけるデータの取り込みタイミングは、クロック信号Clockが立ち上がったときであっても良い。以下に、スレーブセレクトデータについて、詳細に説明する。
The
本実施形態に係る通信システムでは、各IC11〜13に対して、所定数のクロック信号Clockが出力される間に、それぞれ異なるパターンで変化するスレーブセレクトデータが予め割り当てられている。そして、各ICは、所定数のクロック信号Clockによって規定されるスレーブセレクトデータ送出期間において、自身に割り当てられたスレーブセレクトデータと同じデータを受信したとき、マイコン10の通信対象として選択されたことを認識する。
In the communication system according to the present embodiment, slave select data that changes in different patterns is assigned in advance to each of the
このスレーブセレクトデータの割り当ての一例を図3に示す。なお、図3に示す例では、スレーブセレクトデータが割り当てられるICの数が7であり、そのスレーブセレクトデータとして、3ビット分のデータを用いる例を示している。従って、図3に示す例では、スレーブセレクトデータの送出期間は、クロック信号Clockの3個分に相当することになる。 An example of the assignment of the slave select data is shown in FIG. In the example shown in FIG. 3, the number of ICs to which the slave select data is assigned is 7, and an example is shown in which 3-bit data is used as the slave select data. Therefore, in the example shown in FIG. 3, the transmission period of the slave select data corresponds to three clock signals Clock.
図3に示す例では、IC−A11に対し、“001”のスレーブセレクトデータが割り当てられている。従って、クロック信号Clockが立ち下がる、連続した3回のデータ取り込みタイミングにおいて、スレーブセレクトデータを取り込んだ結果、その値が“001”である場合、IC−A11が通信対象として選択されることになる。この場合、IC−A11は、スレーブセレクトデータの送出期間経過後も、通信動作を継続し、マイコン10との間で、送信データTx及び受信データRxのやり取りを行う。
In the example illustrated in FIG. 3, slave select data “001” is assigned to the IC-
同様に、図3に示す例では、IC−B12に対して“010”のスレーブセレクトデータが割り当てられ、IC−C13に対して“011”のスレーブセレクトデータが割り当てられ、IC−D14に対して“100”のスレーブセレクトデータが割り当てられ、IC−E15に対して“101”のスレーブセレクトデータが割り当てられ、IC−F16に対して“110”のスレーブセレクトデータが割り当てられ、IC−G17に対して“111”のスレーブセレクトデータが割り当てられている。 Similarly, in the example shown in FIG. 3, slave select data “010” is assigned to IC-B12, slave select data “011” is assigned to IC-C13, and IC-D14 is assigned. “100” slave select data is assigned, “101” slave select data is assigned to IC-E15, “110” slave select data is assigned to IC-F16, and IC-G17 is assigned. Slave select data of “111” is assigned.
このように、各IC11〜17に対して、固有のスレーブセレクトデータが割り当てられているので、マイコン10は、スレーブセレクト信号SSにより、所望のICに対応するスレーブセレクトデータを送出することで、通信対象とすべきICを任意に選択することができる。
Thus, since unique slave select data is assigned to each of the
ここで、本実施形態においては、全てのビットが、スレーブセレクト信号SSのアクティブレベルとなる“000”のデータは、スレーブセレクトデータとして用いていない。このため、万一、スレーブセレクト信号ラインが、アクティブレベルに相当するグランド電位にショートしてしまった場合、いずれのIC11〜17とも通信が継続されなくなる。従って、少なくとも、通信対象ではないICとの通信が成立してしまい、そのICが意図しない振る舞いをしてしまうことを確実に防止することができる。
Here, in this embodiment, data of “000” in which all bits are at the active level of the slave select signal SS is not used as slave select data. For this reason, if the slave select signal line is short-circuited to the ground potential corresponding to the active level, communication with any of the
次に、図4に示すように、マイコン10が、通信対象としてIC−A11を選択する場合を例に取り、マイコン10における処理、各IC11〜17における処理、及び通信対象として選択されたIC−A11における処理について、図5〜図7のフローチャートを用いて説明する。
Next, as shown in FIG. 4, the case where the
まず、図5のフローチャートに基づき、マイコン10における処理について説明する。
マイコン10は、IC−A11との通信を開始する場合、まず、ステップS100において、スレーブセレクト信号SSをアクティブレベルにする。これにより、IC−A11を含むすべてのIC11〜17が通信可能状態となる。
First, processing in the
When starting communication with the IC-
次いで、マイコン10は、ステップS110において、送信データTxの出力を開始するとともに、IC−A11を選択するためのスレーブセレクトデータの出力を開始する。IC−A11のスレーブセレクトデータは“001”であるため、スレーブセレクトデータの出力開始直後は、図4に示すように、スレーブセレクト信号SSはLowレベルに維持される。送信データTx、及びスレーブセレクトデータの出力後、これらのデータのレベルが安定するのに必要な時間が経過した後、マイコン10は、ステップS120において、クロック信号Clockを立ち下げる。すると、ステップS130に示す全スレーブ通信処理が各IC11〜17にて実行されることで、送信データTx、及びスレーブセレクトデータの取り込みが行われる。
Next, in step S110, the
この全スレーブ通信処理について、図6のフローチャートを参照して説明する。全スレーブ通信処理においては、まず、ステップS300において、スレーブセレクト信号SSがアクティブ化されているか否かを判定する。アクティブ化されていないと判定した場合には、ステップS370に進み、マイコン10との通信処理を終了する。一方、スレーブセレクト信号SSがアクティブ化されていると判定した場合には、ステップS310に進む。
This all-slave communication process will be described with reference to the flowchart of FIG. In the all slave communication processing, first, in step S300, it is determined whether or not the slave select signal SS is activated. If it is determined that it has not been activated, the process proceeds to step S370, and the communication process with the
ステップS310では、各IC11〜17は、それぞれのクロック信号入力端子に与えられているクロック信号Clockが立ち下ったか否かを判定する。このとき、クロック信号Clockが立ち下がっていないと判定した場合には、繰り返し、S310の処理を実行することで、クロック信号Clockの立ち下がりを待機する。一方、クロック信号Clockが立ち下がったと判定した場合には、ステップS320の処理に進む。ステップS320では、各IC11〜17において、送信データTx及びスレーブセレクトデータの受信処理が行われる。この受信処理では、送信データTx及びスレーブセレクトデータの1ビット分のデータの取り込みが行われる。
In step S310, each of the
ステップS330では、マイコン10にて受信すべき受信データRxを出力する。この受信データRxとして、各IC11〜17は、送信データTxに含まれていたコマンドに応答するデータを送信したり、送信すべき応答データがない場合にはダミーデータを送信したりする。
In step S330, reception data Rx to be received by the
なお、スレーブセレクトデータの送出期間中は、全てのIC11〜17にて通信処理動作が行われる。そのため、受信データRxは、全IC11〜17から出力されることになる。この場合、各IC11〜17が、異なる受信データRxを出力したとすると、マイコン10にて受信する受信データRxが不安定となる虞がある。そのため、スレーブセレクトデータの送信期間中、すなわち、全IC11〜17が通信処理動作を行っている期間中は、各IC11〜17から同じ受信データRxが出力されるように構成されている。
During the slave select data transmission period, the communication processing operation is performed in all the
続くステップS340では、各IC11〜17が、予め定められた所定数のクロック数分だけ、スレーブセレクトデータの取り込みを実施したか否かにより、スレーブセレクトデータの受信が完了したか否かを判定する。このとき、まだスレーブセレクトデータの受信が完了していないと判定すると、ステップS310からの処理を繰り返す。この場合、各IC11〜17は、まだ、いずれのICが通信対象として選択されたかを判別することができないためである。ただし、すべてのスレーブセレクトデータの受信を待たずとも、1ビットずつスレーブセレクトデータを受信する過程で、自身が選択されないことが明らかとなった時点で、通信処理を停止するようにすることは可能である。一方、スレーブセレクトデータの受信が完了したと判定すると、ステップS350の処理に進む。
In the subsequent step S340, it is determined whether or not the reception of the slave select data is completed by each of the
ステップS350では、各IC11〜17が、受信したスレーブセレクトデータが、各々のIC11〜17に割り当てられたスレーブセレクトデータと一致するか否かに基づき、自身が通信対象として選択されたか否かを判定する。この際、自身が選択されたと判定した場合には、ステップS360に進み、マイコン10との通信を継続するため、次のクロック信号Clockの立ち下がりを待機する。一方、自身は選択されなかったと判定した場合には、ステップS370に進んで、マイコン10との通信処理を終了させる。
In step S350, each IC 11-17 determines whether it has been selected as a communication target based on whether the received slave select data matches the slave select data assigned to each IC 11-17. To do. At this time, if it is determined that it has been selected, the process proceeds to step S360 to wait for the next falling of the clock signal Clock in order to continue communication with the
なお、ステップS370にて、通信処理を終了したICは、スレーブセレクトデータの送出期間終了後に、スレーブセレクト信号SSがアクティブレベルとなっても、通信処理の再開が禁止されるようになっている。この通信処理の再開禁止は、マイコン10が、選択したIC−A11との通信を完了し、スレーブセレクト信号SSを非アクティブ化したときに、解除される。従って、マイコン10は、スレーブセレクトデータの送出期間経過後は、選択した通信対象であるIC−A11とだけ通信を行うことができる。
In step S370, the IC that has completed the communication process is prohibited from resuming the communication process even if the slave select signal SS becomes active after the slave select data transmission period ends. This prohibition of resuming communication processing is canceled when the
再び、図5のフローチャートに戻り、説明を続ける。マイコン10は、上述した全スレーブ通信処理のために所定の時間待機した後、ステップS140にて、クロック信号Clockを立ち上げる。この時点では、各IC11〜17から出力された受信データRxは安定している。そのため、マイコン10は、このクロック信号Clockの立ち上げに伴い、ステップS150において、受信データRxの受信処理を行う。この受信処理では、受信データRxの1ビット分のデータの取り込みが行われる。
Returning to the flowchart of FIG. 5 again, the description will be continued. The
続くステップS160では、スレーブセレクトデータの送出が完了したか否かを判定する。この際、まだスレーブセレクトデータの送出が完了していないと判定すると、ステップS110からの処理を繰り返す。一方、スレーブセレクトデータの送出が完了したと判定すると、ステップS170の処理に進む。なお、この時点では、通信対象として、IC−A11が選択済みとなっている。また、IC−A11以外のIC12〜17は、通史処理を停止した状態となっている。
In a succeeding step S160, it is determined whether or not the transmission of the slave select data is completed. At this time, if it is determined that the transmission of slave select data has not been completed, the processing from step S110 is repeated. On the other hand, if it is determined that the transmission of the slave select data is completed, the process proceeds to step S170. At this point, IC-A11 has already been selected as a communication target. Further, the
ステップS170では、マイコン10は、IC−A11との通信を継続するため、スレーブセレクト信号SSをアクティブレベルに保持する。続くステップS180では、1ビット分の送信データTxを出力し、ステップS190において、クロック信号を立ち下げる。すると、ステップS200に示す被選択スレーブ通信処理が、選択されたIC−A11にて実行されることで、IC−A11にて送信データTxの受信処理が行われる。
In step S170, the
この非選択スレーブ通信処理について、図7のフローチャートを参照して説明する。被選択スレーブ通信処理においては、まず、ステップS400において、スレーブセレクト信号SSがアクティブ化されているか否かを判定する。アクティブ化されていないと判定した場合には、ステップS450に進み、マイコン10との通信処理を終了する。一方、スレーブセレクト信号SSがアクティブ化されていると判定した場合には、ステップS410に進む。
This non-selected slave communication process will be described with reference to the flowchart of FIG. In the selected slave communication process, first, in step S400, it is determined whether or not the slave select signal SS is activated. If it is determined that it is not activated, the process proceeds to step S450, and the communication process with the
ステップS410では、選択されたIC−A11は、クロック信号入力端子に与えられているクロック信号Clockが立ち下ったか否かを判定する。このとき、クロック信号Clockが立ち下がっていないと判定した場合には、繰り返し、S410の処理を実行することで、クロック信号Clockの立ち下がりを待機する。一方、クロック信号Clockが立ち下がったと判定した場合には、ステップS420の処理に進む。ステップS420では、IC−A11において、送信データTxの受信処理が行われる。この受信処理により、送信データTxの1ビット分のデータの取り込みが行われる。
In step S410, the selected IC-
ステップS430では、IC−A11は、マイコン10にて受信すべき受信データRxを出力する。続くステップS440では、IC−A11は、全ての受信データRxの送出が完了したか否かを判定する。この判定処理において、まだ、全ての受信データRxの送出が完了していないと判定すると、ステップS410からの処理を繰り返す。一方、全ての受信データRxの送出を完了したと判定すると、ステップS450に進み、マイコン10との通信処理を終了する。
In step S430, the IC-
再び、図5のフローチャートに戻り、説明を続ける。マイコン10は、上述した被選択スレーブ通信処理のために所定の時間待機した後、ステップS210にて、クロック信号Clockを立ち上げる。この時点では、選択したIC−A11から出力された受信データRxは安定している。そのため、マイコン10は、このクロック信号Clockの立ち上げに伴い、ステップS220において、受信データRxの受信処理を行う。この受信処理では、受信データRxの1ビット分のデータの取り込みが行われる。
Returning to the flowchart of FIG. 5 again, the description will be continued. The
続くステップS230では、全データの通信処理、すなわち、送信データTxの送出処理及び受信データRxの受信処理が完了したか否かを判定する。この際、まだ全データの通信処理が完了していないと判定すると、ステップS180からの処理を繰り返す。一方、全データの通信処理が完了したと判定すると、ステップS240の処理に進む。ステップS240では、スレーブセレクト信号SSを非アクティブレベルにする。これにより、選択されなかった各IC12〜17の通信処理の再開禁止が解除される。
In the subsequent step S230, it is determined whether or not all data communication processing, that is, transmission data Tx transmission processing and reception data Rx reception processing has been completed. At this time, if it is determined that the communication processing of all data has not been completed yet, the processing from step S180 is repeated. On the other hand, if it is determined that the communication process for all data has been completed, the process proceeds to step S240. In step S240, the slave select signal SS is set to an inactive level. As a result, the prohibition of restart of communication processing of each
続くステップS250では、次に通信対象とすべきICが有るか否かを判定し、通信対象とすべきICが有ると判定した場合には、ステップS100からの処理を繰り返す。一方、通信対象とすべきICが無いと判定した場合には、マイコン10は、図5のフローチャートに示す処理を終了する。
In subsequent step S250, it is determined whether or not there is an IC that should be the next communication target. If it is determined that there is an IC that should be the communication target, the processing from step S100 is repeated. On the other hand, if it is determined that there is no IC to be communicated, the
上述した本実施形態に係る通信システムによれば、マイコン10は、送信データTx中に、通信対象となるICを示す情報を付加するのではなく、スレーブセレクト信号SSにより、通信対象として選択すべきICに対応したスレーブセレクトデータを出力する。このため、従来とは異なり、通信対象を示す情報の分だけ、送信可能なデータのビット数が減少してしまうことがない。さらに、複数のIC11〜17に対して、スレーブセレクト信号ライン23を共通化しても、スレーブセレクトデータにより、通信対象となるICを確実に選択することが可能になる。
According to the above-described communication system according to the present embodiment, the
また上述した通信システムでは、スレーブセレクトデータとして、すべてアクティブレベルとなるパターン以外のパターンを用いている。このため、例えばスレーブセレクト信号ライン23が、アクティブレベルに相当する電位にショートしてしまっても、いずれのIC11〜17も通信対象として選択されないので、マイコン10が通信対象ではないICと誤って通信してしまうことを防止することができる。
Further, in the communication system described above, a pattern other than the pattern that is all in the active level is used as slave select data. For this reason, for example, even if the slave
以上、本発明の好ましい実施形態について説明したが、本発明は、なんら上述した実施形態に制限されることなく、本発明の主旨を逸脱しない範囲において、種々変形して実施することが可能である。 The preferred embodiments of the present invention have been described above. However, the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the spirit of the present invention. .
(変形例1)
例えば、図5のフローチャートに示した、マイコン10の通信処理に関して、図8に示すように変形しても良い。つまり、図5のフローチャートにおけるステップS220の受信データRxの受信処理と、ステップS230の全データの通信完了判定処理との間に、受信データRxの受信ができない状態であるか否かを判定するステップS222を設けても良い。そして、このステップS222において、受信データRxが受信できない状態であると判定したときには、ステップS224に進み、故障が発生したことを検出するようにしても良い。
(Modification 1)
For example, the communication processing of the
上述したように、本実施形態に係る通信システムでは、マイコン10と、複数のIC11〜17あるいは通信対象として選択されたICとの間で、データの送受信が同時期に実行される。それにも係わらず、マイコン10が、受信データRxを受信できないとすると、スレーブセレクト信号ライン23が、アクティブレベルに相当する電位にショートする故障が発生し、いずれのIC11〜17も通信対象として選択されないか、あるいは、通信対象として選択したICになんらかの故障が発生して、受信データRxを出力できない状態である可能性が高い。このように、マイコン10において、受信データRxを受信できないことに基づき、通信システムになんらかの故障が発生したことを検出することができる。
As described above, in the communication system according to the present embodiment, data is transmitted and received between the
(変形例2)
また、図6のフローチャートに示した、全スレーブ通信処理に関して、図9に示すように変形しても良い。すなわち、図6のフローチャートにおけるステップS340のスレーブセレクトデータの受信完了判定処理と、ステップS350の被選択判定処理との間に、受信したスレーブセレクトデータに異常が有るか否かを判定するステップS342を追加しても良い。そして、このステップS342において、スレーブセレクトデータに異常有りと判定した場合、ステップS370に進んで、各IC11〜17における通信処理を終了させるようにする。
(Modification 2)
Further, the all slave communication process shown in the flowchart of FIG. 6 may be modified as shown in FIG. That is, step S342 for determining whether or not there is an abnormality in the received slave select data between the slave selection data reception completion determination process in step S340 and the selected determination process in step S350 in the flowchart of FIG. May be added. If it is determined in step S342 that there is an abnormality in the slave select data, the process proceeds to step S370, and the communication processing in each of the
上述したように、本実施形態では、全てのビットが、スレーブセレクト信号SSのアクティブレベルとなるデータは、スレーブセレクトデータとして用いていない。従って、各IC11〜17において、万一、全てのビットがアクティブレベルとなるスレーブセレクトデータを受信した場合、これは明らかに異常とみなすことができるので、各IC11〜17における通信処理を終了させる。 As described above, in this embodiment, data in which all bits are at the active level of the slave select signal SS is not used as slave select data. Accordingly, in the event that each IC 11-17 receives slave select data in which all bits are at an active level, this can be clearly regarded as abnormal, so the communication processing in each IC 11-17 is terminated.
ただし、図6に示す全スレーブ通信処理においても、自身が通信対象として選択されなかった場合、ステップS350→ステップS370を経由して、通信処理が終了される。このため、図6の全スレーブ通信処理においても、全てのビットがアクティブレベルとなるスレーブセレクトデータを受信した場合には、各IC11〜17で通信処理が終了されることになる。図9に示す例は、スレーブセレクトデータが異常である場合に、より確実に、各IC11〜17の通信処理を終了させるためのものである。
However, also in the all slave communication processing shown in FIG. 6, when the device itself is not selected as a communication target, the communication processing is terminated via step S350 → step S370. For this reason, also in the all-slave communication process of FIG. 6, when the slave select data in which all the bits are at the active level is received, the communication process is finished in each of the
(変形例3)
さらに、上述した実施形態では、各IC11〜17における受信処理を、クロック信号Clockの立ち下がりのタイミングで実施し、マイコン10における受信処理を、クロック信号Clockの立ち上がりのタイミングで実施した。しかしながら、マイコン10と各IC11〜17の受信処理は、クロック信号の立ち下がりもしくは立ち上がりに連動して、全く同じタイミングで実施することも可能である。
(Modification 3)
Further, in the above-described embodiment, the reception process in each of the
10 マイコン(ホストデバイス)
11 IC−A(スレーブデバイス)
12 IC−B(スレーブデバイス)
13 IC−C(スレーブデバイス)
20 クロック信号ライン
21 第1通信ライン
22 第2通信ライン
23 スレーブセレクト信号ライン
10 Microcomputer (host device)
11 IC-A (slave device)
12 IC-B (slave device)
13 IC-C (slave device)
20
Claims (9)
前記ホストデバイスと前記複数のスレーブデバイスとの間には、
前記ホストデバイスから前記複数のスレーブデバイスへクロック信号を送信するための共通のクロック信号ライン(20)と、
前記クロック信号に同期して、前記ホストデバイスから前記複数のスレーブデバイスへデータを送信するための共通の第1通信ライン(21)と、
前記クロック信号に同期して、前記複数のスレーブデバイスから前記ホストデバイスへデータを送信するための共通の第2通信ライン(22)と、
前記ホストデバイスが、通信相手となるスレーブデバイスを選択するスレーブセレクト信号を送信するためのスレーブセレクト信号ライン(23)とが接続されており、
前記スレーブセレクト信号ラインは、前記複数のスレーブデバイスに対して共通化されており、
前記複数のスレーブデバイスには、所定数のクロック信号が出力される間に、それぞれ異なるパターンで変化する2値データが予め割り当てられており、
前記ホストデバイスは、前記スレーブセレクト信号により、選択すべきスレーブデバイスに対応した前記2値データを出力することを特徴とする通信システム。 A communication system in which one host device (10) and a plurality of slave devices (11, 12, 13) perform clock synchronous serial communication,
Between the host device and the plurality of slave devices,
A common clock signal line (20) for transmitting a clock signal from the host device to the plurality of slave devices;
A common first communication line (21) for transmitting data from the host device to the plurality of slave devices in synchronization with the clock signal;
A common second communication line (22) for transmitting data from the plurality of slave devices to the host device in synchronization with the clock signal;
The host device is connected to a slave select signal line (23) for transmitting a slave select signal for selecting a slave device as a communication partner;
The slave select signal line is shared by the plurality of slave devices,
The plurality of slave devices are pre-assigned binary data that changes in different patterns while a predetermined number of clock signals are output,
The communication system, wherein the host device outputs the binary data corresponding to the slave device to be selected in response to the slave select signal.
前記複数のスレーブデバイスは、前記ホストデバイスから前記2値データの出力が終了するまで、前記第2通信ラインを介して、それぞれ同じデータを前記ホストデバイスに送信することを特徴とする請求項5乃至8のいずれか1項に記載の通信システム。 The host device and the plurality of slave devices transmit and receive data at the same time in synchronization with the clock signal,
The plurality of slave devices each transmit the same data to the host device via the second communication line until the output of the binary data from the host device is completed. The communication system according to any one of 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014045411A JP2015170199A (en) | 2014-03-07 | 2014-03-07 | communication system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014045411A JP2015170199A (en) | 2014-03-07 | 2014-03-07 | communication system |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2015170199A true JP2015170199A (en) | 2015-09-28 |
Family
ID=54202860
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014045411A Pending JP2015170199A (en) | 2014-03-07 | 2014-03-07 | communication system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015170199A (en) |
-
2014
- 2014-03-07 JP JP2014045411A patent/JP2015170199A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110532211B (en) | Bus system | |
KR20180017035A (en) | Test for 50 nanosecond spike filter | |
US20190138491A1 (en) | Data communication apparatus | |
US10012975B2 (en) | Numerical control system including internal register self-reset function with serial communication signal monitoring | |
JP2016004388A (en) | Communication system and electronic circuit | |
US11221977B2 (en) | Daisy chain mode entry sequence | |
CN106201973B (en) | Method and system for single-wire serial communication interface | |
WO2012046634A1 (en) | Electronic device and serial data communication method | |
JP6971538B2 (en) | Communication equipment, communication methods, programs, and communication systems | |
JP6696511B2 (en) | Communication device, communication method, program, and communication system | |
US10013374B2 (en) | Bidirectional communication method between a master terminal and a slave terminal on a single transmission line | |
US10740172B2 (en) | Communication apparatus, communication method, program, and communication system | |
US11023023B2 (en) | Start-and-stop detecting apparatus and method for I3C bus | |
JPWO2018150868A1 (en) | COMMUNICATION DEVICE, COMMUNICATION METHOD, PROGRAM, AND COMMUNICATION SYSTEM | |
JP2016170666A (en) | Semiconductor device and control method thereof | |
JP2015170199A (en) | communication system | |
EP3459189B1 (en) | Communication apparatus, communication method, program, and communication system | |
CN110673894A (en) | Automatic loading method for BOB module ED of home gateway | |
CN105701056A (en) | Data communication device and method for data communication | |
CN112445744B (en) | I2C communication | |
JP6413979B2 (en) | Master node | |
JP2009187474A (en) | Semiconductor device, portable electronic equipment, self-diagnosis method, and self-diagnosis program | |
TWI832612B (en) | Target slave device and address change method for i2c communication system | |
TWI776180B (en) | Electronic system | |
CN116775537A (en) | I under 10bit addressing mode 2 C bus transmission method |