Disclosure of Invention
The embodiment of the application aims to provide a method, a device, an upper computer and a system for upgrading software of a battery management unit, which are used for improving the upgrading efficiency of a plurality of battery management units.
In a first aspect, an embodiment of the present application provides a method for upgrading software of a battery management unit, where the method may be applied to software upgrading of a battery management unit of a battery system, where the battery system includes a plurality of battery units, each of the battery units includes a battery management unit, and the battery management unit is configured to manage the battery units, where the method includes:
the method comprises the steps of sending upgrade requests to a plurality of battery management units based on a UDS protocol so that the plurality of battery management units respond to the upgrade requests, sending UDS diagnosis service requests to the plurality of battery management units after receiving first UDS responses returned by the battery management units so that the plurality of battery management units can diagnose, and sending upgrade code requests based on functional addressing after receiving second UDS responses returned by the plurality of battery management units so that the plurality of battery management units can conduct code upgrade based on the upgrade code requests.
According to the embodiment of the application, the plurality of battery management units can be upgraded simultaneously through the functional addressing of the UDS protocol, so that the software upgrading efficiency of the plurality of battery management units is improved.
In any embodiment, sending an upgrade request to a plurality of battery management units based on the UDS protocol includes:
Generating corresponding upgrading requests based on codes of a plurality of battery management units respectively, wherein the upgrading requests comprise physical addressing message IDs associated with the codes of the battery management units;
And sending an upgrade request to the corresponding battery management unit based on the physical addressing message ID.
In the embodiment of the application, the UDS protocol sends the upgrading request to the plurality of battery management units in the form of the physical addressing message, so that the battery management units return response messages and enter a state of preparing for upgrading, and each battery management unit is allocated with a unique code and generates a physical addressing message ID related to the unique code, thereby being capable of accurately identifying and positioning each battery management unit needing upgrading.
In any embodiment, before sending the upgrade request to the plurality of battery management units based on the UDS protocol, the method further comprises:
responding to the interactive operation by triggering the battery management unit on the upper computer interface;
The codes of the plurality of battery management units are determined based on the interoperation.
In the embodiment of the application, the interaction operation with the battery management unit can be realized by triggering the upper computer interface, and the code of the battery management unit can be determined based on the interaction operation, so that the battery management unit to be upgraded can be accurately positioned based on the code, and the operation is convenient.
In either embodiment, the UDS diagnostic service request includes a coded associated physical addressing message ID of the battery management unit.
Compared with the function addressing message, the embodiment of the application only needs the corresponding battery management unit to respond, reduces the response of the battery management unit which does not need to be upgraded, and reduces the occupation of the CAN bus.
In any embodiment, the method further comprises:
And after receiving a third UDS response returned by the battery management unit, sending a post-programming diagnosis service to the battery management unit based on physical addressing, wherein the third UDS response is returned after the battery management unit finishes code upgrading, and the post-programming diagnosis service comprises a physical addressing message ID corresponding to the battery management unit.
The embodiment of the application can verify whether the battery management unit codes successfully or not by performing post-programming diagnosis service on the battery management unit, and is beneficial to early finding out the problem.
In a second aspect, an embodiment of the present application provides another method for upgrading software of a battery management unit, where the method is applied to software upgrading of a battery management unit of a battery system, the battery system includes a plurality of battery units, each of the battery units includes a battery management unit, and the battery management unit is configured to manage the battery unit, and the method includes:
receiving an upgrade request sent by an upper computer based on a UDS protocol;
Responding to the upgrade request, and returning a first UDS response to the upper computer;
Receiving a UDS diagnosis service request sent by the upper computer, performing UDS diagnosis processing based on the UDS diagnosis service request, and sending a second UDS response to the upper computer after diagnosis is completed;
Receiving an upgrade code request sent by an upper computer based on function addressing, wherein the upgrade code request comprises a code address and code content;
And (3) refreshing the code content according to the code address, and returning a third UDS response to the upper computer after the code refreshing is completed.
According to the embodiment of the application, the code in the battery management unit is modified, so that the modified battery management unit can respond to the received functional addressing message, and therefore, the upper computer can upgrade a plurality of battery management units at the same time, and the efficiency of software upgrading is improved.
In any embodiment, receiving the upgrade code request sent by the upper computer based on functional addressing includes:
if the battery management unit starts the upgrading function based on the upgrading request, an upgrading code request sent by the upper computer based on the function addressing is received.
According to the embodiment of the application, the upgrade code request is broadcast in a function addressing mode, so that the battery management units with the upgrade functions started can receive the request and respond to the request, and the request is not required to be sent to each battery management unit independently, so that the occupation of bandwidth is reduced, and the efficiency of software upgrade is improved.
In any embodiment, the method further comprises:
Receiving a post programming diagnosis service sent by an upper computer;
A corresponding post-processing operation is performed based on the post-programming diagnostic service.
The embodiment of the application can verify whether the battery management unit is successfully encoded or not and discover problems early through the post-programming diagnosis service.
In a third aspect, an embodiment of the present application provides a software upgrade apparatus for a battery management unit, where the software upgrade apparatus is configured to upgrade software of a battery management unit of a battery system, and the battery system includes a plurality of battery units, each of the battery units includes a battery management unit, and the battery management unit is configured to manage the battery unit, where the software upgrade apparatus includes:
A first request sending module, configured to send an upgrade request to a plurality of battery management units based on a UDS protocol, so that the battery management units respond to the upgrade request;
The second request sending module is used for sending a UDS diagnosis service request to the battery management units after receiving the first UDS responses returned by the plurality of battery management units so as to enable the plurality of battery management units to diagnose;
and the third request sending module is used for sending an upgrade code request based on the functional addressing after receiving the second UDS response returned by the plurality of battery management units so as to enable the plurality of battery management units to conduct code upgrade based on the upgrade code request.
In a fourth aspect, an embodiment of the present application provides an upper computer, including a processor, a memory, and a bus, where,
The processor and the memory complete the communication with each other through a bus;
The memory stores program instructions executable by the processor, the processor invoking the program instructions capable of performing the method of the first aspect.
In a fifth aspect, embodiments of the present application provide a non-transitory computer readable storage medium comprising:
the non-transitory computer readable storage medium stores computer instructions that cause a computer to perform the method of the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product comprising computer program instructions which, when read and run by a processor, perform the method of the first aspect.
In a seventh aspect, an embodiment of the present application provides a software upgrading system for a battery management unit, where the software upgrading system includes a host computer and a plurality of battery management units according to the fourth aspect, the host computer and the plurality of battery management units are connected through a CAN bus in a communication manner, and the battery management unit is capable of executing the method according to the second aspect.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Detailed Description
Embodiments of the technical scheme of the present application will be described in detail below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present application, and thus are merely examples, and are not intended to limit the scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs, the terms used herein are for the purpose of describing particular embodiments only and are not intended to be limiting of the application, and the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the above description of the drawings are intended to cover non-exclusive inclusions.
In the description of embodiments of the present application, the technical terms "first," "second," and the like are used merely to distinguish between different objects and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated, a particular order or a primary or secondary relationship. In the description of the embodiments of the present application, the meaning of "plurality" is two or more unless explicitly defined otherwise.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In the description of the embodiment of the present application, the term "and/or" is merely an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B, and may indicate that a exists alone, while a and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
In the description of the embodiments of the present application, the term "plurality" means two or more (including two), and similarly, "plural sets" means two or more (including two), and "plural sheets" means two or more (including two).
In the description of the embodiments of the present application, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "fixed" and the like are to be construed broadly and include, for example, fixed connection, detachable connection, or integral therewith, mechanical connection, electrical connection, direct connection, indirect connection via an intermediary, communication between two elements, or interaction between two elements. The specific meaning of the above terms in the embodiments of the present application will be understood by those of ordinary skill in the art according to specific circumstances.
The battery management unit is a core component of the BMS and is responsible for monitoring, controlling and protecting the battery pack in real time, so that the high-efficiency, safe and reliable operation of the battery system is ensured. Including, for example, obtaining data such as voltage temperature and/or current of the battery cells, and also controlling, for example, the switching on, off, and/or equalization management of the battery cells. When the battery management unit has program defects or version problems, the battery management unit needs to be subjected to software upgrading so as to reduce the safety risk of the battery in the use process.
Aiming at the energy storage battery, the energy storage battery comprises a plurality of battery management units, and at present, the battery management units can be upgraded through application programming (In Application Programming; hereinafter referred to as IAP), the IAP upgrade allows a User program to burn and write partial areas of User Flash in the running process, and the purpose is that firmware programs in the product can be updated and upgraded conveniently through a reserved communication port after the product is released. The IAP upgrade can upgrade a plurality of battery management units at the same time, but the IAP upgrade has no diagnostic service and cannot diagnose upgrade failure.
The UDS protocol may be used for diagnosis during the upgrade of the battery management unit, but the UDS protocol currently only supports point-to-point upgrade, and cannot upgrade a plurality of battery management units at the same time. For the case where a plurality of battery management units are included in one battery management system, such as an energy storage battery. When a plurality of battery management units are updated, if the UDS protocol is adopted, the battery management units need to be updated one by one, so that the problem of low updating efficiency is caused.
In order to solve the technical problems, the embodiment of the application provides a method, a device, an upper computer and a system for upgrading software of a battery management unit. By modifying the internal codes of the battery management units, the battery management units can respond to the function addressing message based on the UDS protocol, so that the software codes to be upgraded can be sent to the battery management units to be upgraded through the function addressing message, the software can be upgraded to the plurality of battery management units at the same time, and the efficiency of upgrading the battery management units is improved.
It should be noted that, the method for upgrading the software of the battery management unit provided by the embodiment of the application can be applied to upgrading a plurality of battery management units in the energy storage battery, and can also be applied to other scenes in which a plurality of battery management units need to be upgraded at the same time.
Fig. 1 is a schematic flow chart of a software upgrading method of a battery management unit according to an embodiment of the present application, as shown in fig. 1, the method is applied to an upper computer, and the upper computer may be a smart phone, a tablet computer, a Personal digital assistant (Personal DIGITAL ASSITANT, PDA), etc.
The method comprises the following steps:
step 101, sending upgrade requests to the plurality of battery management units based on the UDS protocol so that the plurality of battery management units respond to the upgrade requests.
And 102, after receiving the first UDS responses returned by the plurality of battery management units, sending a UDS diagnosis service request to the plurality of battery management units so as to enable the plurality of battery management units to diagnose.
Step 103, after receiving the second UDS response returned by the plurality of battery management units, sending an upgrade code request based on the function addressing so that the plurality of battery management units can conduct code upgrade based on the upgrade code request.
In a specific implementation process, before the software is upgraded, related configuration work can be performed in advance, for example, a code package of a Vector and a configuration tool are used for realizing a UDS diagnosis driving function, and coded buttons of a plurality of battery management units are configured on an upper computer, wherein the number of the buttons can be the same as or more than the number of the battery management units contained in the device to be upgraded actually. And the button of the battery management unit on the upper computer interface is associated with the battery management unit of the entity, and specifically, the coding information of the battery management unit can be obtained by reading the NVM value of the battery management unit, and the physical addressing message and the response message of the UDS are associated with the coding information of the battery management unit. Therefore, the information can be sent to the battery management unit of the corresponding entity by triggering the button on the upper computer interface.
The upper computer is in communication connection with the battery management units through the CAN loop, when a plurality of battery management units need to be upgraded, the corresponding buttons on the interface of the upper computer CAN be triggered, after the upper computer receives the coding information of the corresponding buttons, an upgrading request corresponding to the coding information is generated, and the upgrading request is sent to the corresponding battery management units based on the UDS protocol. For convenience of description, after receiving the upgrade request, the battery management unit enters an upgrade state, resets internal software, jumps to a Flash Bootloader, abbreviated as FBL, and prepares for upgrade. The battery management unit which does not receive the upgrade request does not perform software reset, and the upgrade request enters a silent mode, so that subsequent upgrades are not interfered.
And after receiving the upgrading request and entering an upgrading state, the battery management unit sends a first UDS response to the upper computer. The first UDS response is used for representing that the battery management unit receives an upgrade request sent by the upper computer and is ready for upgrade.
After receiving a first UDS response returned by the battery management unit, the upper computer sends a UDS diagnosis service request to the battery management unit, wherein the UDS diagnosis service request is used for diagnosing the battery management unit once before the battery management unit is upgraded, and specifically comprises 10 services, namely diagnosis session control, 11 services, namely restarting services, 22 services, namely reading data according to identifiers, 27 services, namely safe access services, 28 services, namely closing communication and starting communication services, 2e services, namely receiving data according to identifiers Fu Xieshu, 31 services, namely routine control services and the like. After receiving the UDS diagnosis service request, the battery management unit performs diagnosis according to the UDS diagnosis service request and returns a second UDS response to the upper computer. Wherein the second UDS response is used to characterize the diagnostic result of the battery management unit, e.g. no fault, or the presence of a fault, and fault coding, etc.
And after receiving a second UDS response returned by the battery management unit, the upper computer sends an upgrade code request based on the function addressing. When the upper computer sends the upgrade code to the battery management unit, the upgrade code is larger, and data transmitted each time is smaller, so that the upgrade code is required to be divided, only a part of the code is transmitted each time, and after the code is transmitted for a plurality of times, the whole upgrade code is written. For one code transmission, the upgrade code request comprises an upgrade code and a storage address corresponding to the upgrade code. And after receiving the upgrade code request, the battery management unit stores the upgrade code according to the storage address. Since there are multiple battery management units, the present application sends an upgrade code request in a functionally addressed manner. Wherein the function addressing is based on the function or service, and when the upper computer sends the upgrade code request, the battery management unit supporting the function or service responds. Therefore, the plurality of battery management units can receive the upgrade code request, and each battery management unit performs a code upgrade operation after receiving the upgrade code request. That is, the latest code is written in the specified address. The existing battery management unit cannot respond to the function addressing message, and the internal codes of the battery management unit are modified to enable the battery management unit to respond to the function addressing message, so that a plurality of battery management units can be upgraded in parallel.
According to the embodiment of the application, the latest codes can be simultaneously sent to the plurality of battery management units through the functional addressing of the UDS protocol, so that the plurality of battery management units are simultaneously upgraded, and the software upgrading efficiency of the battery management units is improved.
On the basis of the above embodiment, sending an upgrade request to a plurality of battery management units based on the UDS protocol includes:
Generating corresponding upgrading requests based on codes of a plurality of battery management units respectively, wherein the upgrading requests comprise physical addressing message IDs associated with the codes of the battery management units;
And sending an upgrade request to the corresponding battery management unit based on the physical addressing message ID.
In a specific implementation process, the physical addressing is based on the physical address of the battery management unit, and if the host computer adopts a physical addressing mode, the host computer can communicate with the specific battery management unit based on the physical addressing message ID. When an upgrade request occurs, the upper computer can communicate with the battery management unit in a physical addressing mode. The upgrade request includes a physical address message ID corresponding to the battery management unit.
The upper computer sends the upgrade request in a physical addressing mode, so that the battery management unit corresponding to the physical addressing message ID CAN return a response message after receiving the upgrade request, other battery management units CAN not return the response message, and the load on the CAN bus is reduced.
The CAN bus sends the upgrading request to the corresponding battery management unit based on the physical addressing message ID, and the battery management unit resets the software based on the upgrading request and enters an upgrading state.
In the embodiment of the application, the UDS protocol sends the upgrading request to the plurality of battery management units in the form of the physical addressing message, so that the battery management units return response messages and enter a state of preparing for upgrading, and each battery management unit is allocated with a unique code and generates a physical addressing message ID related to the unique code, thereby being capable of accurately identifying and positioning each battery management unit needing upgrading.
On the basis of the above embodiment, before the upgrade request is sent to the plurality of battery management units based on the UDS protocol, the method further includes:
responding to the interactive operation by triggering the battery management unit on the upper computer interface;
The codes of the plurality of battery management units are determined based on the interoperation.
In a specific implementation process, buttons of a plurality of battery management units may be set on the upper computer in advance, where the number of buttons may be the same as or greater than the number of battery management units in an actual application scenario. When the number of the buttons on the upper computer interface is greater than the number of the battery management units in the actual application scene, redundant buttons are added on the upper computer interface, and the buttons which are the same as the number of the battery management units in the actual application scene are selected to be corresponding to the buttons.
After the button is arranged on the upper computer interface, the number of the button is associated with the unique code of the corresponding actual battery management unit, so that when software upgrading is required to be carried out on one or more battery management units, the software upgrading can be realized by triggering the button on the upper computer interface, and after the upper computer receives interactive operation of a user, the code of the battery management unit to be upgraded can be locked according to the number of the triggered button.
It should be noted that the form of the button on the upper computer interface may be arbitrary as long as it can be triggered and associated with the corresponding actual battery management unit.
In the embodiment of the application, the interaction operation with the battery management unit can be realized by triggering the upper computer interface, and the code of the battery management unit can be determined based on the interaction operation, so that the battery management unit to be upgraded can be accurately positioned based on the code, and the operation is convenient.
On the basis of the above-described embodiments, the UDS diagnostic service request includes the coded associated physical address message ID of the battery management unit.
In a specific implementation process, the upper computer sends a UDS diagnosis service request to the battery management unit through a physical addressing manner, so that the UDS diagnosis service request includes a physical addressing message ID of the battery management unit. The battery management unit executes UDS diagnosis after receiving the UDS diagnosis service request, returns a second UDS response to the upper computer after complete diagnosis, and does not respond if the UDS responses are different.
Compared with the function addressing message, the embodiment of the application only needs the corresponding battery management unit to respond, reduces the response of the battery management unit which does not need to be upgraded, and reduces the occupation of the CAN bus.
On the basis of the embodiment, the method further comprises:
And after receiving a third UDS response returned by the battery management unit, sending a post-programming diagnosis service to the battery management unit based on physical addressing, wherein the third UDS response is returned after the battery management unit finishes code upgrading, and the post-programming diagnosis service comprises a physical addressing message ID corresponding to the battery management unit.
In a specific implementation process, after each time of receiving an upgrade code request sent by the upper computer, the battery management unit performs updating of the upgrade code, and returns a third UDS response to the upper computer. Wherein the third UDS response is used to characterize whether the flushing was successful. If the upper computer receives a third UDS response representing the writing failure, the upper computer can send an upgrade code request to the battery management unit again until the upper computer receives the third UDS response of the successful writing of the battery management unit, or sends the upgrade code request for a preset number of times.
After receiving the third UDS response returned by the battery management unit, the upper computer judges whether all the upgrade codes are sent to the battery management unit, and if so, the upper computer sends a post-programming diagnosis service to the battery management unit. The post-programming diagnosis service is used for operations such as verification, configuration recovery or system restarting after the battery management unit has written up the upgrade code. It typically involves verifying the new software, i.e. after the encoding step has been completed, the newly written software needs to be verified to determine its integrity and correctness. Such as verifying a signature, checksum, etc. of the data. Configuration recovery-if certain configuration parameters were altered during a software upgrade, then these parameters would need to be restored to the correct state during a post-program diagnostic process. System restart-in order to validate new software, the battery management unit needs to be restarted, which can enable the new software to be loaded and run correctly at system start-up.
The embodiment of the application can verify whether the battery management unit codes successfully or not by performing post-programming diagnosis service on the battery management unit, and is beneficial to early finding out the problem.
Fig. 2 is a flowchart of another software upgrading method for a battery management unit according to an embodiment of the present application, as shown in fig. 2, where the method is used for performing software upgrading on a battery management unit of a battery system, the battery system includes a plurality of battery units, each of the battery units includes a battery management unit, and the battery management unit is used for managing the battery unit, and the method is applied to the battery management unit and includes:
step 201, receiving an upgrade request sent by an upper computer based on a UDS protocol;
Step 202, responding to the upgrade request, and returning a first UDS response to the upper computer;
Step 203, receiving a UDS diagnosis service request sent by the upper computer, performing UDS diagnosis processing based on the UDS diagnosis service request, and sending a second UDS response to the upper computer after diagnosis is completed;
step 204, receiving an upgrade code request sent by the upper computer based on the function addressing, wherein the upgrade code request comprises a code address and code content;
and 205, flushing the code content according to the code address, and returning a third UDS response to the upper computer after the code flushing is completed.
In a specific implementation process, the upper computer is in communication connection with the battery management units through the CAN bus, a plurality of battery management unit buttons are arranged on an interface of the upper computer, each battery management unit button is associated with a real battery management unit, when software upgrading is required to be carried out on one or more battery management units, the corresponding battery management unit button CAN be triggered on the interface of the upper computer, and the upper computer sends an upgrading request to the corresponding battery management unit based on the UDS protocol. The upgrade request may be sent based on a physical addressing mode of the UDS protocol, and the upgrade request includes a physical addressing message ID of the corresponding battery management unit. After receiving the upgrade request, the battery management unit enters an upgrade state, namely, an upgrade function is started, and after the upgrade code request is broadcast through function addressing, the battery management unit with the upgrade function started responds to the upgrade code request to perform subsequent upgrade operation.
After receiving the upgrade request, the battery management unit responds to the upgrade request and returns a first UDS response to the upper computer. The battery management unit performs upgrading state, namely, software in the battery management unit is reset and jumps to a Flash Bootloader.
It will be appreciated that physical addressing is based on the physical address of the battery management unit, and is a point-to-point or one-to-one communication, i.e., the data packets are sent directly to the battery management unit with a specific physical address.
And after receiving the first UDS response, the upper computer sends a UDS diagnosis service request to the battery management unit for pre-diagnosing the battery management unit. The UDS diagnostic service request may also be transmitted by physical addressing. The diagnosis service mainly comprises 10 service of diagnosing session control, 11 service of restarting service, 22 service of reading data according to identifier, 27 service of safety access service, 28 service of closing communication and opening communication service, 2e service of controlling service according to identifier Fu Xieshu, 31 service of routine program and the like. After receiving the UDS diagnosis service request, the battery management unit performs diagnosis according to the UDS diagnosis service request and returns a second UDS response to the upper computer. Wherein the second UDS response is used to characterize the diagnostic result of the battery management unit, e.g. no fault, or the presence of a fault, and fault coding, etc.
And after receiving a second UDS response returned by the battery management unit, the upper computer sends an upgrade code request to the battery management unit based on the functional addressing. When the upper computer sends the upgrade code to the battery management unit, the upgrade code is larger, and data transmitted each time is smaller, so that the upgrade code is required to be divided, only a part of the code is transmitted each time, and after the code is transmitted for a plurality of times, the whole upgrade code is written. For one code transmission, the upgrade code request comprises an upgrade code and a storage address corresponding to the upgrade code. And after receiving the upgrade code request, the battery management unit stores the upgrade code according to the storage address. Since there are multiple battery management units, the present application sends an upgrade code request in a functionally addressed manner. Wherein the function addressing is based on the function or service, and when the upper computer sends the upgrade code request, the battery management unit supporting the function or service responds. Therefore, the plurality of battery management units can receive the upgrade code request, and each battery management unit performs a code upgrade operation after receiving the upgrade code request. That is, the latest code is written in the specified address. The battery management unit then returns a third UDS response to the host computer to indicate that the current code content has been successfully written.
According to the embodiment of the application, the code in the battery management unit is modified, so that the modified battery management unit can respond to the received functional addressing message, and therefore, the upper computer can upgrade a plurality of battery management units at the same time, and the efficiency of software upgrading is improved.
On the basis of the above embodiment, after the host computer receives the third UDS response and determines that all the code contents have been sent to the battery management unit, the method further includes:
Receiving a post programming diagnosis service sent by an upper computer;
A corresponding post-processing operation is performed based on the post-programming diagnostic service.
In a specific implementation process, after each time of receiving an upgrade code request sent by the upper computer, the battery management unit performs updating of the upgrade code, and returns a third UDS response to the upper computer. Wherein the third UDS response is used to characterize whether the flushing was successful. If the upper computer receives a third UDS response representing the writing failure, the upper computer can send an upgrade code request to the battery management unit again until the upper computer receives the third UDS response of the successful writing of the battery management unit, or sends the upgrade code request for a preset number of times.
After receiving a third UDS response which is returned by the battery management unit and represents that the refreshing is successful, the upper computer judges whether all the upgrade codes are sent to the battery management unit, and if all the upgrade codes are sent to the battery management unit, the upper computer sends a post-programming diagnosis service to the battery management unit. The post-programming diagnosis service is used for operations such as verification, configuration recovery or system restarting after the battery management unit has written up the upgrade code. It typically involves verifying the new software, i.e. after the encoding step has been completed, the newly written software needs to be verified to determine its integrity and correctness. Such as verifying a signature, checksum, etc. of the data. Configuration recovery-if certain configuration parameters were altered during a software upgrade, then these parameters would need to be restored to the correct state during a post-program diagnostic process. System restart-in order to validate new software, by requiring the battery management unit to be restarted. This may allow new software to be properly loaded and run at system start-up.
The embodiment of the application can verify whether the battery management unit is successfully encoded or not and discover problems early through the post-programming diagnosis service.
Fig. 3 is a signaling interaction diagram of a software upgrading method of a battery management unit according to another embodiment of the present application, as shown in fig. 3. It should be noted that, in the software upgrading method, the upper computer and the plurality of battery management units are involved, and for convenience of description, the embodiment of the application only provides a signaling interaction flow between the upper computer and one battery management unit, and interaction flows between other battery management units and the upper computer are the same. The method comprises the following steps:
Step 301, determining the code of the battery management unit, wherein the user can acquire the code of the battery management unit by triggering a button of the battery management unit to be upgraded on an interface of the upper computer.
Step 302, an upgrade request is sent, and the upper computer sends the upgrade request to the battery management unit in a physical addressing mode.
Step 303, entering an upgrade state, and after receiving the upgrade request, the battery management unit enters the upgrade state.
And 304, transmitting the first UDS response by the battery management unit, and transmitting the first UDS response to the upper computer by the battery management unit.
And 305, sending a UDS diagnosis service request to the battery management unit by the upper computer, wherein the UDS diagnosis service request is used for performing pre-diagnosis on the battery management unit before software upgrading. The sending mode of the UDS diagnosis service request can also adopt physical addressing.
And 306, performing UDS diagnosis processing, wherein the battery management unit performs pre-diagnosis after receiving a UDS diagnosis service request sent by the upper computer, such as diagnosis of an extended session, diagnosis of a read version number, diagnosis of key unlocking, diagnosis of fingerprint writing and the like.
Step 307, the battery management unit sends the second UDS response to the upper computer after completing the diagnosis of the UDS.
Step 308, sending an upgrade code request, wherein the upper computer sends the upgrade code request to the battery management unit, and the upgrade code request comprises a code address and code content. It should be noted that, the code quantity to be upgraded is large, one transmission is not completed, multiple transmissions are needed, and the number of battery management units is multiple, so that the upgrade code request adopts a function addressing mode, the upper computer sends the upgrade code request to the battery management units through the function addressing, and the battery management units in the CAN bus loop CAN receive the upgrade code request, and only the battery management units in an upgrade state CAN perform the code refreshing action. By means of the function addressing mode, a plurality of battery management units can be updated in parallel, and software upgrading efficiency is improved.
Step 309, the battery management unit receives the upgrade code request and then writes the code content into the corresponding code address.
And 310, transmitting a third UDS response, and returning the third UDS response to the upper computer by the battery management unit after the code is written.
Step 311, sending the post-programming diagnosis service, and after determining that all the upgrade codes are sent to the battery management unit, the upper computer sends the post-programming diagnosis service to the battery management unit.
Step 312, the battery management unit performs the post-programming process after receiving the post-programming diagnostic service, and the specific post-programming process is described in the above embodiments.
Fig. 4 is a schematic structural diagram of a software upgrading apparatus for a battery management unit according to an embodiment of the present application, where the apparatus may be a module, a program segment, or a code on an electronic device. It should be understood that the apparatus corresponds to the embodiment of the method of fig. 1 described above, and is capable of performing the steps involved in the embodiment of the method of fig. 1, and specific functions of the apparatus may be referred to in the foregoing description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy. The device comprises a first request sending module 401, a second request sending module 402 and a third request sending module 403, wherein:
the first request sending module 401 is configured to send an upgrade request to the plurality of battery management units based on the UDS protocol, so that the plurality of battery management units respond to the upgrade request;
the second request sending module 402 is configured to send a UDS diagnostic service request to the battery management unit after receiving a first UDS response returned by the battery management unit, so that the battery management unit performs diagnosis;
The third request sending module 403 is configured to send an upgrade code request based on functional addressing after receiving a second UDS response returned by the battery management unit, so that the battery management unit performs a code upgrade based on the upgrade code request.
On the basis of the above embodiment, the first request sending module 401 is specifically configured to:
generating corresponding upgrading requests based on codes of a plurality of battery management units respectively, wherein the upgrading requests comprise physical addressing message IDs associated with the codes of the battery management units;
And sending the upgrading request to the corresponding battery management unit based on the physical addressing message ID.
On the basis of the above embodiment, the apparatus further includes a code determining module for:
responding to the interactive operation by triggering the battery management unit on the upper computer interface;
and determining codes of a plurality of battery management units according to the interaction operation.
On the basis of the above embodiment, the UDS diagnostic service request includes a coded associated physical address message ID of the battery management unit.
On the basis of the above embodiment, the apparatus further includes a post-programming module for:
And after receiving a third UDS response returned by the battery management unit, sending a post-programming diagnosis service to the battery management unit based on physical addressing, wherein the third UDS response is returned after the battery management unit finishes code upgrading, and the post-programming diagnosis service comprises a physical addressing message ID corresponding to the battery management unit.
Fig. 5 is a schematic diagram of an entity structure of a host computer according to an embodiment of the present application, as shown in fig. 5, the electronic device includes a processor (processor) 501, a memory (memory) 502 and a bus 503, where,
The processor 501 and the memory 502 complete communication with each other via the bus 503;
the processor 501 is configured to invoke the program instructions in the memory 502 to perform the method provided in the above embodiments of the method, and includes, for example, sending an upgrade request to a plurality of battery management units based on a UDS protocol to cause the plurality of battery management units to respond to the upgrade request, sending a UDS diagnostic service request to the battery management units to cause the battery management units to perform diagnosis after receiving a first UDS response returned by the battery management units, and sending an upgrade code request based on a functional address to cause the battery management units to perform code upgrade based on the upgrade code request after receiving a second UDS response returned by the battery management units.
The processor 501 may be an integrated circuit chip having signal processing capabilities. The processor 501 may be a general-purpose processor including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc., or may be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. Which may implement or perform the various methods, steps, and logical blocks disclosed in embodiments of the application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 502 may include, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, EEPROM), and the like.
The embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions that when executed by a computer are capable of performing the methods provided by the above-described method embodiments, for example, comprising sending upgrade requests to a plurality of battery management units based on a UDS protocol to cause the plurality of battery management units to respond to the upgrade requests, sending a UDS diagnostic service request to the battery management units to cause the battery management units to perform diagnostics after receiving a first UDS response returned by the battery management units, and sending an upgrade code request based on a functional addressing to cause the battery management units to perform code upgrades based on the upgrade code request after receiving a second UDS response returned by the battery management units.
The embodiment provides a non-transitory computer readable storage medium storing computer instructions for causing a computer to execute the methods provided by the above-described method embodiments, for example, including sending upgrade requests to a plurality of battery management units based on a UDS protocol to cause the plurality of battery management units to respond to the upgrade requests, sending a UDS diagnosis service request to the battery management units after receiving a first UDS response returned by the battery management units to cause the battery management units to diagnose, and sending an upgrade code request based on functional addressing after receiving a second UDS response returned by the battery management units to cause the battery management units to conduct code upgrade based on the upgrade code request.
Fig. 6 is a schematic structural diagram of a software upgrade system for a battery management unit according to an embodiment of the present application, where, as shown in fig. 6, the software upgrade system includes an upper computer and a plurality of battery management units, where the upper computer is communicatively connected to the plurality of battery management units through a CAN bus. The host computer and the plurality of battery management units can upgrade all or part of the plurality of battery management units by the method embodiments. The specific upgrading method can be referred to the above embodiments, and will not be described herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
Further, the units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Furthermore, functional modules in various embodiments of the present application may be integrated together to form a single portion, or each module may exist alone, or two or more modules may be integrated to form a single portion.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.