JP2021180448A - Master-slave communication system, electronic device, and control method for them - Google Patents

Master-slave communication system, electronic device, and control method for them Download PDF

Info

Publication number
JP2021180448A
JP2021180448A JP2020085945A JP2020085945A JP2021180448A JP 2021180448 A JP2021180448 A JP 2021180448A JP 2020085945 A JP2020085945 A JP 2020085945A JP 2020085945 A JP2020085945 A JP 2020085945A JP 2021180448 A JP2021180448 A JP 2021180448A
Authority
JP
Japan
Prior art keywords
slave
address
master
node
communication
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
JP2020085945A
Other languages
Japanese (ja)
Inventor
浩一朗 猪
Koichiro Ino
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2020085945A priority Critical patent/JP2021180448A/en
Publication of JP2021180448A publication Critical patent/JP2021180448A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

To determine the operation state of a plurality of slave nodes in a short time.SOLUTION: A master CPU 100 changes, from an initial address, the slave address of each of a plurality of slave nodes to an intrinsic address different from the initial address, then uses the initial address to try communication with each of the plurality of slave nodes. The master CPU 100 determines the operation state of each slave node on the basis of the result of the try.SELECTED DRAWING: Figure 7

Description

本発明は、マスタスレーブ通信システム、電子デバイス、およびこれらの制御方法に関する。 The present invention relates to a master-slave communication system, an electronic device, and a control method thereof.

電子デバイスとしてのマスタノードが複数のスレーブノードと通信を行うマスタスレーブ通信システムが知られている。一般に、マスタノードとスレーブノードの通信には、当該スレーブノードに割り当てられたアドレス(スレーブアドレス)を指定して、任意のスレーブノードとマスタノードとの間の通信を確立する方法がとられている。マスタスレーブ通信システムの1つであるI2C通信においては、図10に示すような通信方式が採用される。 A master-slave communication system in which a master node as an electronic device communicates with a plurality of slave nodes is known. Generally, for communication between a master node and a slave node, a method is adopted in which an address (slave address) assigned to the slave node is specified and communication between an arbitrary slave node and the master node is established. .. In I2C communication, which is one of the master-slave communication systems, a communication method as shown in FIG. 10 is adopted.

まず、マスタノードから、スタートコンディション(S)信号、接続したいスレーブアドレス信号、マスタ側がリードかライトかを指示するR/W信号が送信される。スレーブノードが信号を受け取ると、スレーブノードからACKが返信される。その後、マスタ側がライトとなる場合は、マスタノードからデータ信号が送信され、スレーブノードが信号を受け取るとスレーブノードからACKが返信される。一方、マスタ側がリードとなる場合は、スレーブノードからデータ信号が送信され、マスタノードが信号を受け取るとマスタノードからACKが返信される。最後にマスタノードからストップコンディション信号(P)が送信され、スレーブノードとの通信が終了する。 First, the master node transmits a start condition (S) signal, a slave address signal to be connected, and an R / W signal indicating whether the master side is read or write. When the slave node receives the signal, an ACK is returned from the slave node. After that, when the master side becomes a write, a data signal is transmitted from the master node, and when the slave node receives the signal, an ACK is returned from the slave node. On the other hand, when the master side becomes the read, a data signal is transmitted from the slave node, and when the master node receives the signal, ACK is returned from the master node. Finally, the stop condition signal (P) is transmitted from the master node, and the communication with the slave node ends.

ここで信号を受け取る側が信号を正しく受け取れなかった場合、ACKが返信されずNCK状態となる。このマスタスレーブ通信システムにおいては、複数のスレーブノードにはそれぞれに固有のアドレスが割り当てられる必要がある。その方法としては、特許文献1に記載されるように、マスタノードからスレーブノードそれぞれに固有のスレーブアドレスを設定することで、それぞれのスレーブノードへの通信を可能にする方式が知られている。 If the side receiving the signal does not receive the signal correctly, ACK is not returned and the state becomes NCK. In this master-slave communication system, it is necessary to assign a unique address to each of a plurality of slave nodes. As a method thereof, as described in Patent Document 1, there is known a method of enabling communication to each slave node by setting a slave address unique to each slave node from the master node.

特開平5−292098号公報Japanese Unexamined Patent Publication No. 5-292098

しかしながら、マスタノードは、各スレーブノードが正常に動作しているかどうかという動作状態を判別するためには、それぞれのスレーブノードのスレーブアドレスを指定して通信を行い、通信が確立するかどうかを確認する必要がある。例えば、図9に示すようにスレーブノードA、B、Cの各々との通信の確立を1つ1つ確認し、つまりスレーブノードの各々からACKが返信されることを確認する必要がある。スレーブノードの数が多い場合、確認には長い時間を要してしまう。複数のスレーブノードの動作状態の判別に長時間を要すると、マスタスレーブ通信システムが搭載されている機器全体の円滑な制御ができないおそれがある。 However, in order to determine the operating state of whether each slave node is operating normally, the master node specifies the slave address of each slave node and communicates, and confirms whether communication is established. There is a need to. For example, as shown in FIG. 9, it is necessary to confirm the establishment of communication with each of the slave nodes A, B, and C one by one, that is, to confirm that ACK is returned from each of the slave nodes. If the number of slave nodes is large, it will take a long time to confirm. If it takes a long time to determine the operating status of a plurality of slave nodes, smooth control of the entire device equipped with the master-slave communication system may not be possible.

本発明は、複数のスレーブノードの動作状態を短時間で判別することを目的とする。 An object of the present invention is to determine the operating state of a plurality of slave nodes in a short time.

上記目的を達成するために本発明は、マスタノードと、固有でないアドレスである初期アドレスを保持する複数のスレーブノードとを含むマスタスレーブ通信システムであって、前記複数の各スレーブノードのアドレスを、前記初期アドレスから、前記初期アドレスとは異なる前記各スレーブノードの固有アドレスに変更する変更手段と、前記変更手段によるアドレスの変更後に、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みる試行手段と、前記試行手段による試行結果に基づいて、前記各スレーブノードの動作状態を判別する判別手段と、を有することを特徴とする。 In order to achieve the above object, the present invention is a master-slave communication system including a master node and a plurality of slave nodes holding an initial address which is a non-unique address, and the address of each of the plurality of slave nodes is used. A changing means for changing from the initial address to a unique address of each slave node different from the initial address, and after the address is changed by the changing means, an attempt is made to communicate with each slave node using the initial address. It is characterized by having a trial means and a discriminating means for discriminating the operating state of each slave node based on the trial result by the trial means.

本発明によれば、複数のスレーブノードの動作状態を短時間で判別することができる。 According to the present invention, it is possible to determine the operating state of a plurality of slave nodes in a short time.

マスタスレーブ通信システムの構成を概略的に示すブロック図である。It is a block diagram which shows schematic structure of a master-slave communication system. スレーブノードAの構成を概略的に示すブロック図である。It is a block diagram which shows schematic structure of slave node A. I2C通信のタイミングチャートである。It is a timing chart of I2C communication. スレーブアドレス設定処理を示すフローチャートである。It is a flowchart which shows the slave address setting process. スレーブアドレス設定処理を示す図4の続きのフローチャートである。It is a continuation flowchart of FIG. 4 which shows the slave address setting process. スレーブアドレスの変更を説明する図である。It is a figure explaining the change of a slave address. 状態判別処理を示すフローチャートである。It is a flowchart which shows the state determination process. I2C通信方式の説明図である。It is explanatory drawing of the I2C communication system. 従来のI2C通信方式の説明図である。It is explanatory drawing of the conventional I2C communication system. 従来のI2C通信方式の説明図である。It is explanatory drawing of the conventional I2C communication system.

以下、図面を参照して本発明の実施の形態を説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.

図1は、本発明の一実施の形態に係るマスタスレーブ通信システムの構成を概略的に示すブロック図である。図1において、マスタスレーブ通信システム1000(以下、通信システム1000)は、マスタCPU100、及び複数のスレーブノードを備える。本実施の形態では、一例として、通信システム1000が、3つのスレーブノード、具体的にはスレーブノードA111、スレーブノードB112、及びスレーブノードC113を備える構成について説明する。なお、通信システム1000が備えるスレーブノードの個数は3つに限られず、2つ、又は4つ以上であっても良い。例えば、スレーブノードのアドレスのデータ長が8ビットである場合、スレーブノードの最大個数は、2−1、つまり、255となる。 FIG. 1 is a block diagram schematically showing a configuration of a master-slave communication system according to an embodiment of the present invention. In FIG. 1, the master-slave communication system 1000 (hereinafter, communication system 1000) includes a master CPU 100 and a plurality of slave nodes. In the present embodiment, as an example, a configuration in which the communication system 1000 includes three slave nodes, specifically, a slave node A111, a slave node B112, and a slave node C113 will be described. The number of slave nodes included in the communication system 1000 is not limited to three, and may be two or four or more. For example, if the data length of the address of the slave node is 8 bits, the maximum number of slave nodes 2 8 -1, i.e., a 255.

電子デバイスとしてのマスタCPU100は、1つ以上のマスタノード及びマスタROM104を備える。本実施の形態では、一例として、通信システム1000が、1つのマスタノード、具体的に、マスタノード101を備える構成について説明する。 The master CPU 100 as an electronic device includes one or more master nodes and a master ROM 104. In the present embodiment, as an example, a configuration in which the communication system 1000 includes one master node, specifically, a master node 101 will be described.

マスタノード101は、データ出力端子(SDA)及びクロック出力端子(CLKout)を備える。データ出力端子は、シリアルデータバス102に接続され、クロック出力端子は、クロック信号線103に接続される。シリアルデータバス102及びクロック信号線103には、それぞれスレーブノードA111、スレーブノードB112、及びスレーブノードC113が並列に接続される。このように、通信システム1000では、1つのマスタノードに対して複数のスレーブノードがぶらさがるように接続される。 The master node 101 includes a data output terminal (SDA) and a clock output terminal (CLKout). The data output terminal is connected to the serial data bus 102, and the clock output terminal is connected to the clock signal line 103. A slave node A111, a slave node B112, and a slave node C113 are connected in parallel to the serial data bus 102 and the clock signal line 103, respectively. In this way, in the communication system 1000, a plurality of slave nodes are connected so as to hang from one master node.

通信システム1000では、通信方式として、例えば、I2C通信が使用される。I2C通信では、マスタノード101が、クロック出力端子からクロック信号線103にシリアル通信用のクロック信号を出力する。クロック信号の立上りエッジ時におけるシリアルデータバス102の論理によって、シリアルデータが確定する。すなわち、スレーブノードA111、スレーブノードB112、及びスレーブノードC113のうち、マスタノード101によって指定されたスレーブノードは、当該クロック信号の立上りエッジ時におけるシリアルデータバス102のデータ信号を読み取る。以下では、マスタノード101がシリアルデータバス102及びクロック信号線103を介して各スレーブノードと行う通信を「マスタスレーブ通信」と称する。 In the communication system 1000, for example, I2C communication is used as the communication method. In I2C communication, the master node 101 outputs a clock signal for serial communication from the clock output terminal to the clock signal line 103. The serial data is determined by the logic of the serial data bus 102 at the rising edge of the clock signal. That is, among the slave node A111, the slave node B112, and the slave node C113, the slave node designated by the master node 101 reads the data signal of the serial data bus 102 at the rising edge of the clock signal. Hereinafter, the communication performed by the master node 101 with each slave node via the serial data bus 102 and the clock signal line 103 is referred to as "master-slave communication".

マスタCPU100は、スレーブノードA111、スレーブノードB112、及びスレーブノードC113へ電力を供給する。図1において、マスタCPU100は、電源線121からスレーブノードA111へ電力を供給し、電源線122からスレーブノードB112へ電力を供給し、電源線123からスレーブノードC113へ電力を供給する。なお、以下では、電源線121からスレーブノードA111へ供給される電力を「Vcc−A」とする。電源線122からスレーブノードB112へ供給される電力を「Vcc−B」とする。電源線123からスレーブノードC113へ供給される電力を「Vcc−C」とする。マスタCPU100は、電力の供給のオンオフ制御を電源線121〜123毎に個別に実施可能である。マスタROM104は、複数の変更アドレスを格納する。各変更アドレスは、マスタスレーブ通信にて使用される各スレーブノードのアドレスを設定する後述するスレーブアドレス設定処理(図4、図5)にて使用される。変更アドレスは、各スレーブノードに対応する固有のアドレス(固有アドレス)であり、各スレーブノードの変更アドレスは互いに異なるアドレスである。 The master CPU 100 supplies power to the slave node A111, the slave node B112, and the slave node C113. In FIG. 1, the master CPU 100 supplies power from the power supply line 121 to the slave node A111, supplies power from the power supply line 122 to the slave node B112, and supplies power from the power supply line 123 to the slave node C113. In the following, the power supplied from the power supply line 121 to the slave node A111 is referred to as "Vcc-A". The electric power supplied from the power supply line 122 to the slave node B112 is defined as "Vcc-B". The electric power supplied from the power supply line 123 to the slave node C113 is defined as "Vcc-C". The master CPU 100 can individually perform on / off control of power supply for each power supply line 121 to 123. The master ROM 104 stores a plurality of change addresses. Each changed address is used in the slave address setting process (FIGS. 4 and 5) described later, which sets the address of each slave node used in the master-slave communication. The change address is a unique address (unique address) corresponding to each slave node, and the change address of each slave node is a different address from each other.

I2C通信では、スレーブノードA111、スレーブノードB112及びスレーブノードC113は、通信システム1000内での通信に用いられるそれぞれ固有のスレーブアドレスを有している。マスタノード101は、通信対象とするスレーブノードが有しているスレーブアドレスを指定することで、スレーブノードA111、スレーブノードB112もしくはスレーブノードC113のいずれかが通信対象として選択される。マスタノード101は、選択されたスレーブノードと通信を行う。 In I2C communication, the slave node A111, the slave node B112, and the slave node C113 each have a unique slave address used for communication in the communication system 1000. The master node 101 selects any of the slave node A111, the slave node B112, and the slave node C113 as the communication target by designating the slave address possessed by the slave node to be communicated. The master node 101 communicates with the selected slave node.

I2C通信では、シリアルデータバス102及びクロック信号線103は、抵抗を介して電源Vddにプルアップされている。この電源Vddの電圧は、マスタノード101やスレーブノードへ供給される電圧(Vcc)と同等である。シリアルデータバス102及びクロック信号線103には複数のスレーブノードが接続されるため、それぞれのノードのシリアルデータバス102及びクロック信号線103につながる端子はオープンドレイン構成をとる。各スレーブノードの端子は、常時は入力モードにしてハイインピーダンス状態となる。 In I2C communication, the serial data bus 102 and the clock signal line 103 are pulled up to the power supply Vdd via a resistor. The voltage of this power supply Vdd is equivalent to the voltage (Vcc) supplied to the master node 101 and the slave node. Since a plurality of slave nodes are connected to the serial data bus 102 and the clock signal line 103, the terminals connected to the serial data bus 102 and the clock signal line 103 of each node have an open drain configuration. The terminals of each slave node are always in the input mode and are in a high impedance state.

なお、本実施の形態では、スレーブノードA111、スレーブノードB112、及びスレーブノードC113は互いに同様の構成であるので、以下では、代表してスレーブノードA111の構成を説明する。なお、以下では、スレーブノードB112の構成要素については、スレーブノードA111の構成要素の符号末尾の「A」を「B」と読み替える。また、スレーブノードC113の構成要素について、スレーブノードA111の構成要素の符号末尾の「A」を「C」と読み替える。 In the present embodiment, the slave node A111, the slave node B112, and the slave node C113 have the same configuration as each other. Therefore, the configuration of the slave node A111 will be described below as a representative. In the following, for the component of the slave node B112, "A" at the end of the code of the component of the slave node A111 is read as "B". Further, regarding the component of the slave node C113, "A" at the end of the code of the component of the slave node A111 is read as "C".

図2は、スレーブノードA111の構成を概略的に示すブロック図である。図2において、スレーブノードA111は、シリアル/パラレル変換部201A、受信アドレスレジスタ202A、内部アドレスレジスタ203A、スレーブCPU204A、及びスレーブROM205Aを備える。シリアル/パラレル変換部201A、受信アドレスレジスタ202A、スレーブCPU204Aは、内部バス206Aを介して互いに接続されている。スレーブROM205Aおよび内部アドレスレジスタ203Aは、スレーブCPU204Aと接続されている。 FIG. 2 is a block diagram schematically showing the configuration of the slave node A111. In FIG. 2, the slave node A111 includes a serial / parallel conversion unit 201A, a reception address register 202A, an internal address register 203A, a slave CPU 204A, and a slave ROM 205A. The serial / parallel conversion unit 201A, the reception address register 202A, and the slave CPU 204A are connected to each other via the internal bus 206A. The slave ROM 205A and the internal address register 203A are connected to the slave CPU 204A.

シリアル/パラレル変換部201Aは、シリアルデータバス102及びクロック信号線103と接続される。シリアル/パラレル変換部201Aは、マスタノード101から出力されたクロック信号の立上りエッジのタイミングで、マスタノード101から出力されたデータ信号を取り込む。シリアル/パラレル変換部201Aは、取り込んだデータ信号に基づくシリアルデータをパラレルデータに変換して内部バス206Aに出力する。また、シリアル/パラレル変換部201Aは、内部バス206Aを介して受信したパラレルデータをシリアルデータに変換して、当該シリアルデータのデータ信号をシリアルデータバス102へ出力する。 The serial / parallel conversion unit 201A is connected to the serial data bus 102 and the clock signal line 103. The serial / parallel conversion unit 201A takes in the data signal output from the master node 101 at the timing of the rising edge of the clock signal output from the master node 101. The serial / parallel conversion unit 201A converts the serial data based on the captured data signal into parallel data and outputs the serial data to the internal bus 206A. Further, the serial / parallel conversion unit 201A converts the parallel data received via the internal bus 206A into serial data, and outputs the data signal of the serial data to the serial data bus 102.

受信アドレスレジスタ202Aは、マスタノード101から受信したシリアル情報に含まれる変更アドレスを保持する。スレーブCPU204Aは、スレーブノードA111の全体的な動作制御を司る演算装置である。スレーブROM205Aは、スレーブCPU204Aによる制御に必要な各種情報を格納する。各種情報は、例えば、スレーブノードA111の初期アドレスを含む。初期アドレスは、マスタノード101と初期通信を確立するために用いられる。初期アドレスは、各スレーブノード間で共通であるが、いずれの変更アドレスとも異なる。 The reception address register 202A holds the change address included in the serial information received from the master node 101. The slave CPU 204A is an arithmetic unit that controls the overall operation of the slave node A111. The slave ROM 205A stores various information necessary for control by the slave CPU 204A. The various information includes, for example, the initial address of the slave node A111. The initial address is used to establish initial communication with the master node 101. The initial address is common to each slave node, but is different from any changed address.

スレーブノードA111には、電源線121を介してマスタCPU100から電力(Vcc−A)が供給される。マスタCPU100から電力が供給されない(Vccオフ)と、スレーブノードA111において、スレーブCPU204Aやシリアル/パラレル変換部201A等のスレーブノードA111内の各ブロックは動作しない。従って、スレーブノードA111は、シリアルデータバス102及びクロック信号線103から切断された状態となり、マスタノード101と通信不可能な状態となる。この状態は、実質的に、スレーブノードA111がマスタノード101と未接続状態である。 Power (Vcc-A) is supplied to the slave node A111 from the master CPU 100 via the power supply line 121. If power is not supplied from the master CPU 100 (Vcc off), each block in the slave node A111 such as the slave CPU 204A and the serial / parallel conversion unit 201A does not operate in the slave node A111. Therefore, the slave node A111 is disconnected from the serial data bus 102 and the clock signal line 103, and cannot communicate with the master node 101. In this state, the slave node A111 is substantially not connected to the master node 101.

マスタCPU100から電力が供給される(Vccオン)と、スレーブCPU204Aが起動すると共に、スレーブROM205Aに格納されている初期スレーブアドレスが内部アドレスレジスタ203Aに転送される。また、シリアル/パラレル変換部201A等のスレーブノードA111内の各ブロックが動作可能となる。従って、スレーブノードA111は、シリアルデータバス102及びクロック信号線103に接続された状態となり、マスタノード101と通信可能な状態となる。この状態は、実質的に、スレーブノードA111がマスタノード101と接続状態である。 When power is supplied from the master CPU 100 (Vcc on), the slave CPU 204A is activated and the initial slave address stored in the slave ROM 205A is transferred to the internal address register 203A. Further, each block in the slave node A111 such as the serial / parallel conversion unit 201A can operate. Therefore, the slave node A111 is in a state of being connected to the serial data bus 102 and the clock signal line 103, and is in a state of being able to communicate with the master node 101. In this state, the slave node A111 is substantially connected to the master node 101.

図3(a)、(b)で、I2C通信方式における通信タイミングについて説明する。図3(a)は、I2C通信のタイミングチャートである。ここでは、8ビットを1セットとして通信を行う場合について説明する。まず、マスタノード101はスタートコンディション(S)信号を出力する。スタートコンディションとは、マスタノード101がクロック信号線103上のクロック信号論理がHighの時に、シリアルデータバス102上のシリアルデータ論理をLowにした状態のことである。スタートコンディション(S)信号を出力することが、I2C通信開始の合図となる。 FIGS. 3 (a) and 3 (b) show the communication timing in the I2C communication method. FIG. 3A is a timing chart of I2C communication. Here, a case where communication is performed with 8 bits as one set will be described. First, the master node 101 outputs a start condition (S) signal. The start condition is a state in which the master node 101 sets the serial data logic on the serial data bus 102 to Low when the clock signal logic on the clock signal line 103 is High. Outputting the start condition (S) signal signals the start of I2C communication.

続いてマスタノード101は、クロック信号線103にクロック信号を出力するのと同期して、シリアルデータバス102に8ビットのデータを出力する。スレーブノードは、当該クロック信号の立上りエッジ時におけるシリアルデータバス102のシリアルデータ論理によって、シリアルデータを確定する。その後、必要なデータを受け取ったことを確認したら、スレーブノードはシリアルデータバス102上にACKを出力する。ここで、ACKを出力するというのは、シリアルデータバス102の信号レベルをLowにすることである。シリアルデータバス102はACK状態となる。 Subsequently, the master node 101 outputs 8-bit data to the serial data bus 102 in synchronization with the output of the clock signal to the clock signal line 103. The slave node determines the serial data by the serial data logic of the serial data bus 102 at the rising edge of the clock signal. After that, when it is confirmed that the necessary data has been received, the slave node outputs ACK on the serial data bus 102. Here, outputting ACK means setting the signal level of the serial data bus 102 to Low. The serial data bus 102 is in the ACK state.

一方、必要なデータを受け取ったことを確認できない場合は、スレーブノードはシリアルデータバス102に対して何も制御しない。従って、シリアルデータバス102上はNCK状態となる。図1に示すようにシリアルデータバス102は抵抗を介してプルアップされていることにより、シリアルデータバス102に対して何も制御しないと、シリアルデータバス102の信号レベルがHighになる。すなわち、シリアルデータバス102はNCK状態となる。 On the other hand, if it cannot be confirmed that the required data has been received, the slave node has no control over the serial data bus 102. Therefore, the serial data bus 102 is in the NCK state. As shown in FIG. 1, since the serial data bus 102 is pulled up via a resistor, the signal level of the serial data bus 102 becomes High if nothing is controlled for the serial data bus 102. That is, the serial data bus 102 is in the NCK state.

図3(b)は、マスタ側からスレーブアドレスを指定してI2C通信を行う場合の通信のタイミングチャートである。まず、マスタノード101はスタートコンディション(S)信号を出力する。マスタノード101は、クロック信号線103にクロック信号を出力するのと同期して、シリアルデータバス102にスレーブアドレス値を上位ビットから7ビット分出力する(A6〜A0)。続いて、マスタノード101は、その後の通信でマスタ側が送信となるか受信となるかを指示するためのR/W信号を出力する。マスタ側が送信となる場合、R/W信号はLowであり、マスタ側が受信となる場合、R/W信号はHighである。 FIG. 3B is a communication timing chart when I2C communication is performed by designating a slave address from the master side. First, the master node 101 outputs a start condition (S) signal. The master node 101 outputs the slave address value to the serial data bus 102 by 7 bits from the high-order bits in synchronization with the output of the clock signal to the clock signal line 103 (A6 to A0). Subsequently, the master node 101 outputs an R / W signal for instructing whether the master side will transmit or receive in the subsequent communication. When the master side is transmitting, the R / W signal is Low, and when the master side is receiving, the R / W signal is High.

スレーブノードは、シリアルデータバス102から受け取ったスレーブアドレスが自身のスレーブアドレスと一致すればACKを出力する。例えば、スレーブノードA111は、図2に示すシリアル/パラレル変換部201Aを介して変換されたパラレルデータのアドレス情報を受信アドレスレジスタ202Aに格納する。そしてスレーブノードA111は、受信アドレスレジスタ202Aに格納したアドレス情報と内部アドレスレジスタ203Aに格納されているアドレス情報とが一致した場合に、ACKを出力する。従って、シリアルデータバス102はACK状態となる。 The slave node outputs ACK if the slave address received from the serial data bus 102 matches its own slave address. For example, the slave node A111 stores the address information of the parallel data converted via the serial / parallel conversion unit 201A shown in FIG. 2 in the reception address register 202A. Then, the slave node A111 outputs ACK when the address information stored in the reception address register 202A and the address information stored in the internal address register 203A match. Therefore, the serial data bus 102 is in the ACK state.

一方、シリアルデータバス102から受け取ったスレーブアドレスデータが内部アドレスレジスタ203Aに格納されているアドレス情報と一致しない場合、スレーブノードA111は、シリアルデータバス102の制御をしない。従って、シリアルデータバス102はNCK状態となる。この後のデータ送信の動作は、上述したスレーブアドレス送信と同様であるため、説明を割愛する。 On the other hand, if the slave address data received from the serial data bus 102 does not match the address information stored in the internal address register 203A, the slave node A111 does not control the serial data bus 102. Therefore, the serial data bus 102 is in the NCK state. Since the operation of data transmission after this is the same as that of the slave address transmission described above, the description thereof is omitted.

図4、図5は、通信システム1000により実行されるスレーブアドレス設定処理を示すフローチャートである。この処理は、マスタCPU100と各スレーブCPUとの協働により実現される。そのために、マスタCPU100は、マスタROM104に格納されたプログラムをマスタCPU100に備わるRAMに展開して実行する。これに加えて、各スレーブCPUが、各スレーブROMに格納されたプログラムを各スレーブノードに備わるRAMに展開して実行する。この処理において、マスタCPU100は、本願発明における変更手段としての役割を果たす。 4 and 5 are flowcharts showing the slave address setting process executed by the communication system 1000. This process is realized by the collaboration between the master CPU 100 and each slave CPU. Therefore, the master CPU 100 expands and executes the program stored in the master ROM 104 in the RAM provided in the master CPU 100. In addition to this, each slave CPU expands the program stored in each slave ROM into the RAM provided in each slave node and executes it. In this process, the master CPU 100 serves as a changing means in the present invention.

この処理は、例えば、マスタCPU100に通信開始の指示が入力されると開始される。この処理の初期状態では、マスタCPU100から全てのスレーブノードへの電力の供給が停止されていることとする。つまり、スレーブノードA111、スレーブノードB112、及びスレーブノードC113が、マスタノード101と未接続状態である。 This process is started, for example, when an instruction to start communication is input to the master CPU 100. In the initial state of this processing, it is assumed that the power supply from the master CPU 100 to all the slave nodes is stopped. That is, the slave node A111, the slave node B112, and the slave node C113 are not connected to the master node 101.

ステップS301では、通信システム1000は、マスタCPU100からスレーブノードA111、スレーブノードB112及びスレーブノードC113の中の1つ、例えば、スレーブノードA111へ電力(Vcc−A)を供給する。 In step S301, the communication system 1000 supplies electric power (Vcc-A) from the master CPU 100 to one of the slave node A111, the slave node B112, and the slave node C113, for example, the slave node A111.

ステップS302では、通信システム1000は、電力が供給されたスレーブノードA111の初期設定を行う。具体的には、スレーブノードA111では、スレーブCPU204Aが、スレーブROM205Aに格納された初期アドレスを内部アドレスレジスタ203Aへ転送する。これにより、初期アドレスがスレーブノードA111のスレーブアドレスとして設定される。初期アドレスは、例えば、二進数で表される値である。本実施の形態では、一例として、初期アドレスを「0000100」とする。 In step S302, the communication system 1000 performs initial setting of the slave node A111 to which power is supplied. Specifically, in the slave node A111, the slave CPU 204A transfers the initial address stored in the slave ROM 205A to the internal address register 203A. As a result, the initial address is set as the slave address of the slave node A111. The initial address is, for example, a value represented by a binary number. In the present embodiment, as an example, the initial address is set to "0000100".

ステップS303では、通信システム1000は、マスタノード101により、スレーブノードA111のスレーブアドレス「0000100」を指定して、マスタノード101及びスレーブノードA111のマスタスレーブ通信を開始する。そのために、マスタノード101は、スレーブノードA111のアドレス「0000100」を示すデータ信号をシリアルデータバス102へ出力する。スレーブノードA111においては、シリアル/パラレル変換部201Aが上記データ信号を受信すると、上記データ信号が示すアドレス(以下、「指定アドレス」という)を受信アドレスレジスタ202Aに格納される。 In step S303, the communication system 1000 specifies the slave address "0000100" of the slave node A111 by the master node 101, and starts the master-slave communication of the master node 101 and the slave node A111. Therefore, the master node 101 outputs a data signal indicating the address “0000100” of the slave node A111 to the serial data bus 102. In the slave node A111, when the serial / parallel conversion unit 201A receives the data signal, the address indicated by the data signal (hereinafter referred to as "designated address") is stored in the reception address register 202A.

ステップS304では、通信システム1000は、マスタノード101及びスレーブノードA111のマスタスレーブ通信を確立するための処理を実行する。そのために、スレーブノードA111において、スレーブCPU204Aは、受信アドレスレジスタ202Aに格納された指定アドレスと、内部アドレスレジスタ203Aに保持されたアドレスとを比較する。ここでは、内部アドレスレジスタ203Aに保持されたアドレスは、スレーブノードA111のスレーブアドレスとして設定された初期アドレス「0000100」である。そして、これら2つのアドレスを比較した結果、2つのアドレスが一致した場合、通信システム1000は、マスタノード101及びスレーブノードA111のマスタスレーブ通信を確立する。 In step S304, the communication system 1000 executes a process for establishing master-slave communication between the master node 101 and the slave node A111. Therefore, in the slave node A111, the slave CPU 204A compares the designated address stored in the receive address register 202A with the address held in the internal address register 203A. Here, the address held in the internal address register 203A is the initial address "0000100" set as the slave address of the slave node A111. Then, as a result of comparing these two addresses, if the two addresses match, the communication system 1000 establishes master-slave communication between the master node 101 and the slave node A111.

ステップS305では、通信システム1000は、スレーブノードA111のスレーブアドレスを変更する。具体的には、マスタノード101は、マスタROM104に格納された第1の変更アドレスを、シリアルデータバス102を介してスレーブノードA111へ送信する。ここで、第1の変更アドレスは、初期アドレスと異なるアドレスであって、マスタスレーブ通信におけるスレーブノードA111に固有のアドレス、例えば、「0000101」である。スレーブノードA111は、受信した第1の変更アドレスを内部アドレスレジスタ203Aへ転送する。これにより、スレーブノードA111のスレーブアドレスが、図6に示すように、初期アドレス「0000100」から変更後のアドレス「0000101」に切り替わる。 In step S305, the communication system 1000 changes the slave address of the slave node A111. Specifically, the master node 101 transmits the first change address stored in the master ROM 104 to the slave node A111 via the serial data bus 102. Here, the first changed address is an address different from the initial address, and is an address unique to the slave node A111 in the master-slave communication, for example, "0000101". The slave node A111 transfers the received first change address to the internal address register 203A. As a result, the slave address of the slave node A111 is switched from the initial address "0000100" to the changed address "0000101" as shown in FIG.

ステップS306では、通信システム1000は、第1の変更アドレス「0000101」を指定して、マスタノード101及びスレーブノードA111のマスタスレーブ通信を開始する処理を実行する。 In step S306, the communication system 1000 specifies the first change address "0000101" and executes a process of starting master-slave communication of the master node 101 and the slave node A111.

ステップS307では、通信システム1000は、マスタノード101及びスレーブノードA111のマスタスレーブ通信を確立したか否かを判別する。スレーブノードA111のスレーブアドレスが、初期アドレス「0000100」から第1の変更アドレス「0000101」に正常に切り替わっていれば、通信は確立する。 In step S307, the communication system 1000 determines whether or not master-slave communication between the master node 101 and the slave node A111 has been established. If the slave address of the slave node A111 is normally switched from the initial address "0000100" to the first change address "0000101", communication is established.

ステップS307の判別の結果、マスタノード101及びスレーブノードA111のマスタスレーブ通信が確立しない場合、スレーブノードA111のスレーブアドレスが初期アドレスから第1の変更アドレスに正常に切り替わっていない。この場合、マスタCPU100は、ステップS303の処理に戻る。一方、マスタノード101及びスレーブノードA111のマスタスレーブ通信が確立した場合、スレーブノードA111のスレーブアドレスが初期アドレスから第1の変更アドレスに正常に切り替わっている。この場合、通信システム1000は、処理をステップS308に進める。 As a result of the determination in step S307, when the master-slave communication of the master node 101 and the slave node A111 is not established, the slave address of the slave node A111 is not normally switched from the initial address to the first changed address. In this case, the master CPU 100 returns to the process of step S303. On the other hand, when the master-slave communication of the master node 101 and the slave node A111 is established, the slave address of the slave node A111 is normally switched from the initial address to the first changed address. In this case, the communication system 1000 advances the process to step S308.

ステップS308では、通信システム1000は、スレーブノードA111以外のスレーブノード、例えば、スレーブノードB112のアドレスの設定を開始する。具体的には、通信システム1000は、マスタCPU100からスレーブノードB112へ電力(Vcc−B)を供給する。このとき、スレーブノードA111には電力が供給され続け、スレーブノードA111のスレーブアドレス「000101」の設定は保持される。 In step S308, the communication system 1000 starts setting the address of a slave node other than the slave node A111, for example, the slave node B112. Specifically, the communication system 1000 supplies electric power (Vcc-B) from the master CPU 100 to the slave node B112. At this time, power continues to be supplied to the slave node A111, and the setting of the slave address "000101" of the slave node A111 is maintained.

ステップS309では、通信システム1000は、電力が供給されたスレーブノードB112の初期設定を行う。具体的には、ステップS302と同様に、スレーブノードB112において、スレーブCPUが、スレーブROMに格納された初期アドレスを、スレーブノードB112のスレーブアドレスとして設定する。ここで、スレーブノードB112のスレーブROMに格納された初期アドレスは、スレーブノードA111のスレーブROM205Aに格納された初期アドレスと同じアドレス「0000100」である。 In step S309, the communication system 1000 performs the initial setting of the slave node B112 to which the power is supplied. Specifically, similarly to step S302, in the slave node B112, the slave CPU sets the initial address stored in the slave ROM as the slave address of the slave node B112. Here, the initial address stored in the slave ROM of the slave node B112 is the same address "0000100" as the initial address stored in the slave ROM 205A of the slave node A111.

ステップS310では、通信システム1000は、マスタノード101により、スレーブノードB112のスレーブアドレス「0000100」を指定して、マスタノード101及びスレーブノードB112のマスタスレーブ通信を開始する。そのために、マスタノード101は、スレーブノードB112のアドレス「0000100」を示すデータ信号をシリアルデータバス102へ出力する。スレーブノードB112においては、受信したデータ信号が示す指定アドレスが受信アドレスレジスタに格納される。 In step S310, the communication system 1000 specifies the slave address “0000100” of the slave node B112 by the master node 101, and starts the master-slave communication of the master node 101 and the slave node B112. Therefore, the master node 101 outputs a data signal indicating the address “0000100” of the slave node B112 to the serial data bus 102. In the slave node B112, the designated address indicated by the received data signal is stored in the received address register.

ステップS311では、マスタノード101及びスレーブノードB112のマスタスレーブ通信を確立するための処理を実行する。そのために、スレーブノードB112において、スレーブCPUは、受信アドレスレジスタに格納された指定アドレスと、内部アドレスレジスタに保持されたアドレス(初期アドレス)とを比較する。そして、これら2つのアドレスを比較した結果、2つのアドレスが一致した場合、通信システム1000は、マスタノード101及びスレーブノードB112のマスタスレーブ通信を確立する。 In step S311, a process for establishing master-slave communication between the master node 101 and the slave node B112 is executed. Therefore, in the slave node B112, the slave CPU compares the designated address stored in the receive address register with the address (initial address) stored in the internal address register. Then, as a result of comparing these two addresses, if the two addresses match, the communication system 1000 establishes master-slave communication between the master node 101 and the slave node B112.

ステップS312では、通信システム1000は、スレーブノードB112のスレーブアドレスを変更する。具体的には、マスタノード101は、マスタROM104に格納された第2の変更アドレスを、シリアルデータバス102を介してスレーブノードB112へ送信する。ここで、第2の変更アドレスは、初期アドレス及び第1の変更アドレスのいずれとも異なるアドレスであって、マスタスレーブ通信システムにおけるスレーブノードB112に固有のアドレス、例えば、「0000110」である。スレーブノードB112は、受信した第2の変更アドレスを内部アドレスレジスタへ転送する。これにより、スレーブノードB112のスレーブアドレスが、図6に示すように、初期アドレス「0000100」から第2の変更アドレス「0000110」に切り替わる。 In step S312, the communication system 1000 changes the slave address of the slave node B112. Specifically, the master node 101 transmits the second change address stored in the master ROM 104 to the slave node B 112 via the serial data bus 102. Here, the second change address is an address different from both the initial address and the first change address, and is an address unique to the slave node B112 in the master-slave communication system, for example, "0000110". The slave node B112 transfers the received second change address to the internal address register. As a result, the slave address of the slave node B112 is switched from the initial address "0000100" to the second change address "0000110" as shown in FIG.

ステップS313では、通信システム1000は、第2の変更アドレス「0000110」を指定して、マスタノード101及びスレーブノードB112のマスタスレーブ通信を開始する処理を実行する。 In step S313, the communication system 1000 specifies the second change address "0000110" and executes a process of starting master-slave communication of the master node 101 and the slave node B112.

ステップS314では、通信システム1000は、マスタノード101及びスレーブノードB112のマスタスレーブ通信が確立したか否かを判別する。スレーブノードB112のスレーブアドレスが、初期アドレス「0000100」から第2の変更アドレス「0000110」に正常に切り替わっていれば、通信は確立する。 In step S314, the communication system 1000 determines whether or not master-slave communication between the master node 101 and the slave node B112 has been established. If the slave address of the slave node B112 is normally switched from the initial address "0000100" to the second change address "0000110", communication is established.

ステップS314の判別の結果、マスタノード101及びスレーブノードB112のマスタスレーブ通信が確立しない場合、スレーブノードB112のアドレスが初期アドレスから第2の変更アドレスに正常に切り替わっていない。この場合、通信システム1000は、ステップS310の処理に戻る。一方、マスタノード101及びスレーブノードB112のマスタスレーブ通信が確立した場合、スレーブノードB112のアドレスが初期アドレスから第2の変更アドレスに正常に切り替わっている。この場合、通信システム1000は、ステップS315に処理を進める。 As a result of the determination in step S314, when the master-slave communication of the master node 101 and the slave node B112 is not established, the address of the slave node B112 is not normally switched from the initial address to the second changed address. In this case, the communication system 1000 returns to the process of step S310. On the other hand, when the master-slave communication of the master node 101 and the slave node B112 is established, the address of the slave node B112 is normally switched from the initial address to the second changed address. In this case, the communication system 1000 proceeds to step S315.

ステップS315では、通信システム1000は、スレーブノードA111、スレーブノードB112以外のスレーブノードであるスレーブノードC113のアドレスの設定を開始する。具体的には、通信システム1000は、マスタCPU100からスレーブノードC113へ電力(Vcc−C)を供給する。このとき、スレーブノードA111及びスレーブノードB112には電力が供給され続け、スレーブノードA111のアドレス「0000101」の設定及びスレーブノードB112のアドレス「0000110」の設定は保持される。 In step S315, the communication system 1000 starts setting the address of the slave node C113 which is a slave node other than the slave node A111 and the slave node B112. Specifically, the communication system 1000 supplies electric power (Vcc-C) from the master CPU 100 to the slave node C 113. At this time, power continues to be supplied to the slave node A111 and the slave node B112, and the setting of the address "0000101" of the slave node A111 and the setting of the address "0000110" of the slave node B112 are maintained.

ステップS316では、通信システム1000は、電力が供給されたスレーブノードC113の初期設定を行う。具体的には、ステップS309と同様に、スレーブノードC113において、スレーブCPUが、スレーブROMに格納された初期アドレスを、スレーブノードC113のスレーブアドレスとして設定する。ここで、スレーブノードC113のスレーブROMに格納された初期アドレスは、スレーブノードA111のスレーブROM205Aに格納された初期アドレスと同じアドレス「0000100」である。 In step S316, the communication system 1000 performs the initial setting of the slave node C113 to which the power is supplied. Specifically, as in step S309, in the slave node C113, the slave CPU sets the initial address stored in the slave ROM as the slave address of the slave node C113. Here, the initial address stored in the slave ROM of the slave node C113 is the same address "0000100" as the initial address stored in the slave ROM 205A of the slave node A111.

ステップS317では、通信システム1000は、マスタノード101により、スレーブノードC113のスレーブアドレス「0000100」を指定して、マスタノード101及びスレーブノードC113のマスタスレーブ通信を開始する。そのために、マスタノード101は、スレーブノードC113のアドレス「0000100」を示すデータ信号をシリアルデータバス102へ出力する。スレーブノードC113においては、受信したデータ信号が示す指定アドレスが受信アドレスレジスタに格納される。 In step S317, the communication system 1000 specifies the slave address “0000100” of the slave node C113 by the master node 101, and starts the master-slave communication of the master node 101 and the slave node C113. Therefore, the master node 101 outputs a data signal indicating the address “0000100” of the slave node C113 to the serial data bus 102. In the slave node C113, the designated address indicated by the received data signal is stored in the received address register.

ステップS318では、マスタノード101及びスレーブノードC113のマスタスレーブ通信を確立するための処理を実行する。そのために、スレーブノードC113において、スレーブCPUは、受信アドレスレジスタに格納された指定アドレスと、内部アドレスレジスタに保持されたアドレス(初期アドレス)とを比較する。そして、これら2つのアドレスを比較した結果、2つのアドレスが一致した場合、通信システム1000は、マスタノード101及びスレーブノードC113のマスタスレーブ通信を確立する。 In step S318, a process for establishing master-slave communication between the master node 101 and the slave node C113 is executed. Therefore, in the slave node C113, the slave CPU compares the designated address stored in the receive address register with the address (initial address) stored in the internal address register. Then, as a result of comparing these two addresses, if the two addresses match, the communication system 1000 establishes master-slave communication between the master node 101 and the slave node C113.

ステップS319では、通信システム1000は、スレーブノードC113のスレーブアドレスを変更する。具体的には、マスタノード101は、マスタROM104に格納された第3の変更アドレスを、シリアルデータバス102を介してスレーブノードC113へ送信する。ここで、第3の変更アドレスは、初期アドレス、第1、第2の変更アドレスのいずれとも異なるアドレスであって、マスタスレーブ通信システムにおけるスレーブノードC113に固有のアドレス、例えば、「0000111」である。スレーブノードC113は、受信した第3の変更アドレスを内部アドレスレジスタへ転送する。これにより、スレーブノードC113のスレーブアドレスが、図6に示すように、初期アドレス「0000100」から第3の変更アドレス「0000111」に切り替わる。 In step S319, the communication system 1000 changes the slave address of the slave node C113. Specifically, the master node 101 transmits the third change address stored in the master ROM 104 to the slave node C 113 via the serial data bus 102. Here, the third change address is an address different from any of the initial address and the first and second change addresses, and is an address unique to the slave node C113 in the master-slave communication system, for example, "0000111". .. The slave node C113 transfers the received third change address to the internal address register. As a result, the slave address of the slave node C113 is switched from the initial address "0000100" to the third change address "0000111" as shown in FIG.

ステップS320では、通信システム1000は、第3の変更アドレス「0000111」を指定して、マスタノード101及びスレーブノードC113のマスタスレーブ通信を開始する処理を実行する。 In step S320, the communication system 1000 specifies a third change address "0000111" and executes a process of starting master-slave communication of the master node 101 and the slave node C113.

ステップS321では、通信システム1000は、マスタノード101及びスレーブノードC113のマスタスレーブ通信が確立したか否かを判別する。スレーブノードC113のスレーブアドレスが、初期アドレス「0000100」から第3の変更アドレス「0000111」に正常に切り替わっていれば、通信は確立する。 In step S321, the communication system 1000 determines whether or not master-slave communication between the master node 101 and the slave node C113 has been established. If the slave address of the slave node C113 is normally switched from the initial address "0000100" to the third change address "0000111", communication is established.

ステップS321の判別の結果、マスタノード101及びスレーブノードC113のマスタスレーブ通信が確立しない場合、スレーブノードC113のアドレスが初期アドレスから第3の変更アドレスに正常に切り替わっていない。この場合、通信システム1000は、ステップS317の処理に戻る。一方、マスタノード101及びスレーブノードC113のマスタスレーブ通信が確立した場合、スレーブノードC113のアドレスが初期アドレスから第3の変更アドレスに正常に切り替わっている。この場合、通信システム1000は、図4,図5に示す処理を終了する。 As a result of the determination in step S321, when the master-slave communication of the master node 101 and the slave node C113 is not established, the address of the slave node C113 is not normally switched from the initial address to the third changed address. In this case, the communication system 1000 returns to the process of step S317. On the other hand, when the master-slave communication of the master node 101 and the slave node C113 is established, the address of the slave node C113 is normally switched from the initial address to the third changed address. In this case, the communication system 1000 ends the process shown in FIGS. 4 and 5.

図7は、状態判別処理を示すフローチャートである。この処理は、マスタCPU100が、マスタROM104に格納されたプログラムをマスタCPU100に備わるRAMに展開して実行することにより実現される。この処理は、スレーブアドレス設定処理(図4、図5)の実行後、つまり、各スレーブノードのスレーブアドレスが、それぞれに固有のアドレスに変更された後に実行される。この処理は、スレーブアドレス設定処理の実行直後、あるいはデータ送受信を実施しようとする前に開始される。なお、この処理は、状態判別の指示が入力されると開始されるようにしてもよい。この処理において、マスタCPU100は、本願発明における試行手段、判別手段としての役割を果たす。 FIG. 7 is a flowchart showing the state determination process. This process is realized by the master CPU 100 expanding the program stored in the master ROM 104 into the RAM provided in the master CPU 100 and executing the program. This process is executed after the slave address setting process (FIGS. 4 and 5) is executed, that is, after the slave address of each slave node is changed to an address unique to each slave node. This process is started immediately after the execution of the slave address setting process or before attempting to transmit / receive data. It should be noted that this process may be started when an instruction for determining the state is input. In this process, the master CPU 100 serves as a trial means and a discrimination means in the present invention.

ところで、各スレーブノードは、電力が供給されなくなったときや、外来ノイズの影響を受けたときに初期状態にリセットされ、何らかの要因で電力が瞬断されたときにもリセットされる。また、各スレーブノードは、リセットされると、自身のスレーブアドレス(内部アドレスレジスタに格納されるもの)が固有のアドレスから初期アドレスに戻る。スレーブノードのリセット状態においてはスレーブアドレスは初期アドレスに維持される。通常、スレーブアドレス設定処理(図4、図5)の実行後は、全てのスレーブノードにおいて、スレーブアドレスは初期アドレスから固有のアドレスに変更されている。ところが、スレーブアドレスの変更が適切に実施されなかったり、上記したリセット等の事情があったりした場合は、スレーブアドレスが初期アドレスに戻ってしまっている可能性がある。 By the way, each slave node is reset to the initial state when the power is not supplied or when it is affected by external noise, and is also reset when the power is momentarily interrupted for some reason. Also, when each slave node is reset, its slave address (stored in the internal address register) returns from its unique address to its initial address. The slave address is maintained at the initial address in the reset state of the slave node. Normally, after the slave address setting process (FIGS. 4 and 5) is executed, the slave address is changed from the initial address to the unique address in all the slave nodes. However, if the slave address is not changed properly or if there are circumstances such as the above-mentioned reset, the slave address may have returned to the initial address.

その一方、スレーブノードの各々との通信の確立を1つ1つ確認するには長い時間を要する。そこで、本実施の形態では、マスタCPU100は、初期アドレスを用いた通信の試みにより、正常でないスレーブノードの存在の有無を調べる。 On the other hand, it takes a long time to confirm the establishment of communication with each of the slave nodes one by one. Therefore, in the present embodiment, the master CPU 100 checks for the existence of an abnormal slave node by attempting communication using the initial address.

まず、ステップS701では、マスタCPU100は、通信を試みる全てのスレーブノードへ電力を供給すると共に、全てのスレーブノードに対して初期アドレスでの通信を試みる。すなわち、図8に示すように、マスタCPU100は、シリアルデータバス102に対して初期アドレスを送信する。これにより実質的に、全てのスレーブノード(ここではスレーブノードA111、B112、C113)へ一斉に初期アドレスが送信される。各スレーブノードでは、受信アドレスレジスタに初期アドレスが格納される。 First, in step S701, the master CPU 100 supplies power to all the slave nodes that try to communicate, and tries to communicate with all the slave nodes at the initial address. That is, as shown in FIG. 8, the master CPU 100 transmits the initial address to the serial data bus 102. As a result, the initial address is transmitted to substantially all the slave nodes (here, slave nodes A111, B112, C113) all at once. In each slave node, the initial address is stored in the receive address register.

ステップS702では、マスタCPU100は、シリアルデータバス102がACK状態となっているか否かを判別する。ここで、各スレーブCPUは、受信アドレスレジスタに格納された初期アドレスと、スレーブアドレス(内部アドレスレジスタに保持されたアドレス)の両者が一致すればシリアルデータバス102へACKを出力する。各スレーブノードが正常に動作していればスレーブアドレスは固有アドレスとなっているのでACKが出力される。しかし、両者が一致しないスレーブノードのスレーブCPUは、シリアルデータバス102へNCKを出力する。従って、スレーブアドレスが初期アドレスとなっているスレーブノードが1つでもあれば、シリアルデータバス102はACK状態となる。しかし、全てのスレーブノードでスレーブアドレスが固有アドレスとなっている場合は、シリアルデータバス102はNCK状態となる。 In step S702, the master CPU 100 determines whether or not the serial data bus 102 is in the ACK state. Here, each slave CPU outputs ACK to the serial data bus 102 if both the initial address stored in the receive address register and the slave address (address held in the internal address register) match. If each slave node is operating normally, the slave address is a unique address, so ACK is output. However, the slave CPU of the slave node whose two do not match outputs NCK to the serial data bus 102. Therefore, if there is at least one slave node whose slave address is the initial address, the serial data bus 102 is in the ACK state. However, when the slave address is a unique address in all the slave nodes, the serial data bus 102 is in the NCK state.

ステップS702の判別の結果、シリアルデータバス102がACK状態となっていない場合は、マスタCPU100は処理をステップS703に進める。従って、シリアルデータバス102がNCK状態となっている場合は、マスタCPU100は処理をステップS703に進める。シリアルデータバス102がACK状態となっていないことは、試行結果が「通信の不成立」を示した場合に該当する。これは、ACKを出力したスレーブノードが1つもなかったことを意味する。従って、ステップS703では、マスタCPU100は、全てのスレーブノードの動作状態が正常であると判別する。その後、マスタCPU100は、図7に示す処理を終了する。 If the serial data bus 102 is not in the ACK state as a result of the determination in step S702, the master CPU 100 advances the process to step S703. Therefore, when the serial data bus 102 is in the NCK state, the master CPU 100 advances the process to step S703. The fact that the serial data bus 102 is not in the ACK state corresponds to the case where the trial result indicates "communication failure". This means that none of the slave nodes output ACK. Therefore, in step S703, the master CPU 100 determines that the operating states of all the slave nodes are normal. After that, the master CPU 100 ends the process shown in FIG. 7.

一方、ステップS702の判別の結果、シリアルデータバス102がACK状態となっている場合は、マスタCPU100は処理をステップS704に進める。シリアルデータバス102がACK状態となっていることは、試行結果が「通信の成立」を示した場合に該当する。これは、ACKを出力したスレーブノードが少なくとも1つ存在したことを意味する。そこで、マスタCPU100は、ステップS704で、少なくとも1つのスレーブノードの動作状態が正常でないと判別する。言い換えると、マスタCPU100は、各スレーブノードのうち少なくとも1つは初期状態にリセットされていると判別する。 On the other hand, if the serial data bus 102 is in the ACK state as a result of the determination in step S702, the master CPU 100 advances the process to step S704. The fact that the serial data bus 102 is in the ACK state corresponds to the case where the trial result indicates "establishment of communication". This means that there was at least one slave node that output an ACK. Therefore, in step S704, the master CPU 100 determines that the operating state of at least one slave node is not normal. In other words, the master CPU 100 determines that at least one of the slave nodes has been reset to the initial state.

ステップS705では、マスタCPU100は、通信を試みた全てのスレーブノードに対する電力の供給を停止(電力オフ)する。その後、ステップS706で、図4、図5に示すスレーブアドレス設定処理と同様の処理を再度実行する。これにより、マスタCPU100は、各スレーブノードの内部アドレスレジスタに、それぞれに固有のアドレスを保持させる。その後、マスタCPU100は、処理をステップS701に戻す。なお、ステップS701へ戻る処理が所定回数繰り返されてもステップS703へ移行しない場合は、エラーを報知すると共に、図7に示す処理を終了してもよい。 In step S705, the master CPU 100 stops the power supply (power off) to all the slave nodes that have tried to communicate. After that, in step S706, the same process as the slave address setting process shown in FIGS. 4 and 5 is executed again. As a result, the master CPU 100 causes the internal address registers of the slave nodes to hold their own unique addresses. After that, the master CPU 100 returns the process to step S701. If the process of returning to step S701 is repeated a predetermined number of times but the process does not proceed to step S703, an error may be notified and the process shown in FIG. 7 may be terminated.

このように、マスタCPU100は、シリアルデータバス102がACK状態かどうかを確認することで、少なくとも1つのスレーブノードが異常なのか、それとも全スレーブノードが正常なのか、を判別することができる。 In this way, the master CPU 100 can determine whether at least one slave node is abnormal or all slave nodes are normal by checking whether the serial data bus 102 is in the ACK state.

本実施の形態によれば、マスタCPU100は、スレーブノードのスレーブアドレスを初期アドレスから固有アドレスへ変更した後に、初期アドレスを用いて、各スレーブノードとの通信を試みる。そして、その試行結果に基づいて、各スレーブノードの動作状態を判別する。すなわち、各スレーブノードに接続されたシリアルデータバス102の状態がACKであるか否かによって、少なくとも1つのスレーブノードが異常なのか、全スレーブノードが正常なのか、を判別することができる。よって、複数のスレーブノードの動作状態を短時間で判別することができる。 According to the present embodiment, the master CPU 100 tries to communicate with each slave node by using the initial address after changing the slave address of the slave node from the initial address to the unique address. Then, based on the trial result, the operating state of each slave node is determined. That is, it is possible to determine whether at least one slave node is abnormal or all slave nodes are normal depending on whether or not the state of the serial data bus 102 connected to each slave node is ACK. Therefore, it is possible to determine the operating state of a plurality of slave nodes in a short time.

以上、本発明をその好適な実施形態に基づいて詳述してきたが、本発明はこれら特定の実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の様々な形態も本発明に含まれる。 Although the present invention has been described in detail based on the preferred embodiments thereof, the present invention is not limited to these specific embodiments, and various embodiments within the range not deviating from the gist of the present invention are also included in the present invention. included.

100 マスタCPU
101 マスタノード
111 スレーブノードA
112 スレーブノードB
113 スレーブノードC
1000 マスタスレーブ通信システム
100 master CPU
101 Master node 111 Slave node A
112 Slave node B
113 Slave node C
1000 master-slave communication system

Claims (23)

マスタノードと、固有でないアドレスである初期アドレスを保持する複数のスレーブノードとを含むマスタスレーブ通信システムであって、
前記複数の各スレーブノードのアドレスを、前記初期アドレスから、前記初期アドレスとは異なる前記各スレーブノードの固有アドレスに変更する変更手段と、
前記変更手段によるアドレスの変更後に、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みる試行手段と、
前記試行手段による試行結果に基づいて、前記各スレーブノードの動作状態を判別する判別手段と、を有することを特徴とするマスタスレーブ通信システム。
A master-slave communication system that includes a master node and a plurality of slave nodes that hold an initial address that is a non-unique address.
A changing means for changing the address of each of the plurality of slave nodes from the initial address to a unique address of each slave node different from the initial address.
After the address is changed by the changing means, the trial means for trying to communicate with each of the slave nodes using the initial address, and the trial means.
A master-slave communication system comprising: a discriminating means for discriminating the operating state of each slave node based on a trial result by the trial means.
前記判別手段は、前記試行結果が通信の不成立を示した場合は、前記各スレーブノードの動作状態が正常であると判別することを特徴とする請求項1に記載のマスタスレーブ通信システム。 The master-slave communication system according to claim 1, wherein the discriminating means determines that the operating state of each slave node is normal when the trial result indicates that communication is not established. 前記判別手段は、前記試行結果が通信の成立を示した場合は、前記各スレーブノードのうち少なくとも1つの動作状態が正常でないと判別することを特徴とする請求項1または2に記載のマスタスレーブ通信システム。 The master-slave according to claim 1 or 2, wherein the discriminating means determines that the operating state of at least one of the slave nodes is not normal when the trial result indicates that the communication is established. Communications system. 前記判別手段は、前記試行結果が通信の成立を示した場合は、前記各スレーブノードのうち少なくとも1つは初期状態にリセットされていると判別することを特徴とする請求項3に記載のマスタスレーブ通信システム。 The master according to claim 3, wherein the discriminating means determines that at least one of the slave nodes has been reset to the initial state when the trial result indicates that communication has been established. Slave communication system. 前記マスタノードと前記複数のスレーブノードとは、I2C通信方式を用いて通信され、
前記判別手段は、前記各スレーブノードに接続されたシリアルデータバスの状態がACKである場合に、前記試行結果が通信の成立を示すと判別することを特徴とする請求項1乃至4のいずれか1項に記載のマスタスレーブ通信システム。
The master node and the plurality of slave nodes are communicated using the I2C communication method, and the master node and the plurality of slave nodes are communicated with each other.
One of claims 1 to 4, wherein the determination means determines that the trial result indicates the establishment of communication when the state of the serial data bus connected to each slave node is ACK. The master-slave communication system according to item 1.
前記判別手段は、前記各スレーブノードに接続されたシリアルデータバスの状態がNCKである場合に、前記試行結果が通信の不成立を示すと判別することを特徴とする請求項5に記載のマスタスレーブ通信システム。 The master-slave according to claim 5, wherein the discriminating means determines that the trial result indicates a communication failure when the state of the serial data bus connected to each slave node is NCK. Communications system. 前記固有アドレスは、前記各スレーブノード間で互いに異なることを特徴とする請求項1乃至6のいずれか1項に記載のマスタスレーブ通信システム。 The master-slave communication system according to any one of claims 1 to 6, wherein the unique address is different between the slave nodes. 前記試行手段は、通信を試みるスレーブノードの全てに電力を供給した状態で、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みることを特徴とする請求項1乃至7のいずれか1項に記載のマスタスレーブ通信システム。 One of claims 1 to 7, wherein the trial means attempts to communicate with each of the slave nodes by using the initial address while supplying power to all the slave nodes that attempt to communicate. The master-slave communication system described in the section. 前記試行結果が通信の成立を示す場合は、前記試行手段は、前記各スレーブノードに対する電力の供給を停止した後に、再度、前記各スレーブノードに電力を供給した状態で、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みることを特徴とする請求項8に記載のマスタスレーブ通信システム。 When the trial result indicates that the communication is established, the trial means uses the initial address in a state where the power supply to the slave nodes is stopped and then the power is supplied to the slave nodes again. The master-slave communication system according to claim 8, wherein communication with each of the slave nodes is attempted. 前記各スレーブノードのアドレスは、前記各スレーブノードのリセット状態においては前記初期アドレスに維持されることを特徴とする請求項1乃至9のいずれか1項に記載のマスタスレーブ通信システム。 The master-slave communication system according to any one of claims 1 to 9, wherein the address of each slave node is maintained at the initial address in the reset state of each slave node. 固有でないアドレスである初期アドレスを保持する複数のスレーブノードと通信を行う電子デバイスであって、
前記複数の各スレーブノードのアドレスを、前記初期アドレスから、前記初期アドレスとは異なる前記各スレーブノードの固有アドレスに変更する変更手段と、
前記変更手段によるアドレスの変更後に、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みる試行手段と、
前記試行手段による試行結果に基づいて、前記各スレーブノードの動作状態を判別する判別手段と、を有することを特徴とする電子デバイス。
An electronic device that communicates with multiple slave nodes that hold an initial address that is a non-unique address.
A changing means for changing the address of each of the plurality of slave nodes from the initial address to a unique address of each slave node different from the initial address.
After the address is changed by the changing means, the trial means for trying to communicate with each of the slave nodes using the initial address, and the trial means.
An electronic device comprising: a discriminating means for discriminating an operating state of each of the slave nodes based on a trial result by the trial means.
前記判別手段は、前記試行結果が通信の不成立を示した場合は、前記各スレーブノードの動作状態が正常であると判別することを特徴とする請求項11に記載の電子デバイス。 The electronic device according to claim 11, wherein the discriminating means determines that the operating state of each of the slave nodes is normal when the trial result indicates that the communication is not established. 前記判別手段は、前記試行結果が通信の成立を示した場合は、前記各スレーブノードのうち少なくとも1つの動作状態が正常でないと判別することを特徴とする請求項11または12に記載の電子デバイス。 The electronic device according to claim 11 or 12, wherein the discriminating means determines that the operating state of at least one of the slave nodes is not normal when the trial result indicates that the communication is established. .. 前記判別手段は、前記試行結果が通信の成立を示した場合は、前記各スレーブノードのうち少なくとも1つは初期状態にリセットされていると判別することを特徴とする請求項13に記載の電子デバイス。 13. The electron according to claim 13, wherein the discriminating means determines that at least one of the slave nodes has been reset to the initial state when the trial result indicates that communication has been established. device. 前記電子デバイスは、前記複数のスレーブノードと、I2C通信方式を用いて通信し、
前記判別手段は、前記各スレーブノードに接続されたシリアルデータバスの状態がACKである場合に、前記試行結果が通信の成立を示すと判別することを特徴とする請求項11乃至14のいずれか1項に記載の電子デバイス。
The electronic device communicates with the plurality of slave nodes by using an I2C communication method.
One of claims 11 to 14, wherein the determination means determines that the trial result indicates the establishment of communication when the state of the serial data bus connected to each slave node is ACK. The electronic device according to item 1.
前記判別手段は、前記各スレーブノードに接続されたシリアルデータバスの状態がNCKである場合に、前記試行結果が通信の不成立を示すと判別することを特徴とする請求項15に記載の電子デバイス。 The electronic device according to claim 15, wherein the determination means determines that the trial result indicates a failure of communication when the state of the serial data bus connected to each slave node is NCK. .. 前記固有アドレスは、前記各スレーブノード間で互いに異なることを特徴とする請求項11乃至16のいずれか1項に記載の電子デバイス。 The electronic device according to any one of claims 11 to 16, wherein the unique address is different from each other among the slave nodes. 前記試行手段は、通信を試みるスレーブノードの全てに電力を供給した状態で、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みることを特徴とする請求項11乃至17のいずれか1項に記載の電子デバイス。 One of claims 11 to 17, wherein the trial means attempts to communicate with each of the slave nodes by using the initial address in a state where power is supplied to all the slave nodes that attempt to communicate. The electronic device described in the section. 前記試行結果が通信の成立を示す場合は、前記試行手段は、前記各スレーブノードに対する電力の供給を停止した後に、再度、前記各スレーブノードに電力を供給した状態で、前記初期アドレスを用いて、前記各スレーブノードとの通信を試みることを特徴とする請求項18に記載の電子デバイス。 When the trial result indicates that the communication is established, the trial means uses the initial address in a state where the power supply to the slave nodes is stopped and then the power is supplied to the slave nodes again. The electronic device according to claim 18, wherein the electronic device attempts to communicate with each of the slave nodes. 前記各スレーブノードのアドレスは、前記各スレーブノードのリセット状態においては前記初期アドレスに維持されることを特徴とする請求項11乃至19のいずれか1項に記載の電子デバイス。 The electronic device according to any one of claims 11 to 19, wherein the address of each slave node is maintained at the initial address in the reset state of each slave node. 前記電子デバイスは、マスタノードであることを特徴とする請求項11乃至20のいずれか1項に記載の電子デバイス。 The electronic device according to any one of claims 11 to 20, wherein the electronic device is a master node. マスタノードと、固有でないアドレスである初期アドレスを保持する複数のスレーブノードとを含むマスタスレーブ通信システムの制御方法であって、
前記複数の各スレーブノードのアドレスを、前記初期アドレスから、前記初期アドレスとは異なる前記各スレーブノードの固有アドレスに変更し、
前記アドレスの変更後に、前記初期アドレスを用いて、前記各スレーブノードとの通信を試み、
前記各スレーブノードとの通信の試行結果に基づいて、前記各スレーブノードの動作状態を判別することを特徴とするマスタスレーブ通信システムの制御方法。
A method of controlling a master-slave communication system that includes a master node and a plurality of slave nodes that hold an initial address that is a non-unique address.
The address of each of the plurality of slave nodes is changed from the initial address to the unique address of each slave node different from the initial address.
After changing the address, the initial address is used to try to communicate with each of the slave nodes.
A control method of a master-slave communication system, characterized in that an operating state of each slave node is determined based on a trial result of communication with each slave node.
固有でないアドレスである初期アドレスを保持する複数のスレーブノードと通信を行う電子デバイスの制御方法であって、
前記複数の各スレーブノードのアドレスを、前記初期アドレスから、前記初期アドレスとは異なる前記各スレーブノードの固有アドレスに変更し、
前記アドレスの変更後に、前記初期アドレスを用いて、前記各スレーブノードとの通信を試み、
前記各スレーブノードとの通信の試行結果に基づいて、前記各スレーブノードの動作状態を判別することを特徴とする電子デバイスの制御方法。

A method of controlling an electronic device that communicates with multiple slave nodes that hold an initial address that is a non-unique address.
The address of each of the plurality of slave nodes is changed from the initial address to the unique address of each slave node different from the initial address.
After changing the address, the initial address is used to try to communicate with each of the slave nodes.
A method for controlling an electronic device, which comprises determining an operating state of each slave node based on a trial result of communication with each slave node.

JP2020085945A 2020-05-15 2020-05-15 Master-slave communication system, electronic device, and control method for them Pending JP2021180448A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020085945A JP2021180448A (en) 2020-05-15 2020-05-15 Master-slave communication system, electronic device, and control method for them

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020085945A JP2021180448A (en) 2020-05-15 2020-05-15 Master-slave communication system, electronic device, and control method for them

Publications (1)

Publication Number Publication Date
JP2021180448A true JP2021180448A (en) 2021-11-18

Family

ID=78510544

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020085945A Pending JP2021180448A (en) 2020-05-15 2020-05-15 Master-slave communication system, electronic device, and control method for them

Country Status (1)

Country Link
JP (1) JP2021180448A (en)

Similar Documents

Publication Publication Date Title
KR100439640B1 (en) Method for controlling option devices
CN109753136B (en) Data communication device
US10013374B2 (en) Bidirectional communication method between a master terminal and a slave terminal on a single transmission line
CN109154925A (en) Communication equipment, communication means, program and communication system
JP2021180448A (en) Master-slave communication system, electronic device, and control method for them
JP4160068B2 (en) Digital programming interface between baseband processor and radio frequency integrated module
JP2006527563A (en) Master node for LIN network
EP0830766B1 (en) A digital data bus system including arbitration
TW202119218A (en) Bridge chip with function of expanding external devices and associated expansion method
JP6762546B1 (en) Serial communication method and serial communication system
US6026094A (en) Digital data bus system including arbitration
JP2011120167A (en) Communication system and communication method
KR101082110B1 (en) Timing controller, apparatus for data sending and receving using timing controller
JP4906688B2 (en) Control signal communication method and optical transceiver device
CN109075902A (en) Communication device, communication means, program and communication system
JP2002189697A (en) Data transfer system and data transfer method
KR100790747B1 (en) Plc system and method of controlling communication thereof
JP2021150732A (en) Master-slave communication system, electronic device, control method of master-slave communication system, and control method of electronic device
CN114968899A (en) Control circuit, system and method for realizing chip communication
CN111913904A (en) Method for automatically assigning mutually different addresses to a plurality of slave devices using a master-slave communication protocol and device therefor
JP7380403B2 (en) Information processing device and cooperation method
CN114968898A (en) Control circuit and method for realizing chip communication
JP6833137B1 (en) Expansion base unit, control device, control system and control method
KR100295683B1 (en) General call acknowledge apparatus and method for inter-integrated circuit
JP2743780B2 (en) Distributed processing equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230418

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240226

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240227

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20240425