Peripheral module remote upgrading method
The peripheral module upgrade file is packaged and transmitted through scripting programs, which solves the problem of high dependence and poor compatibility of the main control chip and F l ash memory in the existing technology, and realizes efficient peripheral module firmware upgrades, reducing development and operation costs.
Patent Information
- Application Number
- CN202510078123.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-05-30
AI Technical Summary
The existing peripheral module upgrade methods have high dependence on the main control chip or F l ash memory, poor compatibility with different peripheral modules, low working efficiency, and frequent increase of peripheral upgrade functions of main control equipment to be implemented before the main control equipment can be upgraded to achieve the problem of increasing development and operation costs.
The original upgrade file is repackaged into a peripheral module upgrade file through a script program. The file is divided into a parameter file area and a data file area. The main control chip directly passes the upgrade package data to the peripheral module without adding processes or protocols, realizing firmware upgrade.
It is greatly compatible with the firmware upgrades of peripheral modules of various manufacturers, reduces dependence on main control chip resources and Fl ash memory, reduces development and operation costs, and improves work efficiency.
Smart Images

Figure CN120066543A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of firmware upgrade of electronic products, and particularly to a method for remotely upgrading a peripheral module. Background Art
[0002] The commonly used method for upgrading existing peripheral modules is to create an upgrade task on an upgrade server, and the main control device requests the upgrade. The upgrade data is saved in the Flash memory. After the upgrade data is requested, the peripheral module is upgraded through the upgrade process of the peripheral module and the upgrade protocol. This method has certain limitations. For example, the upgrade processes of each peripheral module manufacturer are different. When changing to a peripheral module of another manufacturer, a corresponding set of programs must be modified to implement the firmware upgrade function of the peripheral module. Especially when the resources of the main control chip are scarce or the Flash memory is small, it is even more impossible to achieve compatibility with the peripheral modules of all manufacturers. The existing methods for peripheral modules have the following defects:
[0003] 1. When the resources of the main control chip are small or the Flash memory is small, the upgrade protocol code for the peripheral module cannot be added, and it is impossible to upgrade the peripheral module;
[0004] 2. When using peripheral modules produced by different manufacturers, the main control device must add an upgrade process for the peripheral module, with poor compatibility and low working efficiency;
[0005] 3. Frequent addition of peripheral upgrade functions to the main control device requires the main control device to be upgraded to achieve, resulting in increased development and operation costs.
[0006] To solve the above problems, we have invented a method for remotely upgrading a peripheral module. Summary of the Invention
[0007] The object of the present invention is to solve the problems existing in the existing peripheral module methods, such as high dependence on the main control chip or Flash memory, poor compatibility with different peripheral modules, low working efficiency, and increased development and operation costs caused by the need to upgrade the main control device for frequent addition of peripheral upgrade functions. The specific solutions are as follows:
[0008] The method for remotely upgrading a peripheral module is carried out according to the following steps:
[0009] Step 1, repackaging the original upgrade file into a peripheral module upgrade file through a script program. The peripheral module upgrade file is divided into a parameter file area and multiple data file areas. The data file area includes an execution instruction file, an upgrade file, and a verification file; the parameter file area is a parameter file, and the data file area is multiple data files;
[0010] Step 2, the main control chip sends a peripheral module upgrade request to the server and waits for the server to reply with an answer;
[0011] Step 3, after the main control chip receives the server's answer, it judges whether it can be upgraded. If it can be upgraded, it opens the request parameter file;
[0012] Step 4, after the main control chip receives the parameter file, it analyzes the peripheral model to be upgraded, the upgrade version number, the number of upgrade files, the size of the upgrade files, and the size of one page of each package of upgrade data. According to the peripheral model and upgrade version number in the parameter file, the main control chip queries the current peripheral model and peripheral version number and makes a judgment. If the peripheral models are different or the peripheral version numbers are the same, the upgrade ends; if the peripheral models are the same but the version numbers are different, it continues to request to execute the instruction file, and each time it requests to execute the instruction file, it is done by one page;
[0013] Step 5, when the server receives one page requested by the main control chip, it transmits one page of data of the execution instruction file. After the main control chip receives the data, it directly passes it through to the peripheral module, and then judges whether the answer returned by the peripheral module is consistent with the answer content of the execution instruction file. If it is consistent, it requests the next page; if it is inconsistent, it resends the answer content 10 times. If the answer content detected 10 times is inconsistent with the answer content of the execution instruction file, the upgrade is terminated;
[0014] Step 6, after all the execution instruction files are transmitted, the main control chip requests the upgrade file from the server again. After the main control chip receives the upgrade file, it also directly passes it through to the peripheral module. After the requested upgrade file is transmitted, finally the main control chip requests the verification file from the server;
[0015] Step 7, the main control chip passes the received verification file through to the peripheral module. After the peripheral module returns an answer, it judges whether the upgrade is successful and reports the upgrade result.
[0016] Further, the format of the execution instruction file is:
[0017] Execution instruction 1 +... + Execution instruction n + Instruction data length 1 + Instruction data content 1 + Response instruction length 1 + Response instruction content 1 +... + Instruction data length n + Instruction data content n + Response instruction length n + Response instruction content n.
[0018] Further, before the main control chip directly passes the received data through to the peripheral module and then judges the answer returned by the peripheral module, it also includes: after the main control chip receives one page, it analyzes the response delay time, instruction data length, instruction data content, response instruction length, and response instruction content, passes the instruction content through to the peripheral module, and detects the answer content returned by the peripheral module within the delay time.
[0019] Furthermore, the format of the upgrade file is as follows:
[0020] Upgrade file protocol header + original upgrade file data + check code.
[0021] Furthermore, the upgrade protocol header is set according to the protocols for upgrading each peripheral module, and the check code is calculated according to the verification method of the peripheral module upgrade protocol.
[0022] Furthermore, the verification file is equivalent to an execution instruction: instruction length + instruction content + response instruction length + response instruction content.
[0023] Furthermore, the instruction content is to calculate the check of the upgrade file.
[0024] Furthermore, the response instruction content is that the peripheral module verifies that the received checksum of the upgrade file and the received verification success content are correct.
[0025] Furthermore, the size of the parameter file is 1k, and when it is less than 1K, it is supplemented with 0xFF; the parameter file, upgrade file, and verification file all transfer data in packets with a page size of one page, and when it is less than one page, it is supplemented with 0xFF at the back.
[0026] Furthermore, the execution instruction 1 +... + execution instruction n represents that there are 1 to n execution instructions, and each execution instruction is 32 bytes.
[0027] In summary, the technical solution of the present invention has the following beneficial effects:
[0028] This solution proposes a new method for remotely upgrading peripheral modules. This method packs the firmware of the peripheral module into a new upgrade file through a script. The newly packed upgrade file includes a parameter file area and a data file area for the upgraded firmware. According to the requested upgrade package data (including the parameter file and the data file), it is directly transmitted to the peripheral without the main control chip adding processes or protocols, realizing the firmware upgrade of the peripheral module. This solution can greatly be compatible with the firmware upgrades of peripheral modules from various manufacturers, and at the same time reduces the dependence on the resources of the main control chip and the Flash memory, thus overcoming the defects of the existing peripheral module methods, such as high dependence on the main control chip or Flash memory, poor compatibility with different peripheral modules, low working efficiency, and the need for the main control device to be upgraded after frequently adding peripheral upgrade functions to the main control device, resulting in increased development and operation costs. Description of the Drawings
[0029] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for the description of the embodiments of the present invention. Obviously, the drawings in the following description are only a part of the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0030] Figure 1 It is the architecture diagram of the upgraded file of the peripheral module repackaged for the present invention;
[0031] Figure 2 It is the simplified flowchart of the method for remotely upgrading the peripheral module of the present invention. Specific embodiments
[0032] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0033] As Figure 1 、 2 shown, the method for remotely upgrading the peripheral module is carried out according to the following steps:
[0034] Step S1, repackage the original upgrade file into an upgrade file for the peripheral module through a script program. The upgrade file for the peripheral module is divided into a parameter file area and multiple data file areas. Among them, the data file area includes an execution instruction file, an upgrade file, and a verification file; the parameter file area is a parameter file, and the data file area is multiple data files;
[0035] Step S2, the main control chip sends a peripheral module upgrade request to the server and waits for the server to reply;
[0036] Step S3, after the main control chip receives the reply from the server, it judges whether it can be upgraded. If it can be upgraded, it opens the requested parameter file;
[0037] Step S4, after the main control chip receives the parameter file, it parses the peripheral model to be upgraded, the upgrade version number, the number of upgrade files, the size of the upgrade files, and the size of one page of each packet of upgrade data. According to the peripheral model and the upgrade version number in the parameter file, the main control chip queries the current peripheral model and peripheral version number and makes a judgment. S4-1 If the peripheral models are different or the peripheral version numbers are the same, the upgrade is terminated; S4-2 If the peripheral models are the same but the version numbers are different, continue to request to execute the instruction file, and each time it requests to execute the instruction file, it is done one page at a time. (Note that the size of the page is set according to specific hardware conditions and application requirements. When the peripheral module upgrade file of this solution is transferred, it is transferred packet by packet, and the size of each packet of upgrade data is one page)
[0038] Step S5, when the server receives a page requested by the main control chip, it transmits one page of data of the instruction execution file. After the main control chip receives the data, it directly forwards it to the peripheral module, and then judges whether the response replied by the peripheral module is consistent with the response content of the instruction execution file. If it is consistent, it requests the next page; if it is not consistent, it resends the response content 10 times. If the response content detected 10 times is not consistent with the response content of the instruction execution file, the upgrade is terminated;
[0039] Step S6, after all the instruction execution files are transferred, the main control chip requests the upgrade file from the server again. After the main control chip receives the upgrade file, it also directly forwards it to the peripheral module. After the requested upgrade file is transferred, finally the main control chip requests the verification file from the server;
[0040] Step S7, the main control chip forwards the received verification file to the peripheral module. After the peripheral module returns a response, it judges whether the upgrade is successful and reports the upgrade result.
[0041] Specifically, the format of the instruction execution file is:
[0042] Execution instruction 1 +... + Execution instruction n + Instruction data length 1 + Instruction data content 1 + Response instruction length 1 + Response instruction content 1 +... + Instruction data length n + Instruction data content n + Response instruction length n + Response instruction content n.
[0043] Specifically, before the main control chip directly forwards the received data to the peripheral module and then judges the response replied by the peripheral module, it also includes: after the main control chip receives a page, it parses the response delay time, the instruction data length, the instruction data content, the response instruction length, and the response instruction content, forwards the instruction content to the peripheral module, and detects the response content returned by the peripheral module within the delay time.
[0044] As an example of the implementation of an execution instruction, for example, the format of "setting the baud rate of the peripheral" is as follows:
[0045] SENDBUA00200 (fill with 0xFF if less than 32 bytes) + instruction length (2 bytes) + instruction content (N bytes) + response length (2 bytes) + response content (N bytes).....
[0046] Among them, "SENDBUA00200" represents an execution instruction of "setting the baud rate of the peripheral device".
[0047] Specifically, the upgrade file format is as follows:
[0048] Upgrade file protocol header + original upgrade file data + checksum.
[0049] Among them, the upgrade protocol header is set according to the protocol for upgrading each peripheral module, and the checksum is calculated according to the checksum method of the peripheral module upgrade protocol. Note: "Upgrade file protocol header + original upgrade file data + checksum" is the format for packing the upgrade file. In this solution, a script program is prepared, and as long as the corresponding peripheral module model is input, it will automatically be packed using the protocol of the corresponding peripheral module. The checksum in the upgrade file format is not the check file in the data file area.
[0050] Specifically, the check file is equivalent to an execution instruction: instruction length + instruction content + response instruction length + response instruction content.
[0051] Among them, the instruction content is to calculate the checksum of the upgrade file, and the response instruction content is the content indicating that the peripheral module verifies that the received upgrade file checksum is successful.
[0052] Specifically, the parameter file size is 1k, and it is filled with 0xFF if less than 1K. The parameter file, upgrade file, and check file all transfer data in packets with a page size of one page, and 0xFF is filled in the back if less than one page.
[0053] Specifically, execution instruction 1 +... + execution instruction n represents 1 to n execution instructions, and each execution instruction is 32 bytes.
[0054] The transparent transmission in this solution belongs to the prior art and is a data transmission method. The transparent transmission technology is achieved by maintaining the originality and integrity of the data.
[0055] In summary, adopting the technical solution of the present invention has the following beneficial effects:
[0056] This solution proposes a new method for remotely upgrading peripheral modules. In this method, the firmware of the peripheral module is packaged into a new upgrade file through a script. The newly packaged upgrade file includes a parameter file area and a data file area for the upgraded firmware. According to the requested upgrade package data (including the parameter file and the data file), it is directly transmitted to the peripheral without the main control chip adding processes or protocols, realizing the firmware upgrade of the peripheral module. This solution can greatly be compatible with the firmware upgrades of peripheral modules from various manufacturers, and at the same time reduce the dependence on the resources of the main control chip and the Flash memory, thus overcoming the defects of the existing peripheral module methods, such as high dependence on the main control chip or Flash memory, poor compatibility with different peripheral modules, low working efficiency, and the need for the main control device to be upgraded after frequently adding peripheral upgrade functions to the main control device, resulting in increased development and operation costs.
[0057] The above-described embodiments do not limit the protection scope of the technical solution. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the above embodiments shall be included in the protection scope of the technical solution.
Claims
1. A method for remotely upgrading a peripheral module, characterized in that: Follow these steps: Step 1, repackaging the original upgrade file into a peripheral module upgrade file through a script program, wherein the peripheral module upgrade file is divided into a parameter file area and multiple data file areas, wherein the data file area includes an execution instruction file, an upgrade file and a verification file; the parameter file area is a parameter file, and the data file area is multiple data files; Step 2: The main control chip sends a peripheral module upgrade request to the server and waits for the server to reply; Step 3: After receiving the response from the server, the main control chip determines whether it can be upgraded. If it can be upgraded, it opens the request parameter file; Step 4: After receiving the parameter file, the main control chip parses the upgraded peripheral model, upgrade version number, number of upgrade files, size of upgrade files, and size of one page of each package of upgrade data. According to the peripheral model and upgrade version number in the parameter file, the main control chip queries the current peripheral model and peripheral version number and makes a judgment. If the peripheral models are different or the peripheral version numbers are the same, the upgrade is terminated; if the peripheral models are the same but the version numbers are different, the execution of the instruction file is continued, and the execution of the instruction file is performed one page at a time; Step 5: When the server receives a page requested by the main control chip, it transmits a page of data of the execution instruction file. After receiving the data, the main control chip directly transmits it to the peripheral module, and then determines whether the response of the peripheral module is consistent with the response content of the execution instruction file. If they are consistent, the next page is requested; if they are inconsistent, the response content is resent 10 times. If the response content detected 10 times is inconsistent with the response content of the execution instruction file, the upgrade is terminated; Step 6: After all execution instruction files are transmitted, the main control chip requests the upgrade file from the server again. After receiving the upgrade file, the main control chip directly transmits it to the peripheral module. After the requested upgrade file is transmitted, the main control chip finally requests the verification file from the server; Step 7: The main control chip transmits the received verification file to the peripheral module. After the peripheral module returns a response, it determines whether the upgrade is successful and reports the upgrade result.
2. The method for remotely upgrading a peripheral module according to claim 1, characterized in that: The format of the execution instruction file is: Execute instruction 1+...+execute instruction n+instruction data length 1+instruction data content 1+response instruction length 1+response instruction content 1+...+instruction data length n+instruction data content n+response instruction length n+response instruction content n.
3. The method for remotely upgrading a peripheral module according to claim 1, characterized in that: After receiving the data, the main control chip directly transmits it to the peripheral module, and before judging the response replied by the peripheral module, it also includes: after receiving a page, the main control chip parses the response delay time, instruction data length, instruction data content, response instruction length and response instruction content, transmits the instruction content to the peripheral module, and detects the response content returned by the peripheral module within the delay time.
4. The method for remotely upgrading a peripheral module according to claim 1, characterized in that: The upgrade file format is: Upgrade file protocol header + original upgrade file data + verification code.
5. The method for remotely upgrading a peripheral module according to claim 4, characterized in that: The upgrade protocol header is set according to the upgrade protocol of each peripheral module, and the verification code is calculated according to the verification method of the peripheral module upgrade protocol.
6. The method for remotely upgrading a peripheral module according to claim 1, characterized in that: The verification file is equivalent to an execution instruction: instruction length + instruction content + response instruction length + response instruction content.
7. The method for remotely upgrading a peripheral module according to claim 6, characterized in that: The instruction content is to calculate the checksum of the upgrade file.
8. The method for remotely upgrading a peripheral module according to claim 6, characterized in that: The response instruction content is the content of the successful verification received by the peripheral module verifying the upgrade file checksum.
9. The method for remotely upgrading a peripheral module according to claim 1, characterized in that: The size of the parameter file is 1k, and 0xFF is added when it is less than 1K; the parameter file, upgrade file and verification file are all transmitted as a packet with a page size, and 0xFF is added after it is less than a page.
10. The method for remotely upgrading a peripheral module according to claim 2, characterized in that: The execution instruction 1+...+execution instruction n represents that there are 1 to n execution instructions, and each execution instruction is 32 bytes.