Communication system

The in-vehicle network includes a plurality of slave devices and a master device that communicates with the plurality of slave devices. The plurality of slave devices generates slave unique information as random information upon setting ID, and transmits the generated slave unique information. When all the slave unique information received from the plurality of slave devices are different from each other, the master device sets the ID based on each slave unique information. When the slave unique information received from the plurality of slave devices matches, the master device transmits a regeneration command to regenerate the slave unique information. Upon receiving the regeneration command, the slave device regenerates the slave unique information.

TECHNICAL FIELD

The present invention relates to a communication system.

BACKGROUND ART

Various loads such as lamps and power windows are mounted on vehicles such as passenger cars and freight cars. A technique has been proposed for controlling the loads by using communication between a slave device to which a plurality of loads is connected and a master device controlling a plurality of slave devices.

In the above technique, it is necessary to set identification information (ID) in a plurality of slave devices to which a plurality of loads is connected, respectively.

As a method for setting the ID, for example, one described in Patent Literature 1 has been proposed. In the above-described ID setting method, the master device sends an ID to the slave device every time when a slave device not set with ID is connected to the in-vehicle LAN, and the slave device stores the ID.

However, since the ID is set every connection of the slave device, there is a problem that it takes time to set the ID. Also, since the order of IDs sent by the master device to the slave device is fixed, there is also a problem that if the connection order of the slave device to the in-vehicle LAN is different, an ID different from the original ID is set.

PRIOR ART DOCUMENT

Patent Literature

Patent Literature 1: JP 2010-184575 A

SUMMARY OF INVENTION

Technical Problem

The present invention has been made in view of the above-described background, and it is an object of the present invention to provide a communication system capable of shortening setting time of identification information and reducing erroneous setting.

Solution to Problem

According to a first aspect of the present invention, there is provided a communication system including:

a plurality of slave devices; and

a master device that communicates with the plurality of slave devices,

wherein each of the plurality of slave devices includes: a generation unit that generates random information when setting identification information; and a first transmission unit that transmits generated random information,

wherein the master device includes: a first setting unit that sets the identification information based on each piece of the random information when all the pieces of the random information received from the plurality of slave devices are different; and a second transmission unit that transmits a regeneration command of the random information if the random information received from the plurality of slave devices includes information equivalent to each other, and

wherein the generation unit generates the random information again upon receiving the regeneration command.

Preferably, there is provided the communication system,

wherein a plurality of types of slave device groups each including the plurality of slave devices are provided,

Wherein the master device is provided for each of the plurality of slave device groups, and includes a switch provided for each of the plurality of slave device groups and supplying power to the corresponding slave device group, and

wherein the master device turns on the switches sequentially and causes the first setting unit to sequentially set the identification information of the plurality of slave devices for each of the slave device groups.

Preferably, there is provided the communication system,

wherein the first setting unit sets the identification information corresponding to each piece of the random information,

wherein the master device includes a third transmitting unit that adds the set identification information to the random information and transmits the random information, and

wherein the plurality of slave devices have a second setting unit that sets the received identification information as its identification information when receiving the random information generated by itself.

Preferably, there is provided the communication system, wherein a plurality of the master devices is installed in a vehicle, and

wherein the identification information includes installation information indicating an installation position of the master device in the vehicle.

Preferably, there is provided the communication system,

wherein the slave device generates the random information if its own identification information is predetermined initial identification information.

Preferably, there is provided the communication system,

wherein the first transmission unit adds the initial identification information to the random information and transmits the added random information, and

wherein upon receiving the initial identification information, the master device causes the first setting unit to set the identification information.

Effect of the Invention

According to the aspect described above, it is unnecessary to assign the identification information every time the slave device is connected, therefore it is possible to shorten the setting time of the identification information and reduce the erroneous setting.

DESCRIPTION OF EMBODIMENTS

Hereinafter, an embodiment of the present invention will be described with reference toFIGS. 1 and 2.FIG. 1is a block diagram showing an in-vehicle network1as a communication system of the present invention.FIG. 2is a block diagram showing a configuration of a master device2and a slave device3constituting the in-vehicle network1shown inFIG. 1.

The in-vehicle network1shown inFIG. 1is mounted in a vehicle10. The in-vehicle network1includes a plurality of master devices2and a plurality of slave devices3. The plurality of master devices2are arranged in each area of the vehicle10. In the present embodiment, the master devices2are disposed at five locations, the center of the front of the vehicle10, the right side of the front, the left side of the front, the right side of the rear, and the left side of the rear.

The five master devices2are communicably connected to each other through a communication line L1. Further, the master devices2are connected to each other via a +B power supply line L2connected to a battery (not shown), and power is supplied via the +B power supply line L2.

Further, each of the five master devices2is communicably connected to a plurality of slave devices3arranged in the own area through a communication line L1. The master device2and the slave devices3are connected one to many. The master device2controls the operations of the plurality of slave devices3by communicating with the plurality of slave devices3. The slave device3is connected to a plurality of loads20(FIG. 2) such as lamps, seat motors, door motors and the like disposed in the own area, and controls the driving of the loads20in accordance with communication with the master device2.

The plurality of slave devices3is provided separately for +B, for ACC, and for IG. The slave device3for +B is connected to the loads20that can be driven at all times. A plurality of slave devices3for +B is provided, and the plurality of slave devices3for +B constitutes a slave device group301for +B.

The slave device3for ACC is connected to the loads20which can be driven when an accessory is used. A plurality of slave devices3for ACC is provided, and the plurality of ACC slave devices3constitutes a slave device group302for ACC.

The slave device3for IG is connected to the loads20that can be driven when using an ignition. A plurality of slave devices3for IG is provided, and the plurality of slave devices3for IG constitutes a slave device group303for IG.

Next, a configuration of the above-described master device2will be explained. The plurality of master devices2has the same configuration, and each of the plurality of master devices2has an interface (hereinafter referred to as I/F)21, a power supply circuit22, a plurality of local SWs23, a microcomputer24, a semiconductor relay25for +B as a switch, a semiconductor relay26for ACC, and a semiconductor relay27for IG.

The I/F21is a communication interface for communicating with another master device2and a plurality of slave devices3. The I/F21is an interface capable of inputting and outputting signals corresponding to various communications (CAN, LIN, and other communication methods). The power supply circuit22is a circuit that generates a power supply for the microcomputer24to be described later from the power supplied from the +B power supply line L2and supplies power to the microcomputer24. The local SW23is operated by the user to operate the load20.

The microcomputer24is composed of a well-known CPU (Central Processing Unit)24A and a flash ROM (Read Only Memory)24B. The CPU24A controls the entire master device2and performs various processes according to the processing program. The flash ROM24B is a memory for storing the ID of the slave device3connected to the master device2, the program of processing to be executed by the CPU24A, and the like.

The semiconductor relays25to27are provided corresponding to the plurality of slave device groups301to303. The semiconductor relay25for +B is connected to the slave device3for +B via the +B power supply line L3. The semiconductor relay25for +B is turned on when a drive signal is output from the microcomputer24, and supplies power from the +B power supply line L2to the slave device3for +B via the +B power supply line L3.

The semiconductor relay26for ACC is connected to the slave device3for ACC via the ACC power supply line L4. The semiconductor relay26for ACC is turned on when a drive signal is output from the microcomputer24, and supplies power from the +B power supply line L2to the slave device3for ACC via the ACC power supply line L4.

The semiconductor relay27for IG is connected to the slave device3for IG via the IG power supply line L5. The semiconductor relay27for IG turns on when a drive signal is output from the microcomputer24, and supplies power from the +B power supply line L2to the slave device3for IG via the IG power supply line L5.

In the present embodiment, the +B power supply line L3, the ACC power supply line L4, and the IG power supply line L5are branched into two and are connected to the two slave devices3, but the present invention is not limited to this. The +B power supply line L3, the ACC power supply line L4, and the IG power supply line L5may be branched into three or more and may be connected to three or more slave devices3.

Incidentally, the semiconductor relays25to27have a current detection function for detecting a current flowing in the semiconductor relays25to27, and the detected currents are input to the microcomputer24.

Next, the configuration of the above-described slave device3will be explained. The plurality of slave devices3has the same configuration and each has an I/F31, a power supply circuit32, a microcomputer33, a plurality of local SWs34, and a plurality of semiconductor relays CH1to CH8. The I/F31is an interface for communicating with the master device2, and capable of inputting and outputting signals corresponding to various communications (CAN, LIN, and other communication methods). The power supply circuit32is a circuit that generates a power supply for a microcomputer33to be described later from power supplied from the +B power supply line L3, the ACC power supply line L4, and the IG power supply line L5and supplies power to the microcomputer33.

The microcomputer33is composed of a CPU33A and a flash ROM33B. The CPU33A controls the entire slave device3and performs various processes according to the processing program. The flash ROM33B is a memory for storing an initial ID, a program, a variable, and a setting value of processing to be executed by the CPU33A, and in the initial state, the same contents are written in all the slave devices3. The initial ID is a temporary ID, and a transmission initial ID and a reception initial ID are set.

The processing program of the CPU33A includes a communication program for communicating with the master device2connected via the communication line L1and a system operation program necessary for system operation. The operation program of the load20is not written in the flash ROM33B in the initial state, but is written after setting the ID.

The plurality of local SWs34are connected to the microcomputer33and input ON/OFF information to the microcomputer33. The plurality of semiconductor relays CH1to CH8are connected between the microcomputer33and the loads20, respectively, and are turned on and off in accordance with a drive signal from the microcomputer33. When the semiconductor relays CH1to CH8in the slave device3for +B turn on, the power from the +B power supply line L3is supplied to the loads20. When the semiconductor relays CH1to CH8in the slave device3for ACC are turned on, the power from the ACC power supply line L4is supplied to the loads20. When the semiconductor relays CH1to CH8in the slave device3for IG are turned on, the power from the IG power supply line L5is supplied to the loads20.

Further, the semiconductor relays CH1to CH8have a current detection function for detecting the current flowing in the semiconductor relays CH1to CH8, and the detected currents are input to the microcomputer33. In the present embodiment, the number of the semiconductor relays CH1to CH8provided in the slave device3is eight as an example, but the present invention is not limited to this and any number may be used. All the slave devices3have the same number of semiconductor relays CH1to CH8.

Next, the bit assignment of signals exchanged between the master device2and the slave device3will be described with reference to Table 1 below.

As shown in Table 1 above, the first bit10to bit0represents the identification information (ID) of the slave device3. The identification information is allocated to all the slave devices3arranged in the vehicle10without overlapping. The identification information is composed of drive power information, installation information, transmission/reception information, and slave type information.

Bit10to bit9are allocated to the drive power information, and become “01” if the slave device3is connected to the +B power supply line L3, “10” if connected to the ACC power supply line L4, and “11” if connected to the IG power supply line L5.

Bit8to bit5are allocated to the installation information. Bit8to bit7represent installation positions in the traveling direction of the vehicle, and become “01” if the installation position of the slave device3is on the front side of the vehicle, “10” if on the rear side, and “11” if at the center in the traveling direction. Bit6to bit5represent installation positions in the left-right direction of the vehicle10, and become “01” if the installation position of the slave device3is on the right side of the vehicle10, “10” in the case of the left side, and “11” in the case of the center in the left-right direction.

Bit4is allocated to the transmission/reception information, becomes “1” when the slave device3transmits to the master device2, and becomes “0” when the slave device3receives from the master device2.

Bit3to bit0are allocated to the slave type information. The slave type information is information that is allocated without overlapping with a plurality of slave devices3connected to the same master device2(but may overlap between the slave devices3connected to different master devices2).

Bit7to bit0following the ID indicate load control information after ID setting. Bit7to bit0are allocated to the semiconductor relays CH8to CH1respectively. When each bit n (n is any integer from0to7) is “0”, it represents “off” of the semiconductor relay CH n+1 assigned to the bit n. When each bit n (n is any integer from0to7) is “1”, it represents “on” of the semiconductor relay CH n+1 assigned to the bit n.

Before ID setting, bit7indicates the presence or absence of a slave unique information generation request, which will be described later, and bit6to bit0indicate slave unique information described later.

Next, the ID setting operation of the in-vehicle network1having the above-described configuration will be described with reference to the flowcharts ofFIGS. 3 to 5. Incidentally, in the initial state (ID is not set), the same initial ID (initial reception ID, initial transmission ID) is set in all the slave devices3and stored in the ID area of the flash ROM33B.

There are two types of IDs set in the slave device3: a reception ID and a transmission ID, but since the difference between the two is only the transmission/reception information (bit4of ID) as shown in Table 1, If either is determined, the transmission/reception ID is naturally determined. In the present embodiment, the setting of the reception ID will be described, and as the initial reception ID, it is assumed that “00000001111” which is “0” for bit10to bit4and “1” for bit3to bit0is set as shown in the following Table 2.

Further, in the initial state, installation information is previously stored in the flash ROM24B or the like in all the master devices2. For example, in the flash ROM24B of the master device2installed on the front right side of the vehicle10, “0101” is previously stored as installation information.

First, the microcomputer24of the master device2(hereinafter sometimes simply referred to as the master device2) executes the ID setting process shown inFIG. 3after activation, performs ID setting process for +B (step S1), ID setting process for ACC (step S2), and ID setting process for IG (step S3) sequentially. The ID setting process for +B is a process of setting the ID of the slave device3for +B. The ID setting process for ACC is a process of setting the ID of the slave device3for ACC. The ID setting process for the IG is a process for setting the ID of the slave device3for IG.

In the ID setting process for +B, the master device2turns on the semiconductor relay25for +B (step S11inFIG. 4). Power is supplied to the slave device3for +B in response to turning on of the semiconductor relay25for +B.

The microcomputer33of the slave device3for +B (hereinafter sometimes simply referred to as the slave device3) is activated when power is supplied and executes the ID setting process shown inFIG. 4. In the ID setting process, the slave device3first reads the ID stored in the ID area of the flash ROM33B (step S201). Next, the slave device3judges whether or not the read ID is the initial ID “00000001111” (step S202).

If the read ID is not the initial ID (N in step S202), the slave device3immediately determines that the ID has already been set and ends the ID setting process. On the other hand, if the read ID is the initial ID (Y in step S202), the CPU33A of the slave device3functions as a generation unit and generates 7-bit slave unique information (random information) (step S203).

In step S203, the slave device3executes a generation program such as a PN code typified by an M series code, for example, to generate a random bit string.

Next, the CPU33A of the slave device3functions as a first transmission unit, gives an initial ID, and transmits the slave unique information generated in step S203(step S204). For example, if “0111100” is generated as the slave unique information, the slave device3transmits a signal of a bit string shown in Table 3 below. That is, the ID is “00000001111” (initial ID), the bit7representing slave unique information generation request is “0” in the byte, and the bit6to 0 representing slave inherent information in the byte is “0111100”.

Each slave device3executes step S204, whereby the slave unique information generated by each slave device3is transmitted to the master device2.

When the master device2receives the slave unique information assigned with the initial ID within a predetermined time T1(Y in step S12) after turning on the semiconductor relay25for +B in step S11, the master device2proceeds to the next step S13.

When the ID of the slave device3is not set, the master device2can receive the slave unique information from all the slave devices3connected to the master device2within a reception cycle (for example, 100 ms). In step S13, the master device2determines whether there is a match with the plurality of slave unique information received within the reception cycle.

For example, as shown in the following Table 4, if there is a match among even one set of slave unique information (Y in step S13), the CPU24A of the master device2functions as a second transmission unit and transmits slave unique information generation request (regeneration command) (step S14), and returns to step S12.

Table 4 shows an example of the slave unique information transmitted from the three slave devices3A to3C connected to the master device2. In the example shown in Table 4, the slave unique information generated by each of the slave devices3A and3C matches. Incidentally, as a slave unique information generation request, a signal of a bit string shown in the following Table 5 is transmitted. That is, the ID is “00000001111” (initial ID), the bit7representing slave unique information generation request in the byte is “1”, and the bits6to 0 representing slave unique information in the byte are “0”.

When the slave device3receives the slave unique information generation request within the predetermined time T2after transmitting the slave unique information (Y in step S205), the slave device3returns to step S203again and regenerates the slave unique information.

On the other hand, as shown in the following Table 6, for example, if all the received slave unique information do not match each other (N in step S13), the master device2proceeds to the next step S15.

Table 6 shows an example of the slave unique information transmitted from the three slave devices3A to3C connected to the master device2. As shown in Table 6, all the slave unique information generated by each of the slave devices3A to3C is different from each other.

In the next step S15, the CPU24A of the master device2functions as a first setting unit and a third transmission unit, sets an ID corresponding to the discrete slave unique information, and transmits set ID and the slave unique information corresponding to the set ID. Step S15will be described in detail. As shown in the following Table 7, the master device2associates the received slave unique information with the slave type information. In the example shown in Table 7, the slave type information is assigned in order from “1” in ascending order of slave unique information.

For example, among the three slave unique information, the slave unique information “0111100” transmitted from the slave apparatus3A is the lowest, so that the lowest slave type information “0001” is associated. Next, since the slave unique information “1011010” transmitted from the slave device3B is the next low, “0010” obtained by adding 1 to “0001” is associated as slave type information. Next, since the slave unique information “1101001” transmitted from the slave device3C is the next low, “0011” obtained by adding 1 to “0010” is associated as slave type information.

Further, as shown in Table 8, the master device2transmits driving power information, installation information, and transmission/reception information “0” to each of slave type information and transmits slave unique information corresponding to each ID.

The master device2assigns “01” indicating the +B power supply as the drive power information. Further, the master device2assigns pre-stored installation information “0101”.

Upon receiving the same slave unique information as the slave unique information generated and transmitted by the slave device3within the predetermined time T2(Y in step S206ofFIG. 5), the slave device3erases the initial ID from the ID area of the flash ROM33B (Step S207). When the erasing of the ID area of the flash ROM33B succeeds (Y in step S208), the CPU33A of the slave device3functions as a second setting unit, and writes the ID transmitted together with the same slave unique information as the slave unique information transmitted by the CPU33A in the flash ROM33B as a reception ID (step S209).

Next, when the received ID matches the reception ID written in the flash ROM33B and the writing is judged successful (Y in step S210), the slave device3transmits the slave unique information with the written ID (Step S211), and ends the process.

When the ID and the slave unique information received from all the slave devices3and the ID and the slave unique information transmitted in step S15match within a predetermined time T3from step S15inFIG. 4(step Y in S16), the ID setting process for +B is terminated.

On the other hand, when the slave device3cannot receive the same slave unique information as the slave unique information transmitted within the predetermined time T2(N in Step S206), when the erasure of the flash ROM33B fails (N in Step S208), or when writing of the ID fails (N in step S210), the slave unique information is transmitted with the initial ID (step S212), and the ID setting process is terminated.

When the master device2cannot receive the initial ID within the predetermined time T1(N in step S12inFIG. 4), or when the master device2cannot receive the ID and the slave unique information matching the ID and the slave unique information transmitted in step S15within the predetermined time T3(N in step S16), the ID setting is canceled (step S17), and the ID setting process for +B is terminated.

Next, the ID setting process for ACC and the ID setting process for IG will be described. In the ID setting process for ACC and the ID setting process for IG, because the master device2is similar to the setting process for +B, the master device2will be briefly described. In the ID setting process for ACC and the ID setting process for IG, the master device2turns on the semiconductor relay26for ACC and the semiconductor relay27for IG, instead of turning on the semiconductor relay25for +B in step S11.

When power is supplied to the slave devices3for ACC and IG in response to the turning-on of the semiconductor relay26for ACC and the semiconductor relay27for IG, the slave devices3execute the above-described ID setting process.

Thereafter, the master device2executes the same processing as the steps S11to S16of the ID setting process for +B. However, in the ID setting process for ACC and the ID setting process for IG, instead of providing “01” indicating the +B power supply in step S15as drive power information, the master device2adds “10”, “11” indicating the ACC power supply and the IG power supply.

According to the embodiment described above, each of the plurality of slave devices3generates the slave unique information which is random information when setting the ID, and transmits the generated slave unique information to the master device2. When all the slave unique information received from the plurality of slave devices3are different from each other, the master device2sets an ID based on each slave unique information, and if the slave unique information received from the plurality of slave devices3matches, the master device2transmits a slave unique information generation request which is an instruction to regenerate the slave unique information. When the slave device3receives the generation request, the slave device3re-creates the slave unique information. Thus, it is not necessary to assign an ID each time the slave device3is connected, so that it is possible to shorten the setting time of the ID and reduce erroneous setting.

According to the above-described embodiment, a plurality of slave devices3having a plurality of types (+B, ACC, IG) of different supply timing of the power supply is provided. The master device2supplies power to the plurality of slave devices3in turn for each type and sets IDs of the plurality of slave devices3in order of power supply for each type. Thus, even if the number of the slave devices3is large, ID setting is sequentially performed for each type of power supply, so the probability that the slave unique information coincides becomes low, and the setting time of the ID can be shortened.

According to the embodiment described above, the master device2sets the ID corresponding to each slave unique information. The master device2adds the ID set to the slave unique information and transmits it to the plurality of slave devices3. Upon receiving the random information generated by the plurality of slave devices, the plurality of slave devices sets the received identification information as its own identification information. As a result, the slave device3can also set the ID corresponding to the slave unique information set by the master device2.

According to the embodiment described above, a plurality of master devices2is installed in the vehicle10, and the ID includes information indicating the installation position of the master device2in the vehicle. Thus, it is possible to easily assign different IDs to the slave devices3set in the vehicle10.

According to the embodiment described above, the slave device3creates slave unique information if its own ID is a predetermined initial ID. Thereby, ID can be set automatically.

According to the embodiment described above, the slave device3adds the initial ID to the slave unique information and transmits the slave unique information, and when receiving the initial ID, the master device2sets the ID. Thereby, ID can be set automatically.

Incidentally, according to the above embodiment, the ID includes 4-bit slave type information different from the 7-bit slave unique information, but the present invention is not limited to this. For example, the same 4-bit slave unique information as the slave type information may be generated and added as the slave type information. However, when the number of the slave devices3is large, it is preferable to generate the slave unique information having a larger number of bits than the slave type information like this embodiment. Thereby, the probability of matching of the generated slave unique information is lowered, and the number of regeneration of the slave unique information is reduced, so that the ID setting can be shortened.

Further, according to the above-described embodiment, the master device2sequentially supplies the power to the slave devices3for +B, ACC, and IG, and sets the IDs in order, but the present invention is not limited to this. The master device2may simultaneously supply power to the slave devices3for +B, ACC, and IG, and set the IDs at the same time. However, when the number of the slave devices3is large, it is better to set the IDs in order like the present embodiment, since the probability of matching of the slave unique information decreases, the number of regeneration of the slave unique information is reduced, and it is possible to shorten the ID setting.

It should be noted that the present invention is not limited to the above embodiment. That is, various modifications can be made without departing from the gist of the present invention.

REFERENCE SIGNS LIST

1in-vehicle network (communication system)2master device3slave device24A CPU (first setting unit, second transmission unit, third transmission unit)25-27semiconductor relay (switch)33A CPU (generation unit, first transmission unit, second setting unit)301slave device group for +B302slave device group for ACC303slave device group for IG