CN101877727B - Method for automatically setting CAN network node address and device thereof - Google Patents
Method for automatically setting CAN network node address and device thereof Download PDFInfo
- Publication number
- CN101877727B CN101877727B CN201010205873.8A CN201010205873A CN101877727B CN 101877727 B CN101877727 B CN 101877727B CN 201010205873 A CN201010205873 A CN 201010205873A CN 101877727 B CN101877727 B CN 101877727B
- Authority
- CN
- China
- Prior art keywords
- address
- default address
- default
- machine
- node
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5038—Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5092—Address allocation by self-assignment, e.g. picking addresses at random and testing if they are already in use
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses a method for automatically setting a CAN network node address and a device thereof. The method of the invention provides the transmission process of preset address information and preset address response information in a CAN communication network, the method for setting a preset address and address setting factors, corresponding measures taken by node equipment on different types of preset address response information and the like. The invention solves the problem of automatically setting the node address in a CAN network, adopts the pure software setting strategy, and requires no additional hardware cost; and meanwhile address setting is enable to become simpler by adopting a self-adaptive address detection method, the flexibility and the expandability of a system are greatly improved, and application range is wider.
Description
Technical field
The present invention relates to a kind of technology that arranges of CAN network node address, particularly a kind of method and apparatus that can Lookup protocol network node address.
Background technology
Along with the fast development in monitoring field, requirement to monitoring technique is more and more higher, need the equipment of monitoring also more and more, the quantity of the node device in CAN network is doubled and redoubled, how effectively to distinguish each node device and become the key of effective management, the system construction drawing of CAN network as shown in Figure 1, between each node device, carry out in real time the mutual and management of information, especially under the communication pattern of master-slave mode, must determine that from address of node information, each node device must ensure the uniqueness of mailing address.The method to set up of CAN network node address adopts the method such as fixed address and hardware dial-up more, and its autgmentability and flexibility are poor.The method of fixed address is the address that each node device is artificially set according to certain principle, and the Comparison of Management of the method is convenient, but stronger to people's dependence, flexibility is poor, if the quantity of node device is more, the workload that address arranges will increase greatly, and the possibility of makeing mistakes also will improve greatly; And the method for hardware dial-up will make the workload of address setting very large, and manageable node device quantity is less, and adaptable occasion is also less.
Summary of the invention
The object of the embodiment of the present invention is to provide a kind of automatic setting method of CAN network node address, can solve better the problem that address arranges in CAN network.
Another object of the embodiment of the present invention is to provide a kind of Lookup protocol device of CAN network node address, can solve better the problem that address arranges in CAN network.
According to the embodiment of the present invention aspect, a kind of automatic setting method of CAN network node address is provided, comprise the following steps:
Each node device in A, CAN network arranges respectively the default address of the machine;
B, described each node device send respectively the default address information of the machine to other node devices in CAN network;
C, described other node devices that receive default address information send the default address response message about described default address information;
D, the node device that sends default address information receive the default address response message that described other node devices send, and determine and preserve the machine address according to described default address response message.
According to the embodiment of the present invention on the other hand, provide a kind of Lookup protocol device of CAN network node address, having comprised:
Preset address-generation unit, the default address of the machine is set respectively for each node device of CAN network;
Preset address information transmitting element, send respectively the default address information of the machine for described each node device to other node devices of CAN network;
Default address information response unit, send producing response concurrent about the default address information of described default address information for described other node devices that receive default address information;
Default address information response receiving element, receives for sending the node device of default address information the default address response message that described other node devices send; And
Address setting unit, determines according to described default address response message and preservation the machine address for the node device that sends default address information.
Compared with prior art, the beneficial effect of the embodiment of the present invention is: the embodiment of the present invention can complete the setting of each device node address in CAN network automatically, its Lookup protocol strategy is applicable to communications such as master-slave communication pattern or competition communication patterns, also avoided the telecommunication management mistake causing because of the error that address arranges, the intelligent of equipment control also improved greatly simultaneously.
Brief description of the drawings
Fig. 1 is the system construction drawing of the CAN network that provides of prior art;
Fig. 2 is the logical flow chart that the CAN network node address that provides of the present embodiment arranges;
Fig. 3 is the structure chart of the CAN network node address setting device that provides of the present embodiment;
Fig. 4 is the Lookup protocol flow chart of the CAN network node address that provides of the present embodiment.
Embodiment
To a preferred embodiment of the present invention will be described in detail, should be appreciated that following illustrated preferred embodiment, only for description and interpretation the present invention, is not intended to limit the present invention below in conjunction with accompanying drawing.
Fig. 2 has shown the logic flow that CAN network node address that the present embodiment provides arranges, as shown in Figure 2:
Step S201, the each node device in CAN network arranges respectively the default address of the machine.Wherein, each node device will detect self and whether have default address, if testing result is for having Qie Gai address, default address in effective range, this address is set to the default address of the machine, if testing result is for not yet there being default address, this node device arranges voluntarily the default address of the machine in effective range.Default address can be discontinuous, can formulate different modes according to different system requirements, if in effective range can, the lower limit of effective range is 1, higher limit should be more than or equal to the sum of described CAN nodes equipment.Described node device can be the equipment applicable to CAN network such as monitor in apparatus of electrical monitoring equipment, community.
In addition, before this step, the address that each node device will arrange respectively the machine arranges the factor, and the producing method of this factor can be formulated according to the difference of system, and formulation mode comprises to be obtained equipment Serial Number or start-up time etc.
Step S202, each node device sends respectively the default address information of the machine to other node devices in CAN network.
Step S203, other node devices that receive default address information send the default address response message about default address information.
Wherein, default address response message comprises one of following:
Address setting response message is identical with the default address of described default address information for representing the address that other node devices have set;
Default address same response information is identical with the default address of described default address information for representing the default address of other node devices;
The different response messages in default address are different with the default address of described default address information for representing the default address of other node devices.
Step S204, the node device that sends default address information receives the default address response message that other node devices send, and determines and preservation the machine address according to described default address response message.
Wherein, the node device that sends default address information is determined the machine address according to the default address response message receiving:
If default address response message is address setting response message, this node device is abandoned former default address, regenerates the default address of the machine, again sends newly-generated default address information to other node devices, and waits for scheduled time T0;
If default address response message is default address same response information, the size that this node device arranges the factor according to address is determined the machine address; If the address of described node device arranges the address that the factor is greater than the node device that sends default address same response information the factor is set, and in scheduled time T0, do not receive the default address response message of other types, the default address of this node device the machine is set to the machine address; If the address of described node device arranges the address that the factor is less than or equal to the node device that sends default address same response information the factor is set, this node device is abandoned former default address, regenerate the default address of the machine, again send newly-generated default address information to other node devices;
If default address response message is the different response messages in default address, and in scheduled time T0, do not receive the default address response message of other types, the default address of this node device the machine is set to the machine address.
Scheduled time T0 determines according to the inter-process mechanism of the quantity of the speed of network, nodes equipment and each node device etc.
If if the default address of the machine regenerating is identical with the default address generating last time, again regenerate the default address of the machine, until newly-generated default address is different from the default address generating last time.
After determining the machine address, it is identical with the machine address if determine, the node device of address receives default address in the default address information that other node devices send, to its transmission address setting response message.And, when node device startup next time, preferentially use the address of this setting as the default address of the machine.
Fig. 3 has shown the structure of the CAN network node address setting device that the present embodiment provides, as shown in Figure 3.This device comprises default address-generation unit, default address information transmitting element, default address information response unit, default address information response receiving element and address setting unit.
Wherein, preset address-generation unit, the default address of the machine is set respectively for each node device of CAN network.
Preset address information transmitting element, send respectively the default address information of the machine for each node device to other node devices of CAN network.
Default address information response unit, send producing response concurrent about the default address information of default address information for other node devices that receive default address information.
Default address information response receiving element, receives for sending the node device of default address information the default address response message that other node devices send.
Address setting unit, determines and preservation the machine address according to default address response message for the node device that sends default address information.
Fig. 4 has shown the Lookup protocol flow process of the CAN network node address that the present embodiment provides, as shown in Figure 4.
Embodiment mono-:
In communication DC power-supply system, monitoring unit and each rectifier have formed a CAN bus network, it between monitoring unit and each rectifier, is a typical master-slave communication pattern, monitoring unit is host node device, each rectifier is from node device, the traffic rate of CAN network is 500Kbps, the message format adopting is expansion 29 bit data bit formats, this system has 1 monitoring unit, 10 rectifiers, the setting address that rectifier is preserved is deposited in EERPOM, is initially 0, and address setting steps is as follows:
Step S401, after system powers on, each rectifier obtains respectively the time millisecond number that in self machine, monitoring software starts, and as the address of the machine, factor randomN is set, the sequence number that wherein value of N is rectifier, 1~10;
Step S402~405, reading address information from EEPROM, if address information is 0, produces a scope at 1~50 default address addrN; If the address information in EEPROM is not 0, and in 1~50 scope, the default address addrN using this address as the machine, if not in 1~50 scope, produces a scope at 1~50 default address addrN;
Step S406, in rectifier, monitoring software sends the default address information of the machine to other node devices in CAN network;
Step S407~S416, in scheduled time T0=50ms, may receive one of data message with Types Below, and T0 value can appropriately adjust as the case may be:
If receive the address setting response message that other rectifiers send, represent that the default address in the default address information of address that other rectifiers have set and the machine is identical, now this rectifier is abandoned former default address, regenerate a new default address, if newly-generated address is the same with the address generating last time, regenerate once again, until newly-generated default address is different from the default address generating last time; This processing mode can alleviate the burden of network, shortens the time of address setting;
If receive the default address same response information that other rectifiers send, represent that the default address in the default address of other rectifiers and the default address information of the machine is identical, now, if the address of this rectifier arranges the address that the factor is greater than the rectifier that sends default address same response information the factor is set, and in scheduled time T0, do not receive the default address response message of other types, the default address of this rectifier the machine is set to the machine address; If the address of this rectifier arranges the address that the factor is less than or equal to the node device that sends default address same response information the factor is set, this rectifier is abandoned former default address, regenerate the default address of the machine, again send newly-generated default address information to other node devices;
If receive the different response messages in default address that other rectifiers send, represent that the default address in the default address of other rectifiers and the default address information of the machine is different, now, if this rectifier does not receive the default address response message of other types in scheduled time T0, the default address of this rectifier the machine is set to the machine address.
Step S417, this rectifier is determined behind the machine address, and this address is stored in EEPROM, sends an Address Confirmation information to monitoring unit simultaneously, monitoring unit records this address after receiving, and starts normal CAN communication.After this,, in the time receiving the default address information that other rectifiers send, if the default address in this default address information is identical with the machine address, send address setting response message to the rectifier that sends this default address information.
Embodiment bis-:
In communication DC power-supply system, formed the CAN bus network of a peer-to-peer communications pattern by 6 rectifiers, the traffic rate of CAN is 500Kbps, message format is 29 bit data positions of expansion, rectifier is kept at setting address in FLASH, and initial value is 0, and address setting steps is as follows:
Step S401, after system powers on, each rectifier obtains the time of making the product of the machine, i.e. and date Hour Minute Second, arranges factor randomN as the address of the machine, and wherein the value of N is 1~6;
Step S402~405, reading address information from FLASH, if address information is 0, produces a scope at 1~30 default address addrN; If the address information in EEPROM is not 0, and in 1~30 scope, the default address addrN using this address as the machine; If not in 1~30 scope, produce a scope at 1~30 default address addrN;
Step S406, in rectifier, monitoring software sends the default address information of the machine to other node devices in CAN network;
Step S407~S416, in scheduled time T0=30ms, may receive one of data message with Types Below, and T0 value can appropriately adjust as the case may be:
If receive the address setting response message that other rectifiers send, now this rectifier is abandoned former default address, regenerates a new default address, if newly-generated address is the same with the address generating last time, regeneration once, until different from the default address of last time;
If receive the default address same response information that other rectifiers send, now, if the address of this rectifier arranges the address that the factor is greater than the rectifier that sends default address same response information the factor is set, and in scheduled time T0, do not receive the default address response message of other types, the default address of this rectifier the machine is set to the machine address; Otherwise this rectifier is abandoned former default address, regenerate the default address of the machine, and again send newly-generated default address information to other node devices;
If receive the different response messages in default address that other rectifiers send, now, if this rectifier does not receive the default address response message of other types in scheduled time T0, the default address of this rectifier the machine is set to the machine address;
Step S417, this rectifier is determined behind the machine address, and this address is stored in FLASH, starts normal CAN communication.After this,, in the time receiving the default address information that other rectifiers send, if the default address in this default address information is identical with the machine address, send address setting response message to the rectifier that sends this default address information.
In sum, the present embodiment has following technique effect: what the automatic setting method of CAN network node address adopted is the Provisioning Policy of pure software, so on hardware without increase cost, in addition, the present embodiment adopts adaptive address detection method, address is arranged and become simple, and the quantity of nodes equipment also can be unrestricted, greatly improve flexibility and the extensibility of system, and there is the scope of application more widely.
Although above the present invention is had been described in detail, the invention is not restricted to this, those skilled in the art can carry out various amendments according to principle of the present invention.Therefore, all amendments of doing according to the principle of the invention, all should be understood to fall into protection scope of the present invention.
Claims (10)
1. an automatic setting method for CAN network node address, for Lookup protocol network node address, is characterized in that, comprises the following steps:
Each node device in A, CAN network arranges respectively the default address of the machine;
B, described each node device send respectively the default address information of the machine to other node devices in CAN network;
C, described other node devices that receive default address information send the default address response message about described default address information; And
D, the node device that sends default address information receive the default address response message that described other node devices send, and determine and preserve the machine address according to described default address response message;
Wherein, described default address response message comprises one of following:
Address setting response message is identical with the default address of described default address information for representing the address that other node devices have set;
Default address same response information is identical with the default address of described default address information for representing the default address of other node devices; And
The different response messages in default address are different with the default address of described default address information for representing the default address of other node devices.
2. the automatic setting method of CAN network node address according to claim 1, is characterized in that, before described steps A, the address that each node device will arrange respectively the machine arranges the factor.
3. the automatic setting method of CAN network node address according to claim 1, is characterized in that, described steps A comprises the following steps:
A1, described each node device detect self whether to have had default address;
If A2 testing result is for having Qie Gai address, default address in effective range, this address is set to the default address of the machine; And
If A3 testing result is for not yet there being default address, this node device arranges voluntarily the default address of the machine in effective range.
4. according to the automatic setting method of the CAN network node address described in claim 1 or 3, it is characterized in that, described default address, its formulating method can be decided in its sole discretion under the condition in effective range in its value of guarantee, the lower limit of its effective range is 1, and higher limit should be more than or equal to the sum of described CAN nodes equipment.
5. the automatic setting method of CAN network node address according to claim 2, is characterized in that, it is one of following that the node device of the default address information of described transmission determines that according to described default address response message the step of the machine address comprises:
If default address response message is address setting response message, this node device is abandoned former default address, regenerates the default address of the machine, again sends newly-generated default address information to other node devices, and waits for scheduled time T0;
If default address response message is default address same response information, the size that this node device arranges the factor according to address is determined the machine address; And
If default address response message is the different response messages in default address, and in scheduled time T0, do not receive the default address response message of other types, the default address of this node device the machine is set to the machine address.
6. the automatic setting method of CAN network node address according to claim 5, is characterized in that, it is one of following that the size that described node device arranges the factor according to address determines that the step of the machine address comprises:
If the address of described node device arranges the address that the factor is greater than the node device that sends default address same response information the factor is set, and in scheduled time T0, do not receive the default address response message of other types, the default address of this node device the machine is set to the machine address; And
If the address of described node device arranges the address that the factor is less than or equal to the node device that sends default address same response information the factor is set, this node device is abandoned former default address, regenerate the default address of the machine, again send newly-generated default address information to other node devices.
7. the automatic setting method of CAN network node address according to claim 6, it is characterized in that, if the default address of the machine regenerating described is identical with the default address generating last time, again regenerate the default address of the machine, until newly-generated default address is different from the default address generating last time.
8. the automatic setting method of CAN network node address according to claim 1, it is characterized in that, determine the machine address in described step D after, if the default address in the default address information that described in described node device receives, other node devices send is identical with the machine address, send address setting response message to the node device that sends this default address information.
9. the automatic setting method of CAN network node address according to claim 1, is characterized in that, after described step D, when described node device startup next time, preferentially uses the address of this setting as the default address of the machine.
10. a Lookup protocol device for CAN network node address, for Lookup protocol network node address, is characterized in that, comprising:
Preset address-generation unit, the default address of the machine is set respectively for each node device of CAN network;
Preset address information transmitting element, send respectively the default address information of the machine for described each node device to other node devices of CAN network;
Default address information response unit, send producing response concurrent about the default address information of described default address information for described other node devices that receive default address information;
Default address information response receiving element, receives for sending the node device of default address information the default address response message that described other node devices send; And
Address setting unit, determines according to described default address response message and preservation the machine address for the node device that sends default address information;
Wherein, described default address response message comprises one of following:
Address setting response message is identical with the default address of described default address information for representing the address that other node devices have set;
Default address same response information is identical with the default address of described default address information for representing the default address of other node devices; And
The different response messages in default address are different with the default address of described default address information for representing the default address of other node devices.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010205873.8A CN101877727B (en) | 2010-06-21 | 2010-06-21 | Method for automatically setting CAN network node address and device thereof |
PCT/CN2010/076334 WO2011160335A1 (en) | 2010-06-21 | 2010-08-25 | Method and device for configuring network node addresses in controller area network automatically |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010205873.8A CN101877727B (en) | 2010-06-21 | 2010-06-21 | Method for automatically setting CAN network node address and device thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101877727A CN101877727A (en) | 2010-11-03 |
CN101877727B true CN101877727B (en) | 2014-07-16 |
Family
ID=43020189
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010205873.8A Active CN101877727B (en) | 2010-06-21 | 2010-06-21 | Method for automatically setting CAN network node address and device thereof |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN101877727B (en) |
WO (1) | WO2011160335A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103217956B (en) * | 2013-03-26 | 2015-05-13 | 三一重工股份有限公司 | Industrial control system as well as control method and control device thereof |
CN105812496A (en) * | 2014-12-30 | 2016-07-27 | 深圳奥特迅电力设备股份有限公司 | Power module address automatic setting method and system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101175000A (en) * | 2007-11-22 | 2008-05-07 | 华为技术有限公司 | Method and device for automatic IP address detection |
CN101399700A (en) * | 2008-06-06 | 2009-04-01 | 韦自力 | Apparatus, method and integrated circuit chip having on-line addressing bus type node |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FI87290C (en) * | 1991-01-17 | 1992-12-10 | Kone Oy | Procedure for determining message identifiers in an elevator network computer |
DE19713240C2 (en) * | 1997-03-29 | 1999-01-28 | Endress Hauser Gmbh Co | Procedure for automatic address assignment in a CAN network |
CN101309306B (en) * | 2008-07-16 | 2010-06-30 | 哈尔滨工业大学 | Method for allocating addresses from node device in Modbus communication network |
-
2010
- 2010-06-21 CN CN201010205873.8A patent/CN101877727B/en active Active
- 2010-08-25 WO PCT/CN2010/076334 patent/WO2011160335A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101175000A (en) * | 2007-11-22 | 2008-05-07 | 华为技术有限公司 | Method and device for automatic IP address detection |
CN101399700A (en) * | 2008-06-06 | 2009-04-01 | 韦自力 | Apparatus, method and integrated circuit chip having on-line addressing bus type node |
Also Published As
Publication number | Publication date |
---|---|
CN101877727A (en) | 2010-11-03 |
WO2011160335A1 (en) | 2011-12-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102821050B (en) | A kind of RSTP is applied to the processing method of Single-ring network topology | |
US11272396B2 (en) | Frame aggregation method, network setting frame sending method, and device | |
CN106130680B (en) | Industry internet field layer wideband bus clock synchronization realizing method | |
CN103812823A (en) | Method, device and system for configuration information migration in thermal migration of virtual machine | |
CN104038570B (en) | A kind of data processing method and device | |
CN104901858A (en) | System communication method based on CAN bus | |
CN101815005B (en) | network device, system and network management method | |
US11316654B2 (en) | Communication device and method for operating a communication system for transmitting time critical data | |
CN103684716A (en) | Method for transmitting messages in a redundantly operable industrial communication network and communication device for the redundantly operable industrial communication network | |
CN104702560A (en) | Method and device for preventing message attack | |
CN104833055B (en) | The method and apparatus of multi-online air-conditioning system data transfer | |
EP3629535A1 (en) | Method, device, and system for implementing mux machine | |
CN109699089A (en) | A kind of channel access method and device | |
CN105389278A (en) | CAN bus based serial communication method for master and slave machines | |
CN110730095B (en) | Cloud computing platform-oriented data security emergency drilling method and system | |
CN1357184A (en) | Block-oriented control system on high speed ethernet | |
CN101877727B (en) | Method for automatically setting CAN network node address and device thereof | |
CN104160735A (en) | Packet processing method, forwarder, packet processing device and packet processing system | |
EP3633931B1 (en) | Method and system for implementing mux machine | |
CN108093077B (en) | Abnormality eliminating method, device and server | |
CN104536926B (en) | The control method and device of serial equipment | |
RU2693903C1 (en) | Method, apparatus and processing system for expanded port | |
CN109753012A (en) | A kind of processing machine long-range control method, apparatus and system based on cloud platform | |
CN105681229A (en) | Method for extending port serial numbers and switch | |
EP3331199B1 (en) | Method and system for simple device replacement in a class a (cca) network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20200720 Address after: 210012 Nanjing, Yuhuatai District, South Street, Bauhinia Road, No. 68 Patentee after: Nanjing Zhongxing Software Co.,Ltd. Address before: 518057 Nanshan District Guangdong high tech Industrial Park, South Road, science and technology, ZTE building, Ministry of Justice Patentee before: ZTE Corp. |
|
TR01 | Transfer of patent right |