CN102546340B - Method of networking small CAN (controller area network) bus network - Google Patents

Method of networking small CAN (controller area network) bus network Download PDF

Info

Publication number
CN102546340B
CN102546340B CN201210034238.7A CN201210034238A CN102546340B CN 102546340 B CN102546340 B CN 102546340B CN 201210034238 A CN201210034238 A CN 201210034238A CN 102546340 B CN102546340 B CN 102546340B
Authority
CN
China
Prior art keywords
node
network
nodes
networking
generates
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.)
Expired - Fee Related
Application number
CN201210034238.7A
Other languages
Chinese (zh)
Other versions
CN102546340A (en
Inventor
王公堂
于国栋
许福运
方圆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Normal University
Original Assignee
Shandong Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Normal University filed Critical Shandong Normal University
Priority to CN201210034238.7A priority Critical patent/CN102546340B/en
Publication of CN102546340A publication Critical patent/CN102546340A/en
Application granted granted Critical
Publication of CN102546340B publication Critical patent/CN102546340B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a method capable of self-distributing ID (identity) so as to realize the networking of a small CAN bus network of CAN network communication, and aims at occasions with less network nodes. The method comprises the following steps: firstly, since the ID of each node in the CAN network is an initial value ID0, selecting one of the node as an initial target node, and then broadcasting and sending a command for generating the ID on the CAN network; secondly, after other nodes receive the command for generating the ID, beginning to randomly generate an integer as an own ID, after each node generates the own ID, using the ID0 as a target address, and sending out the new ID; thirdly, adding the ID0 to the received ID number by the ID0 node to form an ID table; and finally, sending the generated ID table to other nodes by the ID0 node, thereby, finishing the ID distribution of the CAN network.

Description

The method of a kind of Small-sized C AN bus network networking
Technical field
The present invention relates to CAN bussing technique field, relate in particular to the method for a kind of Small-sized C AN bus network networking.
Background technology
CANJi controller local area network, belongs to the category of industrial field bus.Compare with general communication bus, the data communication of CAN bus has outstanding reliability, real-time and flexibility.Due to its good performance and unique design, CAN bus is more and more subject to people's attention.Its range of application is no longer confined to automobile industry at present, and to automatic control, Aero-Space, navigation, process industrial, mechanical industry, textile machine, farm machinery, robot, Digit Control Machine Tool, medicine equipment and the development of sensor field.
Generally, when forming CAN network, need to first define the ID of each node in CAN network, make like this foundation of CAN network need a large amount of times, need to have professional to set the ID of each node.For general CAN network, user cannot make to complete voluntarily the distribution of ID in CAN network.
Although in the method for existing CAN networking, also can be by network allocation ID, adopt a main frame to manage more and distribute address, each node need to be connected to network successively, in node access procedure, easily in network, introduce and disturb, networking complexity is higher, operates more inconvenient.
Summary of the invention
The object of the invention is to design a kind of ID that can distribute voluntarily for the problems referred to above, realize the method for the Small-sized C AN bus network networking of CAN network communication, mainly for the less occasion of network node number, this method is without host assignment address, each node has all accessed CAN bus network when networking, does not need to be connected to successively network, and algorithm is simple, simple to operate, under existing hardware condition, only need add simple code just can realize this method.
For achieving the above object, the present invention adopts with the following method:
A method for Small-sized C AN bus network networking, its step is:
The first step, in CAN network, the ID of each node is initial value ID0, and selecting one of them is initial destination node, the then order of broadcast transmission generation ID on CAN network; Because node initial value is ID0, so CAN communication module can be produced in batches, assembling is simple, without as traditional networking, need to set in advance the ID of each node.CAN communication module indifference due to each node, so initial destination node can be selected by user's needs, without any restrictions, and existingly can distribute voluntarily in the network of ID, all adopt a node that is used for specially managing and distributing ID, this node is well-determined, very inconvenient in actual installation network.
Second step, other nodes, after receiving the order that generates ID, start integer of random generation as the ID of oneself, and each node generates after the ID of oneself, using ID0 as destination address, own new ID is sent; Because the initial ID of node is ID0, so the order of the generation ID that destination node sends, each node all can receive at one time, then utilizes random number functions to generate the ID of oneself.Than the management node with fixing, the node of access network is successively carried out to the distribution of ID, can save a large amount of time, and communication robust is good, can not introduce interference because of the access successively of node; Algorithm is simple and reliable, directly calls existing random number functions.
The 3rd step, ID0 node adds that by the id number receiving ID0 forms an ID table; Initial destination node temporarily manages the ID in network, whether successfully can judge fast networking.Fixing management node need at every moment be monitored bus, so not only wastes resource, but also takies in a large number bus time, reduces effective communication.Fixing management node is different from adopting, and initial destination node is the data that passive each node of reception sends, and is all useful communication, and total line use ratio is high, and is temporary transient management ID table.
The 4th step, ID0 node sends to each other nodes by the ID table of generation, and so far CAN network ID is assigned.Complete ID table is sent to other each nodes, thereby cancelled the otherness of initial destination node, made the status of each node in network all identical, used the network of fixing management node, this management node is all the time in gerentocratic status, and other nodes are all managed.
In described the 3rd step, if random No. ID of generating of each node is all different, in ID table, contain N not identical No. ID, represent that ID is allocated successfully, enter the 4th step.
In described the 3rd step, if there is identical ID in the ID generating table, or in ID table, the number of ID is less than N, and ID0 node retransmits according to current ID table the order that generates ID, skips to second step and proceeds.
The present invention be directed to the network-building method that small-sized CAN network proposes, is the network-building method with interior CAN network specifically for nodes 50.It is first by each address of node unification in CAN network, then therefrom select a node as initial destination node, immediately to CAN network issue ID information generated, each node of all the other except destination node all can generate an address automatically, and to destination node, send the address of oneself, for the appearance of avoiding a conflict, only have when the difference of the own address of all node issues, networking is just counted as merit, as long as there is any two or more address of node to occur identical, this networking failure, will re-start networking operation.
The invention has the beneficial effects as follows:
1) method realizes simply, thereby has reduced development cost, only need add simple code just can realize this method, without any hardware, changes.2) in this method, the initial ID of initial each node is identical, and the CAN communication part software and hardware of each node is identical, so be suitable for the production node communication device of output.3) networking operation is simple, can be completed voluntarily by user, as long as user connects circuit, the ID that can complete whole network distributes, easy to use.
Accompanying drawing explanation
Fig. 1 is CAN network diagram of the present invention.
Embodiment
Below in conjunction with accompanying drawing and embodiment, the present invention is elaborated.
In Fig. 1,
The first step, first, by connecting each node shown in accompanying drawing, the ID initial value of each node is ID0, and that use is 10 binary system ID.
Second step, chooses a node, and for example node 3, and input CAN nodes sum N, opens ID distribution function.
The 3rd step, node 3 is usingd ID0 as destination address, sends the order that generates ID in CAN network.
The 4th step, in CAN network, other nodes receive after the order that generates ID, start 10 binary positive integers of random generation as the ID of oneself, and this ID is sent to node 3.For example, node 1 is after receiving the order that generates ID, and node 1 can generate 10 bits at random, the ID using this binary number as oneself, and this ID is sent to node 3.
The 5th step, node 3 can receive No. ID that each node is sent in certain hour, and generates ID table.Surpass after this time, node 3 starts to calculate in ID table the not number n of identical ID, if n equals N, represents that the ID of each node in network is not identical, and ID is allocated successfully, and enters the 6th step.Otherwise node 3, by according to current ID table, retransmits to other each nodes the order that generates ID, goes to the 4th step and proceeds.
The 6th step, node 3 sends to other each nodes by ID table.
Calculating about the method scope of application in CAN network.
Suppose to adopt 10 binary system ID, available ID is 1024, and we calculate with 1000 available ID.
(CAN nodes sum N)-1 The probability that ID is allocated successfully for the first time
10 94.63%
20 80.94%
30 62.51%
40 43.55%
50 27.33%
60 15.44%
70 7.84%
Known in table, when adopting 10 binary system ID, CAN network node sum is in 40 time, and it is higher that ID is distributed into power, can complete at short notice ID and distribute.When node sum is greater than 50, it is lower that ID is distributed into power, complete ID and distribute and may need the long period.Therefore, the method is relatively applicable to the occasion that CAN network size is less, and concrete use can be with reference to above table.

Claims (1)

1. a method for Small-sized C AN bus network networking, is characterized in that, its step is:
The first step, in CAN network, the ID of each node is initial value ID0, and selecting one of them is initial destination node, the then order of broadcast transmission generation ID on CAN network;
Second step, other nodes, after receiving the order that generates ID, start integer of random generation as the ID of oneself, and each node generates after the ID of oneself, using ID0 as destination address, own new ID is sent;
The 3rd step, ID0 node adds that by the id number receiving ID0 forms an ID table;
If random No. ID of generating of each node is all different, in ID table, contain N not identical No. ID, represent that ID is allocated successfully, enter the 4th step;
If there is identical ID in the ID generating table, or in ID table, the number of ID is less than N, and ID0 node retransmits according to current ID table the order that generates ID, skips to second step and proceeds;
The 4th step, ID0 node sends to each other nodes by the ID table of generation, and so far, CAN network ID is assigned.
CN201210034238.7A 2012-02-16 2012-02-16 Method of networking small CAN (controller area network) bus network Expired - Fee Related CN102546340B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210034238.7A CN102546340B (en) 2012-02-16 2012-02-16 Method of networking small CAN (controller area network) bus network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210034238.7A CN102546340B (en) 2012-02-16 2012-02-16 Method of networking small CAN (controller area network) bus network

Publications (2)

Publication Number Publication Date
CN102546340A CN102546340A (en) 2012-07-04
CN102546340B true CN102546340B (en) 2014-02-19

Family

ID=46352341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210034238.7A Expired - Fee Related CN102546340B (en) 2012-02-16 2012-02-16 Method of networking small CAN (controller area network) bus network

Country Status (1)

Country Link
CN (1) CN102546340B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102830685B (en) * 2012-09-19 2015-02-18 三一矿机有限公司 Electric wheel dumper and control system
CN105337826B (en) * 2014-06-20 2019-05-10 奇点新源国际技术开发(北京)有限公司 The method and apparatus of carry nodal information in a kind of acquisition bus
CN104192654B (en) * 2014-07-29 2016-03-23 广州日滨科技发展有限公司 Elevator calling device and elevator device
CN105573174A (en) * 2016-02-03 2016-05-11 惠州市蓝微新源技术有限公司 Battery management system slave control unit identification information automatic distribution method
CN106657263A (en) * 2016-11-11 2017-05-10 宁波柯力传感科技股份有限公司 Weighing sensor CAN network node number automatic distribution method
CN108123860A (en) * 2017-01-19 2018-06-05 山西智舒智能科技有限公司 The ID of intelligent domestic system node device based on CAN bus is distributed automatically and management method
CN106817438A (en) * 2017-02-09 2017-06-09 浙江风向标科技有限公司 A kind of device management method and device based on controller local area network
CN107786405B (en) * 2017-10-17 2020-10-27 南京博兰得电子科技有限公司 Multi-node automatic networking method based on CAN bus
CN109873676B (en) * 2017-12-05 2020-07-03 艾乐德电子(南京)有限公司 CAN bus asynchronous communication method and network based on optical fiber
CN109586978B (en) * 2018-12-28 2022-03-18 浙江中控研究院有限公司 Bus topology network ad hoc network method
CN110311824B (en) * 2019-07-25 2021-12-28 江苏小牛电动科技有限公司 CAN communication dynamic networking method of battery management system
CN113347070B (en) * 2021-05-31 2022-11-04 上海汇解科技有限公司 Intelligent building field bus ad hoc network method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1409516A (en) * 2001-09-28 2003-04-09 深圳市中兴通讯股份有限公司上海第二研究所 Dynamic networking method for monitoring system
CN1988503A (en) * 2006-11-13 2007-06-27 西北工业大学 Routing method of radio sensor network
EP2104277A1 (en) * 2008-03-10 2009-09-23 Delphi Technologies, Inc. Detection of breakdowns and isolation of a high-speed downstream CAN network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1409516A (en) * 2001-09-28 2003-04-09 深圳市中兴通讯股份有限公司上海第二研究所 Dynamic networking method for monitoring system
CN1988503A (en) * 2006-11-13 2007-06-27 西北工业大学 Routing method of radio sensor network
EP2104277A1 (en) * 2008-03-10 2009-09-23 Delphi Technologies, Inc. Detection of breakdowns and isolation of a high-speed downstream CAN network

Also Published As

Publication number Publication date
CN102546340A (en) 2012-07-04

Similar Documents

Publication Publication Date Title
CN102546340B (en) Method of networking small CAN (controller area network) bus network
US20230198257A1 (en) Establishing Communication and Power Sharing Links Between Components of a Distributed Energy System
CN111147619B (en) Method and system for realizing automatic address allocation of RS485 slave equipment locally
CN109450662B (en) Ad hoc network communication manager, networking method and ad hoc network communication system
CN108696298B (en) Data transmission method and device, power line communication network and power system
CN104166384A (en) Method and special-purpose device for household electrical interconnection intercommunication bottom transmission
CN103280894A (en) Power distribution network control application network topology automatic identifying method
CN101266490B (en) MAC address free bus family wired control network plug and play method
CN102711139A (en) Data flow counting method and terminal
CN112583677A (en) Method, device, storage medium and system for allocating addresses to slave devices
CN102710809B (en) Address distribution method
CN104113435A (en) Method and device for generating identifier
CN104950829A (en) Bus system power consumption control method and device
CN102685274B (en) Group address distribution method of intelligent equipment in intelligent household network
CN103164262B (en) A kind of task management method and device
CN106953809B (en) 485 time-sharing communication-based equipment resource acquisition method
CN116233200B (en) Electric energy meter communication method and system based on subsequent frame dynamic registration
CN111371659B (en) Method for automatically allocating RS485 slave equipment address
CN113660353B (en) Method, device, equipment and medium for managing Provisioner address based on Bluetooth Mesh
CN102694882A (en) Group address distribution method for intelligent equipment in intelligent household network
CN109905300A (en) A kind of household appliance binding control method based on kinsfolk
CN104899174A (en) Method for automatically assigning addresses after plurality of photovoltaic inverters are connected in series
CN103997450A (en) Implementation method of CANopen master station based on DSP 28335
WO2016062050A1 (en) Method, device and system for micro-module management
CN104486449A (en) Calculation device controlling method and device

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140219

Termination date: 20150216

EXPY Termination of patent right or utility model