System and method for automated id allocation for can bus devices

CN120111027APending Publication Date: 2025-06-06NXP USA INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311663808.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-06-06

Smart Images

  • Figure CN120111027A_ABST
    Figure CN120111027A_ABST
Patent Text Reader

Abstract

The invention describes a method of assigning a respective CAN ID to each of a plurality of devices, where each of the plurality of devices is coupled to a CAN bus and comprises at least one input and at least one output, a plurality of devices are connected in a chain via at least one input and at least one output to a controller of a CAN bus having at least one output, the method comprising: resetting a CAN ID of each of the plurality of devices to a same initial value; setting at least one input of a first device of the plurality of devices to a first value using at least one output of the controller; setting a CAN ID of the first device using the first value; setting at least one input of a second device of the plurality of devices to a second value using at least one output of the first device, wherein the second device is connected to the first device; and setting the CAN ID of the second device using the second value. The invention also proposes a system for assigning a respective CAN ID to each of a plurality of devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a system and method for automatically assigning IDs to CAN bus devices. Background Art

[0002] More and more battery management systems in electric vehicles or industrial energy storage systems use the Controller Area Network (CAN) protocol to build their communication infrastructure. In systems with a CAN bus, assigning IDs to CAN nodes significantly affects production and assembly efficiency as well as application and maintenance flexibility.

[0003] CAN ID can be manually configured by DIP switches. However, if there are a large number (greater than 8) of CAN nodes, manually switching the DIP switches becomes inappropriate. Configuring CAN IDs one by one will result in a high error rate and is inefficient.

[0004] In the automatic allocation solution, a fixed CAN ID is programmed into the device during the production stage. In production and system assembly, a unique CAN ID should be downloaded to each device, and the device should be installed in a specific location according to its unique CAN ID. As a result, production cannot be standardized. The CAN ID is unchangeable. At the same time, system maintenance is complicated due to the fixed CAN ID.

[0005] Automatic CAN ID allocation has been implemented, including arbitrating addresses based on the speed at which previous nodes sent messages, or allocating and arbitrating addresses based on a random generator, etc. However, such automatic CAN ID allocation takes a long time (usually greater than 1 second); conversely, some systems such as battery management systems may need to be initialized in less than 500ms.

[0006] Automatic CAN ID assignment for multiple devices can be implemented by introducing a slave microcontroller chip in each device subsystem, which waits until the device CAN ID is assigned. Each slave microcontroller is configured to communicate with the master microcontroller via a CAN bus, which adds complexity and cost.

[0007] Therefore, a technology is needed to provide a system with good real-time performance for automatically allocating CAN IDs to a large number of CAN nodes, while removing the microcontroller chip in the device subsystem to improve system integration and save costs. Summary of the invention

[0008] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

[0009] According to a first aspect of the present invention, there is provided a method of assigning a corresponding controller area network (CAN) ID to each of a plurality of devices, each of the plurality of devices being coupled to a CAN bus and comprising at least one input and at least one output, the plurality of devices being connected in a chain via the at least one input and the at least one output to a controller of the CAN bus having at least one output, the method comprising:

[0010] resetting the CAN ID of each of the plurality of devices to the same initial value;

[0011] using the at least one output of the controller to set the at least one input of a first device of the plurality of devices to a first value;

[0012] setting the CAN ID of the first device using the first value;

[0013] setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device, wherein the second device is connected to the first device; and

[0014] The CAN ID of the second device is set using the second value.

[0015] In one or more embodiments, the at least one input of the each of the plurality of devices is configured as a CAN ID port.

[0016] In one or more embodiments, the first device is closest to the controller in the chain.

[0017] In one or more embodiments, the second value is different from the first value.

[0018] In one or more embodiments, setting the CAN ID of the first device and setting the CAN ID of the second device each further include the controller instructing any device having a CAN ID that is the same initial value to reset.

[0019] In one or more embodiments, the at least one input of each of the plurality of devices is a corresponding M-multiple ID port configured to receive an M-bit value corresponding to a binary value at each ID port, the at least one output of each of the plurality of devices is a corresponding M-multiple GPIO port configured to output an M-bit value corresponding to a binary value at each GPIO port, and

[0020] Wherein setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device comprises instructing the first device to output a value greater than a value of the CAN ID of the first device at the M plurality of GPIO terminals.

[0021] In one or more embodiments, the method further includes setting the CANID of the (N+1)th device along the chain including the controller instructing the Nth device along the chain to output a value greater than a value of the CAN ID of the Nth device at the M plurality of GPIO terminals of the Nth device.

[0022] In one or more embodiments, the at least one input is a first input and the at least one output is a first output, and wherein each of the plurality of devices comprises a plurality of additional outputs and a plurality of additional inputs, and each of the plurality of additional outputs is electrically connected to a corresponding one of the plurality of additional inputs.

[0023] In one or more embodiments, setting the CAN ID of the first device further comprises:

[0024] After setting the at least one input of a first device of the plurality of devices to a first value using the at least one output of the controller, the controller instructs any device having a CAN ID that is the same initial value to reset,

[0025] the controller instructs any device having a first input being the first value to output a third value at its plurality of further outputs, thereby applying the third value to its plurality of further inputs, and

[0026] the controller instructs any device having a first input of the first value to reset; and

[0027] Setting the CAN ID of the second device includes:

[0028] the controller instructing any device having a CAN ID of the same initial value to reset after setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device,

[0029] the controller instructs any device having a first input that is the second value to output a fourth value at its plurality of further outputs, thereby applying the fourth value to its plurality of further inputs, and

[0030] The controller instructs any device having a first input that is the second value to reset.

[0031] In one or more embodiments, the second value is equal to the first value, and wherein the fourth value is different from the third value.

[0032] In one or more embodiments, each of the plurality of further outputs is connected to a respective one of the plurality of further inputs by means of a latch.

[0033] According to a second aspect of the present invention, there is provided a system for assigning a corresponding controller area network (CAN) ID to each of a plurality of devices, the system comprising:

[0034] each of the plurality of devices coupled to a CAN bus; and

[0035] a controller of the CAN bus having at least one output, wherein each of the plurality of devices comprises at least one input and at least one output, the plurality of devices being connected to the controller in a chain via the at least one input and the at least one output;

[0036] wherein after the system is powered on, the CAN ID of each of the plurality of devices is reset to the same initial value;

[0037] wherein the at least one output of the controller is used to set the at least one input of a first device of the plurality of devices to a first value, and the first value is used to set the CAN ID of the first device;

[0038] The at least one output of the first device is used to set the at least one input of a second device of the plurality of devices to a second value, and the second value is used to set the CAN ID of the second device, wherein the second device is connected to the first device.

[0039] In one or more embodiments, the at least one input of the each of the plurality of devices is configured as a CAN ID port.

[0040] In one or more embodiments, the first device is closest to the controller in the chain.

[0041] In one or more embodiments, setting the CAN ID of the first device and setting the CAN ID of the second device each further include the controller instructing any device having a CAN ID that is the same initial value to reset.

[0042] In one or more embodiments, the at least one input of each of the plurality of devices is a corresponding M-multiple ID port configured to receive an M-bit value corresponding to a binary value at each ID port, the at least one output of each of the plurality of devices is a corresponding M-multiple GPIO port configured to output an M-bit value corresponding to a binary value at each GPIO port, and

[0043] Wherein setting the at least one input of a second device among the plurality of devices to a second value comprises instructing, by the controller, the first device to output a value greater than a value of the CAN ID of the first device at the M plurality of GPIO terminals.

[0044] In one or more embodiments, the CAN ID of the (N+1)th device along the chain is set by the controller instructing the Nth device along the chain to output a value one greater than the value of the CAN ID of the Nth device at the M GPIO terminals of the Nth device.

[0045] In one or more embodiments, the at least one input is a first input and the at least one output is a first output, and wherein each of the plurality of devices comprises a plurality of additional outputs and a plurality of additional inputs, and each of the plurality of additional outputs is electrically connected to a corresponding one of the plurality of additional inputs.

[0046] In one or more embodiments, setting the CAN ID of the first device further comprises:

[0047] After setting the at least one input of a first device of the plurality of devices to a first value using the at least one output of the controller, the controller instructs any device having a CAN ID that is the same initial value to reset,

[0048] the controller instructs any device having a first input being the first value to output a third value at its plurality of further outputs, thereby applying the third value to its plurality of further inputs, and

[0049] the controller instructs any device having a first input of the first value to reset; and

[0050] Setting the CAN ID of the second device includes:

[0051] the controller instructing any device having a CAN ID of the same initial value to reset after setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device,

[0052] the controller instructs any device having a first input that is the second value to output a fourth value at its plurality of further outputs, thereby applying the fourth value to its plurality of further inputs, and

[0053] The controller instructs any device having a first input that is the second value to reset.

[0054] In one or more embodiments, the second value is equal to the first value, and wherein the fourth value is different from the third value.

[0055] Although the present disclosure allows various modifications and alternative forms, its characteristics have been shown in the accompanying drawings by way of example, and its characteristics will be described in detail. However, it should be understood that other embodiments beyond the specific embodiments described are also possible. All modifications, equivalents and alternative embodiments that fall within the spirit and scope of the appended claims are also encompassed.

[0056] The above discussion is not intended to represent every example embodiment or every implementation within the scope of the current or future claim sets. The figures and the following detailed description also illustrate various example embodiments. The various example embodiments can be more fully understood by considering the following detailed description in conjunction with the drawings.

[0057] These and other aspects of the invention will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order that the manner in which the above-mentioned features of the present disclosure may be understood in detail, a more detailed description of the present disclosure may be obtained with reference to the embodiments, some of which are shown in the accompanying drawings. The accompanying drawings illustrate only typical embodiments of the present disclosure and should not limit the scope of the present disclosure, as the present disclosure may have other equally effective embodiments. The accompanying drawings are used to facilitate understanding of the present disclosure and are therefore not necessarily drawn to scale. For those skilled in the art, the advantages of the claimed subject matter will become apparent after reading this specification in conjunction with the accompanying drawings, in which the same reference numerals have been used to indicate the same elements, and in the accompanying drawings:

[0059] Figure 1 is a simplified block diagram depicting the concepts of a proposed system for automatic ID allocation according to the present disclosure;

[0060] Figure 2 is a simplified flow chart describing a method for automatic ID assignment for CAN bus devices according to the present disclosure;

[0061] Figure 3 is a block diagram depicting a first embodiment of a proposed system for automatic ID allocation according to the present disclosure;

[0062] Figure 4 is a flowchart describing a method for automatic ID allocation for CAN bus devices according to a first embodiment of the present disclosure;

[0063] Figure 5 is a block diagram depicting a second embodiment of a proposed system for automatic ID allocation according to the present disclosure;

[0064] Figure 6 is a flowchart describing a method for automatic ID allocation of CAN bus devices according to a second embodiment of the present disclosure. DETAILED DESCRIPTION

[0065] Figure 1 is a simplified block diagram depicting the concept of the proposed system for automatic ID allocation according to the present disclosure. Figure 1 As shown in , the system of the solution includes multiple devices (e.g., 101, 102, and 103) waiting to be assigned a corresponding unique CAN ID. The system includes a controller 100, and each device is coupled to the controller 100 via a CAN bus. The controller 100 is configured to communicate back and forth with each device using the CAN protocol. The controller 100 can be implemented by means of a microcontroller unit (MCU), a microprocessor unit (MPU), or other controller units known to those skilled in the art. It will be appreciated by those skilled in the art that the controller can communicate with each device via a CAN transceiver connected between the CAN bus and each corresponding device using the CAN protocol, or the CAN transceiver can be embedded in the device so that the controller can communicate directly with each device via the CAN bus using the CAN protocol. The controller 100 further includes one or more general purpose input / output (GPIO) terminals to configure one or more ID ports of a first device 101 in a plurality of devices. The first device 101 further includes one or more GPIO terminals, which are connected to one or more ID ports of a second device 102 in a plurality of devices. One or more GPIO terminals of the first device 101 are configured as outputs and are used to configure one or more ID ports of the second device 102. One or more GPIO terminals of the second device 102 are configured as outputs and are used to configure one or more ID ports of the third device 103. It is contemplated that any other input / output terminals other than the GPIO terminals are also preferred in embodiments. Furthermore, the controller and the terminals of the plurality of devices may only require one of the input and output functions.

[0066] Figure 2 is a simplified flow chart describing a method for automatic ID assignment for CAN bus devices according to the present disclosure. Figure 1 The method is described in detail in the system.

[0067] At step 201, when the system is powered on, the controller 100 sends a CAN signal to all devices 101, 102, and 103 on the CAN bus to reset the devices. The CAN ID, i.e., one or more ID ports of all devices is set to the same initial value. A counter with a count of N=1 is set. At step 202, one or more GPIO terminals of the controller 100 output a signal to the first device 101 to set the one or more ID ports of the first device so as to assign the CAN ID of the first device. At step 203, one or more GPIO terminals of the Nth device (which is the first device 101 when the current count N=1) output a signal to the (N+1)th device (which is the second device 102 when the current count N=1) to set the one or more ID ports of the (N+1)th device so as to assign the CAN ID of the (N+1)th device. The count N is then incremented, and the method proceeds to step 204. At step 204, it is determined whether the count N has reached a threshold. The threshold, if known, may be, for example, the number of devices on the bus. Alternatively, the threshold value may be a maximum value for the word length of the CAN ID (e.g., if the CAN-ID is a four-bit word, the threshold value will be 15; if the CAN ID is a three-bit word, the threshold value will be 7, etc.). If the count N is less than the threshold value, the method loops back to step 203, where the CAN ID of the (N+1)th device will be configured from the GPIO terminal of the Nth device. If the count N reaches the threshold value, the method ends. A preferred embodiment of the proposed solution for automatic ID allocation according to the present disclosure will be described in detail below.

[0068] Figure 3 is a block diagram depicting a first embodiment of a proposed system for automatic ID allocation according to the present disclosure. Figure 3 As shown in , the system for automatic ID allocation solution includes a plurality of subsystems 301 and 302. The system includes a controller 300, and each subsystem is connected to the controller 300 via a CAN bus.

[0069] The controller 300 provides 12V power to the low voltage area of ​​the subsystem. The controller 300 is configured to communicate with each subsystem using the CAN protocol. The controller 300 can be implemented with the aid of a microcontroller unit (MCU), a microprocessor unit (MPU), or other controller units known to those skilled in the art. Figure 3 In the embodiment shown in , the controller 300 further includes 4 GPIO terminals configured as outputs of the controller.

[0070] Each subsystem includes a device (e.g., 310, 320), a transceiver (e.g., 312, 322), and one or more analog front ends (AFEs) (e.g., 311, 321). Device 310 or 320 is usually implemented as a gateway or a transceiver and needs to be assigned a corresponding unique ID when the system starts.

[0071] AFEs 311 and 321 may include a battery monitoring module having a monitoring chip for sensing the voltage and temperature of a battery cell, for example, in an electric vehicle or an industrial-grade energy storage system. AFEs 311, 321 are configured to communicate with devices 310, 320 via a daisy chain. Figure 3 As shown in FIG. 1 , AFEs 311, 321 are connected in a loop-back daisy chain arrangement. As will be familiar to those skilled in the art, other possible connection relationships between AFEs and devices (eg, single daisy chain, etc.) may also be applicable and are intended to be included in the present disclosure.

[0072] The gateway device 310 includes four daisy chain communication ports to connect with the AFE 311. Figure 3 In the embodiment shown in , the gateway device 310 further includes 4 general purpose input / output (GPIO) terminals and 4 ID ports. The 4 GPIO terminals of the controller 300 are configured to output signals to the ID ports ID0 to ID3 of the gateway device 310. The 4 ID ports ID0 to ID3 are configured to receive 4-bit signals, wherein each ID port carries one bit when used in CAN ID allocation. Therefore, the CAN ID length of the gateway device 310 is 4 bits. The assigned CAN ID can be stored in a register of the gateway device by retrieving data from the ID port. Those skilled in the art will appreciate that in conventional CAN devices, such ID ports may be connected to a "DIP" switch, which may be manually set so that a CAN ID is assigned to the device when the device is installed in the system. However, in an embodiment of the present disclosure, the ID port is connected in a different manner: specifically, according to Figure 3 In the embodiment shown in FIG. 3 , the four GPIO terminals GPIO0 to GPIO3 of the gateway device 310 are configured as outputs and are used to configure the ID ports ID0 to ID3 of the gateway device 320 of the next subsystem 302. The permanent and constant 5V signal from the GPIO terminal to the corresponding ID port represents the logic change from "0" to "1" at the corresponding ID port. In other words, the four GPIO terminals are configured as 4-bit parallel output ports, and the four ID ports are configured as 4-bit parallel input ports, as will be referred to in FIG. Figure 4 It is contemplated that in some embodiments the GPIO terminals and ID port may be used for additional purposes other than the described CAN ID allocation purpose.

[0073] The gateway device 310 communicates with the controller 300 via the CAN bus by means of a transceiver 312. As shown, a 5 MHz external crystal oscillator can be provided for the gateway device 310 to support its communication through the CAN bus. The transceiver 312 is a CAN signal transceiver that is configured to output CAN_HIGH (CANH) and CAN_LOW (CANL) signals. The differential voltage on this pair of CANH and CANL signals represents the logic signal from the controller to the gateway device. It is contemplated that the transceiver 312 can be a separate chip or embedded in the gateway device 310.

[0074] It should be understood that Figure 3 The system may include more subsystems, depending on the allowable number defined by the length of the CAN ID assigned from the controller 300.

[0075] Figure 4 is a flowchart describing a method for automatic ID allocation for CAN bus devices according to a first embodiment of the present disclosure. Figure 3 The method is described in detail in the system.

[0076] All systems are started at the beginning, including all subsystems, controller 300 and other modules are powered on. At step 401, all subsystems 301 and 302 are reset. CAN ID, that is, port ID0 to ID3 of all gateway devices are set to "0000". In the first embodiment, when the system is powered on, the controller 300 sends a CAN signal to all subsystems on the CAN bus to reset these subsystems.

[0077] At step 402, the GPIO terminal of the controller 300 outputs a signal to the first subsystem 301. The controller GPIO terminal outputs signals ID0_IN to ID3_IN to the first subsystem 301 to respectively configure the port ID0 of the first gateway device 310 to "1", the port ID1 of the first gateway device to "0", the port ID2 of the first gateway device to "0", and the port ID3 of the first gateway device to "0". Therefore, the CAN ID of the first gateway device is ready to be set from "0000" to "0001".

[0078] like Figure 3As shown in , one possible implementation is to use 4 wires to directly connect the controller GPIO terminal and ports ID0 to ID3 of the first gateway device 310. In this way, changing the signal level on the pin of the ID port via the wire causes the value of the ID port to change. As described, the permanent and constant 5V signal from the controller GPIO terminal to the corresponding ID port represents a logical change from "0" to "1". It is envisioned that other possible GPIO signaling methods may be used. It should be understood that setting the value at the ID port does not itself establish the CAN ID of the device: in fact, this usually only occurs when the value is read and stored, which usually occurs when the device is reset.

[0079] At step 403, the controller 300 sends a CAN signal to those subsystems having the gateway device CAN ID "0000" to reset these subsystems. As already mentioned, for a typical gateway device, a reset action is required to update the CAN ID of the gateway device according to the value at the ID port. A delay time (which may be at least 800μs for some embodiments) is introduced to meet the minimum requirements for resetting a typical gateway device. If the gateway device loses power, the gateway device will lose its configured ID and reset its ID to "0000" (or whatever value may be on its ID port next). At step 403, it may include additional waiting times or delays until the configuration of the CAN ID of the first gateway device to "0001" is ready and completed.

[0080] At step 404, the CAN ID of the first gateway device 310 is read to check whether the ID configured in step 403 is correct. That is, the current CAN ID of the first gateway device 310 (which should now be "0001") is checked using the device ID of any other gateway device of each subsystem. As a preferred embodiment, the controller requests all gateway devices to return their IDs and checks whether the current CAN ID of the first gateway device is the same as any previously configured ID. It is contemplated that other duplicate ID checking methods may also be applicable to the described solution. If the ID "0001" is already in use, i.e., the same as any other device ID, due to reasons such as some subsystems failing to reset at the beginning, the method will loop back to step 401, where the CAN IDs of all gateway devices will be reset to "0000" and the system will restart the automatic ID allocation process.

[0081] If the current CAN ID "0001" of the first gateway device 310 is correct by step 404, the method continues with a loop procedure to assign CAN IDs to other gateway devices. The count will start at N=1 because the ID of the first gateway device 310 has been assigned.

[0082] At step 405 , the controller sends a CAN signal to those subsystems having the gateway device CAN ID “0000” to reset these subsystems.

[0083] At step 406, the controller sends a CAN signal to the first gateway device 310, the CANID of the first gateway device 310 has been assigned as "0001", thereby instructing the first gateway device 310 to output signals ID0_OUT to ID3_OUT from its GPIO0 to GPIO3 to the second subsystem 302, respectively, so as to correspondingly configure the ports ID0 to ID3 of the second gateway device 320 from "0000" to "0010". Figure 3 As shown in FIG, in an exemplary implementation, this is accomplished using four wires directly connecting the GPIO terminals of the first gateway device 310 and the ID port of the second gateway device 320. It is contemplated that other possible GPIO signaling methods may be applicable.

[0084] At step 407, the controller sends a CAN signal to those subsystems with the gateway device CAN ID "0000" to reset these subsystems. A delay is introduced (typically a minimum of 800 μs). For step 407, the second subsystem waits until the configuration of the CAN ID of the second gateway device 320 to "0010" is completed.

[0085] At step 408, the CAN ID of the second (or more generally, "(N+1)th") gateway device is retrieved (or read) to check whether the CAN ID configured in step 407 is correct. That is, for the first time in the loop, the current CAN ID of the second gateway device 320 (which should now be "0010") is checked against the device ID of any other gateway device of each subsystem. As a preferred embodiment, the controller requests all gateway devices to return their IDs and checks whether the current CAN ID of the second gateway device is the same as any previously configured ID. It is contemplated that other duplicate ID checking methods may also be applicable to the described solution. If the ID "0010" is already in use, i.e., is the same as any other device ID, due to reasons such as some subsystems failing to reset at the beginning, then the method will loop back to step 405, where the controller sends a CAN signal to all subsystems, all of which have their gateway device CAN IDs currently "0000", to reset these subsystems. Next, the CAN ID of the second gateway device 320 will be configured again from step 406 as described above.

[0086] At step 408, if the ID "0010" of the second gateway device 320 is determined to be correct (or the corresponding ID "N+1" of the Nth device, considering the later round trip), then the count N is incremented and the method proceeds to step 409. At step 409, it is determined whether the count N has reached a threshold, which may be preconfigured to 15, such as Figure 4 As shown in . If the count N is less than the threshold, the method loops back to step 405, where the controller 300 sends a CAN signal to those subsystems having the gateway device CAN ID "0000" to reset these subsystems. The CAN ID of the (N+1)th gateway device will be configured from the GPIO terminal of the Nth gateway device. If the count N reaches the threshold, the method ends, which means that, in the case of a threshold of 15, the ID "1111" has been assigned to the last gateway device of the last subsystem, and the corresponding CAN IDs from "0001" to "1111" have been assigned to the gateway devices of all 15 subsystems.

[0087] It should be noted that in the first embodiment, although the first gateway device operates as a passive device and requires a CAN signal instruction from the controller to output a signal from its GPIO terminal to the second gateway device, it is envisioned that introducing the first gateway device into the subsystem as a more active and intelligent device will allow the first gateway device to automatically assign an ID to the next gateway device by receiving instructions from the controller only once in the entire solution.

[0088] It should also be noted that the number of introduced GPIO terminals and ID ports, the number of gateway devices (subsystems) to be assigned IDs, and the combination of ID values ​​can each be selected by the user or determined by the system designer.

[0089] exist Figure 3 In the embodiment shown in , 4 ID ports are introduced for each gateway device in the solution, which means that the CAN ID length of the gateway device is 4 bits, and the maximum allowable number of gateway devices (subsystems) should be 15, because "0000" should remain as the initial ID value of all gateway devices. However, different numbers of GPIO terminals and ID ports will produce different numbers of bits of CAN ID length. This means that the number of subsystems greater than 15 may also be applicable. For example, in Figure 3 The 5 GPIO terminals and 5 ID ports in the gateway device in the first embodiment will allow a maximum number of 31 subsystems in the system to be automatically assigned IDs.

[0090] And, although 15 is preconfigured as the threshold value of the count N for the solution in the first embodiment, when 4 GPIO terminals and 4 ID ports are introduced into the solution, any number less than 15 may be applicable to the solution.

[0091] Although IDs from "0001" to "1111" are preconfigured as CAN IDs of the gateway device for the solution in the first embodiment, any ID number group that matches the threshold value of the count N may be applicable to the solution. For example, if there are 7 subsystems for ID allocation, (0001, 0011, 0100, 0101, 0110, 0111, 1111) is a possible ID combination. If there are 11 subsystems for ID allocation, (0001, 0010, 0011, 0100, 0101, 0110, 0111, 1001, 1010, 1100, 1110) is a possible ID combination.

[0092] Figure 5 is a block diagram depicting a second embodiment of a proposed system for automatic ID allocation according to the present disclosure. Figure 5 As shown in , the system for automatic ID allocation solution includes a plurality of subsystems 501 and 502. The system includes a controller 500, and each subsystem is connected to the controller 500 via a CAN bus.

[0093] The controller 500 provides 12V power to the low voltage area of ​​the subsystem. The controller 500 is configured to communicate with each subsystem using the CAN protocol. The controller 500 can be implemented with the aid of a microcontroller unit (MCU), a microprocessor unit (MPU), or other controller units known to those skilled in the art. Figure 5 In the embodiment shown in , the controller 500 further includes 1 GPIO terminal configured as an output of the controller.

[0094] Each subsystem includes a device (e.g., 510, 520), a transceiver (e.g., 512, 522), a latch (e.g., 513, 523), and one or more analog front ends (AFEs) (e.g., 511, 521). The device is usually implemented as a gateway or a transceiver and needs to be assigned a corresponding unique ID when the system is started.

[0095] AFEs 511 and 521 may include a battery monitoring module having a monitoring chip for sensing the voltage and temperature of a battery cell, for example, in an electric vehicle or an industrial-grade energy storage system. AFEs 511, 521 are configured to communicate with devices 510, 520 via a daisy chain. Figure 5 As shown in FIG. 5 , AFEs 511, 521 are connected in a loop-back daisy chain arrangement. As will be familiar to those skilled in the art, other possible connection relationships between AFEs and devices (eg, single daisy chain, etc.) may also be applicable and are intended to be included in the present disclosure.

[0096] The gateway device 510 includes four daisy chain communication ports to connect with the AFE 511. Figure 5 In the embodiment shown in , the gateway device 510 further includes 4 general purpose input / output (GPIO) terminals and 4 ID ports. One GPIO terminal of the controller 500 is configured to output a signal to the ID port ID0 of the gateway device 510. The 4 ID ports ID0 to ID3 are configured to receive 4-bit signals, wherein each ID port carries one bit when used in CAN ID allocation. Therefore, the CANID length of the gateway device 510 is 4 bits. The assigned CAN ID can be stored in a register of the gateway device by retrieving data from the ID port. Those skilled in the art will appreciate that in conventional CAN devices, such ID ports may be connected to a "DIP" switch, which may be manually set so that a CAN ID is assigned to the device when the device is installed in the system. However, in an embodiment of the present disclosure, the ID port is connected in a different manner: specifically, according to Figure 5 In the embodiment shown in FIG. 5 , three GPIO terminals GPIO0 to GPIO2 of the gateway device 510 are configured as outputs and used to configure the ID ports ID1 to ID3 of the gateway device 510 itself through the latch 513, and one GPIO terminal of the gateway device 510 is configured as an output and used to configure the ID port ID0 of the gateway device 520 of the next subsystem 502. The 5V signal from the GPIO terminal to the corresponding ID port represents the logic change from "0" to "1" at the corresponding ID port, as will be referred to in FIG. Figure 6 Detailed description. In this embodiment, the 5V signal need not be permanent and constant, as the latch can be configured to "hold" the supplied signal - for example when the gateway device is reset at the command of the controller. It is contemplated that in some embodiments, the GPIO terminals and ID port can be used for additional purposes other than the described CAN ID allocation purpose.

[0097] The gateway device 510 communicates with the controller 500 via the CAN bus by means of a transceiver 512. As shown, a 5 MHz external crystal oscillator can be provided for the gateway device 510 to support its communication through the CAN bus. The transceiver 512 is a CAN signal transceiver that is configured to output CAN_HIGH (CANH) and CAN_LOW (CANL) signals. The differential voltage on this pair of CANH and CANL signals represents the logic signal from the controller to the gateway device. It is contemplated that the transceiver 512 can be a separate chip or embedded in the gateway device 510.

[0098] It should be understood that Figure 5 The system may include more subsystems, depending on the allowable number defined by the length of the CAN ID assigned from the controller 500.

[0099] Figure 6 is a flowchart describing a method for automatic ID allocation for CAN bus devices according to a second embodiment of the present disclosure. Figure 5 This embodiment is similar to the above reference Figure 4 The described embodiment. However, a significant difference is that, in this embodiment, the controller 500 does not need to have multiple GPIO terminals connected to devices or subsystems on the CAN bus. Instead, according to this embodiment, the controller outputs a single bit to the first subsystem 501 on a single GPIO terminal, thereby commanding the first gateway device 510 to set its ID to a transitional ID. Therefore, the first gateway device 510 only uses a single ID port to receive commands. Similarly, the first gateway device 510 is connected to a single ID port of the second gateway device 520 using only a single GPIO terminal. Another difference from the first embodiment is that, in this embodiment, the "intermediate" CAN ID (which is the same "0001" in each case) is sequentially assigned to each device, and then the final CAN ID is assigned to the device.

[0100] All systems are started at the beginning, including all subsystems, the controller 500 and other modules are powered on. At step 601, all subsystems 501 and 502 are reset. CAN ID, that is, port ID0 to ID3 of all gateway devices are set to "0000". In the second embodiment, when the system is powered on, the controller 500 sends a CAN signal to all subsystems on the CAN bus to reset these subsystems.

[0101] At step 602, the (single) GPIO terminal of the controller 500 outputs a signal to the first subsystem 501. The controller GPIO terminal outputs a signal ID0_IN to the first subsystem 501 to configure the port ID0 of the first gateway device 510 from "0" to "1", so the ID of the first gateway device is ready to be set from "0000" to "0001".

[0102] like Figure 5 As shown in , one possible implementation is to use 1 wire to directly connect between the controller GPIO terminal of the first gateway device 510 and the ID port ID0. In this way, changing the signal level on the pin of the ID port via the wire will cause the value of the ID port to change. As described, the 5V signal from the controller GPIO terminal to the corresponding ID port represents a logic change from "0" to "1". It is contemplated that other possible GPIO signaling methods can be used.

[0103] At step 603, the controller 500 sends a CAN signal to those subsystems having the gateway device CAN ID "0000" to reset these subsystems. As already mentioned, for a typical gateway device, a reset action is required to update the CAN ID of the gateway device according to the value at the ID port. A delay time (which may be at least 800μs for some embodiments) is introduced to meet the minimum requirements for resetting a typical gateway device. If the gateway device loses power, the gateway device will lose its configured ID and reset its ID to "0000" (or whatever value may be on its ID port next). At step 603, it may include additional waiting times or delays until the configuration of the CAN ID of the first gateway device to "0001" is ready and completed.

[0104] At step 604, the controller sends a CAN signal to the subsystem having the gateway device CAN ID "0001", thereby instructing the gateway device to output a signal from its GPIO0 to GPIO2 to configure the ports ID3 to ID1 of the gateway device from "000" to "001", respectively. Figure 5 As shown in , the controller 500 sends a CAN signal to the first subsystem 501 to instruct the GPIO2 of the first gateway device 510 to configure the port ID1 of the first gateway device to "1", to instruct the GPIO1 of the first gateway device to configure the port ID2 of the first gateway device to "0", and to instruct the GPIO0 of the first gateway device to configure the port ID3 of the first gateway device to "0". Therefore, the CAN ID of the first gateway device is ready to be set from "0001" to "0011".

[0105] At step 605, the controller sends a CAN signal to those subsystems having the gateway device CAN ID "0001" to reset these subsystems. At step 605, it waits until the CAN ID of the first gateway device is configured to "0011" and is ready and completed. With the help of latch 513, after resetting the first subsystem 501, the ports ID1 to ID3 of the first gateway device 510 can maintain their values ​​as "1", "0" and "0", respectively.

[0106] At step 606, the CAN ID of the first gateway device 510 is read to check whether the ID configured in step 605 is correct. That is, the current CAN ID of the first gateway device 510 (which should now be "0011") is checked using the device ID of any other gateway device of each subsystem. As a preferred embodiment, the controller requests all gateway devices to return their IDs and checks whether the current CAN ID of the first gateway device is the same as any previously configured ID. It is contemplated that other duplicate ID checking methods may also be applicable to the described solution. If the ID "0011" has been used, i.e., is the same as any other device ID, due to reasons such as some subsystems failing to reset at the beginning, the method will loop back to step 601, where the CAN IDs of all gateway devices will be reset to "0000" and the system will restart the automatic ID allocation process.

[0107] If the current CAN ID "0011" of the first gateway device 510 is correct using step 606, the method continues with a loop procedure to assign CAN IDs to other gateway devices. The count will start at N=1 because the ID of the first gateway device has already been assigned.

[0108] At step 607 , the controller sends a CAN signal to those subsystems having the gateway device CAN ID “0000” to reset these subsystems.

[0109] At step 608, the controller sends a CAN signal to the first gateway device 510, the CANID of which has been assigned "0011", thereby instructing the first gateway device 510 to output a signal ID0_OUT from its GPIO3 to the second subsystem 502 to configure the port ID0 of the second gateway device 520 from "0" to "1", so that the ID of the second gateway device is ready to be set from "0000" to "0001". Figure 5 As shown in FIG, in an exemplary implementation, this is accomplished using 1 wire directly connecting GPIO3 of the first gateway device 510 and port ID0 of the second gateway device 520. It is contemplated that other possible GPIO signaling methods may be applicable.

[0110] At step 609, the controller sends a CAN signal to those subsystems with the gateway device CAN ID "0000" to reset these subsystems. A delay is introduced (typically a minimum of 800 μs). For step 609, the second subsystem waits until the configuration of the CAN ID of the second gateway device 520 to "0001" is completed.

[0111] At step 610, the controller sends a CAN signal to the subsystem having the gateway device CAN ID "0001", thereby instructing the gateway device to output a signal from its GPIO0 to GPIO2 to configure the ports ID3 to ID1 of the gateway device from "000" to "010", respectively. Figure 5 As shown in , the controller 500 sends a CAN signal to the second subsystem 502 to instruct the GPIO2 of the second gateway device 520 to configure the port ID1 of the second gateway device to "0", to instruct the GPIO1 of the second gateway device to configure the port ID2 of the second gateway device to "1", and to instruct the GPIO0 of the second gateway device to configure the port ID3 of the second gateway device to "0". Therefore, the CAN ID of the second gateway device is ready to be set from "0001" to "0101".

[0112] At step 611, the controller sends a CAN signal to those subsystems with the gateway device CAN ID "0001" to reset these subsystems. A delay is introduced (typically a minimum of 800 μs). At step 611, wait until the CAN ID of the second gateway device is configured to "0101" is ready and completed. With the help of latch 523, after resetting the second subsystem 502, the ports ID1 to ID3 of the second gateway device 520 can maintain their values ​​as "0", "1" and "0" respectively.

[0113] At step 612, the CAN ID of the second (or more generally, "(N+1)th") gateway device is retrieved (or read) to check whether the CAN ID configured in step 611 is correct. That is, for the first time in the loop, the current CAN ID of the second gateway device 520 (which should now be "0101") is checked against the device ID of any other gateway device of each subsystem. As a preferred embodiment, the controller requests all gateway devices to return their IDs and checks whether the current CAN ID of the second gateway device is the same as any previously configured ID. It is contemplated that other duplicate ID checking methods may also be applicable to the described solution. If the ID "0101" is already in use, i.e., is the same as any other device ID, due to reasons such as some subsystems failing to reset at the beginning, then the method will loop back to step 607, where the controller sends a CAN signal to all subsystems, all of which have their gateway device CAN IDs currently "0000", to reset these subsystems. Next, the CAN ID of the second gateway device 520 will be configured again from step 408 as described above.

[0114] At step 612, if the ID "0101" of the second gateway device 520 is determined to be correct, then the count N is incremented, and the method proceeds to step 613. At step 613, it is determined whether the count N has reached a threshold, which may be preconfigured to 7, such as Figure 6 As shown in . If the count N is less than the threshold, the method will loop back to step 607, where the controller 500 sends a CAN signal to those subsystems with the gateway device CAN ID "0000" to reset these subsystems. The CAN ID of the (N+1)th gateway device will be configured from the GPIO terminal of the Nth gateway device. If the count N reaches the threshold, the method ends, which means that, when the threshold is 7, the ID "1111" has been assigned to the last gateway device of the last subsystem, and the corresponding CAN IDs from "0011" to "1111" have been assigned to the gateway devices of all 7 subsystems.

[0115] It should be noted that the number of introduced GPIO terminals and ID ports, the number of gateway devices (subsystems) to be assigned IDs, and the combination of ID values ​​may each be selected by the user or determined by the system designer.

[0116] exist Figure 5 In the embodiment shown in , 4 ID ports are introduced for each gateway device in the solution, which means that the CAN ID length of the gateway device is 4 bits. 3 GPIO ports are introduced for each gateway device in the solution to configure its own 3 ID ports, namely ID1 to ID3. This means that the maximum allowable number of gateway devices (subsystems) should be 7. Ports ID3 to ID1 of the gateway devices of the 7 subsystems should be configured from "001" to "111", because ID 0001 should remain as the transitional ID value of all gateway devices, and then the controller sends a CAN signal to each subsystem to instruct the gateway device of each subsystem to configure its own 3 ID ports, namely ID1 to ID3. However, different numbers of GPIO ports and ID ports will produce different numbers of bits of the CAN ID length. This means that a number of more than 7 subsystems may also be applicable. For example, in Figure 5 The 5 GPIO terminals and 5 ID ports in the gateway device in the second embodiment will allow a maximum number of 15 subsystems in the system to be automatically assigned IDs.

[0117] And, although 7 is preconfigured as the threshold value of the count N for the solution in the second embodiment, when 4 GPIO terminals and 4 ID ports are introduced into the solution, any number less than 7 may be applicable to the solution.

[0118] Although IDs from "0011" to "1111" are preconfigured as CAN IDs of the gateway device for the solution in the second embodiment, any ID number group matching the threshold value of the count N may be applicable to the solution. For example, if there are 3 subsystems for ID allocation, (0101, 0111, 1111) is a possible ID combination. If there are 5 subsystems for ID allocation, (0011, 0101, 1001, 1011, 1111) is a possible ID combination.

[0119] It should also be noted that in the second embodiment, although only three GPIO terminals are introduced for each gateway device in the solution to configure its own three ID ports, it is envisaged that configuring a value on the fourth ID port (which is the ID port ID0 described in the second embodiment), for example, adding a switch function at the fourth ID port, will allow more CAN IDs to be allocated. This means that the maximum allowable number of subsystems in the second embodiment will become 14, because IDs "0010", "0100", "0110", "1000", "1010", "1100" and "1110" will also be applicable.

[0120] Compared to the first embodiment of the proposed automatic ID assignment solution according to the present disclosure, the second embodiment of the proposed solution utilizes fewer wires between the controller and the first gateway device and fewer wires between the two gateway devices. Also, as shown, the size of any pin terminals that may be implemented as part of the subsystems 501, 502, etc. is smaller in the second embodiment compared to the first embodiment. This will additionally save costs and reduce the design complexity of the proposed solution.

[0121] Unless otherwise indicated herein or clearly contradicted by the context, the use of the terms "a", "an", "the" and similar indicators in the context of describing the subject matter (especially in the context of the following claims) should be understood to cover both the singular and the plural. Unless otherwise indicated herein, the description of the range of values ​​herein merely serves as a shorthand method of individually referring to each individual value falling within the range, and each individual value is incorporated into the specification as if it were individually described herein. In addition, the foregoing description is for illustrative purposes only, not for limiting purposes, because the scope of protection sought is defined by the claims set forth below and any equivalents thereof. Unless otherwise required, the use of any and all examples or exemplary language (e.g., "such as") provided herein is intended only to better illustrate the subject matter, rather than to limit the scope of the subject matter. The use of the term "based on" and other similar phrases indicates the conditions that produce the results in the claims and written descriptions, rather than other conditions that are intended to exclude the results. No language in the specification should be construed as indicating any non-claimed element as essential to the practice of the claimed disclosure.

[0122] Preferred embodiments are described herein, including the best modes known to the inventors for performing the claimed subject matter. Of course, after reading the foregoing description, variations of those preferred embodiments will become apparent to those of ordinary skill in the art. The inventors expect that those of ordinary skill in the art will adopt such variations as appropriate, and the inventors intend to practice the claimed subject matter of the present invention in other ways than those specifically described herein. Therefore, the claimed subject matter includes all variations and equivalents of the subject matter recited in the appended claims as permitted by applicable law. In addition, unless otherwise specified herein or otherwise clearly contradictory to the context, any combination of the elements described above with all possible variations thereof is encompassed.

Claims

1. A method of assigning a corresponding controller area network (CAN) ID to each of a plurality of devices, It is characterized in that Each of the plurality of devices is coupled to a CAN bus and comprises at least one input and at least one output, the plurality of devices being connected in a chain via the at least one input and the at least one output to a controller of the CAN bus having at least one output, the method comprising: resetting the CAN ID of each of the plurality of devices to the same initial value; using the at least one output of the controller to set the at least one input of a first device of the plurality of devices to a first value; setting the CAN ID of the first device using the first value; setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device, wherein the second device is connected to the first device; and The CAN ID of the second device is set using the second value.

2. The method according to claim 1, It is characterized in that The second value is different from the first value.

3. The method according to claim 1, It is characterized in that Setting the CAN ID of the first device and setting the CAN ID of the second device each further include the controller instructing any device having a CAN ID that is the same initial value to reset.

4. The method according to claim 1, It is characterized in that The at least one input of each of the plurality of devices is a corresponding M plurality of ID ports configured to receive an M-bit value corresponding to a binary value at each ID port, the at least one output of each of the plurality of devices is a corresponding M plurality of GPIO terminals configured to output an M-bit value corresponding to a binary value at each GPIO terminal, and Wherein setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device comprises instructing the first device to output a value greater than a value of the CAN ID of the first device at the M plurality of GPIO terminals.

5. The method according to claim 4, It is characterized in that The method additionally includes setting the CAN ID of an (N+1)th device along the chain including instructing, by the controller, an Nth device along the chain to output a value at the M plurality of GPIO terminals of the Nth device that is one greater than a value of the CAN ID of the Nth device.

6. The method according to claim 1, It is characterized in that The at least one input is a first input and the at least one output is a first output, and wherein each of the plurality of devices comprises a plurality of further outputs and a plurality of further inputs, and each of the plurality of further outputs is electrically connected to a respective one of the plurality of further inputs.

7. The method according to claim 6, It is characterized in that Setting the CAN ID of the first device further comprises: After setting the at least one input of a first device of the plurality of devices to a first value using the at least one output of the controller, the controller instructs any device having a CAN ID that is the same initial value to reset, the controller instructs any device having a first input being the first value to output a third value at its plurality of further outputs, thereby applying the third value to its plurality of further inputs, and the controller instructs any device having a first input of the first value to reset; and Setting the CAN ID of the second device includes: the controller instructing any device having a CAN ID of the same initial value to reset after setting the at least one input of a second device of the plurality of devices to a second value using the at least one output of the first device, the controller instructs any device having a first input that is the second value to output a fourth value at its plurality of further outputs, thereby applying the fourth value to its plurality of further inputs, and The controller instructs any device having a first input that is the second value to reset.

8. The method according to claim 7, It is characterized in that The second value is equal to the first value, and wherein the fourth value is different from the third value.

9. The method according to claim 6, It is characterized in that Each of the plurality of further outputs is connected to a respective one of the plurality of further inputs by means of a latch.

10. A system for assigning a corresponding controller area network (CAN) ID to each of a plurality of devices, It is characterized in that The system comprises: each of the plurality of devices coupled to a CAN bus; and a controller of the CAN bus having at least one output, wherein each of the plurality of devices comprises at least one input and at least one output, the plurality of devices being connected to the controller in a chain via the at least one input and the at least one output; wherein after the system is powered on, the CAN ID of each of the plurality of devices is reset to the same initial value; wherein the at least one output of the controller is used to set the at least one input of a first device of the plurality of devices to a first value, and the first value is used to set the CAN ID of the first device; The at least one output of the first device is used to set the at least one input of a second device of the plurality of devices to a second value, and the second value is used to set the CAN ID of the second device, wherein the second device is connected to the first device.