Electric drive firmware burning upgrading method and device
Firmware upgrades are performed via the control bus interface of the electric drive device, which solves the problems of cumbersome operation for electric drive firmware upgrades and unstable Bluetooth upgrades in the existing technology. It achieves efficient and stable wired firmware burning and upgrade, simplifies the operation process, and improves upgrade speed and reliability.
Patent Information
- Application Number
- CN202511024139.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-11-14
AI Technical Summary
Existing methods for upgrading electric drive firmware are cumbersome and make it difficult to achieve efficient and stable firmware burning and upgrading within the packaged structure. Furthermore, Bluetooth upgrades suffer from poor compatibility and unstable connections.
Firmware upgrades are performed using the control bus interface of the electric drive equipment. By configuring the communication port and communication protocol, upgrade data is directly transmitted and parsed to form an upgrade file, realizing wired communication firmware burning and upgrade, avoiding additional hardware devices and complex interface operations.
It enables efficient and stable upgrades of electric drive firmware, simplifies the operation process, improves upgrade speed and reliability, reduces labor costs, and is suitable for industrial environments.
Smart Images

Figure CN120950091A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of firmware upgrade technology, and more specifically, to a method and apparatus for burning and upgrading firmware for an electric drive. Background Technology
[0002] Marine motor drives are specialized electronic devices that control the operation of motors by running specific control programs. Because they operate near the water surface, these products are typically encased in highly airtight structures to prevent irreversible damage to components from water splashes during operation. However, this results in fewer communication interfaces with the outside world; generally, only the control communication interface is available. This leads to difficulties in firmware upgrades, modifications, and maintenance. Updating the firmware requires disassembling the product's casing and using a dedicated programming interface on the circuit board, a cumbersome process that significantly impacts testing efficiency during the research and development and production phases.
[0003] Currently, there are several feasible methods for firmware upgrades of electric drive products. One is to use a programmer for online or offline programming, but this requires disassembling the product casing, which poses a significant inconvenience when updating and maintaining the firmware during subsequent use of the product test machine. The second method is to use an app to upgrade via Bluetooth connection, but Bluetooth connection depends on the device's Bluetooth driver and protocol stack, and differences in compatibility between different platforms can easily lead to failure. It is also susceptible to radio frequency interference and cannot guarantee a stable connection environment. In addition, Bluetooth communication speed is low, and a terminal app for the product needs to be developed, which increases additional manpower costs.
[0004] Therefore, it is essential to develop an efficient, time-saving, and stable firmware burning and upgrade method. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a method and apparatus for firmware burning and upgrading of an electric drive. This method utilizes the electric drive's own control bus interface to directly upgrade and update the firmware via communication, achieving an efficient, time-saving, and stable firmware burning and upgrading method.
[0006] In a first aspect, embodiments of this application provide a method for burning and upgrading firmware for an electric drive, the method comprising: The control bus of the electric drive device is configured with a communication port and a communication protocol; the communication port is used to transmit upgrade data; the communication protocol is used to read the upgrade data and package it into a communication data frame; the upgrade data includes an upgrade file for firmware upgrade and a firmware version number extracted from the upgrade file; The communication data of the communication port is obtained and the firmware data is parsed out. The parsed firmware data is written into the storage area in an orderly manner and combined to form the upgrade file for firmware upgrade. The communication data is the communication data frame sent by the host computer to the electric drive device through the communication port. In response to the formation of the upgrade file in the storage area, the upgrade file in the storage area is read and the upgrade file is overwritten to the runtime area.
[0007] Preferably, after overwriting the upgrade file to the runtime area, the method further includes: Self-check the current version number of the firmware of the electric drive device; Obtain the firmware version number for this upgrade, and determine whether the current version number matches the firmware version number: If so, the upgrade was successful; If not, the upgrade fails, and an upgrade failure message is sent. The upgrade failure information is used to trigger the host computer to reacquire upgrade data and resend communication data frames to the electric drive device through the communication port.
[0008] Preferably, the communication protocol specifically includes: A preset framing standard for communication data frames is defined as the amount of data contained in each frame. Read the upgrade data and perform frame segmentation on the upgrade data based on the frame segmentation standard to obtain multiple data frames; Based on the upgraded data, the multiple data frames obtained from the frame splitting process are sorted and verified to obtain the sequence number and check code of each data frame. Each data frame and its checksum are packaged according to the sequence number to obtain multiple orderly arranged communication data frames.
[0009] Preferably, acquiring the communication data from the communication port and parsing the firmware data specifically includes: The communication data is acquired, and the communication data frame is extracted. The communication data frame includes a sequence number, a check code, and a data frame. Verify the checksum of the data frame based on the data frame: If the verification fails, a request message is sent back, which includes the serial number. The request message is used to trigger the host computer to reacquire the upgrade data and resend the communication data frame with the corresponding serial number to the electric drive device through the communication port. If the verification is successful, the data frame is parsed into firmware data, and the serial number is associated and bound with the parsed firmware data.
[0010] Preferably, the parsed firmware data is written sequentially to the storage area and combined to form the upgrade file for firmware upgrade, specifically including: Obtain the serial number of the firmware data; the serial number includes a start symbol and a stop symbol, the start symbol being the first character of the serial number and the stop symbol being the last character of the serial number; Identify the serial number and write the corresponding firmware data into the storage area in an orderly manner; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file is received only when the serial number is full and a start symbol and an end symbol are present. The firmware data written to the storage area is then combined in an orderly manner according to the serial number to form the upgrade file. The term "full sequence number" specifically means that the entire sequence number, from the first digit to the last digit, is present.
[0011] Preferably, the parsed firmware data is written sequentially to the storage area and combined to form the upgrade file for firmware upgrade, specifically including: Obtain the serial number of the firmware data; the serial number includes a start symbol and a stop symbol, the start symbol being the first character of the serial number and the stop symbol being the last character of the serial number; Identify the serial number and write the corresponding firmware data into the storage area one by one; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file reception is completed when and only when the serial number is detected to be full and a start symbol and an end symbol are present. The firmware data written into the storage area is defined as forming the upgrade file. The upgrade file includes a serial number and the firmware data associated with it. The upgrade file is overwritten to the runtime area, specifically including: The serial numbers in the storage area are detected and identified, and an overwrite order for calling firmware data is generated. The overwrite order includes all the serial numbers in the storage area and they are arranged in an orderly manner. The firmware data is called one by one according to the overwrite order and overwritten to the running area until the firmware data associated with the termination symbol is called and overwritten to the running area.
[0012] Preferably, when performing defect detection, it also includes: When a missing sequence number is detected and a stop symbol is present, the data transmission status of the communication port is checked: If data transmission is still ongoing, wait for the transmission to complete before re-performing the missing data detection. If no data is transmitted, the missing detection is responded to immediately; The response to the missing detection specifically includes: Obtain the missing sequence number, send missing information based on the missing sequence number, the missing information includes the missing sequence number, the missing information is used to trigger the host computer to re-acquire upgrade data, and resend the communication data frame with the corresponding sequence number to the electric drive device through the communication port.
[0013] Secondly, embodiments of this application provide an electric drive firmware burning and upgrading device, the device comprising: Port configuration module: Configures communication ports and communication protocols based on the control bus of the electric drive device; the communication port is used to transmit upgrade data; the communication protocol is used to read upgrade data and package it into communication data frames; the upgrade data includes upgrade files for firmware upgrades and firmware version numbers extracted from the upgrade files; Data parsing module: acquires communication data from the communication port and parses out firmware data, writes the parsed firmware data into the storage area in an orderly manner, and combines them to form an upgrade file for firmware upgrade; the communication data is the communication data frame sent by the host computer to the electric drive device through the communication port. Upgrade overwrite module: In response to the formation of upgrade files in the storage area, it reads the upgrade files in the storage area and overwrites the upgrade files to the runtime area.
[0014] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method provided as in the first aspect or any possible implementation of the first aspect.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method provided as in the first aspect or any possible implementation thereof.
[0016] The beneficial effects of this invention are as follows: This invention relates to a method and apparatus for burning and upgrading firmware for electric drives. It utilizes the electric drive's own control bus interface to directly upgrade and update the firmware via communication, eliminating the need for a dedicated burning interface and additional hardware devices, thus simplifying the upgrade process for electric drives.
[0017] This invention enables firmware burning and updating via wired communication, requiring no additional wiring. The wired physical connection provides strong resistance to electromagnetic interference, making it suitable for industrial environments. It also features a low data error rate and significantly faster actual upgrade speed than Bluetooth. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart illustrating a method for burning and upgrading firmware for an electric drive, provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of an electric drive firmware burning and upgrading device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0020] Figure 4 This is a functional block diagram of an electric drive firmware burning and upgrading method provided in an embodiment of this application. Detailed Implementation
[0021] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0022] In the following description, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The following description provides multiple embodiments of this application, which can be substituted or combined with each other. Therefore, this application can also be considered to include all possible combinations of the same and / or different embodiments described. Thus, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then this application should also be considered to include embodiments containing one or more other possible combinations of A, B, C, and D, even if such embodiments are not explicitly described in the following text.
[0023] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the described elements without departing from the scope of this application. Various processes or components may be appropriately omitted, substituted, or added to the examples. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Furthermore, features described with respect to some examples may be combined into other examples.
[0024] See Figure 1 , Figure 1 This is a flowchart illustrating a method for flashing and upgrading firmware for an electric drive according to an embodiment of this application. In this embodiment, the method includes: S101. Configure communication ports and communication protocols based on the control bus of electric drive equipment; The communication port is used to transmit upgrade data; the communication protocol is used to read the upgrade data and package it into communication data frames; the upgrade data includes the upgrade file for firmware upgrade and the firmware version number extracted from the upgrade file.
[0025] The subject of this application can be an electric drive device that acquires communication data through a communication port and parses it to form an upgrade file, thereby realizing firmware upgrade.
[0026] Firmware files, such as bin files, for firmware upgrades can be obtained from a host computer or other terminal. The host computer or other terminal compiles the firmware file to form communication data frames that can be transmitted based on the communication protocol of the communication port, and then transmits them to the electric drive device.
[0027] In this application, the control bus is retained after the electric drive device is packaged. Firmware upgrades of the electric drive device are performed based on the control bus without opening the package structure of the electric drive device. Only an external interface needs to be configured based on the control bus. This interface is the communication port used to transmit upgrade data. The corresponding communication protocol can be configured for the communication port to limit the data structure and data format of the transmitted data. After receiving the transmitted data, the electric drive device can parse it to form an upgrade file for firmware upgrade. That is, the received data is restored to the original firmware file for firmware upgrade.
[0028] In this application, for ease of identification of file location and function, the firmware file obtained by the host computer can be referred to as the original file, i.e., the upgrade data; see reference. Figure 4 Specifically, it can be represented as a bin file used for firmware upgrades, i.e., firmware bin; the upgrade data includes at least the upgrade file used for firmware upgrades and the firmware version number extracted from the upgrade file.
[0029] like Figure 4 As shown, port 485 is selected as the communication port. The host computer compiles the original file / upgrade data into a data format that meets the requirements of the communication protocol, namely, a communication data frame. At this time, the upgrade data exists and is transmitted in the form of a communication data frame. In addition to the framed data packets containing the upgrade data, other conventional contents such as IP header, data checksum, and data start and end characters should also exist in the communication data frame, which has the necessary data structure to form a complete communication data frame.
[0030] Considering the practical situation, the firmware bin data may be large. Therefore, it can be divided into multiple data frames for transmission. After being transmitted to the electric drive device, the data frames are then merged to restore the firmware bin, so that the firmware bin can be obtained at the electric drive device and firmware upgrade can be achieved.
[0031] Data partitioning can be implemented based on communication protocols, determining the data volume of each frame and the sequence number for subsequent merging, thereby forming a communication data frame. Data transmission is then performed based on the communication data frame, and the firmware bin is transmitted to the electric drive device in frames.
[0032] In one possible implementation, the communication protocol may specifically include: A preset framing standard for communication data frames is defined as the amount of data contained in each frame. Read the upgrade data and perform frame segmentation on the upgrade data based on the frame segmentation standard to obtain multiple data frames; Based on the upgraded data, the multiple data frames obtained from the frame splitting process are sorted and verified to obtain the sequence number and check code of each data frame. Each data frame and its checksum are packaged according to the sequence number to obtain multiple orderly arranged communication data frames.
[0033] In this application, the host computer can obtain the firmware bin or store the firmware bin in the host computer. Then, the host computer connects to the 485 port to obtain its communication protocol. The host computer can perform frame processing on the firmware bin, dividing it into multiple data frames. Based on the firmware bin as upgrade data, the multiple data frames are sorted so that after the multiple data frames are arranged in order, they can correspond to the upgrade data, that is, obtain the same content as the upgrade data, thereby restoring the firmware bin for firmware upgrade.
[0034] In the embodiments of this application, framing can be performed in an orderly manner, and the sequence number associated with the data frame can be obtained at the same time as the framing is completed, without the need for further detection, identification, and verification of the sequence position of the data frame in the upgrade data.
[0035] However, for the sake of data frame integrity, data integrity verification can be performed after the framing process is completed. This specifically includes: Obtain the data frame corresponding to the target sequence number. Based on the target sequence number, retrieve the data frames corresponding to the previous and next sequence numbers. Merge the data frames of the three sequence numbers and compare them with the upgrade data. If they match, it means that the data frame corresponding to the target sequence number is complete and the frame segmentation process is complete. If they do not match, it means that the data frame corresponding to the target sequence number is incomplete and there is an error in the frame segmentation process.
[0036] It can complete the data frame corresponding to the target sequence number based on the data frames corresponding to the preceding and following sequence numbers.
[0037] It should be clarified that the upgrade data is processed into multiple data frames based on the framing standard. The framing standard can be used to characterize the maximum value of the communication data frame. The data volume of each data frame should be less than the framing standard. When performing framing processing, a redundancy ratio can be preset. With this redundancy ratio, framing processing is performed based on the possibility of data completion requirements, so that each data frame after framing will not completely occupy the framing standard of the communication data frame, and there is redundant space for adding data.
[0038] For example, the data volume of a data frame is 70% of the framing standard. When performing completion, a completion standard can be preset, and the completion standard can be increased to 90% of the framing standard. At this time, based on the framing standard, there is still enough redundancy space to configure a communication data frame with a complete data structure.
[0039] For example, when completing a data frame with a target sequence number, if the data volume of the data frame corresponding to the target sequence number is insufficient to complete the data frame even if the completion standard is met, the frame can be re-divided based on the three sequence numbers, and the excess data volume can be evenly distributed among the data frames corresponding to the three sequence numbers.
[0040] If, after equal distribution, the data volume of the data frames corresponding to the three sequence numbers exceeds the completion standard, a completion sequence number can be inserted. The completion sequence number is attached to the last sequence number among the three sequence numbers and does not occupy the normal order of the sequence numbers, that is, it does not disrupt the order of the subsequent sequence numbers.
[0041] Based on the completion standard, data is allocated to the three sequence numbers, and the remaining data is allocated to the completion sequence number, thus obtaining three data frames in the regular sorting and one completion data frame in the hanging state. The completion data frame is used to complete the data content missing in the data frames in the regular sorting.
[0042] When retrieving a data frame based on a sequence number, the sequence priority of the completed sequence number is only below the sequence number it is attached to. For example, when retrieving a data frame based on the regular sorting of sequence numbers, the sequence number in the regular sorting is retrieved first, and it is determined whether there is a completed sequence number below it. If it exists, first retrieve the data frame corresponding to the sequence number, and then retrieve the completion data frame corresponding to the completion sequence number below it, and complete the data through the completion data frame; If it does not exist, the next sequence number is retrieved based on the normal sorting, and the next frame of data is called. In this application, the data frame for completion can have the same data structure as the data frame in the regular sorting, differing only in the sequence number. Furthermore, completion detection can be performed after frame segmentation. If there are too many completion sequence numbers, frame segmentation can be performed again. The completion sequence number is generated based on its associated sequence number and can be considered as additional content of the data frame, used to complete any missing or omitted content that may exist in the frame segmentation process.
[0043] In the embodiments of this application, the check code can be obtained based on the data frame and is only used to ensure the integrity of the data frame. As one of the valid data contents of the communication data frame, it together with the data frame and the sequence number constitutes the data packet of the communication data frame. It can be distinguished from the check code of the communication data frame. The check code of the communication data frame can be used to ensure the legality and integrity of the communication data frame.
[0044] S102. Obtain the communication data from the communication port and parse out the firmware data. Write the parsed firmware data into the storage area in an orderly manner and combine them to form an upgrade file for firmware upgrade. Among them, the communication data refers to the communication data frames sent by the host computer to the electric drive device through the communication port.
[0045] In the embodiments of this application, data transmission may be performed simultaneously through multiple channels, and there may be delays in the parsing of firmware data, resulting in time delays in obtaining firmware data. On the electric drive device side, the firmware data may not be obtained in chronological order. Therefore, on the electric drive device side, the parsed firmware data cannot be arranged in strict order of installation time. It should be arranged and retrieved based on the serial number in order to synthesize the required upgrade file.
[0046] Therefore, the serial number can include a start symbol and a stop symbol, with the start symbol at the beginning and the stop symbol at the end. Simultaneously with acquiring the firmware data, the corresponding serial number can be parsed. Following normal order, when the stop symbol is acquired, it indicates that data transmission is complete, meaning all data frames included in the upgrade data have been transmitted. Based on the received firmware data, the upgrade file can be reconstructed.
[0047] In practice, the start symbol can be appended after the first sequence number and the stop symbol can be appended after the last sequence number to represent the start and end segments of the upgrade data. The start and stop symbols have the same nature as the sequence number and are both part of the data packet content of the communication data frame.
[0048] The electric drive equipment receives communication data from the communication port. The specific form of the communication data is frame-by-frame data, i.e., communication data frames. The data packet content in each frame is a data frame obtained by frame processing, along with its sequence number and check code. In addition, the data packet in the first frame also includes a start symbol, and the data packet in the last frame also includes a stop symbol.
[0049] In one possible implementation, acquiring communication data from the communication port and parsing out firmware data specifically includes: The communication data is acquired, and the communication data frame is extracted. The communication data frame includes a sequence number, a check code, and a data frame. Verify the checksum of the data frame based on the data frame: If the verification fails, a request message is sent back, which includes the serial number. The request message is used to trigger the host computer to reacquire the upgrade data and resend the communication data frame with the corresponding serial number to the electric drive device through the communication port. If the verification is successful, the data frame is parsed into firmware data, and the serial number is associated and bound with the parsed firmware data.
[0050] In this application, communication data is in units of frames, specifically in the form of communication data frames. The data packet of a communication data frame includes a sequence number, a checksum, and a data frame. The checksum serves the data frame to characterize the integrity of the data frame, not the communication data frame. The sequence number is used to characterize the position of the data frame in the upgrade data.
[0051] If the verification code fails, it indicates that the received data frame is incomplete. A request message can be sent back to the host computer to resend the data frame with the corresponding sequence number. During this process, the data is still sent in the form of a communication data frame.
[0052] Given this retransmission situation, the order of communication data frames may be disrupted, resulting in data frames not arriving at the electric drive device in the order of their sequence numbers. That is, the time order does not match the sequence number order. Therefore, it is necessary to call data frames by their sequence numbers.
[0053] It is understandable that when the host computer receives the request information from the electric drive device, it may re-acquire the upgrade data and perform frame segmentation processing for specific frames for the sake of data integrity, rather than performing frame segmentation processing based on the already acquired upgrade data.
[0054] For the framing of a specific frame, the preceding and following sequence numbers can be determined based on the sequence number in the request information. Then, the last address of the data frame corresponding to the preceding sequence number and the first address of the data frame corresponding to the following sequence number can be obtained. Data is extracted from the upgrade data based on the last and first addresses. The data content of the specific frame is generated based on the extracted data. Then, the data content of the specific frame is packaged to form a data frame corresponding to the specific sequence number, generating a communication data frame, which is then resent to the electric drive device.
[0055] In the embodiments of this application, after the electric drive device obtains communication data based on the communication port, the continuous communication data can be decomposed into a series of communication data frames. A data frame can be obtained based on each communication data frame, and the data frame can be parsed into firmware data. However, the firmware data is not a complete upgrade file. It is necessary to wait for all firmware data to be parsed before the firmware bin can be restored according to the serial number. At this time, the firmware bin has been transmitted to the electric drive device and can be referred to as the upgrade file.
[0056] The data frame is obtained based on the communication data frame, and then the data frame is parsed into firmware data. Due to the influence of the transmission rate of the communication port, the electric drive device obtains the firmware data one by one. Therefore, when writing the firmware data to the storage area, the firmware data itself does not have order. Although the firmware data has a serial number, if there is no comparison item for the serial number when writing, it does not have order. Therefore, when writing, it can be written in an ordered manner based on the serial number or written in an unordered manner based on the serial number. However, the integrity of the writing area should be guaranteed, rather than arbitrarily inserted. That is, after writing the firmware data, the writing area is locked, and no other content is inserted or written in the writing area.
[0057] In one specific embodiment, the writing of the firmware data can be ordered. In this case, the parsed firmware data is written to the storage area in an orderly manner and combined to form the upgrade file for firmware upgrade, specifically including: The serial number used to obtain firmware data; Identify the serial number and write the corresponding firmware data into the storage area in an orderly manner; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file is received only when the serial number is full and a start symbol and an end symbol are present. The firmware data written to the storage area is then combined in an orderly manner according to the serial number to form the upgrade file.
[0058] In this application, a full sequence number means that all sequence numbers from the first to the last exist.
[0059] In practical implementation, if ordered writing is required, the storage area can be partitioned into multiple ordered write partitions. Firmware data can then be written to these relatively independent write partitions. Furthermore, ordered writing can be based on either physical addresses or virtual addresses.
[0060] For example, if the serial number is known, firmware data can be written to the corresponding write partition based on the serial number. The addresses of the multiple write partitions divided within the storage area are fixed, and the concept of write partitions can be real. Regardless of whether the firmware data is parsed in order, the firmware data can be written to the corresponding partition. During the call, the firmware data can be obtained in an ordered manner by calling according to the address of the write partition, forming the required upgrade file.
[0061] For example, if the serial number is unknown, only one firmware data corresponding to the serial number can be written to each write partition. Then, the write partitions are sorted based on the serial number of the firmware data in the write partition. The addresses of the multiple write partitions in the storage area are variable, and the concept of write partitions can be virtual. When calling, the write partition is queried based on the serial number, and the contents in the corresponding partition are retrieved to obtain the ordered firmware data, forming the required upgrade file.
[0062] Of course, in the above examples, given the known serial number, it is more suitable to write the physical address in an ordered manner; when the serial number is unknown, it is more suitable to write the virtual address in an ordered manner.
[0063] In another feasible embodiment, the writing of the fixed data can be unordered. In this case, the parsed firmware data is written to the storage area in an ordered manner and combined to form an upgrade file for firmware upgrade, specifically including: The serial number used to obtain firmware data; Identify the serial number and write the corresponding firmware data into the storage area one by one; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file reception is completed when the serial number is full and a start symbol and an end symbol are present. The firmware data written into the storage area is defined as forming the upgrade file. The upgrade file includes the serial number and the firmware data associated with it.
[0064] In a specific embodiment, if the writing is out of order, the serial number of the firmware data can be used as a marker to write the parsed firmware data into the storage area in sequence. From an overall perspective, since the firmware data is obtained at different times, the writing order may be different, and the firmware data in the storage area may be out of order. However, due to the existence of the serial number as a marker, the ordered retrieval of the fixed data based on the serial number can also be achieved when calling, thereby obtaining the ordered firmware data and forming the required upgrade file.
[0065] In the embodiments of this application, a full sequence number means that all sequence numbers from the first to the last are present, while a missing sequence number means that there is a missing number in the sequence number order, that is, there is a missing number in the already sorted sequence number, and the non-sequence number is not in complete order compared to the complete arrangement.
[0066] In the embodiments of this application, missing data frames can be used to determine whether they are transmitted completely, and missing data frames can be retransmitted to ensure that all upgrade data is transmitted to the electric drive device.
[0067] In one specific embodiment, the missing detection process further includes: When a missing serial number is detected and a stop symbol is present, the data transmission status of the communication port is checked: If data transmission is still ongoing, wait for the transmission to complete before re-performing the missing data detection. If no data is transmitted, then respond to the missing detection. In this application, the response absence detection specifically includes: Obtain the missing sequence number, send missing information based on the missing sequence number, the missing information includes the missing sequence number, the missing information is used to trigger the host computer to re-acquire upgrade data, and resend the communication data frame with the corresponding sequence number to the electric drive device through the communication port.
[0068] In this application, a second layer of guarantee for data integrity is provided based on missing data detection. The first layer of guarantee is implemented by the checksum of the data frame and the feedback request information.
[0069] Missing data can be detected to determine if received data is missing. However, considering the data transmission speed and the delay caused by retransmission, the firmware data corresponding to the last serial number may have been parsed, while the data frames corresponding to other serial numbers may still be in transmission and have not been parsed. Therefore, when there is a missing serial number, the data transmission status of the communication port can be detected to avoid the redundant behavior of reporting missing information before the data transmission is completed.
[0070] In summary, in this application, after performing a missing data detection on the firmware data in the storage area, it can be determined that all upgrade data has been transmitted and that the storage area contains all the upgrade data, which can be used to form an upgrade file. The criterion for determining that an upgrade file has been formed is that the sequence number is full and a start symbol and an end symbol are present. All upgrade data has been received, that is, the upgrade file has been received, and the fixed data in the storage area can be combined to form a complete upgrade file for firmware upgrade.
[0071] S103. In response to the formation of an upgrade file in the storage area, read the upgrade file in the storage area and overwrite the upgrade file to the runtime area.
[0072] In the embodiments of this application, after determining that an upgrade file has been formed in the storage area, the upgrade file in the storage area can be read and overwritten to the runtime area to complete the upgrade.
[0073] In an embodiment of ordered writing, firmware data can be merged into a relatively independent upgrade file based on ordered data. During reading, this complete upgrade file can be read directly, rather than multiple ordered firmware data sets. During overwriting, a fast global overwrite is possible.
[0074] In the out-of-order write embodiment, the out-of-order firmware data is not merged into a relatively independent upgrade file, but the storage area already contains a complete upgrade file. That is, a complete upgrade file can be read from the storage area for firmware upgrade. Therefore, during reading, individual firmware data can be read based on the serial number, or multiple out-of-order firmware data can be merged into a relatively independent upgrade file based on the ordered serial number and stored in the storage area, so that a complete upgrade file can be read during reading.
[0075] For this implementation where single firmware data is read based on a serial number, the process of overwriting the upgrade file to the runtime area specifically includes: The serial numbers in the storage area are detected and identified, and an overwrite order for calling firmware data is generated. The overwrite order includes all the serial numbers in the storage area and they are arranged in an orderly manner. The firmware data is called one by one according to the overwrite order and overwritten to the running area until the firmware data associated with the termination symbol is called and overwritten to the running area.
[0076] Of course, when reading and overwriting a single firmware data, multiple firmware data can also be overwritten simultaneously based on the serial number, thereby improving overwriting efficiency.
[0077] In the embodiments of this application, when overwriting the upgrade file to the runtime area, the overwriting may fail. To address this, existing technologies often determine it as an upgrade failure and restore the runtime area to its pre-upgrade state, i.e., restore it to the pre-upgrade firmware version. Therefore, after the overwriting is completed, the success of the overwriting can be determined by checking the firmware version number of the power drive device, specifically including: Self-check the current version number of the firmware of the electric drive device; Obtain the firmware version number for this upgrade, and determine whether the current version number matches the firmware version number: If so, the upgrade was successful; If not, the upgrade fails, and an upgrade failure message is sent. The upgrade failure information is used to trigger the host computer to reacquire upgrade data and resend communication data frames to the electric drive device through the communication port.
[0078] Version number-based self-checks can determine whether an upgrade was successful after each upgrade. The entire process of communication data transmission and reception can be monitored via a host computer in log form, indicating successful or failed upgrades; and monitoring can also be implemented for data frame verification and duplicate transmissions.
[0079] This application employs a communication mechanism involving retransmission and data verification to ensure the reliability of equipment upgrades under complex operating environments. The communication status and upgrade results can be visualized and monitored via a host computer in log form. The host computer can be developed using Python, whose efficiency and readability facilitate subsequent maintenance, functional expansion, and customized communication protocol implementation, significantly reducing labor costs.
[0080] The following will be combined with the appendix Figure 2 This application provides a detailed description of the electric drive firmware burning and upgrading device provided in its embodiments. It should be noted that the appendix... Figure 2 The illustrated electric drive firmware burning and upgrade device is used to execute the present application. Figure 1 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figure 1 The example shown.
[0081] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of an electric drive firmware burning and upgrading device provided in an embodiment of this application. Figure 2 As shown, the device includes: Port configuration module 201: Configures communication ports and communication protocols based on the control bus of the electric drive device; the communication port is used to transmit upgrade data; the communication protocol is used to read upgrade data and package it into communication data frames; the upgrade data includes upgrade files for firmware upgrades and firmware version numbers extracted from the upgrade files; Data parsing module 202: acquires communication data from the communication port and parses out firmware data, writes the parsed firmware data into the storage area in an orderly manner, and combines them to form an upgrade file for firmware upgrade; the communication data is the communication data frame sent by the host computer to the electric drive device through the communication port. Upgrade overwrite module 203: In response to the formation of an upgrade file in the storage area, reads the upgrade file in the storage area and overwrites the upgrade file to the runtime area.
[0082] Those skilled in the art will clearly understand that the technical solutions of the embodiments of this application can be implemented by means of software and / or hardware. In this specification, "unit" and "module" refer to software and / or hardware that can independently complete or cooperate with other components to complete a specific function, wherein the hardware may be, for example, a field-programmable gate array (FPGA), an integrated circuit (IC), etc.
[0083] Each processing unit and / or module in the embodiments of this application can be implemented by an analog circuit that implements the functions described in the embodiments of this application, or by software that executes the functions described in the embodiments of this application.
[0084] See Figure 3 It shows a schematic diagram of the structure of an electronic device according to an embodiment of this application, which can be used to implement... Figure 1 The method in the illustrated embodiment. (As shown) Figure 3 As shown, the electronic device 300 may include: at least one central processing unit 301, at least one network interface 304, user interface 303, memory 305, and at least one communication bus 302.
[0085] The communication bus 302 is used to enable communication between these components.
[0086] The user interface 303 may include a display screen and a camera. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0087] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0088] The central processing unit 301 may include one or more processing cores. The central processing unit 301 connects to various parts within the electronic device 300 using various interfaces and lines. It executes various functions of the terminal and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and by calling data stored in the memory 305. Optionally, the central processing unit 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The central processing unit 301 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display on the screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the central processing unit 301 and may be implemented as a separate chip.
[0089] The memory 305 may include random access memory (RAM) or read-only memory. Optionally, the memory 305 may include a non-transitory computer-readable storage medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned central processing unit 301. Figure 3 As shown, the memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.
[0090] exist Figure 3In the illustrated electronic device 300, the user interface 303 is mainly used to provide an input interface for the user and to acquire user input data; while the central processing unit 301 can be used to call the power drive firmware burning and upgrade application stored in the memory 305, and specifically perform the following operations: The control bus of the electric drive device is configured with a communication port and a communication protocol; the communication port is used to transmit upgrade data; the communication protocol is used to read the upgrade data and package it into communication data frames; the upgrade data includes the upgrade file for firmware upgrade and the firmware version number extracted from the upgrade file. The system acquires communication data from the communication port and parses out firmware data. The parsed firmware data is then written into the storage area in an orderly manner and combined to form an upgrade file for firmware upgrade. The communication data consists of communication data frames sent by the host computer to the electric drive device through the communication port. In response to the creation of upgrade files in the storage area, the upgrade files in the storage area are read and overwritten to the runtime area.
[0091] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0092] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0093] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0097] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0098] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0099] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of embodiments of this disclosure upon considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described herein. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.
Claims
1. A method for burning and upgrading firmware for an electric drive, characterized in that, The method includes: The control bus of the electric drive device is configured with a communication port and a communication protocol; the communication port is used to transmit upgrade data; the communication protocol is used to read the upgrade data and package it into a communication data frame; the upgrade data includes an upgrade file for firmware upgrade and a firmware version number extracted from the upgrade file; The communication data of the communication port is obtained and the firmware data is parsed out. The parsed firmware data is written into the storage area in an orderly manner and combined to form the upgrade file for firmware upgrade. The communication data is the communication data frame sent by the host computer to the electric drive device through the communication port. In response to the formation of the upgrade file in the storage area, the upgrade file in the storage area is read and the upgrade file is overwritten to the runtime area.
2. The method according to claim 1, characterized in that, After overwriting the upgrade file to the runtime area, the process also includes: Self-check the current version number of the firmware of the electric drive device; Obtain the firmware version number for this upgrade, and determine whether the current version number matches the firmware version number: If so, the upgrade was successful; If not, the upgrade fails, and an upgrade failure message is sent. The upgrade failure information is used to trigger the host computer to reacquire upgrade data and resend communication data frames to the electric drive device through the communication port.
3. The method according to claim 1, characterized in that, The communication protocol specifically includes: A preset framing standard for communication data frames is defined as the amount of data contained in each frame. Read the upgrade data and perform frame segmentation on the upgrade data based on the frame segmentation standard to obtain multiple data frames; Based on the upgraded data, the multiple data frames obtained from the frame splitting process are sorted and verified to obtain the sequence number and check code of each data frame. Each data frame and its checksum are packaged according to the sequence number to obtain multiple orderly arranged communication data frames.
4. The method according to claim 1, characterized in that, Obtaining communication data from the communication port and parsing firmware data specifically includes: The communication data is acquired, and the communication data frame is extracted. The communication data frame includes a sequence number, a check code, and a data frame. Verify the checksum of the data frame based on the data frame: If the verification fails, a request message is sent back, which includes the serial number. The request message is used to trigger the host computer to reacquire the upgrade data and resend the communication data frame with the corresponding serial number to the electric drive device through the communication port. If the verification is successful, the data frame is parsed into firmware data, and the serial number is associated and bound with the parsed firmware data.
5. The method according to claim 4, characterized in that, The parsed firmware data is written sequentially to the storage area and combined to form the upgrade file used for firmware upgrades, specifically including: Obtain the serial number of the firmware data; the serial number includes a start symbol and a stop symbol, the start symbol being the first character of the serial number and the stop symbol being the last character of the serial number; Identify the serial number and write the corresponding firmware data into the storage area in an orderly manner; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file is received only when the serial number is full and a start symbol and an end symbol are present. The firmware data written to the storage area is then combined in an orderly manner according to the serial number to form the upgrade file. The term "full sequence number" specifically means that the entire sequence number, from the first digit to the last digit, is present.
6. The method according to claim 4, characterized in that, The parsed firmware data is written sequentially to the storage area and combined to form the upgrade file used for firmware upgrades, specifically including: Obtain the serial number of the firmware data; the serial number includes a start symbol and a stop symbol, the start symbol being the first character of the serial number and the stop symbol being the last character of the serial number; Identify the serial number and write the corresponding firmware data into the storage area one by one; Obtain the serial number of the firmware data written to the storage area and perform a missing number detection: The upgrade file reception is completed when and only when the serial number is detected to be full and a start symbol and an end symbol are present. The firmware data written into the storage area is defined as forming the upgrade file. The upgrade file includes a serial number and the firmware data associated with it. The upgrade file is overwritten to the runtime area, specifically including: The serial numbers in the storage area are detected and identified, and an overwrite order for calling firmware data is generated. The overwrite order includes all the serial numbers in the storage area and they are arranged in an orderly manner. The firmware data is called one by one according to the overwrite order and overwritten to the running area until the firmware data associated with the termination symbol is called and overwritten to the running area.
7. The method according to claim 5 or 6, characterized in that, Miss detection also includes: When a missing serial number is detected and a stop symbol is present, the data transmission status of the communication port is checked: If data transmission is still ongoing, wait for the transmission to complete before re-performing the missing data detection. If no data is transmitted, the missing detection is responded to immediately; The response to the missing detection specifically includes: Obtain the missing sequence number, send missing information based on the missing sequence number, the missing information includes the missing sequence number, the missing information is used to trigger the host computer to re-acquire upgrade data, and resend the communication data frame with the corresponding sequence number to the electric drive device through the communication port.
8. A power-driven firmware burning and upgrading device, characterized in that, include: Port configuration module: Configures communication ports and communication protocols based on the control bus of the electric drive equipment; The communication port is used to transmit upgrade data; The communication protocol is used to read upgrade data and package it into communication data frames; the upgrade data includes the upgrade file for firmware upgrade and the firmware version number extracted from the upgrade file; Data parsing module: acquires communication data from the communication port and parses out firmware data, writes the parsed firmware data into the storage area in an orderly manner, and combines them to form an upgrade file for firmware upgrade; the communication data is the communication data frame sent by the host computer to the electric drive device through the communication port. Upgrade overwrite module: In response to the formation of upgrade files in the storage area, it reads the upgrade files in the storage area and overwrites the upgrade files to the runtime area.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-7.