[go: up one dir, main page]

CN118394393B - IO module firmware updating method based on EtherCat coupler - Google Patents

IO module firmware updating method based on EtherCat coupler Download PDF

Info

Publication number
CN118394393B
CN118394393B CN202410840285.3A CN202410840285A CN118394393B CN 118394393 B CN118394393 B CN 118394393B CN 202410840285 A CN202410840285 A CN 202410840285A CN 118394393 B CN118394393 B CN 118394393B
Authority
CN
China
Prior art keywords
firmware
file
upgrade
updating
upgrading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410840285.3A
Other languages
Chinese (zh)
Other versions
CN118394393A (en
Inventor
郑金鑫
阚开放
夏红雨
侯峰
潘勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Shidian Electronic Technology Co ltd
Original Assignee
Nanjing Shidian Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Shidian Electronic Technology Co ltd filed Critical Nanjing Shidian Electronic Technology Co ltd
Priority to CN202410840285.3A priority Critical patent/CN118394393B/en
Publication of CN118394393A publication Critical patent/CN118394393A/en
Application granted granted Critical
Publication of CN118394393B publication Critical patent/CN118394393B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of equipment software upgrading, and provides an IO module firmware updating method based on an EtherCat coupler, which aims at the problems of high hardware cost and low upgrading success rate in the prior art, and the EtherCat coupler receives an updating file provided by a main station, repacks the updating file and prepares a firmware upgrading request file, and then the updating request file is sent out by connecting a plug-in type IO through a backboard bus; the EtherCat coupler sends a complete firmware upgrade package at a preset upgrade time; after checking, storing the firmware upgrade package in the partitioned space for decompression and upgrading; and after the upgrading is finished, modifying the execution area mark, and restarting the updated firmware program until the upgrading is successful. By adopting the technical scheme, the updating process is more safe and reliable, and the disastrous consequences of firmware updating failure caused by transmission or file storage can be effectively avoided.

Description

IO module firmware updating method based on EtherCat coupler
Technical Field
The invention relates to the technical field of equipment software upgrading, in particular to an IO module firmware updating method based on an EtherCat coupler.
Background
The plug-in IO product is input and output equipment widely used in the industrial automation field. It is usually composed of a bus coupler and a functional IO module, which can be connected to the bus coupler by means of a plug-in, so as to realize input and output of signals. With the function expansion and technology update of the plug-in type IO product, the system upgrade is required. For example, in the invention patent No. 202210606748.0, "a firmware upgrading method and device based on EtherCat communication driver", a firmware upgrading method and device based on EtherCat communication driver is disclosed, so that only firmware to be upgraded supporting the COE protocol supports the COE protocol and the FOE protocol simultaneously, the method adds the FOE protocol content in the original protocol stack, adds a flash read-write function interface by a bootstrap program, and writes the FOE protocol data into a flash memory through the flash read-write function interface; modifying the communication configuration XML file of the driver to be upgraded to support the FOE protocol; combining the bootstrap program and the firmware program through simulator software to generate a burning file; the programming is completed to download the guide program and the firmware program, so that the problems that in the prior art, firmware upgrading through a serial port cannot be operated or is difficult to operate on the site of equipment, extra tools and interfaces are needed to be carried, a reserved space is needed on a product, the cost is paid, and meanwhile, the transmission process cannot be interrupted, and an error correction mechanism is not needed are solved.
In fact, it can be seen from the patent that the conventional upgrading method of the insert type IO product mainly comprises two schemes of externally hanging an EEPROM or specially dividing a space from a storage unit in the MCU to access data. However, both of these methods have certain drawbacks: the traditional external EEPROM mode generally needs to detach the shell after the product is detached from the production line, and the new firmware is burnt by using the burner, so that the read-write interface between the MCU and the EEPROM is increased, the pin burden of the MCU is increased, the read-write speed of data is reduced, and the power consumption is increased. The internal memory unit is divided for the operation data, so that the memory space of the program code is greatly reduced, and the operations of reading, writing, erasing and the like of the memory space are relatively complex, and special care is needed to avoid the loss of the useful program code caused by misoperation. More importantly, in both modes, a dedicated burner and burning software, i.e. the emulator software mentioned in the prior art, need to be updated, so that the overall operation is difficult, and the operation must be performed by a professional, and the updating efficiency is low.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide an IO module firmware updating method based on an EtherCat coupler, which simplifies the operation of staff during firmware updating and saves hardware cost. But also introduces a safer mechanism to avoid the risks that may be brought during the upgrade process.
In order to achieve the purpose, the IO module firmware updating method based on the EtherCat coupler is used for updating the inserted sheet IO connected to the EtherCat coupler through the backboard bus, and operates according to the following steps,
S1: the master station of the production line issues a new firmware file to the EtherCat coupler;
S2: the EtherCat coupler receives the file, repacks the file and produces a firmware upgrading request file, and the EtherCat coupler sends the firmware upgrading request file through a backboard bus connection plug-in IO;
S3: MCU module in plug-in IO obtains specific time of firmware upgrade selected after the firmware upgrade request, and divide out the correspondent space according to the firmware upgrade request;
S4: in a preset upgrading time, the EtherCat coupler sends a complete firmware upgrading packet through a backboard bus;
s5: the MCU module checks after receiving the request of the firmware upgrade package, stores the firmware upgrade package in the partitioned space for decompression and upgrading after checking without errors;
S6: after the upgrading is finished, modifying the execution area mark, and restarting to run the updated firmware program;
S7: judging that the upgrade is successful, otherwise, re-decompressing the firmware upgrade package and executing S6 again; if the updating still fails, the updating failure is recorded and the original firmware program is marked as an execution area again.
Preferably, the master station in S1 transmits the complete upgrade file group and the upgrade code to the EtherCat coupler through the FOE. The complete upgrade file set contains new version data for the firmware, application programs, or other software components, as well as associated metadata and description. These files define the content and purpose of the upgrade. And the upgrade code is an auxiliary script for realizing the upgrade process. Because the upgrade passes through the EtherCat coupler, but firmware or a program of the EtherCat coupler also needs to be upgraded, under the condition that the built-in program of the EtherCat coupler cannot be updated in time, the information in the upgrade file group can be read through the upgrade code of the EtherCat coupler, and the upgrade operation is executed according to preset logic and steps. The upgrade code can assist in ensuring the integrity and accuracy of the transmission of the complete upgrade file group, and is particularly suitable for scenes with high requirements on reliability.
Preferably, the firmware upgrade request in S2 includes a hardware configuration requirement, verification information, an upgrade total duration based on the hardware configuration requirement, and an acceptable upgrade start time, where the hardware configuration requirement includes a hardware model type and an upgrade file size corresponding to the upgrade. The invention respectively sends the firmware upgrading request and the firmware upgrading packet, which can ensure that the firmware is suitable for updating, and can not be found out to be unable to be updated after the firmware upgrading packet is downloaded.
Preferably, the verification information includes a first verification code included in the firmware upgrade request, a second verification code when the firmware upgrade packet is sent, and a verification code calculated based on the first verification code and the second verification code. The manner in which new check codes are formed is common in the art, such as parity check (PARITY CHECK), modulo check, cyclic Redundancy Check (CRC), and the like. The MCU can also be adjusted at any time during verification, so that the information of the final verification code is changed. Therefore, even if other people acquire the first verification code and the second verification code, the finally adopted verification code cannot be directly deduced.
Preferably, the memory area of the tab IO is divided into three areas, which are specifically a first area for storing a boot program, a second area for storing upgrade configuration and related records, and a third area serving as a working area; and when the firmware upgrading request file is received and the residual space is judged to be sufficient, dividing a temporary area in the third area. Although divided into three regions, the three regions are different in size, the first region is set based on the size of the boot program basically and has a certain redundancy. The second area is very small, and in the present invention, only two pages are usually occupied, while the remaining space is the third area, and the starting position of the third area has a program upgrade flag bit.
Preferably, the MCU performs the division of the temporary area, after the MCU obtains the firmware upgrading request file, firstly compiling the firmware corresponding to the Bootloader program in the update, and recording the size of the firmware; under the condition that the space occupied by a Bootloader program is sufficient, the MCU acquires the total residual capacity of the flash of the plug-in type IO from configuration information stored in a second area, the partition capacity of each area, the standard capacity of each paging in the partition and Bootloader firmware information, and the partition configuration of the flash is automatically carried out by combining with the volume information of an upgrade package recorded in a firmware upgrade request file; the configuration information is stored in the second area, and the starting position of the temporary area is marked in the third area according to the configuration information. The determination in the middle of the operation process is completed by the MCU, so that even a non-professional operator can realize the update.
Preferably, the space size of the temporary area is sufficient to store the firmware upgrade package and upgrade program codes decompressed from the firmware upgrade package simultaneously; a start address pointer is provided for each of the two parts of content. Therefore, enough space is available, and the update compression packet does not need to be deleted after the update is finished, so that once an abnormality occurs in the decompression process, the retry can be performed in a mode of re-decompression, and the success rate of the update is improved. The starting address pointer is set to facilitate finding the specified location among other actions.
Preferably, after receiving the firmware upgrade packet, the MCU module locates a stack top address according to the configuration information, and judges whether a subsequent initial address is legal or not based on the stack top address; after confirming that the starting address is legal, the boot program downloads, decompresses and configures the firmware upgrade package, and then jumps the program to the program reset address. Thus, the storage space in the flash can be more effectively utilized.
Preferably, when no corresponding address is found in the process of judging whether the subsequent initial address is legal, the stack top address is offset and then readdressed; and when the legal starting address cannot be found again, reporting errors and stopping the updating. Because the location of the area may still change before the update, such address changes are recorded in the run record of the second area, and the MCU may be re-addressed according to the contents of the run record. However, if the legal starting address still cannot be found, the update can only be stopped.
Preferably, after S7 confirms that the update is successful, the area occupied by the actually running firmware program is marked as the first area, and the partition mark where the old version firmware program is located is deleted. This also eliminates the step of erasing the original program. The partition flag is removed and new content may directly cover this space later, if desired.
The invention selects plug-in IO updating based on the EtherCat coupler because the EtherCat coupler supports FOE, which leads the file transmission in the updating process to have great flexibility and reliable transmission.
By the technical scheme, the invention mainly has the following technical effects:
1. The whole upgrading process does not need an additional plug-in memory, and meanwhile, a temporary storage space replacement mode is adopted instead of a fixed replacement space mode common in the prior art, so that the storage space occupied by the updating is more flexible.
2. In the upgrading process, not only is the transmission of the firmware checked, but also a process of integrally checking the upgraded firmware is added in the bootstrap program, so that the failure of the upgraded firmware caused by transmission or file storage can be effectively avoided, and the original firmware can not only be failed to be upgraded, but also the unrecoverable disastrous result can be avoided.
3. The upgrade firmware is encrypted, decrypted in the boot program and updated to the application area. This effectively guarantees the intellectual property rights of the firmware owners. The third party cannot use the correct check code even if he gets up to the upgraded firmware.
By the technical scheme, the only disadvantage is that the self-provided flash memory total amount of the plug-in IO is required, otherwise, the mode recorded by the invention cannot be used.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention.
Fig. 1 is: the invention discloses a flow diagram of an IO module firmware updating method based on an EtherCat coupler.
Fig. 2 is: the EtherCat coupler repacks the flow diagram of the new firmware file.
Fig. 3 is: a flash structure schematic diagram of an inserting type IO in the prior art.
Fig. 4 is: the invention discloses a flash structure diagram adopted by an IO module firmware updating method based on an EtherCat coupler.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant content and not limiting of the present disclosure.
The invention is realized based on the large trend that the built-in flash capacity of the MCU in the prior art is gradually increased, and the space occupied by the updated file is gradually reduced due to the optimization of the program.
The invention discloses an IO module firmware updating method based on an EtherCat coupler, and the adopted updating method is also based on built-in flash of an MCU. Since the built-in flash of the MCU takes a Block or a Page as a minimum erasure unit, the size of the Block or the Page of the actual MCU must be considered when dividing the built-in flash space of the MCU. The area is divided, the built-in flash size of the MCU adopted in this embodiment is 256KB, the minimum Page (Page) is 4KB, and the minimum Block (Block) is 32KB.
DATA FLASH erase operations can only be in BLOCK units, and do not support single word or single byte erase. It is impossible to write data each time in a memory location corresponding to a fixed physical address when there is a piece of data of several bytes in length to be written DATA FLASH, but it is necessary to write in a new empty memory location. This means that the user must have an addressing function when designing the memory structure of DATA FLASH.
Furthermore DATA FLASH, only 1 BLOCK is active at the same time, and is active, while another BLOCK is not accessible and is inactive. Conventionally, we often refer to a BLOCK of DATA FLASH as a BLOCK, and when a valid BLOCK is full of data, it is only necessary to write in the next BLOCK if the data is written next, and it is also necessary to copy other data items useful in the previous BLOCK into the next BLOCK, mark the next BLOCK as the current valid BLOCK, mark the previous BLOCK as an invalid BLOCK, that is, there must be a DATA FLASH BLOCK mark and BLOCK mechanism.
In EtherCat technology, FOE (FILE ACCESS over EtherCat) is a special communication protocol that allows file access, uploading and downloading over EtherCat networks. Specifically, the FOE function enables a master (e.g., PC or controller) to access the memory of an EtherCat slave (e.g., IO module, servo driver, etc.) to read or write firmware, configuration files, or other data. In summary, the code and complete upgrade file group of the EtherCat coupler support the FOE function, so that a master station in the EtherCat network can directly access the memory of a slave station through the network, and perform file uploading, downloading and other file operations. This is important for tasks such as configuration of the device, firmware upgrades, troubleshooting, etc.
The EtherCat coupler described in the present invention is a key component in EtherCat networks that allows multiple slave devices to be connected in a single EtherCat network. The EtherCat coupler code and complete upgrade file set may contain support for the FOE functions to ensure that these devices can respond to FOE requests and perform file access operations properly.
The complete upgrade file set comprises an XML format file, which describes the equipment information of the EtherCat slave station, including equipment types, communication parameters, supported protocols and other relevant information.
As shown in fig. 1, the specific method for connecting the plug-in type IO on the EtherCat coupler through the backplane bus and performing firmware upgrade on the plug-in type IO according to the present invention operates according to the following steps,
S1: the master station of the production line issues a new firmware file to the EtherCat coupler;
S2: the EtherCat coupler receives the file, repacks the file and produces a firmware upgrading request file, and the EtherCat coupler sends the firmware upgrading request file through a backboard bus connection plug-in IO;
The step of repackaging the EtherCat coupler after receiving the file is very important, because the new firmware files carried in the complete upgrade file group sent by the master station need to be compatible with different types, patch-type IOs of different interfaces, and all the possibilities are covered, so that the whole file capacity is larger. However, in the specific embodiment of the present invention, the upgrade needs to be performed without adding an external memory in the limited flash space of the MCU module in the plug-in IO, so that the volume of the firmware file actually written into the flash needs to be reduced as much as possible. And the EtherCat coupler can acquire the attribute and the equipment state information of all patch IOs to which the EtherCat coupler is connected. Therefore, the EtherCat coupler receives the file and repacks the file according to the attribute of the connected inserted sheet IO, and the volume of the updated firmware file can be reduced as much as possible on the premise of ensuring successful updating of the firmware.
As shown in fig. 2, the process of repackaging a specific plug-in type IO module after the EtherCat coupler obtains a new firmware file included in the complete upgrade file group generally involves the following steps:
1. and (3) verifying a firmware file: the EtherCat coupler verifies the integrity, version number, and compatibility of the firmware file before any processing takes place. This is typically done by checking the signature, checksum, or comparison of the new firmware file with the last successfully acquired firmware version.
2. After the verification of the firmware file, the firmware file analysis is carried out: the portion thereof associated with the patch IO module connected to the EtherCat coupler is identified. And simultaneously, the format, structure and content of the firmware file are unloaded so as to be correctly processed later.
3. Device identification and matching: the EtherCat coupler identifies the model number, serial number, or other unique identifier of the patch IO module to which it is connected. And confirming the specific plug-in IO related to the firmware update, and matching the update content analyzed from the new firmware file with the configuration and specification of the specific devices.
4. Customizing firmware content: the EtherCat coupler may adjust the content in the firmware file according to the model, configuration and specification of the patch IO module. This includes, but is not limited to, modifying specific parameter settings, updating identification information of the device, or adding specific function codes. After the customization of the firmware content is completed, the EtherCat coupler repacks the modified firmware content into a new firmware file. This file will be dedicated to updating a specific patch IO module.
After repacking of the plug-in IO module is completed, a firmware upgrading request file is automatically generated, wherein the firmware upgrading request file comprises the volume size of the repacked single firmware upgrading file and the information of the content contained in the single firmware upgrading file. Since the firmware upgrade request file includes only the information of the firmware upgrade and does not include the code of the specific firmware upgrade, this file is small in size. The firmware upgrade request file comprises a first verification code.
S3: MCU module in plug-in IO obtains specific time of firmware upgrade selected after the firmware upgrade request, and divide out the correspondent space according to the firmware upgrade request; on one hand, the reservation of specific time avoids the influence on the normal service of the plug-in IO by inserting the update when the plug-in IO performs busy work; on the other hand, the specific space can be divided on the corresponding flash for storing the firmware file updated at the time.
S4: in a preset upgrading time, the EtherCat coupler sends a complete firmware upgrading packet through a backboard bus; the firmware upgrade package contains a second verification code.
S5: the MCU module checks after receiving the request of receiving the firmware upgrade package, and the MCU module respectively sends a first verification code and a second verification code through the firmware upgrade request file and the firmware file before; after the generation mode of the verification code is obtained, the obtained verification code can be calculated according to the first verification code and the second verification code. The manner in which new check codes are formed is common in the art, such as parity check (PARITY CHECK), modulo check, cyclic Redundancy Check (CRC), and the like. The MCU can also be adjusted at any time during verification, so that the information of the final verification code is changed. And feeding the check code back to the EtherCat coupler to obtain the authority of final upgrading. After the check code is checked to be correct, the firmware upgrade package is stored in the divided space to be decompressed and upgraded.
S6: after the upgrading is finished, modifying the execution area mark, and restarting to run the updated firmware program; after the upgrading is finished, the original file is not required to be deleted; and only the execution area mark is required to be adjusted, so that the configuration stored in the updated position is ensured to be started after restarting.
S7: after the updated plug-in IO is put into operation, the operation is normal, if the update is successful, otherwise, the updating package is decompressed again to execute S6 again; if the updating still fails, the updating failure is recorded and the original firmware program is marked as an execution area again. Therefore, even if the updating fails, the continuous use of the plug-in IO is not affected.
Fig. 3 shows a flash structure in the prior art. Fig. 4 is a schematic diagram of a flash structure adopted in the present invention, and it can be seen that the storage area of the insert-type IO in the present invention is divided into three areas, specifically, a first area for storing a boot program, a second area for storing an upgrade configuration and related records, and a third area serving as a working area. And when the firmware upgrading request file is received and the residual space is judged to be sufficient, dividing a temporary area in the third area. Although divided into three regions, the three regions are different in size, the first region is set based on the size of the boot program basically and has a certain redundancy. In this embodiment, the bootstrap program occupies one block, i.e., 32KB of space. The second area is very small and typically occupies only two pages, i.e., 8KB of space in the present invention. So 8KB is sufficient to store a large amount of system information and up to date several firmware upgrade request files. The remaining space is a third area, and the third area is provided with a corresponding starting position according to the position of the stack top, and the starting position is provided with a starting mark position. After the MCU acquires the new firmware upgrading request file, the division of the temporary area is executed after the verification is completed. After the MCU obtains the firmware upgrade request file, firstly compiling the firmware corresponding to the Bootloader program in the update, and recording the size of the firmware; under the condition that the space occupied by a Bootloader program is sufficient, the MCU acquires the total residual capacity of the flash of the plug-in type IO from configuration information stored in a second area, the partition capacity of each area, the standard capacity of each paging in the partition and Bootloader firmware information, and the partition configuration of the flash is automatically carried out by combining with the volume information of an upgrade package recorded in a firmware upgrade request file; the configuration information is stored in the second area, and the starting position of the temporary area is marked in the third area according to the configuration information. The determination in the middle of the operation process is completed by the MCU, so that even a non-professional operator can realize the update.
The startup procedure specified by the MCU startup file has two steps. The following are provided:
1) And positioning the stack top address, and judging whether the initial position is legal or not according to the stack top address. In the present invention the top of stack address is kept at 0x08000000, but an offset is needed if the address changes. Whether offset is performed or not, a start address pointer needs to be set at an initial position, so that later positioning is facilitated.
The distinction between the lower stack top address and the starting address is described herein, and the stack top address refers to the memory address where the last element in the stack structure is located. During the growth of the stack, new elements are always added to the top of the stack, and the address of the top of the stack changes. And the start address refers to the memory address at the beginning of the stack structure (i.e., the bottom of the stack). It identifies the start position of the stack, which is the memory address occupied by the first element or potential first element in the stack. The start address remains unchanged throughout the life cycle of the stack.
According to the above requirements, we need to store at least two programs in flash, one is a boot loader (bootstrap) and the other is an application (app). Bootloader programs are at the entry address of the MCU and APP programs are at the back of Bootloader. Because unexpected situations need to be prevented during upgrading, a blank area needs to be reserved for storing the upgraded firmware. For the division of three areas, the existing MCU partition software is adopted for realizing. Firstly, compiling firmware corresponding to a Bootloader program, and recording the size of the firmware. The MCU partitioning tool automatically acquires the size of the residual storage space of the MCU flash, the page size and the size information of the Bootloader firmware, and directly generates partition configuration information of the flash. The Bootloader program is recompiled and the APP program is compiled using this configuration information.
2) After receiving the firmware, the plug-in IO firstly checks whether the information of the firmware package is matched with the module type of the current IO, if not, the plug-in IO directly returns an error, and if so, the plug-in IO continues to receive the firmware and stores the firmware into a new area marked in a third area. After the firmware is received, the basic information of the firmware is written into the designated address of the flash and the upgrading flag bit is set. And finally actively resetting IO. The program is jumped to the program reset address and the reset entry address information is stored at 0x08000004. Setting generally refers to the process of changing a bit or flag from 0 to 1, i.e., changing the value on the corresponding bit to a valid value. Setting the upgrade flag bit in the present invention refers to setting the storage space state to an upgrade state.
After the power is turned on again, the boot program detects the program upgrading zone bit, reads the new firmware from the new area marked in the third area through the read flash interface, and normally operates the new firmware program according to the new mark position.
After the reset is successful, the program first executes the boot program of the first region. This is performed from the first zone location based on the MCU default, if manual guidance is required, by the designated zone. The bootstrap program firstly judges whether the upgrade flag bit is set, and if not, the bootstrap program directly jumps to the application program. If the program upgrading flag bit is set, the boot program starts to sub-package and sequentially reads the upgrading firmware of the new area marked in the third area of the flash. And calculating whether the file check code of the upgraded firmware is correct according to a pre-designed checking rule. And after the updating firmware compression packet is correct, decrypting the updating firmware compression packet and updating the updating firmware compression packet to a new area marked in a third area of the flash in sequence. The initial marker bits of the compressed packets and decompressed files are different and can be quickly located by the start address pointer. After the decryption and updating operations are completed, the original firmware is not required to be deleted, and only the program upgrading flag bit is required to be set. Restarting the inserted-sheet IO, and if the inserted-sheet IO can normally work after starting, finishing the upgrading process of the inserted-sheet IO. If the normal work cannot be performed after restarting, the work of decompressing and installing the updated firmware compression package is needed to be performed again, and the normal work still cannot be restarted after repeating once, the marking bit is modified to the firmware file before updating, and updating fails. This information of update failure is recorded in the second area and sent back to the EtherCat coupler, which facilitates the next update. As shown in fig. 1, in such a case, no matter whether the upgrade is successful or not, the end use of the tab IO is not affected.
The invention is suitable for various inserted sheet type IO connected to EtherCat coupler, but the built-in flash capacity of MCU of the inserted sheet type IO adopting the method of the invention is usually not less than 128KB.
While the application has been described in terms of preferred embodiments, it is not intended to limit the scope of the application. It is intended that all modifications within the scope of the application, i.e., all equivalents thereof, be embraced by the application as they come within their scope without departing from the application. In the description of the present specification, reference to the terms "one embodiment/manner," "some embodiments/manner," "example," "a particular example," "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment/manner or example is included in at least one embodiment/manner or example of the application. In this specification, the schematic representations of the above terms are not necessarily for the same embodiment/manner or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments/modes or examples. Furthermore, the various embodiments/modes or examples described in this specification and the features of the various embodiments/modes or examples can be combined and combined by persons skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
It will be appreciated by those skilled in the art that the above-described embodiments are merely for clarity of illustration of the disclosure, and are not intended to limit the scope of the disclosure. Other variations or modifications will be apparent to persons skilled in the art from the foregoing disclosure, and such variations or modifications are intended to be within the scope of the present disclosure.

Claims (9)

1. An IO module firmware updating method based on an EtherCat coupler is used for upgrading an inserted sheet IO connected to the EtherCat coupler through a backboard bus, and is characterized in that: the operation is performed in accordance with the following steps,
S1: the master station of the production line issues a new firmware file to the EtherCat coupler;
s2: the EtherCat coupler repacks and makes a firmware upgrade request file after receiving the file, and the repacking process involves the following steps:
and (3) verifying a firmware file: before any processing is performed, the EtherCat coupler verifies the integrity, version number and compatibility of the firmware file;
after the verification of the firmware file, the firmware file analysis is carried out: identifying the part related to the inserted sheet type IO module connected to the EtherCat coupler, and simultaneously analyzing the format, structure and content of the firmware file so as to enable the subsequent processing to be correctly performed;
device identification and matching: the EtherCat coupler identifies the model, serial number or other unique identifier of the inserted-sheet type IO module connected to the EtherCat coupler, confirms the specific inserted-sheet type IO related to the firmware update, and matches the update content analyzed from the new firmware file with the configuration and specification of the specific devices;
Customizing firmware content: according to the model, configuration and specification of the plug-in IO module, the EtherCat coupler adjusts the content in the firmware file; this includes, but is not limited to, modifying specific parameter settings, updating identification information of the device, or adding specific functional code, after the customization of the firmware content is completed, the EtherCat coupler repackages the modified firmware content into a new firmware file, which is to be used specifically for updating the specific tab IO module;
After repacking is completed on the plug-in IO module, automatically generating a firmware upgrading request file, wherein the firmware upgrading request file comprises the volume size of a single repacked firmware upgrading file and the information of the content contained in the single firmware upgrading file; the EtherCat coupler sends out a firmware upgrading request file through a backboard bus connection patch IO;
S3: MCU module in plug-in IO obtains specific time of firmware upgrade selected after the firmware upgrade request, and divide out the correspondent space according to the firmware upgrade request; the memory area of the inserted-sheet IO is divided into three areas, namely a first area for storing a bootstrap program, a second area for storing upgrade configuration and related records and a third area serving as a working area; after receiving the firmware upgrading request file and under the condition that the residual space is judged to be sufficient, dividing a temporary area in a third area;
S4: in a preset upgrading time, the EtherCat coupler sends a complete firmware upgrading packet through a backboard bus;
S5: the MCU module checks after receiving the request of the firmware upgrade package, stores the firmware upgrade package in the divided space for decompression and upgrading after checking;
S6: after the upgrading is finished, modifying the execution area mark, and restarting to run the updated firmware program;
S7: judging that the upgrade is successful, otherwise, re-decompressing the firmware upgrade package and executing S6 again; if the updating still fails, the updating failure is recorded and the original firmware program is marked as an execution area again.
2. The method for updating the firmware of the IO module based on the EtherCat coupler, as set forth in claim 1, is characterized in that: and in the S1, the master station transmits the complete upgrade file group and the upgrade code to the EtherCat coupler through the FOE.
3. The method for updating the firmware of the IO module based on the EtherCat coupler, as set forth in claim 1, is characterized in that: the firmware upgrade request in S2 includes a hardware configuration requirement, verification information, an upgrade total duration based on the hardware configuration requirement, and an acceptable upgrade start time, where the hardware configuration requirement includes a hardware model type corresponding to the upgrade and an upgrade file size.
4. The IO module firmware updating method based on the EtherCat coupler as claimed in claim 3, wherein: the verification information comprises a first verification code contained in the firmware upgrading request, a second verification code when the firmware upgrading packet is sent, and a verification code calculated based on the first verification code and the second verification code.
5. The method for updating the firmware of the IO module based on the EtherCat coupler, as set forth in claim 1, is characterized in that: the MCU executes the division of the temporary area, after the MCU obtains the firmware upgrading request file, firstly compiling the firmware corresponding to the Bootloader program in the update, and recording the size of the firmware; under the condition that the space occupied by a Bootloader program is sufficient, the MCU acquires the total residual capacity of the flash of the plug-in type IO from configuration information stored in a second area, the partition capacity of each area, the standard capacity of each paging in the partition and Bootloader firmware information, and the partition configuration of the flash is automatically carried out by combining with the volume information of an upgrade package recorded in a firmware upgrade request file; the configuration information is stored in the second area, and the starting position of the temporary area is marked in the third area according to the configuration information.
6. The method for updating the firmware of the IO module based on the EtherCat coupler according to claim 1 or 5 is characterized in that: the space size of the temporary area meets the requirement of simultaneously storing a firmware upgrade package and upgrade program codes decompressed from the firmware upgrade package; a start address pointer is provided for each of the two parts of content.
7. The IO module firmware updating method based on the EtherCat coupler as set forth in claim 6, wherein: after receiving the firmware upgrade packet, the MCU module locates a stack top address according to configuration information and judges whether a subsequent initial address is legal or not based on the stack top address; after confirming that the starting address is legal, the boot program downloads, decompresses and configures the firmware upgrade package, and then jumps the program to the program reset address.
8. The method for updating the firmware of the IO module based on the EtherCat coupler, as claimed in claim 7, is characterized in that: when no corresponding address is found in the process of judging whether the subsequent initial address is legal or not, the stack top address is subjected to offset and then readdrew; and when the legal starting address cannot be found again, reporting errors and stopping the updating.
9. The method for updating the firmware of the IO module based on the EtherCat coupler, as set forth in claim 1, is characterized in that: and S7, marking the area occupied by the actually operated firmware program as a first area after the successful updating is confirmed, and deleting the partition mark of the old version firmware program.
CN202410840285.3A 2024-06-27 2024-06-27 IO module firmware updating method based on EtherCat coupler Active CN118394393B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410840285.3A CN118394393B (en) 2024-06-27 2024-06-27 IO module firmware updating method based on EtherCat coupler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410840285.3A CN118394393B (en) 2024-06-27 2024-06-27 IO module firmware updating method based on EtherCat coupler

Publications (2)

Publication Number Publication Date
CN118394393A CN118394393A (en) 2024-07-26
CN118394393B true CN118394393B (en) 2024-10-11

Family

ID=91989267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410840285.3A Active CN118394393B (en) 2024-06-27 2024-06-27 IO module firmware updating method based on EtherCat coupler

Country Status (1)

Country Link
CN (1) CN118394393B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119939609B (en) * 2025-04-08 2025-07-01 深圳市矩控新辰科技有限公司 Encryption firmware upgrading method, device, equipment and storage medium based on EtherCAT

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450763A (en) * 2018-12-29 2019-03-08 上海新时达机器人有限公司 A kind of bus expanding method, gateway and extended bus system
CN110545319A (en) * 2019-08-23 2019-12-06 武汉久同智能科技有限公司 design of SoC core system and method for realizing task communication between cores

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111198698B (en) * 2018-11-16 2023-04-18 上海安浦鸣志自动化设备有限公司 EtherCAT-based multi-device firmware program parallel downloading method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450763A (en) * 2018-12-29 2019-03-08 上海新时达机器人有限公司 A kind of bus expanding method, gateway and extended bus system
CN110545319A (en) * 2019-08-23 2019-12-06 武汉久同智能科技有限公司 design of SoC core system and method for realizing task communication between cores

Also Published As

Publication number Publication date
CN118394393A (en) 2024-07-26

Similar Documents

Publication Publication Date Title
KR100584338B1 (en) Software update method and system
JP2914360B2 (en) External storage device and data processing method
CN102124447B (en) Control device for vehicle and method for updating data of vehicle control device
TWI384367B (en) System of updating firmware and method thereof
KR100987628B1 (en) Firmware update method of embedded controller and firmware storage medium for update
CN109189445B (en) Method for upgrading program of equipment of Internet of things
CN110096300B (en) FPGA program file backup management system, operation method and upgrading method
CN113064604B (en) Firmware upgrading method and device
US20110004871A1 (en) Embedded electronic device and firmware updating method thereof
US20070226400A1 (en) Information processing apparatus and method of using otp memory
US20130067455A1 (en) Memory online update system and method
CN118394393B (en) IO module firmware updating method based on EtherCat coupler
JP4482029B2 (en) Radio base station and radio base station operation method
CN111813597A (en) Air conditioner
WO2006107086A1 (en) Storage device, memory managing apparatus, memory managing method, and program
CN117407020A (en) OTA upgrade refreshing method and device, electronic equipment and storage medium
CN115794188A (en) Firmware upgrading method and device based on USB DFU equipment and storage medium
CN119537253A (en) Application software validity verification method based on double verification and self-verification in Bootloader
CN119917149A (en) A wireless embedded product online upgrade method
JP6935694B2 (en) Electronic control device
JP2001117766A (en) Information processor with patch function of mask rom
US6961869B2 (en) Electronic apparatus and correction method
CN116755735A (en) Online upgrading method and device for embedded software, peritoneal dialysis instrument and storage medium
CN116166292A (en) Software upgrading method and server
CN118885202A (en) An incremental upgrade method for embedded DSP programs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant