A CAN bus address automatic allocation device and method
Through the combination of power-on delay circuit, oscillation circuit and temperature acquisition circuit, the CAN bus address is automatically allocated, which solves the problem of inconvenient address allocation in the modular production of charge and discharge detection equipment, realizes plug-and-play, and improves production efficiency and operation and maintenance convenience.
Patent Information
- Application Number
- CN202111332810.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-11-11
AI Technical Summary
In the modular production of existing charge and discharge detection equipment, the CAN bus address allocation is inconvenient for production debugging and after-sales maintenance, especially when the number of functional modules is large, traditional methods cannot achieve plug-and-play.
The power-on delay circuit, oscillation circuit and temperature acquisition circuit are adopted to achieve time difference, oscillation frequency discretency and temperature acquisition through the power supply, and the CAN bus address is automatically allocated, so that each functional module competes for the address, and realizes plug-and-play.
It realizes plug-and-play function modules of charge and discharge detection equipment, improves production efficiency and facilitates operation and maintenance.
Smart Images

Figure CN114089661B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power electronics technology, and particularly to a CAN bus address automatic allocation device and method. Background Art
[0002] With the rapid development of lithium battery vehicles, the demand for testing lithium batteries is increasing day by day. That is, in order to ensure the safety of lithium batteries, a series of tests need to be carried out on lithium batteries through charge and discharge detection equipment, resulting in an increasing number of models and types of charge and discharge detection equipment.
[0003] Due to the increasing number, models, and types of charge and discharge detection equipment, in order to facilitate the large-scale production of charge and discharge detection equipment and improve market adaptability, it is necessary to adopt a modular method to produce charge and discharge detection equipment, that is, to combine each functional module in parallel or series, and then produce various models of charge and discharge detection equipment.
[0004] During the modular production of charge and discharge detection equipment, each functional module needs to exchange data through the CAN bus for intelligent identification to achieve plug-and-play. Exchanging data through the CAN bus involves the problem of allocating CAN bus addresses to each functional module. For the allocation of CAN bus addresses, there are the following two traditional methods:
[0005] The first method is to manually operate a binary DIP switch to achieve the allocation of 2^N addresses, where N represents the number of DIP switches. This method has the disadvantages of being inconvenient for production debugging and after-sales maintenance when there are a large number of functional modules, as Figure 6 shown; the second method is to write the CAN bus address into software for storage, but it has the disadvantages of not being able to achieve plug-and-play and being inconvenient for production debugging and after-sales maintenance, as Figure 7 shown.
[0006] Therefore, how to provide a CAN bus address automatic allocation device and method to achieve the automatic allocation of CAN bus addresses and make the functional modules of charge and discharge detection equipment plug-and-play has become an urgent problem to be solved. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a CAN bus address automatic allocation device and method to achieve the automatic allocation of CAN bus addresses and make the functional modules of charge and discharge detection equipment plug-and-play.
[0008] In a first aspect, the present invention provides a CAN bus address automatic allocation device, including an MCU, a power-on delay circuit, an oscillation circuit, a temperature acquisition circuit, a switch K1, and a switch K2;
[0009] The MCU is respectively connected to a power-on delay circuit, an oscillation circuit, and a temperature acquisition circuit; one end of the switch K1 is connected to the power-on delay circuit, and the other end is connected to the live wire; one end of the switch K2 is connected to the power-on delay circuit, and the other end is connected to the neutral wire.
[0010] Further, the power-on delay circuit includes a first power supply, a second power supply, a third power supply, a first DSP chip, a capacitor C1, a capacitor C2, a capacitor C3, and a capacitor C4;
[0011] One end of the capacitor C1 is connected to the switch K1 and the pin 1 of the first power supply, and the other end is connected to the switch K2 and the pin 2 of the first power supply; one end of the capacitor C2 is connected to the pin 4 of the first power supply and the pin 1 of the second power supply, and the other end is connected to the pin 3 of the first power supply and the pin 2 of the second power supply; one end of the capacitor C3 is connected to the pin 4 of the second power supply and the pin 1 of the third power supply, and the other end is connected to the pin 3 of the second power supply and the pin 2 of the third power supply; one end of the capacitor C4 is connected to the pin 4 of the third power supply and the pin 1 of the first DSP chip, and the other end is connected to the pin 3 of the third power supply and the pin 2 of the first DSP chip; the pins 3 and 4 of the first DSP chip are connected to the MCU.
[0012] Further, the first power supply is a low-power high-frequency 220VAC / 12VDC power supply, the second power supply is a 12V / 15V high-frequency isolated DC / DC power supply, and the third power supply is an LDO linear power supply.
[0013] Further, the oscillation circuit includes an oscillation chip U1, a second DSP chip, a resistor R1, a resistor R2, a resistor R3, and a capacitor C5;
[0014] The pin 1 of the oscillation chip U1 is connected to the resistor R3 and the capacitor C5, the pin 2 is connected to the resistor R1 and the resistor R2, and the pin 3 is connected to the resistor R3 and the pin 1 of the second DSP chip; the resistor R2 is connected to the capacitor C5 and grounded; the pins 2 and 3 of the second DSP chip are connected to the MCU.
[0015] Further, the temperature acquisition circuit includes a third DSP chip, a resistor R4, and a thermistor RT;
[0016] The pin 1 of the third DSP chip is connected to one end of the resistor R4 and the thermistor RT, and the pins 2 and 3 are connected to the MCU; the other end of the resistor R4 is grounded.
[0017] Further, both the switch K1 and the switch K2 are connected to the MCU.
[0018] Second aspect, the present invention provides a method for automatically allocating CAN bus addresses, including the following steps:
[0019] Step S10: The MCU presets a duration threshold, and turns on switch K1 and switch K2 to supply power to the power-on delay circuit;
[0020] Step S20: The MCU automatically allocates the first address of the CAN bus address based on the time when the first power supply, the second power supply, and the third power supply reach the effective working voltage of the system;
[0021] Step S30: The MCU automatically allocates the remaining addresses of the CAN bus address based on the time generated by each oscillation frequency of the oscillation circuit, and determines whether all the CAN bus addresses have been allocated when the duration threshold is reached. If so, the process ends; if not, it enters step S40;
[0022] Step S40: The MCU automatically allocates the remaining addresses of the CAN bus address based on the time of each temperature value collected by the temperature acquisition circuit.
[0023] Further, the step S20 is specifically:
[0024] The MCU corresponds the first power supply, the second power supply, and the third power supply to a function module respectively; the MCU determines the power supply that reaches the effective working voltage of the system fastest among the first power supply, the second power supply, and the third power supply, and automatically allocates the first address of the CAN bus address to the function module corresponding to this power supply.
[0025] Further, in the step S30, the MCU automatically allocates the remaining addresses of the CAN bus address based on the time generated by each oscillation frequency of the oscillation circuit specifically as follows:
[0026] The MCU corresponds each oscillation frequency generated by the oscillation circuit to a function module, and automatically allocates the remaining addresses of the CAN bus address to the corresponding function module based on the sequence of the time generated by each oscillation frequency.
[0027] Further, the step S40 is specifically:
[0028] The MCU corresponds each temperature value collected by the temperature acquisition circuit to a function module, and automatically allocates the remaining addresses of the CAN bus address to the corresponding function module based on the sequence of the time generated by each temperature value.
[0029] The advantages of the present invention are:
[0030] By setting up a power-on delay circuit, an oscillation circuit, and a temperature acquisition circuit, the starting address of the CAN bus address is competed through the time differences of the first power supply, the second power supply, and the third power supply in the power-on delay circuit to reach the effective working voltage of the system. The remaining CAN bus addresses are competed through the discreteness of the oscillation frequency generated by the oscillation circuit and the discreteness of the ambient temperature value collected by the temperature acquisition circuit; that is, the remaining CAN bus addresses are competed in ascending order according to the sequence of the generation times of the oscillation frequencies. If the competition is not completed within the preset duration threshold, the remaining CAN bus addresses are then competed in ascending order according to the sequence of the generation times of the temperature values until all CAN bus addresses are allocated; finally, the automatic allocation of the CAN bus addresses is realized, enabling the functional modules of the charge and discharge detection device to be plug-and-play, thereby greatly improving the production efficiency of the charge and discharge detection device and facilitating the operation and maintenance of the charge and discharge detection device. Description of the Drawings
[0031] The present invention will be further described below with reference to the accompanying drawings in conjunction with embodiments.
[0032] Figure 1 It is a circuit principle block diagram of an automatic CAN bus address allocation device of the present invention.
[0033] Figure 2 It is a circuit diagram of the power-on delay circuit of the present invention.
[0034] Figure 3 It is a circuit diagram of the oscillation circuit of the present invention.
[0035] Figure 4 It is a circuit diagram of the temperature acquisition circuit of the present invention.
[0036] Figure 5 It is a flowchart of an automatic CAN bus address allocation method of the present invention.
[0037] Figure 6 It is a circuit schematic diagram of the traditional DIP switch mode.
[0038] Figure 7 It is a circuit schematic diagram of the traditional software writing mode.
[0039] Marking Explanation:
[0040] 100 - An automatic CAN bus address allocation device, 1 - MCU, 2' - Power-on delay circuit, 3' - Oscillation circuit, 4' - Temperature acquisition circuit, 21 - First power supply, 22 - Second power supply, 23 - Third power supply, 24 - First DSP chip, 31 - Second DSP chip, 41 - Third DSP chip. Detailed Embodiment
[0041] The technical solution in the embodiment of the present application has the following general idea: By using the time differences of the first power supply 21, the second power supply 22, and the third power supply 23 in the power-on delay circuit 2' to reach the effective working voltage of the system to compete for the first address of the CAN bus address, and by using the discreteness of the oscillation frequency generated by the oscillation circuit 3' and the discreteness of the ambient temperature value collected by the temperature acquisition circuit 4' to compete for the remaining CAN bus addresses until all the CAN bus addresses are allocated, so as to realize the automatic allocation of the CAN bus addresses and make the functional modules of the charge and discharge detection device plug and play.
[0042] Please refer to Figures 1 to 7 As shown, a preferred embodiment of a CAN bus address automatic allocation device 100 of the present invention includes an MCU1, a power-on delay circuit 2', an oscillation circuit 3', a temperature acquisition circuit 4', a switch K1, and a switch K2; the MCU1 is used to control the operation of the automatic allocation device 100, that is, to automatically allocate the CAN bus addresses based on the time of the data collected by the power-on delay circuit 2', the oscillation circuit 3', and the temperature acquisition circuit 4'. In specific implementation, any MCU that can achieve this function can be selected from the prior art, and it is not limited to any model. For example, the MCU of the STM32F103 series of ST Company, and the control program is well-known to those skilled in the art, which can be obtained by those skilled in the art without creative labor; the power-on delay circuit 2' has multiple power supplies with different times to reach the effective working voltage of the system, and then competes for the first address of the CAN bus address based on the speed of reaching the effective working voltage of the system; the oscillation circuit 3' is used to generate multiple oscillation sources with different oscillation frequencies, and competes for the remaining CAN bus addresses in ascending order according to the sequence of the generation times of the oscillation frequencies; the temperature acquisition circuit 4' is used to collect the ambient temperature value, and competes for the remaining CAN bus addresses in ascending order according to the sequence of the generation times of the temperature values; the switch K1 and the switch K2 are used to turn on and off the power input of the power-on delay circuit 2'.
[0043] The MCU1 is respectively connected to the power-on delay circuit 2', the oscillation circuit 3', and the temperature acquisition circuit 4'; one end of the switch K1 is connected to the power-on delay circuit 2', and the other end is connected to the live wire; one end of the switch K2 is connected to the power-on delay circuit 2', and the other end is connected to the neutral wire.
[0044] The power-on delay circuit 2' includes a first power supply 21, a second power supply 22, a third power supply 23, a first DSP chip 24, a capacitor C1, a capacitor C2, a capacitor C3, and a capacitor C4; the capacitors C1, C2, C3, and C4 are all filter capacitors.
[0045] One end of the capacitor C1 is connected to the switch K1 and the pin 1 of the first power supply 21, and the other end is connected to the switch K2 and the pin 2 of the first power supply; one end of the capacitor C2 is connected to the pin 4 of the first power supply 21 and the pin 1 of the second power supply 22, and the other end is connected to the pin 3 of the first power supply 21 and the pin 2 of the second power supply 22; one end of the capacitor C3 is connected to the pin 4 of the second power supply 22 and the pin 1 of the third power supply 23, and the other end is connected to the pin 3 of the second power supply and the pin 2 of the third power supply 23; one end of the capacitor C4 is connected to the pin 4 of the third power supply 23 and the pin 1 of the first DSP chip 24, and the other end is connected to the pin 3 of the third power supply 23 and the pin 2 of the first DSP chip 24; the pins 3 and 4 of the first DSP chip 24 are connected to the MCU1.
[0046] The first power supply 21 is a low-power high-frequency 220VAC / 12VDC power supply, the second power supply 22 is a 12V / 15V high-frequency isolated DC / DC power supply, and the third power supply 23 is an LDO linear power supply. That is, the parameters of each power supply have dispersion, so that the time for each power supply to reach the effective working voltage of the system is different.
[0047] The oscillation circuit 3’ includes an oscillation chip U1, a second DSP chip 31, a resistor R1, a resistor R2, a resistor R3, and a capacitor C5; the oscillation chip U1 is used to convert DC electrical energy into AC electrical energy with a certain frequency, that is, to generate a number of oscillation sources with different oscillation frequencies.
[0048] The pin 1 of the oscillation chip U1 is connected to the resistor R3 and the capacitor C5, the pin 2 is connected to the resistor R1 and the resistor R2, and the pin 3 is connected to the resistor R3 and the pin 1 of the second DSP chip 31; the resistor R2 is connected to the capacitor C5 and grounded; the pins 2 and 3 of the second DSP chip 31 are connected to the MCU1.
[0049] The temperature acquisition circuit 4’ includes a third DSP chip 41, a resistor R4, and a temperature-sensitive resistor RT; the temperature-sensitive resistor RT is used to collect the ambient temperature value inside the chassis (not shown). Due to the dispersion of the ambient temperature value, the collected temperature values will be a set of random numbers.
[0050] The pin 1 of the third DSP chip 41 is connected to one end of the resistor R4 and the temperature-sensitive resistor RT, and the pins 2 and 3 are connected to the MCU1; the other end of the resistor R4 is grounded.
[0051] The first DSP chip 24, the second DSP chip 31, and the third DSP chip 41 are respectively used for signal acquisition and calculation of the power-on delay circuit 2', the oscillation circuit 3', and the temperature acquisition circuit 4'. In specific implementation, any DSP chip that can achieve this function can be selected from the prior art, and there is no limitation on the model.
[0052] Both the switch K1 and the switch K2 are connected to the MCU1; both the switch K1 and the switch K2 are relays.
[0053] A preferred embodiment of a method for automatically allocating CAN bus addresses according to the present invention includes the following steps:
[0054] Step S10: The MCU presets a duration threshold, and turns on the switch K1 and the switch K2 to supply power to the power-on delay circuit.
[0055] Step S20: The MCU automatically allocates the first address (0000H) of the CAN bus address based on the time when the first power supply, the second power supply, and the third power supply reach the effective working voltage of the system; that is, competes for the first address of the CAN bus address based on the time when the three power supplies reach the effective working voltage of the system.
[0056] Step S30: The MCU automatically allocates the remaining addresses of the CAN bus address based on the time generated by each oscillation frequency of the oscillation circuit, and determines whether all the CAN bus addresses have been allocated when the duration threshold is reached. If so, the process ends; if not, it enters step S40.
[0057] Step S40: The MCU automatically allocates the remaining addresses of the CAN bus address based on the time of each temperature value collected by the temperature acquisition circuit.
[0058] The specific content of step S20 is as follows:
[0059] The MCU corresponds the first power supply, the second power supply, and the third power supply to a function module respectively; the MCU determines the power supply that reaches the effective working voltage of the system fastest among the first power supply, the second power supply, and the third power supply, and automatically allocates the first address of the CAN bus address to the function module corresponding to this power supply.
[0060] In step S30, the specific content that the MCU automatically allocates the remaining addresses of the CAN bus address based on the time generated by each oscillation frequency of the oscillation circuit is as follows:
[0061] The MCU corresponds each oscillation frequency generated by the oscillation circuit to a function module, and automatically allocates the remaining addresses of the CAN bus address to the corresponding function module based on the sequence of the time generated by each oscillation frequency, that is, automatically allocates the CAN bus addresses in ascending order.
[0062] The specific content of step S40 is as follows:
[0063] The MCU corresponds each temperature value collected by the temperature acquisition circuit to a function module, and based on the chronological order of the generation of each temperature value, automatically assigns the remaining addresses of the CAN bus address to the corresponding function module, that is, automatically assigns the CAN bus addresses in ascending order.
[0064] In summary, the advantages of the present invention are as follows:
[0065] By setting up a power-on delay circuit, an oscillation circuit, and a temperature acquisition circuit, the first power supply, the second power supply, and the third power supply in the power-on delay circuit are used to compete for the first address of the CAN bus address due to the time difference in reaching the effective working voltage of the system. Through the discreteness of the oscillation frequency generated by the oscillation circuit and the discreteness of the ambient temperature value collected by the temperature acquisition circuit, the remaining CAN bus addresses are competed for; that is, the remaining CAN bus addresses are competed for in ascending order according to the chronological order of the generation of each oscillation frequency. If the competition is not completed after exceeding the preset duration threshold, then the remaining CAN bus addresses are competed for in ascending order according to the chronological order of the generation of each temperature value until all the CAN bus addresses are allocated; finally, the automatic allocation of the CAN bus address is realized, so that the function modules of the charge and discharge detection device can be plugged and used, thereby greatly improving the production efficiency of the charge and discharge detection device and facilitating the operation and maintenance of the charge and discharge detection device.
[0066] Although the specific implementation manners of the present invention have been described above, those skilled in the art of this technology should understand that the specific embodiments we described are illustrative rather than used to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered by the scope protected by the claims of the present invention.
Claims
1. A CAN bus address automatic allocation device, characterized in that: It includes an MCU, a power-on delay circuit, an oscillation circuit, a temperature acquisition circuit, a switch K1, and a switch K2; The MCU is respectively connected to the power-on delay circuit, the oscillation circuit, and the temperature acquisition circuit; One end of the switch K1 is connected to the power-on delay circuit, and the other end is connected to the live wire; One end of the switch K2 is connected to the power-on delay circuit, and the other end is connected to the neutral wire; The power-on delay circuit includes a first power supply, a second power supply, a third power supply, a first DSP chip, a capacitor C1, a capacitor C2, a capacitor C3, and a capacitor C4; One end of the capacitor C1 is connected to the switch K1 and the pin 1 of the first power supply, and the other end is connected to the switch K2 and the pin 2 of the first power supply; One end of the capacitor C2 is connected to the pin 4 of the first power supply and the pin 1 of the second power supply, and the other end is connected to the pin 3 of the first power supply and the pin 2 of the second power supply; One end of the capacitor C3 is connected to the pin 4 of the second power supply and the pin 1 of the third power supply, and the other end is connected to the pin 3 of the second power supply and the pin 2 of the third power supply; One end of the capacitor C4 is connected to the pin 4 of the third power supply and the pin 1 of the first DSP chip, and the other end is connected to the pin 3 of the third power supply and the pin 2 of the first DSP chip; The pins 3 and 4 of the first DSP chip are connected to the MCU; The temperature acquisition circuit includes a third DSP chip, a resistor R4, and a thermistor RT; The pin 1 of the third DSP chip is connected to one end of the resistor R4 and the thermistor RT, and the pins 2 and 3 are connected to the MCU; The other end of the resistor R4 is grounded.
2. The CAN bus address automatic allocation device according to claim 1, characterized in that: The first power supply is a low-power high-frequency 220VAC / 12VDC power supply, the second power supply is a 12V / 15V high-frequency isolated DC / DC power supply, and the third power supply is an LDO linear power supply.
3. The CAN bus address automatic allocation device according to claim 1, characterized in that: The oscillation circuit includes an oscillation chip U1, a second DSP chip, a resistor R1, a resistor R2, a resistor R3, and a capacitor C5; The pin 1 of the oscillation chip U1 is connected to the resistor R3 and the capacitor C5, the pin 2 is connected to the resistor R1 and the resistor R2, and the pin 3 is connected to the resistor R3 and the pin 1 of the second DSP chip; The resistor R2 is connected to the capacitor C5 and grounded; The pins 2 and 3 of the second DSP chip are connected to the MCU.
4. The CAN bus address automatic allocation device according to claim 1, characterized in that: Both the switch K1 and the switch K2 are connected to the MCU.
5. A method for automatically allocating CAN bus addresses, characterized in that: The method needs to use the automatic allocation device as described in any one of claims 1 to 4, and includes the following steps: Step S10, the MCU presets a duration threshold, and turns on the switch K1 and the switch K2 to supply power to the power-on delay circuit; Step S20, the MCU automatically allocates the starting address of the CAN bus address based on the time when the first power supply, the second power supply, and the third power supply reach the system effective working voltage; Step S30, the MCU automatically allocates the remaining addresses of the CAN bus address based on the time generated by the oscillation frequencies of the oscillation circuit, and determines whether all the CAN bus addresses have been allocated when the duration threshold arrives. If so, the process ends; If not, it enters step S40; Step S40: The MCU automatically assigns the remaining addresses of the CAN bus addresses based on the time of each temperature value collected by the temperature acquisition circuit.
6. The CAN bus address automatic allocation method according to claim 5, characterized in that: The specific content of step S20 is as follows: The MCU corresponds the first power supply, the second power supply, and the third power supply to a function module respectively; the MCU determines the power supply that reaches the effective working voltage of the system fastest among the first power supply, the second power supply, and the third power supply, and automatically assigns the first address of the CAN bus address to the function module corresponding to this power supply.
7. The CAN bus address automatic allocation method according to claim 5, characterized in that: In step S30, the specific content that the MCU automatically assigns the remaining addresses of the CAN bus addresses based on the time generated by each oscillation frequency of the oscillation circuit is as follows: The MCU corresponds each oscillation frequency generated by the oscillation circuit to a function module, and automatically assigns the remaining addresses of the CAN bus addresses to the corresponding function modules based on the sequence of the time generated by each oscillation frequency.
8. The CAN bus address automatic allocation method according to claim 5, characterized in that: The specific content of step S40 is as follows: The MCU corresponds each temperature value collected by the temperature acquisition circuit to a function module, and automatically assigns the remaining addresses of the CAN bus addresses to the corresponding function modules based on the sequence of the time generated by each temperature value.
Citation Information
Patent Citations
CAN bus address automatic distribution device
CN216361921U