Wireless embedded product online upgrading method

By using a wireless online upgrade method in 4G wireless embedded products, using IAP technology and HTTPS encrypted transmission, the problems of low online upgrade efficiency, hidden security risks, and insufficient compatibility in the existing technology are solved, and efficient, secure and compatible online upgrade effects are achieved.

CN119917149APending Publication Date: 2025-05-02JIANGSU LIANHONG SMART ENERGY CO LTD

Patent Information

Application Number
CN202411983806.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The prior art has problems such as low efficiency, hidden security risks and insufficient compatibility during the online upgrade of 4G wireless embedded products. Especially in large-scale distributed systems, serial communication causes extremely long upgrades.

Method used

The wireless embedded product online upgrade method is adopted, through the collaborative work of the microcontroller and 4G module, IAP technology, HTTPS encryption transmission, identity authentication and file operation instructions, the entire package file download and shard cache verification and writing are realized, simplifying the file transfer process and improving efficiency.

Benefits of technology

It significantly improves the efficiency and reliability of the online upgrade process, improves compatibility and security, and is suitable for the online upgrade needs of 4G wireless embedded products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917149A_ABST
    Figure CN119917149A_ABST
Patent Text Reader

Abstract

The invention discloses a wireless embedded product online upgrading method, and particularly relates to the technical field of product online upgrading, and the method comprises the steps: 1, determining the types of a single-chip microcomputer and a 4G module; 2, power-on or reset restart of the single-chip microcomputer is analyzed, a start code reads an upgrade identifier in a storage area, whether firmware upgrade is carried out or not is judged, and if yes, an upgrade instruction is generated; 3, an upgrading instruction is received, the single-chip microcomputer is upgraded, only the selected single-chip microcomputer needs to support the IAP technology, the 4G module provides storage space and necessary HTTPS and file operation functions, and most products in the market at present can meet the requirement. The server side only needs to deploy HTTPS service and adds necessary functions of identity verification, label verification, version management and the like, so that safe, reliable and efficient online upgrading service can be realized, and good compatibility and wide adaptability are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of product online upgrade, and more specifically, to a method for online upgrade of wireless embedded products. Background Art

[0002] The development of information technology has led to the widespread application of embedded products, and they play a key role in many industries under 4G technology. Embedded products are designed for specific scenarios, but user needs often change and there will be problems with operation. Traditional maintenance and upgrades need to be sent back to the manufacturer, which is time-consuming and labor-intensive and affects use. Although 4G provides a communication foundation, the network is complex, and it is difficult to ensure that data transmission is complete and reliable and that it can be upgraded efficiently under limited resources. At present, some online upgrade methods for embedded products are defective. They are not optimized for 4G, resulting in low efficiency, security risks, data vulnerability, and imperfect verification mechanisms that allow malware to invade. The way of sending firmware files in pieces is cumbersome and error-prone, and is not conducive to large-scale processing by the server. There is also insufficient consideration of hardware and software compatibility. There are large differences between different models and versions of products. The general method leads to upgrade failures and compatibility issues, affecting the normal operation of the product and system security.

[0003] Among the existing methods, for example, the Chinese patent application with publication number CN110647339A discloses an online software upgrade method for embedded products. The online software upgrade method for embedded products does not require disassembly of the embedded products in the distributed system. It only requires the master control computer of the distributed system and each embedded product to have the capabilities of the present invention. After the system powers on all products, the master control computer can realize online software upgrades for each embedded product through buses such as RS422 or RS485. It does not require powering on and off each unit, and can be upgraded repeatedly before exiting the upgrade. Although the above method can achieve ***, research and application of the above method and the prior art found that the above method and the prior art have at least the following partial defects:

[0004] RS422 and RS485 buses use serial communication, which has limited communication speed. The data transmission speed at common baud rates is much lower than that of 4G networks. In large-scale distributed systems, when multiple embedded products are upgraded at the same time, the bit-by-bit transmission characteristics of serial communication will cause the upgrade to take a very long time, slowing down the overall upgrade progress.

[0005] To this end, the present invention provides an online upgrade method for wireless embedded products. There is an urgent need for an online upgrade method specifically for 4G wireless embedded products to overcome various problems in the prior art, improve the efficiency, security and compatibility of online upgrades, and meet the needs of the continuous development of 4G wireless embedded products. Summary of the invention

[0006] In order to overcome the above defects of the prior art, the present invention provides an online upgrade method for a wireless embedded product to solve the problems raised in the above background technology.

[0007] To achieve the above purpose, the present invention provides the following technical solutions:

[0008] In a first aspect, the present invention provides a method for online upgrading of a wireless embedded product, comprising:

[0009] Step 1: Determine the type of MCU and 4G module;

[0010] Step 2: Analyze the power-on or reset restart of the microcontroller, and the startup code reads the upgrade mark in the storage area to determine whether to perform a firmware upgrade. If so, generate an upgrade instruction;

[0011] Step 3: Receive the upgrade instruction and upgrade the microcontroller.

[0012] Furthermore, the method for determining the type of the single chip microcomputer includes:

[0013] Select a microcontroller that supports online upgrade (IAP) technology, and divide its FLASH storage space into a boot code area (Bootloader area) and an application code area (Application area). If the FLASH remaining space value belongs to the preset remaining space threshold range, add a device backup area (Backup area);

[0014] Methods for determining the type of 4G module include:

[0015] Select a 4G module that supports user secondary development and has available UFS space (usually several hundred KB), use the UART interface to connect the MCU to the 4G module, and connect an external watchdog chip to the MCU.

[0016] Furthermore, the method for analyzing the power-on or reset restart of the single-chip microcomputer includes:

[0017] After the MCU is initially powered on or reset, the startup code starts to execute from the Bootloader area. The startup code first initializes the key hardware inside the MCU.

[0018] Methods for determining whether a firmware upgrade is required include:

[0019] Preset upgrade threshold range, compare the upgrade identification value with the preset upgrade threshold range,

[0020] If the upgrade identification value belongs to the preset upgrade threshold range, an upgrade instruction is generated;

[0021] If the upgrade identification value does not belong to the preset upgrade threshold range, the instruction is not upgraded and the program directly jumps to the application code area to execute the regular function code.

[0022] Furthermore, the method for upgrading the single chip microcomputer includes:

[0023] Step a1: The single chip microcomputer sends a power-on initialization instruction to the 4G module according to the 4G module manual and configures relevant parameters;

[0024] Step a2: The MCU sends the identity authentication certificate to the firmware management platform through the 4G module. After the platform verifies the certificate, it returns a successful authentication message and grants access authorization.

[0025] Step a3: Encrypt the file transmission channel using the key to establish a secure transmission environment;

[0026] Step a4: The device uses an encrypted channel to request the management platform to read the corresponding firmware version number, and obtains its own current firmware version number, and compares the two. If no new firmware exists, the upgrade process is exited and jumps to the application code area.

[0027] Furthermore, the method for upgrading the single chip microcomputer also includes:

[0028] Step a6: After the IMEI number is verified, the MCU operates the 4G module and uses the AT instruction set to request the server to download the firmware program file through the HTTPS-GET command. The firmware file is first saved in the UFS memory of the 4G module;

[0029] Step a7: When making the firmware file, add a 4-byte CRC32 check value to the end of the original bin file. The 4G module obtains the file size through the HTTPS-GET command and determines the file location after removing the 4-byte CRC32 check value.

[0030] Step a8: After the firmware is downloaded to the UFS memory, the MCU reads 2k bytes from the beginning of the file into the buffer for CRC32 calculation. The last packet is read based on the actual number of remaining bytes minus 4 bytes. The calculated CRC32 value is compared with the 4-byte checksum at the end of the firmware. If they are inconsistent, the upgrade is terminated and an error alarm is sent to the server. The server confirms the file status and replaces it if it is incorrect. If it is correct, the upgrade instruction is resent.

[0031] Step a9: After confirming that the downloaded firmware is correct, the MCU reads 2k or 1k bytes each time according to the F1ash write page requirements and writes them into the application area from the beginning of the file. The last packet is also processed according to the actual number of remaining bytes minus 4 bytes.

[0032] Step a10: For a microcontroller with large FLASH storage space, first write the firmware file from the 4G module into the backup area, perform CRC32 check again, and then write it into the application area after passing it;

[0033] Step a11: After the firmware is successfully written into the application area, the system jumps from the boot area to the application area to execute the upgraded code. If the application area code runs normally, the online upgrade flag is set to "completed". If an exception occurs, the upgrade flag remains "needs to be upgraded". If the timeout fails to run normally, the external watchdog reset restart is triggered, and the online upgrade process is re-entered.

[0034] Furthermore, the method of encrypting the file transmission channel using a key includes a symmetric encryption algorithm or an asymmetric encryption algorithm, the symmetric encryption algorithm includes DES, 3DES, AES, and the asymmetric encryption algorithm includes RSA, ECC.

[0035] Furthermore, the acquired solid files are stored in the UFS memory built into the 4G module, and the MCU reads the files by slicing and performs CRC32 cyclic check to verify the integrity of the files.

[0036] Technical effects and advantages of the present invention:

[0037] 1. The present invention only requires the selected single-chip microcomputer to support IAP technology, and the 4G module to provide storage space and necessary HTTPS and file operation functions. Most products on the market can meet this requirement. The server only needs to deploy HTTPS service and add necessary identity authentication, annotation verification and version management functions to achieve safe, reliable and efficient online upgrade services with good compatibility and wide adaptability.

[0038] 2. The present invention utilizes the UFS storage space built into the 4G module, combines HTTPS encrypted transmission, identity authentication and file operation instructions, and adopts the method of downloading the entire package of files and writing the fragmented cache verification, thereby simplifying the file transmission process. By combining with the authentication, encryption, device identification verification and file integrity verification on the server side, the efficiency and reliability of the online upgrade process are significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flow chart of a wireless embedded product online upgrade method according to Embodiment 1;

[0040] Figure 2 A schematic diagram of the structure of a wireless embedded product online upgrade method system according to Embodiment 2; DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.

[0043] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and a similar second unit may be referred to as a first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.

[0044] Example 1

[0045] See also Figure 1 As shown, this embodiment discloses a method for online upgrading of a wireless embedded product, the method comprising:

[0046] Step 1: Determine the type of MCU and 4G module;

[0047] Specifically, the method for determining the type of the microcontroller includes:

[0048] Select a microcontroller that supports online upgrade (IAP) technology, and divide its FLASH storage space into a boot code area (Bootloader area) and an application code area (Application area). If the FLASH remaining space value belongs to the preset remaining space threshold range, add a device backup area (Backup area).

[0049] Specifically, the method for determining the type of the 4G module includes:

[0050] Select a 4G module that supports user secondary development and has available UFS space (usually several hundred KB), use the UART interface to connect the MCU to the 4G module, and connect an external watchdog chip to the MCU.

[0051] This step uses the built-in IAP function of the microcontroller to divide its code area into two parts: the starting area is used to store the boot code (Bootloader area), and the subsequent area is used to store the application code (Application area). During the execution of the boot code, the API interface provided by the IAP function is used to read and write the FLASH of the application program, thereby realizing online programming.

[0052] Step 2: Analyze the power-on or reset restart of the microcontroller, and the startup code reads the upgrade mark in the storage area to determine whether to perform a firmware upgrade. If so, generate an upgrade instruction;

[0053] Specifically, the method for analyzing the power-on or reset restart of the single-chip microcomputer includes:

[0054] After the microcontroller is initially powered on or reset, the startup code starts to execute from the Bootloader area. The startup code first initializes the key hardware inside the microcontroller, such as the clock, memory, etc.

[0055] In implementation, the method for determining whether a firmware upgrade is required includes:

[0056] Preset upgrade threshold range, compare the upgrade identification value with the preset upgrade threshold range,

[0057] If the upgrade identification value belongs to the preset upgrade threshold range, an upgrade instruction is generated;

[0058] If the upgrade identification value does not belong to the preset upgrade threshold range, the instruction is not upgraded and the program directly jumps to the application code area to execute the regular function code.

[0059] Step 3: Receive the upgrade instruction and upgrade the microcontroller;

[0060] In practice, the methods for upgrading the microcontroller include:

[0061] Step a1: The single chip microcomputer sends a power-on initialization instruction to the 4G module according to the 4G module manual, configures relevant parameters, and puts the 4G module into a working state.

[0062] Step a2: The MCU sends an identity authentication certificate to the firmware management platform through the 4G module. After verification by the platform, it feeds back an authentication success message and grants access authorization.

[0063] Step a3: Use the key to encrypt the file transfer channel to establish a secure transmission environment.

[0064] Specifically, HTTPS certificate authentication and channel encryption technology are used to ensure the security of file transmission. At the same time, the HTTPS protocol itself also provides integrity protection, providing additional security for the file transmission channel.

[0065] Specifically, the method of encrypting the file transmission channel using a key includes a symmetric encryption algorithm or an asymmetric encryption algorithm. The symmetric encryption algorithm includes DES, 3DES, and AES, and the asymmetric encryption algorithm includes RSA and ECC.

[0066] Step a4: The device uses an encrypted channel to request the management platform to read the corresponding firmware version number, and obtains its own current firmware version number, and compares the two. If no new firmware exists, the upgrade process is exited and jumps to the application code area.

[0067] Step a5: The management platform associates the device operation record with the unique IMEI number of the 4G module. When the device initiates an upgrade request, the platform verifies the IMEI number and does not respond if it is not in the database.

[0068] It should be noted that: during data transmission, the server compares the IMEI of the 4G module in the project library with the IMEI of the currently connected device to ensure that only the devices in the library can obtain the firmware file.

[0069] Step a6: After the IMEI number is verified, the microcontroller operates the 4G module and uses the AT instruction set to request the server to download the firmware program file through the HTTPS-GET command. The firmware file is first saved in the UFS memory of the 4G module.

[0070] Step a7: When making the firmware file, add a 4-byte CRC32 check value to the end of the original bin file. The 4G module obtains the file size through the HTTPS-GET command and determines the file location after removing the 4-byte CRC32 check value.

[0071] Step a8: After the firmware is downloaded to the UFS memory, the MCU reads 2k bytes each time from the starting position of the file into the buffer for CRC32 calculation. The last packet is read based on the actual number of remaining bytes minus 4 bytes, and the calculated CRC32 value is compared with the 4-byte checksum at the end of the firmware. If they are inconsistent, the upgrade is terminated and an error alarm is sent to the server; the server confirms the file status and replaces it if it is incorrect, otherwise resend the upgrade instruction.

[0072] It should be noted that when generating an upgrade firmware file, a 4-byte CRC32 check value should be appended to the end of the file so that it can be obtained together with the firmware without having to read the check value of the file separately.

[0073] Step a9: After confirming that the downloaded firmware is correct, the MCU reads 2k or 1k bytes each time according to the Flash write page requirements and writes them into the application area from the beginning of the file. The last packet is also processed based on the actual remaining bytes minus 4 bytes.

[0074] It is worth noting that when writing the firmware file to the application area of ​​the microcontroller, since the file size is not necessarily an integer multiple of the number of bytes read each time (2k or 1k), a part of the data will remain when the writing process is nearing the end. This part of the data is the "last packet".

[0075] For example, if the microcontroller reads the firmware file from the 4G module and writes it to the application area at 2k bytes (2048 bytes) each time, the size of the entire firmware file is 10250 bytes.

[0076] 10250÷2048=5 times of reading, there are still 10 bytes left, this remaining part of less than 2k bytes is the "last packet" of data. Because there are 4 bytes at the end that are CRC32 checksum values, which do not belong to the actual firmware content to be written into the application area, when processing this last packet, these 4 bytes must be subtracted and only the real firmware data must be written into the application area, so as to complete the complete and accurate writing of the entire firmware file.

[0077] It should be noted that after using the whole package reading function of the 4G module to obtain the firmware file, the 4G network connection can be disconnected immediately without maintaining a long connection, thereby reducing the impact of network instability. The entire process has been simplified. Traditional packet transmission involves a series of operations such as file slicing, transmission, abnormal retransmission, and packet assembly. It is often necessary to consider the continued transmission after an error in a certain packet in the middle. These processes require the participation of the server, which makes the process cumbersome and difficult to implement, and reliability is difficult to guarantee. When a large number of devices need to be upgraded and high-concurrency file distribution is processed, the progress of the upgrade is seriously affected.

[0078] Step a10: For MCUs with large FLASH storage space, first write the firmware file from the 4G module to the backup area, perform CRC32 check again, and then write it to the application area after passing it.

[0079] It should be noted that: for large FLASH capacity, in addition to the space occupied by the boot area and the application area, there is still a part of the space that can be used to store firmware files. This area can also be used as a firmware backup area. First, the verified firmware file is written to the backup area, then the integrity of the entire file is verified, and finally written to the application area to further enhance the reliability of the entire process.

[0080] The acquired solid files are stored in the UFS memory built into the 4G module. The MCU reads the files by slicing and performs CRC32 cyclic check to verify the integrity of the files. The entire process is completed inside the device without the need for network connection, ensuring security and reliability.

[0081] Step a11: After the firmware is successfully written into the application area, the system jumps from the boot area to the application area to execute the upgraded code. If the application area code runs normally, the online upgrade flag is set to "completed". If an exception occurs, the upgrade flag remains "needs to be upgraded". If the timeout fails to run normally, the external watchdog reset restart is triggered, and the online upgrade process is re-entered.

[0082] It should be noted that after the firmware file is verified, the slices are read and written to the application area. After writing is completed, jump to the application area to execute the upgraded code. If the application area code is executed successfully, the online upgrade flag is set to "completed", thus ending the entire online upgrade process.

[0083] This embodiment only requires the selected MCU to support IAP technology, and the 4G module to provide storage space and necessary HTTPS and file operation functions. Most products on the market can meet this requirement. The server only needs to deploy HTTPS service and add necessary identity authentication, annotation verification and version management functions to achieve safe, reliable and efficient online upgrade services with good compatibility and wide adaptability.

[0084] This embodiment uses the UFS storage space built into the 4G module, combined with HTTPS encrypted transmission, identity authentication and file operation instructions, and adopts the method of downloading the entire package file and writing the fragment cache verification, thereby simplifying the file transfer process. By combining with the authentication, encryption, device identification verification and file integrity verification on the server side, the efficiency and reliability of the online upgrade process are significantly improved.

[0085] Example 2

[0086] See also Figure 2 As shown, this embodiment provides a wireless embedded product online upgrade system, including an option module, a judgment module and an upgrade module, each module is connected by wired and / or wireless means to achieve data transmission between modules;

[0087] Option module, used to determine the selection of MCU and 4G module;

[0088] Specifically, the selection method of the microcontroller includes:

[0089] Select a microcontroller that supports online upgrade (IAP) technology, and divide its FLASH storage space into a boot code area (Bootloader area) and an application code area (Application area). If the FLASH space is sufficient, add a device backup area (Backup area).

[0090] Specifically, the selection method for 4G modules includes:

[0091] Select a 4G module that supports user secondary development and has available UFS space (usually several hundred KB), use the UART interface to connect the MCU to the 4G module, and connect an external watchdog chip to the MCU.

[0092] This step uses the built-in IAP function of the microcontroller to divide its code area into two parts: the starting area is used to store the boot code (Bootloader area), and the subsequent area is used to store the application code (Application area). During the execution of the boot code, the API interface provided by the IAP function is used to read and write the FLASH of the application program, thereby realizing online programming.

[0093] The judgment module is used to analyze the power-on or reset restart of the single-chip microcomputer, and the startup code reads the upgrade mark in the storage area to determine whether to perform a firmware upgrade. If so, an upgrade instruction is generated;

[0094] Specifically, the method for analyzing the power-on or reset restart of the single-chip microcomputer includes:

[0095] After the microcontroller is initially powered on or reset, the startup code starts to execute from the Bootloader area. The startup code first initializes the key hardware inside the microcontroller, such as the clock, memory, etc.

[0096] In implementation, the method for determining whether a firmware upgrade is required includes:

[0097] Preset upgrade threshold range, compare the upgrade identification value with the preset upgrade threshold range,

[0098] If the upgrade identification value belongs to the preset upgrade threshold range, an upgrade instruction is generated;

[0099] If the upgrade identification value does not belong to the preset upgrade threshold range, the instruction is not upgraded and the program directly jumps to the application code area to execute the regular function code.

[0100] An upgrade module is used to receive upgrade instructions and upgrade the microcontroller;

[0101] In practice, the methods for upgrading the microcontroller include:

[0102] Step a1: The single chip microcomputer sends a power-on initialization instruction to the 4G module according to the 4G module manual, configures relevant parameters, and puts the 4G module into a working state.

[0103] Step a2: The MCU sends an identity authentication certificate to the firmware management platform through the 4G module. After verification by the platform, it feeds back an authentication success message and grants access authorization.

[0104] Step a3: Use the key to encrypt the file transfer channel to establish a secure transmission environment.

[0105] Specifically, HTTPS certificate authentication and channel encryption technology are used to ensure the security of file transmission. At the same time, the HTTPS protocol itself also provides integrity protection, providing additional security for the file transmission channel.

[0106] Step a4: The device uses an encrypted channel to request the management platform to read the corresponding firmware version number, and obtains its own current firmware version number, and compares the two. If no new firmware exists, the upgrade process is exited and jumps to the application code area.

[0107] Step a5: The management platform associates the device operation record with the unique IMEI number of the 4G module. When the device initiates an upgrade request, the platform verifies the IMEI number and does not respond if it is not in the database.

[0108] It should be noted that: during data transmission, the server compares the IMEI of the 4G module in the project library with the IMEI of the currently connected device to ensure that only the devices in the library can obtain the firmware file.

[0109] Step a6: After the IMEI number is verified, the microcontroller operates the 4G module and uses the AT instruction set to request the server to download the firmware program file through the HTTPS-GET command. The firmware file is first saved in the UFS memory of the 4G module.

[0110] Step a7: When making the firmware file, add a 4-byte CRC32 check value to the end of the original bin file. The 4G module obtains the file size through the HTTPS-GET command and determines the file location after removing the 4-byte CRC32 check value.

[0111] Step a8: After the firmware is downloaded to the UFS memory, the MCU reads 2k bytes each time from the starting position of the file into the buffer for CRC32 calculation. The last packet is read based on the actual number of remaining bytes minus 4 bytes, and the calculated CRC32 value is compared with the 4-byte checksum at the end of the firmware. If they are inconsistent, the upgrade is terminated and an error alarm is sent to the server; the server confirms the file status and replaces it if it is incorrect, otherwise resend the upgrade instruction.

[0112] It should be noted that when generating an upgrade firmware file, a 4-byte CRC32 check value should be appended to the end of the file so that it can be obtained together with the firmware without having to read the check value of the file separately.

[0113] Step a9: After confirming that the downloaded firmware is correct, the MCU reads 2k or 1k bytes each time according to the Flash write page requirements and writes them into the application area from the beginning of the file. The last packet is also processed based on the actual remaining bytes minus 4 bytes.

[0114] It should be noted that after using the whole package reading function of the 4G module to obtain the firmware file, the 4G network connection can be disconnected immediately without maintaining a long connection, thereby reducing the impact of network instability. The entire process has been simplified. Traditional packet transmission involves a series of operations such as file slicing, transmission, abnormal retransmission, and packet assembly. It is often necessary to consider the continued transmission after an error in a certain packet in the middle. These processes require the participation of the server, which makes the process cumbersome and difficult to implement, and reliability is difficult to guarantee. When a large number of devices need to be upgraded and high-concurrency file distribution is processed, the progress of the upgrade is seriously affected.

[0115] Step a10: For MCUs with large FLASH storage space, first write the firmware file from the 4G module to the backup area, perform CRC32 check again, and then write it to the application area after passing it.

[0116] It should be noted that: for large FLASH capacity, in addition to the space occupied by the boot area and the application area, there is still a part of the space that can be used to store firmware files. This area can also be used as a firmware backup area. First, the verified firmware file is written to the backup area, then the integrity of the entire file is verified, and finally written to the application area to further enhance the reliability of the entire process.

[0117] The acquired files are first stored in the UFS memory built into the 4G module. The MCU reads the files in slices and performs CRC32 cyclic check to verify the integrity of the files. The entire process is completed inside the device without the need for network connection, ensuring security and reliability.

[0118] Step a11: After the firmware is successfully written into the application area, the system jumps from the boot area to the application area to execute the upgraded code. If the application area code runs normally, the online upgrade flag is set to "completed". If an exception occurs, the upgrade flag remains "needs to be upgraded". If the timeout fails to run normally, the external watchdog reset restart is triggered, and the online upgrade process is re-entered.

[0119] It should be noted that: after the file is verified, the shards are read and written to the application area, and after writing is completed, the upgraded code is executed in the application area. If the application area code is executed successfully, the online upgrade flag is set to "completed", thus ending the entire online upgrade process.

[0120] This embodiment only requires the selected MCU to support IAP technology, and the 4G module to provide storage space and necessary HTTPS and file operation functions. Most products on the market can meet this requirement. The server only needs to deploy HTTPS service and add necessary identity authentication, annotation verification and version management functions to achieve safe, reliable and efficient online upgrade services with good compatibility and wide adaptability.

[0121] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0122] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A wireless embedded product online upgrade method, characterized in that: include: Step 1: Determine the type of MCU and 4G module; Step 2: Analyze the power-on or reset restart of the microcontroller, and the startup code reads the upgrade mark in the storage area to determine whether to perform a firmware upgrade. If so, generate an upgrade instruction; Step 3: Receive the upgrade instruction and upgrade the microcontroller.

2. A wireless embedded product online upgrade method according to claim 1, characterized in that: Methods for determining the type of microcontroller include: Select a microcontroller that supports online upgrade IAP technology, and divide its FLASH storage space into Bootloader area and Application area. If the FLASH remaining space value belongs to the preset remaining space threshold range, add a Backup area; Methods for determining the type of 4G module include: Select a 4G module that supports user secondary development and has available UFS space, use the UART interface to connect the MCU and the 4G module, and connect an external watchdog chip to the MCU.

3. A wireless embedded product online upgrade method according to claim 2, characterized in that: Methods for analyzing the power-on or reset restart of a microcontroller include: After the MCU is initially powered on or reset, the startup code starts to execute from the Bootloader area. The startup code first initializes the key hardware inside the MCU. Methods for determining whether a firmware upgrade is required include: Preset upgrade threshold range, compare the upgrade identification value with the preset upgrade threshold range, If the upgrade identification value belongs to the preset upgrade threshold range, an upgrade instruction is generated; If the upgrade identification value does not belong to the preset upgrade threshold range, the instruction is not upgraded and the program directly jumps to the application code area to execute the regular function code.

4. A wireless embedded product online upgrade method according to claim 3, characterized in that: The methods for upgrading the microcontroller include: Step a1: The single chip microcomputer sends a power-on initialization instruction to the 4G module according to the 4G module manual and configures relevant parameters; Step a2: The MCU sends the identity authentication certificate to the firmware management platform through the 4G module. After the platform verifies the certificate, it returns a successful authentication message and grants access authorization. Step a3: Encrypt the file transmission channel using the key to establish a secure transmission environment; Step a4: The device uses an encrypted channel to request the management platform to read the corresponding firmware version number, and obtains its own current firmware version number, and compares the two. If no new firmware exists, the upgrade process is exited and jumps to the application code area.

5. A wireless embedded product online upgrade method according to claim 4, characterized in that: The method of upgrading the microcontroller also includes: Step a6: After the IMEI number is verified, the MCU operates the 4G module and uses the AT instruction set to request the server to download the firmware program file through the HTTPS-GET command. The firmware file is first saved in the UFS memory of the 4G module; Step a7: When making the firmware file, add a 4-byte CRC32 check value to the end of the original bin file. The 4G module obtains the file size through the HTTPS-GET command and determines the file location after removing the 4-byte CRC32 check value. Step a8: After the firmware is downloaded to the UFS memory, the MCU reads 2k bytes from the beginning of the file into the buffer for CRC32 calculation. The last packet is read based on the actual number of remaining bytes minus 4 bytes. The calculated CRC32 value is compared with the 4-byte checksum at the end of the firmware. If they are inconsistent, the upgrade is terminated and an error alarm is sent to the server. The server confirms the file status and replaces it if it is incorrect. If it is correct, the upgrade instruction is resent. Step a9: After confirming that the downloaded firmware is correct, the MCU reads 2k or 1k bytes each time according to the Flash write page requirements and writes them into the application area from the beginning of the file. The last packet is also processed based on the actual number of remaining bytes minus 4 bytes. Step a10: For a microcontroller with large FLASH storage space, first write the firmware file from the 4G module into the backup area, perform CRC32 check again, and then write it into the application area after passing it; Step a11: After the firmware is successfully written into the application area, the system jumps from the boot area to the application area to execute the upgraded code. If the application area code runs normally, the online upgrade flag is set to "completed". If an exception occurs, the upgrade flag remains "needs to be upgraded". If the timeout fails to run normally, the external watchdog reset and restart is triggered, and the online upgrade process is re-entered.

6. A wireless embedded product online upgrade method according to claim 5, characterized in that: The method of encrypting the file transmission channel using a key includes a symmetric encryption algorithm or an asymmetric encryption algorithm. The symmetric encryption algorithm includes DES, 3DES, and AES, and the asymmetric encryption algorithm includes RSA and ECC.

7. A wireless embedded product online upgrade method according to claim 6, characterized in that: The acquired solid files are stored in the UFS memory built into the 4G module. The microcontroller reads the files by slicing and performs CRC32 cyclic check to verify the integrity of the files.

Citation Information

Patent Citations

  • Online upgrading method for embedded product software

    CN110647339A

Cited By

  • Low-power-consumption easily-upgraded temperature vibration sensor and working method thereof

    CN120628216A