Communication method, communication device, blower device, and program
The method allows devices to automatically set addresses based on random numbers and access timing, addressing the challenge of unique addressing on shared I2C buses without extra wiring, ensuring flexible and continuous communication.
Patent Information
- Application Number
- PCT/JP2024/046493
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-28
- Filing Date
- 2024-12-27
- Publication Date
- 2025-07-03
AI Technical Summary
Existing I2C communication systems face challenges in easily setting unique addresses for multiple devices sharing a communication bus without increasing the number of wiring lines, especially for mass-produced devices where manual address setting is difficult and adding extra wiring lines is not preferred.
A communication method involving each device generating a random number to determine its address and waiting time, then determining itself as a master or slave based on whether it is accessed within that time, allowing automatic address setting without additional wiring.
Enables easy address setting for multiple devices on a shared bus without extra wiring, facilitating seamless operation and flexibility in device addition or removal, ensuring continuous communication.
Smart Images

Figure JP2024046493_03072025_PF_FP_ABST
Abstract
Description
Communication method, communication device, air blower, and program
[0001] The present invention relates to a communication method, a communication device, a blower device, and a program.
[0002] In an I2C communication system that complies with the I2C (Inter-Integrated Circuit) communication standard, 112 addresses can be assigned to nodes (I2C devices), excluding 16 reserved addresses, allowing a maximum of 112 I2C devices to be connected to the same communication bus. Since multiple I2C devices with the same address cannot be connected to the same communication bus, the address of each I2C device must be set so that addresses do not overlap.
[0003] It is extremely difficult to configure addresses for mass-produced I2C devices to match the customer's system before shipping. However, it is not possible to provide customers with I2C devices equipped with address configuration functionality and force them to configure the addresses themselves. While it is possible to automatically configure the addresses of each I2C device by increasing the number of wires on the communication bus, customers would not welcome the idea of increasing the number of wires on an existing communication bus. Patent Document 1 discloses a technology that makes it easy to build a system without configuring an ID for each device, but this requires adding two dedicated wires to the existing communication bus.
[0004] Japanese Patent Application Laid-Open No. 2022-99027
[0005] As described above, there has been a demand for the development of a technology that allows addresses to be easily set for multiple communication devices that share the same communication bus without increasing the number of wires on the existing communication bus.
[0006] One aspect of the communication method of the present invention is a communication method executed by each of multiple communication devices that share a communication bus, and includes the following steps: a first step of obtaining a random number; a second step of generating an address and a first standby time of the own device based on the random number; a third step of starting to measure time; a fourth step of determining the own device as a master if the time reaches the first standby time without being accessed by another communication device; a fifth step of accessing the other communication device immediately after determining the own device as the master; and a sixth step of determining the own device as a slave if the time receives access from the other communication device before the first standby time is reached.
[0007] One aspect of the communication device of the present invention is a communication device that shares a communication bus with other communication devices, and includes a control device that communicates with the other communication devices via the communication bus, wherein the control device executes the following steps: a first step of acquiring a random number; a second step of generating an address and a first standby time of the device itself based on the random number; a third step of starting to measure time; a fourth step of determining the device itself as a master if the time reaches the first standby time without receiving access from the other communication devices; a fifth step of accessing the other communication devices immediately after determining the device itself as the master; and a sixth step of determining the device itself as a slave if the time receives access from the other communication devices before the first standby time.
[0008] One aspect of the blower device of the present invention is a blower device that shares a communication bus with other blowers, and includes a fan, a motor for rotating the fan, and a control device that communicates with the other blowers via the communication bus and controls the motor, wherein the control device performs the following steps: a first step of acquiring a random number; a second step of generating an address and a first standby time for the device itself based on the random number; a third step of starting to measure time; a fourth step of determining the device itself as a master if the time reaches the first standby time without being accessed by the other blowers; a fifth step of accessing the other blowers immediately after determining the device itself as the master; and a sixth step of determining the device itself as a slave if the time receives access from the other blowers before the first standby time is reached.
[0009] One aspect of the program of the present invention is a program executed by a computer that shares a communication bus with another computer, and causes the computer to execute the following steps: a first step of obtaining a random number; a second step of generating an address and a first standby time of the device itself based on the random number; a third step of starting to measure time; a fourth step of determining the device itself as a master if the time reaches the first standby time without being accessed by the other computer; a fifth step of accessing the other computer immediately after determining the device itself as the master; and a sixth step of determining the device itself as a slave if the time receives access from the other computer before the first standby time is reached.
[0010] According to the above aspect of the present invention, it is possible to easily set addresses for a plurality of communication devices that share the same communication bus without increasing the number of wires on the existing communication bus.
[0011] Fig. 1 is a diagram schematically illustrating the configuration of a communication system according to this embodiment. Fig. 2 is a first flowchart illustrating processing executed by the MCU of the blower. Fig. 3 is a second flowchart illustrating processing executed by the MCU of the blower. Fig. 4 is a third flowchart illustrating processing executed by the MCU of the blower.
[0012] An embodiment of the present invention will be described in detail below with reference to the drawings. Fig. 1 is a diagram schematically illustrating the configuration of a communication system 1 according to this embodiment. As shown in Fig. 1, the communication system 1 includes three air blowers 10A, 10B, and 10C, a host control device 20, and a communication bus 30.
[0013] The air blowers 10A, 10B, and 10C, each having a communication function, are a type of communication device. As will be described later, the air blowers 10A, 10B, and 10C are also a type of computer because they include an MCU (microcontroller unit) 11 that executes various processes according to a program. For example, the air blowers 10A, 10B, and 10C are used as cooling fans for general-purpose computers such as personal computers.
[0014] The fan devices 10A, 10B, and 10C communicate with the host control device 20 via a communication bus 30. As an example, in this embodiment, a communication system 1 will be described in which the fan devices 10A, 10B, and 10C and the host control device 20 communicate with each other according to the I2C communication standard. The communication bus 30 conforming to the I2C communication standard includes a clock signal line 31 and a data line 32. The fan devices 10A, 10B, and 10C and the host control device 20 are electrically connected to a power line 40 including a power line 41 and a ground line 42. Although not shown in FIG. 1 , the clock signal line 31 and the data line 32 are electrically connected to the power line 41 via pull-up resistors.
[0015] Fan 10A shares communication bus 30 with other fans 10B and 10C. Fan 10A also shares communication bus 30 with host controller 20. Fan 10A is electrically connected to clock signal line 31, data line 32, power supply line 41, and ground line 42. Similar to fan 10A, other fans 10B and 10C are also electrically connected to clock signal line 31, data line 32, power supply line 41, and ground line 42.
[0016] The blower device 10A includes an MCU 11, a motor 12, and a fan 13. The MCU 11 executes various processes according to programs stored in a memory built into the MCU 11. For example, the MCU 11 communicates with the other blowers 10B and 10C via a communication bus 30 and controls the motor 12 according to the programs. The MCU 11 also communicates with a higher-level control device 20 via the communication bus 30 according to the programs. The MCU 11 is an example of a control device. The fan 13 is an impeller connected to the rotor shaft of the motor 12. The motor 12 is, for example, a DC motor. The motor 12 rotates in response to a drive signal supplied from the MCU 11, thereby rotating the fan 13. The configurations of the other blowers 10B and 10C are the same as those of the blower device 10A, and therefore will not be described here.
[0017] The host control device 20 controls the rotation speeds of the air blowers 10A, 10B, and 10C. The host control device 20 is also electrically connected to a clock signal line 31, a data line 32, a power supply line 41, and a ground line 42. As will be described in detail later, in the communication system 1 of this embodiment, one of the air blowers 10A, 10B, and 10C serves as a master, and the remaining two serve as slaves. The host control device 20 communicates with the master and transmits a rotation speed command value to the master. The master transmits the rotation speed command values to the two slaves. The master also acquires status data from the two slaves and transmits the acquired status data from the two slaves and its own status data to the host control device 20. The status data includes information regarding the status of each of the air blowers 10A, 10B, and 10C. For example, the status data includes at least one of the following information: rotation speed, vibration value, current value, temperature, operating time, and number of reset occurrences.
[0018] The communication processing executed by the MCU 11 in accordance with the program will be described below with reference to Figures 2 to 4. Figure 2 is a first flowchart showing the communication processing executed by the MCU 11. Figure 3 is a second flowchart showing the communication processing executed by the MCU 11. Figure 4 is a third flowchart showing the communication processing executed by the MCU 11. Note that each processing described below is processing executed by the MCU 11 of each of the blower devices 10A, 10B, and 10C.
[0019] 2, when a power supply voltage is supplied via the power line 41, the MCU 11 executes an initialization process and starts counting down the I2C timeout (step S1). As part of the initialization process, the MCU 11 resets the values of all flags to 0.
[0020] Next, the MCU 11 determines whether a random number has been acquired based on the value of the first flag F1 (step S2). Specifically, in step S2, the MCU 11 determines whether the value of the first flag F1 is 1. If the MCU 11 determines that a random number has not been acquired, i.e., if the value of the first flag F1 is 0 (step S2: NO), the MCU 11 acquires a random number by executing the process described below (step S3).
[0021] For example, in step S3, the MCU 11 acquires data of the lower 8 bits of a timer or AD converter with an arbitrary bit length of 8 or more at random timing to acquire a random number within the range of 0 to 255. In this case, the timer or AD converter built into the MCU 11 can be used to acquire the random number.
[0022] An example of random timing is the timing of a rising edge or a falling edge of the Hall signal output from the Hall element of the motor 12. Another example of random timing is the timing of detecting lock of the motor 12. In this manner, random numbers may be generated within each of the blower devices 10A, 10B, and 10C. This also includes obtaining random numbers. These random timings are merely examples, and any event that can obtain random timing may be used. The MCU 11 may also obtain random numbers by executing an algorithm that calculates random numbers. After obtaining the random numbers through the above process, the MCU 11 sets the value of the first flag F1 to 1.
[0023] Next, the MCU 11 generates an address of its own device and a random wait time based on the acquired random number (step S4). The random wait time is an example of a first standby time. For example, in step S4, the MCU 11 generates an address of its own device by adding an offset value to the remainder obtained by dividing the random number by a divisor n that is 127 or less.
[0024] In I2C communication, where addresses are represented by 7 bits, the total number of addresses, including reserved addresses that cannot be used, is 127. Therefore, the random number used to generate the address of the device itself must be 127 or less, and as described above, the remainder obtained by dividing the random number by a divisor n that is 127 or less is used to generate the address of the device itself. For example, the divisor n is any value between 1 and 111. Furthermore, in I2C communication, addresses 8 through 119 are permitted to be used, but in the communication system 1 of this embodiment, address 8 is used as the master slave address, so an offset value of 9 is used. In other words, in step S4, one of addresses 9 through 119 is generated as the address of the device itself.
[0025] In step S4, the MCU 11 generates a random wait time by multiplying the random number by a proportionality constant. For example, the proportionality constant is 8.18 msec. When the random number varies within a range from 0 to 255, the random wait time varies within a range from 0 to approximately 2 seconds.
[0026] After generating the address and random wait time of its own device as described above, the MCU 11 proceeds to step S5 shown in Fig. 3. Furthermore, in step S2, if the MCU 11 determines that the random number has been acquired, i.e., if the value of the first flag F1 is 1 (step S2: YES), it skips the processes of steps S3 and S4 and proceeds to step S5 shown in Fig. 3.
[0027] 3, when the MCU 11 proceeds to step S5, it determines whether or not the MCU 11 has already been determined as a slave based on the value of the second flag F2 (step S5). Specifically, in step S5, the MCU 11 determines whether or not the value of the second flag F2 is 1. If the MCU 11 determines that the MCU 11 has not already been determined as a slave, i.e., if the value of the second flag F2 is 0 (step S5: NO), it proceeds to step S6, which will be described later.
[0028] On the other hand, if the MCU 11 determines that the MCU 11 itself has been determined as the slave, that is, if the value of the second flag F2 is 1 (step S5: YES), the MCU 11 proceeds to step S18 shown in Fig. 4. Below, the process of step S6 shown in Fig. 3 will be described first.
[0029] When the MCU 11 proceeds to step S6, it determines whether or not the MCU 11 has been determined as the master based on the value of the third flag F3 (step S6). Specifically, in step S6, the MCU 11 determines whether or not the value of the third flag F3 is 1. If the MCU 11 determines that the MCU 11 has not been determined as the master, that is, if the value of the third flag F3 is 0 (step S6: NO), it proceeds to step S7, which will be described later.
[0030] On the other hand, if the MCU 11 determines that the MCU 11 itself has been determined as the master, that is, if the value of the third flag F3 is 1 (step S6: YES), the MCU 11 proceeds to step S15 shown in Fig. 4. Below, the process of step S7 shown in Fig. 3 will be described first.
[0031] When the MCU 11 proceeds to step S7, it starts measuring time (step S7).
[0032] After starting the time measurement, the MCU 11 determines whether or not it has been accessed by another blower device (step S8). For example, in step S8, the MCU 11 determines that it has been accessed by another blower device when it receives a general call address via the communication bus 30 or when it receives an address scan via the communication bus 30.
[0033] The reason why the "other blowers" are not numbered here is because the "other blowers" change depending on which of the three blowers 10A, 10B, and 10C the MCU 11 executing this process is installed in. For example, if the MCU 11 executing this process is installed in blower 10A, the "other blowers" are blowers 10B and 10C. Also, if the MCU 11 executing this process is installed in blower 10B, the "other blowers" are blowers 10A and 10C.
[0034] If the MCU 11 determines that it has not received access from another blower device (step S8: NO), it determines whether the time has reached the hearing time (step S9). The hearing time is a preset fixed value. It is desirable that the hearing time be set to a time longer than one cycle (control period) of communication in the communication system 1. The control period becomes longer in proportion to the number of slaves present in the communication system 1. For example, if the control period of the three blower devices 10A, 10B, and 10C is 0.8 seconds, the hearing time is set to 1 second. The hearing time is an example of a predetermined second standby time. If the MCU 11 determines that the time has not reached the hearing time (step S9: NO), it returns to the processing of step S8.
[0035] On the other hand, if the MCU 11 determines that the time has reached the hearing time (step S9: YES), it resets the time measurement value to 0 and then starts measuring the time again (step S10). In this way, if the time has reached the hearing time without being accessed by another air blower device, the MCU 11 proceeds to step S10 and starts measuring the time again.
[0036] After starting to measure the time, the MCU 11 determines whether or not it has been accessed by another blower device (step S11). For example, in step S11, similar to step S8, the MCU 11 determines that it has been accessed by another blower device when it receives a general call address via the communication bus 30 or when it receives an address scan via the communication bus 30.
[0037] If the MCU 11 determines that it has not been accessed by another blower (step S11: NO), it determines whether the time has reached the random wait time (step S12). If the MCU 11 determines that the time has not reached the random wait time (step S12: NO), it returns to the processing of step S11.
[0038] On the other hand, if the MCU 11 determines that the time has reached the random wait time (step S12: YES), it determines its own device as the master (step S13). Specifically, in step S13, the MCU 11 sets the value of the third flag F3 to 1. In this way, the MCU 11 determines its own device as the master when the time has reached the random wait time without being accessed by another blower device. Once the MCU 11 determines its own device as the master, it discards the address generated in step S4 and determines the master address number 8 as its own device's address. After determining its own device as the master, the MCU 11 proceeds to step S15 shown in FIG. 4.
[0039] Furthermore, in step S8, if the MCU 11 determines that it has received access from another air blower during the time measurement started in step S7 (step S8: YES), it determines its own device as the slave (step S14). Specifically, in step S14, the MCU 11 sets the value of the second flag F2 to 1. In this way, if the MCU 11 receives access from another air blower before the time reaches the hearing time, it determines its own device as the slave. After determining its own device as the slave, the MCU 11 proceeds to step S18 shown in FIG. 4.
[0040] Furthermore, in step S11, if the MCU 11 determines that it has received access from another blower device during the time measurement started in step S10 (step S11: YES), it determines its own device as the slave (step S14). Specifically, in step S14, the MCU 11 sets the value of the second flag F2 to 1. In this way, if the MCU 11 receives access from another blower device before the time reaches the random wait time, it determines its own device as the slave. Once the MCU 11 determines its own device as the slave, it determines the address generated in step S4 as its own device's slave address. After determining its own device as the slave, the MCU 11 proceeds to step S18 shown in FIG. 4.
[0041] As shown in Fig. 4, when it is determined that the MCU 11 is the master, the MCU 11 proceeds to step S15 shown in Fig. 4 and executes steps S15, S16, and S17 as master-specific processing. On the other hand, when it is determined that the MCU 11 is the slave, the MCU 11 proceeds to step S18 shown in Fig. 4 and executes step S18 as slave-specific processing. First, the processing of steps S15, S16, and S17, which are master-specific processing, will be described below.
[0042] When the MCU 11 proceeds to step S15, it transmits a general call address via the data line 32 (step S15). In I2C communication, when transmitting data from a master to a slave, the master transmits a specific slave address via the data line 32 to designate one slave from among multiple slaves as a destination slave, and then transmits the data via the data line 32. Of the multiple slaves, the slave designated as the destination slave receives the data via the data line 32. In such I2C communication, the master can simultaneously designate all slaves as destination slaves by transmitting a reserved address of number 0 called a general call address.
[0043] That is, in step S15, the MCU 11 simultaneously designates all other blowers as destination slaves by transmitting the reserved address of No. 0 as the general call address. Also, in step S15, after transmitting the general call address, the MCU 11 transmits the address book as data via the data line 32. The address book will be described later.
[0044] Next, the MCU 11 performs an I2C address scan (step S16). Specifically, in step S16, the MCU 11 transmits slave address candidates No. 9 through No. 119 in order and determines whether an acknowledgement (ACK) is received in response to the transmission of the slave address candidates, thereby acquiring the slave addresses of the slaves (other air blowers) present in the communication system 1. By performing this I2C address scan, the MCU 11 creates an address book showing the slave addresses of the slaves present in the communication system 1.
[0045] A specific example of how to create an address book is as follows: First, the MCU 11 transmits the ninth slave address candidate. If the MCU 11 receives an acknowledgement for the transmission of the ninth slave address candidate, it increments the slave counter and stores the ninth slave address in an array (address book) that has the value of the slave counter as the element number. On the other hand, if the MCU 11 does not receive an acknowledgement for the transmission of the ninth slave address candidate, it does nothing and proceeds to the next process.
[0046] Next, MCU 11 transmits slave address candidate No. 10. If MCU 11 receives an acknowledgement for transmitting slave address candidate No. 10, it increments the slave counter and stores slave address No. 10 in the address book. On the other hand, if MCU 11 does not receive an acknowledgement for transmitting slave address candidate No. 10, it does nothing and proceeds to the next process.
[0047] The MCU 11 performs the above process on each of the slave address candidates from No. 11 to No. 119, thereby completing an address book showing the slave addresses of the slaves present in the communication system 1. For example, when the MCU 11 receives an acknowledgement for the transmission of the slave address candidate No. 35 and the transmission of the slave address candidate No. 90, it acquires an address book containing the slave address No. 35 linked to the element number No. 1 and the slave address No. 90 linked to the element number No. 2.
[0048] As described above, the MCU 11 performs an address scan of all slave address candidates and associates the slave address candidates that respond with element numbers to generate a slave address book. The element number, i.e., the value of the slave counter, may be used as the slave identifier. Note that, for example, a number unique to the fan device, such as a serial number, may also be used as the slave identifier.
[0049] Next, the MCU 11 executes at least one of communication with the upper control device 20, communication with the slave, and mutual aid processing as necessary (step S17). For example, the MCU 11 receives a rotation speed command value from the upper control device 20. The MCU 11 transmits the rotation speed command value to the other slave blower device. The MCU 11 acquires status data from the other blower device and transmits the status data acquired from the other blower device and its own status data to the upper control device 20. For example, as a mutual aid processing, the MCU 11 transmits a rotation speed command value determined by itself to the other slave blower device. Also, in step S16, if I2C communication is established, the MCU 11 resets the I2C timeout. After executing the processing of step S16 as described above, the MCU 11 proceeds to step S19, which will be described later.
[0050] On the other hand, when the MCU 11 proceeds to step S18, it executes the following processing as a slave-specific processing (step S18). Specifically, in step S18, the MCU 11 executes at least one of the following as necessary: receiving an address book via a general call, sending an acknowledgement in response to an I2C address scan, and sending status data in response to a request from the master. Also, in step S18, the MCU 11 resets the I2C timeout if I2C communication is established. After executing the processing of step S18 as described above, the MCU 11 proceeds to step S19, which will be described later.
[0051] When the MCU 11 proceeds to the process of step S19, it executes processes other than the above-mentioned communication (step S19). Thereafter, the MCU 11 determines whether an I2C timeout has occurred (step S20). If the MCU 11 determines that an I2C timeout has not occurred (step S20: NO), the MCU 11 returns to step S2 shown in Fig. 2. On the other hand, if the MCU 11 determines that an I2C timeout has occurred (step S20: YES), the MCU 11 returns to step S1 shown in Fig. 2.
[0052] The above is an explanation of the communication process executed by the MCU 11 of each of the air blowers 10A, 10B, and 10C. Below, we will explain in detail, using specific examples, how each of the air blowers 10A, 10B, and 10C operates as a result of the MCU 11 executing the above communication process.
[0053] First, we will explain the operation of each of the fan devices 10A, 10B, and 10C when power is applied to the communication system 1 with each of the fan devices 10A, 10B, and 10C connected to the communication bus 30. When power is applied to the communication system 1 with each of the fan devices 10A, 10B, and 10C connected to the communication bus 30, power is also applied to each of the fan devices 10A, 10B, and 10C via the power line 41.
[0054] When power is applied to each of the fan devices 10A, 10B, and 10C, the MCU 11 of each of the fan devices 10A, 10B, and 10C executes initialization processing, including resetting all flags, and starts counting down the I2C timeout. Then, the MCU 11 of each of the fan devices 10A, 10B, and 10C acquires a random number and generates the address and random wait time of the fan device itself based on the acquired random number.
[0055] Next, the MCU 11 of each of the air blowers 10A, 10B, and 10C starts measuring time to measure the hearing time. However, at this point, it is not yet determined whether each of the air blowers 10A, 10B, and 10C is the master or slave, so the measured time value reaches the hearing time without any of the air blowers 10A, 10B, and 10C being accessed by the other air blowers. In the following description, the measured time value may be referred to as the "measured time."
[0056] After the measured time reaches the hearing time, the MCU 11 of each of the air blowers 10A, 10B, and 10C starts measuring time to measure the random wait time. Here, for example, let's assume that among the air blowers 10A, 10B, and 10C, the random number obtained by the air blower 10A is the smallest. In this case, the random wait time generated by the air blower 10A is the shortest among the air blowers 10A, 10B, and 10C. Therefore, since the measured time of the air blower 10A reaches the random wait time first, the MCU 11 of the air blower 10A determines itself as the master earlier than the MCU 11 of the other air blowers 10B and 10C.
[0057] The MCU 11 of the fan device 10A transmits a general call address immediately after determining that it is the master. As a result, the MCU 11 of the other fan devices 10B and 10C receive the general call address before the measured time reaches the random wait time they themselves generated. Because the MCU 11 of the other fan devices 10B and 10C received the general call address before the measured time reached the random wait time they themselves generated, they determine that they are the slaves. As a result, the fan device 10A with the smallest acquired random number becomes the master, and the other fan devices 10B and 10C become slaves.
[0058] For example, assume that the random number acquired by fan 10A is equal to the random number acquired by fan 10B and smaller than the random number acquired by fan 10C. In this case, the measurement times of fan 10A and fan 10B reach the random wait time earlier and simultaneously than the measurement time of fan 10C, so the MCUs 11 of fan 10A and fan 10B determine themselves as the master earlier and simultaneously than the MCU 11 of fan 10C.
[0059] The MCUs 11 of the fan units 10A and 10B simultaneously transmit their general call addresses immediately after determining that they are the master. If the random wait times of multiple fan units expire simultaneously and multiple fan units simultaneously transmit their general call addresses, an I2C timeout occurs due to a communication error. Therefore, in this case, the MCUs 11 of each fan unit 10A, 10B, and 10C restart by performing an initialization process that includes resetting all flags, and then again acquire random numbers and generate their own unit addresses and random wait times. In this way, the master determination process is repeated until one of the fan units 10A, 10B, and 10C becomes the master.
[0060] The MCU 11 of the master fan 10A periodically performs processes such as sending the general call address, sending the address book, scanning the addresses, and generating the address book, unless an I2C timeout occurs. On the other hand, the MCU 11 of the slave fan 10B and fan 10C periodically performs processes such as receiving the general call address, receiving the address book, and sending an acknowledgement for the address scan, unless an I2C timeout occurs.
[0061] As described above, in this embodiment, the MCU 11 of each of the fan devices 10A, 10B, and 10C generates an address and random wait time that are different from those of the other fan devices based on the acquired random number. The fan device whose measured time reaches the random wait time earliest becomes the master, and the other fan devices become slaves. The address generated by the slave fan device is determined as the slave address of the slave node in the communication system 1. As described above, according to this embodiment, it is possible to easily set addresses for multiple communication devices (fan devices 10A, 10B, and 10C) that share the same communication bus 30 without increasing the number of wires on the existing communication bus 30.
[0062] Next, we will explain the operation of each of the blower devices 10B and 10C when the blower device 10A is disconnected from the communication bus 30 and the power line 40, with the blower device 10A acting as the master and the other blower devices 10B and 10C acting as slaves, as described above.
[0063] If the master fan device 10A is disconnected from the communication bus 30 and the power line 40, the slave fan devices 10B and 10C will no longer be accessed by the master, resulting in an I2C timeout due to a communication error. In this case, the MCU 11 of each fan device 10B and 10C will restart by executing an initialization process that includes resetting all flags, and will again obtain a random number and generate the address and random wait time of its own device.
[0064] For example, let us assume that the random number acquired by the fan 10C is the smallest of the two fan units 10B and 10C. In this case, the random wait time generated by the fan 10C is the shortest of the two fan units 10B and 10C. Therefore, the measured time of the fan 10C reaches the random wait time the fastest, and the MCU 11 of the fan 10C determines itself as the master earlier than the MCU 11 of the other fan unit 10B.
[0065] The MCU 11 of the fan device 10C transmits the general call address immediately after determining that the fan device is the master. As a result, the MCU 11 of the other fan device 10B receives the general call address before the measured time reaches the random wait time that it generated. Because the MCU 11 of the other fan device 10B received the general call address before the measured time reached the random wait time that it generated, it determines that the fan device is the slave.
[0066] As described above, in this embodiment, even if the master fan device 10A is disconnected from the communication bus 30 and the power line 40 while the communication system 1 is in operation, the remaining fan devices 10B and 10C perform a master selection process, and a new master and slave are automatically selected from among the remaining fan devices 10B and 10C. Therefore, according to this embodiment, even if the master fan device 10A is disconnected from the communication bus 30 and the power line 40 while the communication system 1 is in operation, communication can be continued seamlessly without stopping the operation of the communication system 1. Note that even if the master fan device 10A fails, the fan devices 10B and 10C perform the same operation as described above.
[0067] Next, we will explain the operation of blower device 10A when blower device 10A is reconnected to communication bus 30 and power line 40 while blower device 10C is the master and blower device 10B is the slave, as described above.
[0068] When the fan device 10A is reconnected to the communication bus 30 and the power line 40, the fan device 10A is powered on, and the MCU 11 of the fan device 10A executes initialization processing, including resetting all flags, and starts counting down the I2C timeout. The MCU 11 of the fan device 10A then acquires a random number and generates its own address and a random wait time based on the acquired random number.
[0069] Next, MCU 11 of blower device 10A starts measuring time to measure the hearing time, but at this point it has been determined that blower device 10C is the master, so blower device 10A will be accessed by master blower device 10C while measuring time. Because MCU 11 of blower device 10A received access from the master before the measured time reached the hearing time, it determines that its own device is the slave.
[0070] Thus, in this embodiment, even if a new fan 10A joins communication system 1 while communication system 1 is in operation, fan 10A automatically becomes a slave because it receives access from the master before the measurement time reaches the hearing time. The slave address generated by fan 10A that has become a slave is established as the address of a slave node in communication system 1. Therefore, according to this embodiment, even if a new fan joins communication system 1 while communication system 1 is in operation, it is possible to easily set the address of the newly added fan without stopping the operation of communication system 1.
[0071] It should be noted that there is a possibility that the slave address generated by blower device 10A added to communication system 1 may overlap with the slave address of existing slave blower device 10B. When MCU 11 of blower device 10A recognizes, based on the address book received from master blower device 10C, that the slave address it generated overlaps with the slave address of existing slave blower device 10B, it repeats the process of obtaining a random number and generating a slave address until the overlap with the slave address included in the address book is resolved.
[0072] As described above, according to this embodiment, it is possible to easily set addresses for multiple communication devices (blower devices 10A, 10B, and 10C) sharing the same communication bus 30 without increasing the number of wires on the existing communication bus 30. Furthermore, according to this embodiment, the master communication device performs an I2C address scan every cycle, so that communication devices can be attached to and detached from the communication system 1 and the number of communication devices can be increased or decreased as desired while the communication system 1 is in operation. Therefore, according to this embodiment, a communication system 1 can be realized that can flexibly accommodate the addition or decrease of communication devices. Furthermore, according to this embodiment, if the master communication device fails, an I2C timeout occurs simultaneously in all communication devices, and new master and slave devices are created from among the other slave communication devices. This allows seamless communication to continue without interrupting the operation of the communication system 1.
[0073] The present invention is not limited to the above-described embodiments, and the configurations described herein can be appropriately combined within the scope of their mutual compatibility. For example, in the above-described embodiments, a fan device is illustrated as one form of communication device, but the communication device of the present invention is not limited to a fan device. By applying the present invention to any device (including a computer) that has communication capabilities and shares the same communication bus with other devices, the effect of easily setting addresses for multiple communication devices can be achieved. Furthermore, in the above-described embodiments, the communication system 1 includes three fan devices 10A, 10B, and 10C, but the number of fan devices is not limited to three. The greater the number of fan devices sharing the same communication bus, the greater the benefit of being able to eliminate the cumbersome task of manually setting addresses as in the past.
[0074] The present technology may be configured as follows: (1) A communication method executed by each of a plurality of communication devices sharing a communication bus, the communication method including: a first step of acquiring a random number; a second step of generating an address of the communication device and a first standby time based on the random number; a third step of starting time measurement; a fourth step of determining the communication device as a master when the first standby time has elapsed without being accessed by another communication device; a fifth step of accessing the other communication device immediately after determining the communication device as the master; and a sixth step of determining the communication device as a slave when the communication device has accessed the other communication device before the first standby time has elapsed. (2) The communication method described in (1), wherein the fifth step includes a seventh step of transmitting, via the communication bus, a general call address that collectively designates all of the other communication devices after determining the communication device as the master. (3) The communication method according to (2), wherein the fifth step further includes an eighth step of generating an address book of the slaves by performing an address scan on all slave address candidates and associating slave address candidates that have responded with slave identifiers. (4) The communication method according to (3), wherein the seventh step includes transmitting the general call address via the communication bus and transmitting the address book via the communication bus. (5) The communication method according to any one of (1) to (4), further including a ninth step executed between the second step and the third step, wherein the ninth step includes a tenth step of starting to measure time, an eleventh step of transitioning to the third step if the time reaches a predetermined second standby time without being accessed by the other communication device, and a twelfth step of determining the own device as the slave if the own device receives access from the other communication device before the time reaches the second standby time. (6) A communication method described in any one of (1) to (5), in which in the first step, the random number falling within the range of 0 to 255 is obtained by acquiring the lower 8 bits of data from a timer or AD converter of any bit length of 8 or more at random timing.(7) The communication method according to (6), wherein in the second step, an address of the own device is generated by adding an offset value to a remainder obtained by dividing the random number by a divisor that is equal to or less than 127, and the first standby time is generated by multiplying the random number by a proportional constant. (8) A communication device that shares a communication bus with another communication device, and includes a control device that communicates with the other communication device via the communication bus, the control device performing the following steps: a first step of acquiring a random number, a second step of generating an address of the own device and a first standby time based on the random number, a third step of starting to measure time, a fourth step of determining the own device as a master when the first standby time has elapsed without being accessed by the other communication device, a fifth step of accessing the other communication device immediately after determining the own device as the master, and a sixth step of determining the own device as a slave when the other communication device has accessed the own device before the first standby time has elapsed. (9) A blower that shares a communication bus with another blower, comprising: a fan; a motor for rotating the fan; and a control device that communicates with the other blower via the communication bus and controls the motor, wherein the control device performs the following steps: a first step of acquiring a random number; a second step of generating an address and a first standby time for the blower based on the random number; a third step of starting to measure time; a fourth step of determining the blower as a master if the first standby time is reached without being accessed by the other blower; a fifth step of accessing the other blower immediately after determining the blower as the master; and a sixth step of determining the blower as a slave if the blower is accessed by the other blower before the first standby time is reached.(10) A program executed by a computer that shares a communication bus with another computer, the program causing the computer to execute the following steps: a first step of acquiring a random number; a second step of generating an address and a first standby time of the device based on the random number; a third step of starting time measurement; a fourth step of determining the device as a master if the time reaches the first standby time without being accessed by the other computer; a fifth step of accessing the other computer immediately after determining the device as the master; and a sixth step of determining the device as a slave if the time receives access from the other computer before the first standby time. (11) A communication method executed by first and second communication devices sharing a communication bus, comprising: a first step of acquiring a random number; a second step of generating a first standby time based on the random number; a third step of starting time measurement; a fourth step of executing the first and second steps in each of the first and second communication devices and determining as a master one of the first and second communication devices whose time reaches the first standby time first; and a fifth step of accessing another communication device from the communication device determined as the master immediately after determining the other communication device as a slave.
Claims
1. A communication method executed by each of a plurality of communication devices sharing a communication bus, the method comprising: a first step of obtaining a random number; a second step of generating an address of the own device and a first waiting time based on the random number; a third step of starting measurement of time; a fourth step of determining the own device as a master when the time reaches the first waiting time without receiving access from another communication device; a fifth step of accessing the other communication device immediately after determining the own device as the master; and a sixth step of determining the own device as a slave when receiving access from the other communication device before the time reaches the first waiting time.
2. The communication method according to claim 1, wherein the fifth step includes a seventh step of transmitting a general call address designating all of the other communication devices collectively via the communication bus after determining the own device as the master.
3. The communication method according to claim 2, wherein the fifth step further includes an eighth step of generating an address book of the slave by performing an address scan for all slave address candidates and associating the slave address candidates with responses as slave identifiers.
4. The communication method according to claim 3, wherein in the seventh step, the general call address is transmitted via the communication bus and the address book is transmitted via the communication bus.
5. The communication method according to any one of claims 1 to 4, further including a ninth step executed between the second step and the third step, the ninth step including: a tenth step of starting measurement of time; an eleventh step of proceeding to the third step when the time reaches a predetermined second waiting time without receiving access from the other communication device; and a twelfth step of determining the own device as the slave when receiving access from the other communication device before the time reaches the second waiting time.
6. The communication method according to any one of claims 1 to 4, wherein in the first step, the random number within the range from 0 to 255 is obtained by obtaining data of lower 8 bits of a timer with an arbitrary bit length of 8 or more or an AD converter at random timing.
7. The communication method according to claim 6, wherein in the second step, an offset value is added to the remainder obtained by dividing the random number by a divisor of 127 or less to generate the address of the own device, and the first waiting time is generated by multiplying the random number by a proportionality constant.
8. A communication device that shares a communication bus with other communication devices, comprising a control device that communicates with the other communication devices via the communication bus, wherein the control device performs: a first step of acquiring a random number; a second step of generating the address of the own device and a first waiting time based on the random number; a third step of starting time measurement; a fourth step of determining the own device as a master when the time reaches the first waiting time without receiving access from the other communication devices; a fifth step of accessing the other communication devices immediately after determining the own device as the master; and a sixth step of determining the own device as a slave when access is received from the other communication devices before the time reaches the first waiting time.
9. A blower device that shares a communication bus with other blower devices, comprising a fan, a motor that rotates the fan, and a control device that communicates with the other blower devices via the communication bus and controls the motor, wherein the control device performs: a first step of acquiring a random number; a second step of generating the address of the own device and a first waiting time based on the random number; a third step of starting time measurement; a fourth step of determining the own device as a master when the time reaches the first waiting time without receiving access from the other blower devices; a fifth step of accessing the other blower devices immediately after determining the own device as the master; and a sixth step of determining the own device as a slave when access is received from the other blower devices before the time reaches the first waiting time.
10. A program executed by a computer that shares a communication bus with other computers, the program causing the computer to execute: a first step of obtaining a random number; a second step of generating its own device address and a first waiting time based on the random number; a third step of starting time measurement; a fourth step of determining its own device as the master when the time reaches the first waiting time without receiving access from the other computer; a fifth step of accessing the other computer immediately after determining its own device as the master; and a sixth step of determining its own device as a slave when receiving access from the other computer before the time reaches the first waiting time.
11. A communication method executed by first and second communication devices that share a communication bus, the communication method including: a first step of obtaining a random number; a second step of generating a first waiting time based on the random number; a third step of starting time measurement; a fourth step of executing the first and second steps in each of the first and second communication devices and determining, as the master, the communication device among the first and second communication devices in which the time reaches the first waiting time earlier; and a fifth step of, immediately after determining the master, accessing, from the communication device determined as the master, another communication device and determining the other communication device as a slave.
Citation Information
Patent Citations
Inter-equipment communication system
JP1995236182A
Data transmission system
JP1995327043A
Device and method for generating random number and recording medium
JP2000242470A
Device and method for file transmission and reception
JP2015177267A
Multiple output quantum random number generator
US20160335054A1