Summary of the invention
The object of the invention is the problem in order to solve car body control module poor universality, the invention provides a kind of car body control module address distribution method and device.
Car body control module address distribution method of the present invention,
All N number of car body control module that described address distribution method relates to all is connected to form distributed formula network by CAN, and the N number of car body control module in described N number of car body control module is main control module, and remaining N-1 car body control module is submodule; Described address distribution method comprises the steps:
To the unlocked step that each submodule unlocks;
For the address configuration step of each submodule configuration address.
In the unlocked step that each submodule is unlocked, the process that any one submodule unlocks is comprised the steps:
Main control module sends configuring request to the step of submodule by CAN;
Main control module calculates according to the unblock seed received and obtains corresponding key, and this key and initial address seed is fed back to the step of corresponding submodule;
Main control module, after receiving unblock failure information, sends the step of configuring request information again to corresponding submodule;
After submodule receives configuring request, send to main control module and unlock seed, calculate the step of the key obtaining self simultaneously according to this unblock seed;
Submodule receive main control module feedback key, simultaneously by this key with the key self obtained compared with, if difference, feed back to main control module unlock failure information, otherwise to main control module feed back unblock successful information unblock feedback step.
Described address configuration step comprises the steps: further
The address configuration step of the 1st submodule;
The address configuration step of i-th submodule, 1<i<N;
Main control module is to the step of submodule configuration address.
Main control module comprises the steps: further to the step of submodule configuration address
Main control module sends the step of configuration information to the 1st submodule, and described configuration information comprises the step of initial address seed and address number;
Main control module contrasts two of continuous feedback keys, if identical, then judges the submodule configuration successful that the double secret key first fed back is answered, the step that the address of the submodule that the double secret key of rear feedback is answered is correct;
Primary module judges the number of the submodule of configuration successful, when number is N-1 time, has judged the step of address configuration.
The address configuration step of described 1st submodule comprises the steps: further
1st submodule receives configuration information, and the address key producing this submodule is calculated according to the initial address seed in described configuration information, determine the geocoding of self according to geocoding, and described address key and geocoding are fed back to the step of main control module;
1st submodule, initial address coding is added the new geocoding of 1 formation, and this new geocoding and address key form the step that configuration information sends to the 2nd submodule;
1st submodule, after determining the geocoding of self, is determined the program function of self, and is started the step of corresponding program according to this geocoding.
The address configuration step of described i-th submodule comprises the steps: further
I-th submodule receives the configuration information of the i-th-1 module, and calculate according to geocoding in described configuration information with from the initial address seed of main control module the check key producing this submodule, the address key of this check key and the i-th-1 module compares, if identical, the geocoding of self is determined according to geocoding, after geocoding is determined, calculate the address key producing this submodule again according to initial address seed according to fixing algorithm, and described address key and geocoding are fed back to the step of main control module;
If check key is not identical with the address key of the i-th-1 module, return the step of the address configuration of a submodule;
Geocoding adds after 1 by i-th submodule, forms with address key the step that configuration information sends to the i-th+1 submodule;
I-th submodule, after determining the geocoding of self, determines the program function of self according to this geocoding, and starts the step of corresponding program.
Car body control module address distributing device, all N number of car body control module that described address distributing device relates to all is connected to form distributed formula network by CAN, N number of car body control module in described N number of car body control module is main control module, and remaining N-1 car body control module is submodule; Described address distributing device comprises as lower device:
To the tripper that each submodule unlocks;
For the address configuration means of each submodule configuration address;
Described address configuration means comprises further as lower device:
The address configuration means of the 1st submodule;
The address configuration means of i-th submodule, 1<i<N;
Main control module is to the device of submodule configuration address.
In the tripper that each submodule is unlocked, comprise as lower device to the process that any one submodule unlocks:
Main control module sends configuring request to the device of submodule by CAN;
Main control module calculates according to the unblock seed received and obtains corresponding key, and this key and initial address seed is fed back to the device of corresponding submodule;
Main control module, after receiving unblock failure information, sends the device of configuring request information again to corresponding submodule;
After submodule receives configuring request, send to main control module and unlock seed, calculate the device of the key obtaining self simultaneously according to this unblock seed;
Submodule receive main control module feedback key, simultaneously by this key with the key self obtained compared with, if difference, feed back to main control module unlock failure information, otherwise to main control module feed back unblock successful information unblock feedback assembly.
Main control module comprises as lower device further to the device of submodule configuration address:
Main control module sends the device of configuration information to the 1st submodule, and described configuration information comprises the device of initial address seed and address number;
Main control module contrasts two of continuous feedback keys, if identical, then judges the submodule configuration successful that the double secret key first fed back is answered, the device that the address of the submodule that the double secret key of rear feedback is answered is correct;
Primary module judges the number of the submodule of configuration successful, when number is N-1 time, has judged the device of address configuration.
The address configuration means of described 1st submodule comprises further as lower device:
1st submodule receives configuration information, and the address key producing this submodule is calculated according to the initial address seed in described configuration information, determine the geocoding of self according to geocoding, and described address key and geocoding are fed back to the device of main control module;
1st submodule, initial address coding is added the new geocoding of 1 formation, and this new geocoding and address key form the device that configuration information sends to the 2nd submodule;
1st submodule, after determining the geocoding of self, is determined the program function of self, and is started the device of corresponding program according to this geocoding.
The address configuration means of described i-th submodule comprises further as lower device:
I-th submodule receives the configuration information of the i-th-1 module, and calculate according to geocoding in described configuration information with from the initial address seed of main control module the check key producing this submodule, the address key of this check key and the i-th-1 module compares, if identical, the geocoding of self is determined according to geocoding, after geocoding is determined, calculate the address key producing this submodule again according to initial address seed according to fixing algorithm, and described address key and geocoding are fed back to the device of main control module;
If check key is not identical with the address key of the i-th-1 module, return the device of the address configuration of a submodule;
Geocoding adds after 1 by i-th submodule, forms with address key the device that configuration information sends to the i-th+1 submodule;
I-th submodule, after determining the geocoding of self, determines the program function of self according to this geocoding, and starts the device of corresponding program.
Beneficial effect of the present invention is, the software of each module is also designed to identical by the present invention, the function of configuration module is carried out by the mode of address assignment, the hardware-software so just reaching module is all general, when dispatching from the factory, each module can be duplicate, the laggard row address configuration of entrucking, after address assignment, submodule is just defined as 1#, 2#, 3#, ... .., each submodule performs the function of corresponding numbering and has oneself independently CAN message ID, in vehicle use procedure, the position of each module also can exchange, as long as carry out primary address configuration again after exchanging, just can normally work.
Embodiment
Embodiment one: composition graphs 1 and Fig. 2 illustrate present embodiment, the car body control module address distribution method described in present embodiment,
All N number of car body control module that described address distribution method relates to all is connected to form distributed formula network by CAN, and the N number of car body control module in described N number of car body control module is main control module, and remaining N-1 car body control module is submodule; Described address distribution method comprises the steps:
To the unlocked step that each submodule unlocks;
For the address configuration step of each submodule configuration address.
In the unlocked step that each submodule is unlocked, the process that any one submodule unlocks is comprised the steps:
Main control module sends configuring request to the step of submodule by CAN;
Main control module calculates according to the unblock seed received and obtains corresponding key, and this key and initial address seed is fed back to the step of corresponding submodule;
Main control module, after receiving unblock failure information, sends the step of configuring request information again to corresponding submodule;
After submodule receives configuring request, send to main control module and unlock seed, calculate the step of the key obtaining self simultaneously according to this unblock seed;
Submodule receive main control module feedback key, simultaneously by this key with the key self obtained compared with, if difference, feed back to main control module unlock failure information, otherwise to main control module feed back unblock successful information unblock feedback step.
As shown in Figure 1, unlocked by CAN parallel communication.Main control module sends configuring request, after each submodule receives request, send and unlock seed, this seed is the random number of two bytes, main control module returns a key according to the seed received after fixing algorithm calculates, main control module also issues an initial address seed together with key simultaneously, initial address seed is two the byte random numbers produced by main control module, use when being mainly used in address assignment, each submodule also according to the unblock seed self sent according to fixing algorithm computation key value, then the key value returned with main control module compares, if the same think and unlock successfully, enter address configuration pattern, return to main control module one simultaneously and unlock successful confirmation message.Main control module unlocks according to confirming the quantity that pass signal counts out submodule, if conformed to quantity during design just can carry out address configuration.
Described address configuration step comprises the steps: further
The address configuration step of the 1st submodule;
The address configuration step of i-th submodule, 1<i<N;
Main control module is to the step of submodule configuration address.
Main control module comprises the steps: further to the step of submodule configuration address
Main control module sends the step of configuration information to the 1st submodule, and described configuration information comprises the step of initial address seed and address number;
Main control module contrasts two of continuous feedback keys, if identical, then judges the submodule configuration successful that the double secret key first fed back is answered, the step that the address of the submodule that the double secret key of rear feedback is answered is correct;
Primary module judges the number of the submodule of configuration successful, when number is N-1 time, has judged the step of address configuration.
The address configuration step of described 1st submodule comprises the steps: further
1st submodule receives configuration information, and the address key producing this submodule is calculated according to the initial address seed in described configuration information, determine the geocoding of self according to geocoding, and described address key and geocoding are fed back to the step of main control module;
1st submodule, initial address coding is added the new geocoding of 1 formation, and this new geocoding and address key form the step that configuration information sends to the 2nd submodule;
1st submodule, after determining the geocoding of self, is determined the program function of self, and is started the step of corresponding program according to this geocoding.
The address configuration step of described i-th submodule comprises the steps: further
I-th submodule receives the i-th-1 module configuration information, and according to geocoding in described configuration information and from main control module initial address seed calculate and produce the check key of this submodule, the address key of this check key and the i-th-1 module compares, if identical, illustrate that the address number of the i-th-1 module received is correct, after verification, the geocoding of self is determined according to geocoding, after geocoding is determined, calculate the address key producing this submodule again according to fixing algorithm according to initial address seed, and described address key and geocoding are fed back to the step of main control module,
If check key is not identical with the address key of the i-th-1 module, return the step of the address configuration of a submodule;
Geocoding adds after 1 by i-th submodule, forms with address key the step that configuration information sends to the i-th+1 submodule;
I-th submodule, after determining the geocoding of self, determines the program function of self according to this geocoding, and starts the step of corresponding program.
As shown in Figure 2, carried out the transmission step by step of address configuration information by the series system of serial ports, main control module is according to CAN parallel communication Real-Time Monitoring configuration result.After each submodule unlocks and enters address configuration pattern, main control module sends address configuration information by serial ports, and configuration information is made up of two parts, a part is initial address seed, be made up of two bytes, another part is address number, by a byte for forming.Main control module transmission initial address seed and address number are to first submodule, and the initial address seed being handed down to each module when initial address seed is herein main control module unblock is identical, and address number is 0x00, after first submodule receives configuration information, main variety is fixed algorithm calculating over the ground, produce submodule 1# address key, and geocoding is added 1, confirm oneself to be submodule 1#, will the program function of implementation sub-module 1# after all configuring, then address key and geocoding are issued submodule 2# by serial ports, issue main control module by CAN simultaneously, main control module and submodule 2# carry out calculation check key according to address number value and initial address seed, compared with the address key sent with submodule 1#, as identical, the success of submodule 1# address configuration is described, the address number that submodule 2# module receives also is correct, submodule 2# will be fixed algorithm to initial address seed and calculate, produce the address key of submodule 2#, and geocoding 0x01 is added 1, confirm oneself to be submodule 2# simultaneously, will the program function of implementation sub-module 2# after all configuring, then address key and geocoding are issued submodule 3# by serial ports, issue main control module by CAN simultaneously.Submodule 3# also performs the flow process identical with submodule 2#, the like, a to the last module's address configuration terminates.Main control module monitors the layoutprocedure of modules in real time, calculate the module number of configuration successful simultaneously, finally configure module number identical with the quantity of unblock time, configuration successful is described, after configuration successful, main control module sends configuration ending request, each submodule receives configuration ending request backed off after random address configuration pattern, enter normal mode of operation, in layoutprocedure, if which block configuration unsuccessfully causes configure interrupt, main control module can be identified by the address key of CAN real-time reception and coded message, which undertaken pointing out module to have fault by display terminal, also the eliminating of fault is conducive to.
The present invention adopts the mode combined of connecting in parallel to realize, and main control module carries out parallel communication by CAN and submodule, is configured unblock, monitors in real time in layoutprocedure, and last transmission configures ending request, and configuration is terminated.Main control module carries out the specifying information of address configuration by serial ports transmission and submodule.Unlocking function has two effects, one is unlock to make each module enter into address configuration pattern from mode of operation, another effect is the quantity carrying out each module in certainty annuity by unlocking successful confirmation message, then compared with the module number of Car design, if not identical, illustrate that the module of series connection has cisco unity malfunction, that follow-up arranged in series cannot normally realize, and needs to confirm that each submodule connects and intactly could continue this work.
Embodiment two: composition graphs 1 and Fig. 2 illustrate present embodiment, car body control module address distributing device described in present embodiment, all N number of car body control module that described address distributing device relates to all is connected to form distributed formula network by CAN, N number of car body control module in described N number of car body control module is main control module, and remaining N-1 car body control module is submodule; Described address distributing device comprises as lower device:
To the tripper that each submodule unlocks;
For the address configuration means of each submodule configuration address;
Described address configuration means comprises further as lower device:
The address configuration means of the 1st submodule;
The address configuration means of i-th submodule, 1<i<N;
Main control module is to the device of submodule configuration address.
In the tripper that each submodule is unlocked, comprise as lower device to the process that any one submodule unlocks:
Main control module sends configuring request to the device of submodule by CAN;
Main control module calculates according to the unblock seed received and obtains corresponding key, and this key and initial address seed is fed back to the device of corresponding submodule;
Main control module, after receiving unblock failure information, sends the device of configuring request information again to corresponding submodule;
After submodule receives configuring request, send to main control module and unlock seed, calculate the device of the key obtaining self simultaneously according to this unblock seed;
Submodule receive main control module feedback key, simultaneously by this key with the key self obtained compared with, if difference, feed back to main control module unlock failure information, otherwise to main control module feed back unblock successful information unblock feedback assembly.
Main control module comprises as lower device further to the device of submodule configuration address:
Main control module sends the device of configuration information to the 1st submodule, and described configuration information comprises the device of initial address seed and address number;
Main control module contrasts two of continuous feedback keys, if identical, then judges the submodule configuration successful that the double secret key first fed back is answered, the device that the address of the submodule that the double secret key of rear feedback is answered is correct;
Primary module judges the number of the submodule of configuration successful, when number is N-1 time, has judged the device of address configuration.
The address configuration means of described 1st submodule comprises further as lower device:
1st submodule receives configuration information, and the address key producing this submodule is calculated according to the initial address seed in described configuration information, determine the geocoding of self according to geocoding, and described address key and geocoding are fed back to the device of main control module;
1st submodule, initial address coding is added the new geocoding of 1 formation, and this new geocoding and address key form the device that configuration information sends to the 2nd submodule;
1st submodule, after determining the geocoding of self, is determined the program function of self, and is started the device of corresponding program according to this geocoding.
The address configuration means of described i-th submodule comprises further as lower device:
I-th submodule receives the configuration information of the i-th-1 module, and calculate according to geocoding in described configuration information with from the initial address seed of main control module the check key producing this submodule, the address key of this check key and the i-th-1 module compares, if identical, the geocoding of self is determined according to geocoding, after geocoding is determined, calculate the address key producing this submodule again according to initial address seed according to fixing algorithm, and described address key and geocoding are fed back to the device of main control module;
If check key is not identical with the address key of the i-th-1 module, return the device of the address configuration of a submodule;
Geocoding adds after 1 by i-th submodule, forms with address key the device that configuration information sends to the i-th+1 submodule;
I-th submodule, after determining the geocoding of self, determines the program function of self according to this geocoding, and starts the device of corresponding program.