Method for switching zigbee firmware and matter firmware based on OTA upgrade

Through the OTA upgrade method, the problem of firmware protocol mismatch after smart home equipment is replaced with a gateway is solved, and flexible switching between zigbee and matter firmware is realized, ensuring that the equipment can work normally in different environments and improving system reuse capability and stability. .

CN118567684AActive Publication Date: 2024-08-30SHENZHEN ZHONGYI TENGDA TECH CO LTD

Patent Information

Application Number
CN202410728949.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-08-30
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

After replacing the gateway of existing smart home devices, the original device and the new gateway firmware protocol do not match, resulting in the device being unable to continue to be used, causing inconvenience and waste.

Method used

Through the OTA upgrade method, obtain device information, prepare the OTA upgrade package, add firmware identification and OTA header, generate zigbee or matter firmware adapted to different environments, push and upgrade the device, ensure that the bootloader can identify and initialize the corresponding startup environment, and realize zigbee and Flexible switching between matter firmwares.

Benefits of technology

It realizes convenient switching between zigbee and matter firmware, improves the reusability of the system, enables IoT devices to work normally in different environments, and ensures the stability and adaptability of the firmware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567684A
    Figure CN118567684A
Patent Text Reader

Abstract

The invention belongs to the technical field of Internet of Things, and particularly discloses a method for switching zigbee firmware and matter firmware based on OTA upgrading. According to the method, the bootloader is modified on the basis of mcuboot, so that the bootloader has the capability of being matched with zigbee firmware and matter firmware starting at the same time, and the stability and the adaptability of firmware starting are ensured by identifying different firmware types and dynamically selecting corresponding starting environments and processes; according to the method, the OTA firmware corresponding to the zigbee firmware and the matter firmware is generated, and flexible switching among different firmware is realized through an OTA updating and upgrading mode, so that firmware switching is more convenient and efficient. According to the invention, not only is flexible switching between the zigbee firmware and the matter firmware realized, but also the multiplexing capability of the system is improved, so that the Internet of Things equipment can work normally in different environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things, relates to Zigbee firmware and Matter firmware, and specifically to a method for switching Zigbee firmware and Matter firmware based on OTA upgrade. Background Art

[0002] Zigbee is a low-power, highly interoperable wireless communication technology suitable for smart home and IoT applications, with the advantages of long life and high security. Matter is an initiative to unify the interconnection standards of smart home devices, emphasizing interoperability, simplified development and deployment, security and privacy protection, and aims to provide users with a more integrated, safe and reliable smart home experience. Together, the two are driving the development and popularization of smart home technology.

[0003] Zigbee and Matter are both excellent protocols for smart home. Currently, smart home products on the market can only support one of the two. Zigbee devices connect to Zigbee gateways, and Matter devices connect to Matter gateways. If users replace the gateway, the original device will not match the replaced gateway firmware protocol, making the original home device unusable, causing inconvenience and waste. Summary of the invention

[0004] Based on the above technical status and problems, the design purpose of the present invention is to provide a method for flexibly switching between ZigBee firmware and Matter firmware through OTA upgrade, so that the device can adapt to different environments and ensure that the firmware can work normally in different environments.

[0005] In order to achieve the above-mentioned purpose, the technical solution adopted by the present invention is specifically as follows.

[0006] The method for switching between zigbee firmware and matter firmware based on OTA upgrade proposed in the present invention comprises the following steps: Step 1: Obtain device information. Obtain device information of the device to be upgraded through the Zigbee protocol or the Matter protocol, including at least the device's firmware type, firmware version, and related attribute information; Step 2: Prepare the OTA upgrade package and add the firmware identifier to the appropriate position of the firmware; then add the firmware information table to the header and tail of the mcuboot firmware respectively to generate the basic firmware of zigbee or matter, which is used for firmware security and integrity verification when the bootloader is started; finally, add the OTA header, which is the information description part of the firmware request during OTA, to convert the matter firmware into OTA firmware that can be used in the zigbee environment, or convert the zigbee firmware into OTA firmware that can be used in the matter environment; Step 3: Push the OTA upgrade package; Step 4: Device upgrade, bootloader starts, determines whether there is firmware in the partition table, verifies the bootloader information of the existing firmware, reads the firmware type, and performs corresponding initialization according to the firmware type, provides different startup environments for matter firmware and zigbee firmware, and performs device upgrade; Step 5: Restart the device to start the new firmware.

[0007] Further explanation: the firmware identifier in step 2 is added to the firmware header. The firmware identifier can identify the zigbee firmware and the matter firmware, and also includes the firmware version and the firmware magic number information.

[0008] It is further explained that the basic firmware of zigbee and matter generated in step 2 adopts the same firmware partition table to ensure that the firmware can run normally.

[0009] Further explanation: in step 2, the OTA header of the zigbee firmware generates a corresponding format according to the input firmware type and firmware version parameter information by adding an OTA header script, and then adds it to the header of the generated basic firmware.

[0010] To further illustrate, the parameters input into the zigbee firmware OTA header script in step 2 need to be consistent with the firmware parameters of the running zigbee firmware, otherwise the generated OTA firmware cannot be normally recognized by zigbee OTA, where the firmware parameters include the firmware type and the firmware magic number.

[0011] To further illustrate, the OTA firmware of the matter firmware in step 2 is generated by calling the OTA tool of matter, and the firmware parameters passed in the OTA tool need to be consistent with the parameters of the running matter firmware, otherwise the generated OTA firmware cannot be normally recognized by matter OTA, wherein the firmware parameters include pid parameters and vid parameters.

[0012] It is further explained that the initialization of the matter firmware startup environment in step 4 specifically includes interrupt configuration and initialization of peripherals.

[0013] Further explanation: the initialization of the Zigbee firmware startup environment in step 4 includes two startup modes. One is that the bootloader initializes the interrupt priority, and the Zigbee firmware does not need to initialize the interrupt priority again; the other is that the bootloader does not initialize the interrupt priority, but actively initializes the interrupt priority before executing normal functions after the firmware is started.

[0014] The beneficial effects of the present invention are as follows: the present invention modifies the bootloader based on mcuboot, so that it has the ability to adapt to the startup of zigbee firmware and matter firmware at the same time, and dynamically selects the corresponding startup environment and process by identifying different firmware types to ensure the stability and adaptability of firmware startup; generates corresponding OTA firmware of zigbee firmware and matter firmware, and realizes flexible switching between different firmwares through OTA update and upgrade, making firmware switching more convenient and efficient. The present invention not only realizes flexible switching between zigbee firmware and matter firmware, but also improves the multiplexing capability of the system, so that the Internet of Things devices can work normally in different environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 This is a schematic diagram of switching between the zigbee firmware and the matter firmware disclosed in the present invention.

[0016] Figure 2 The figure is a flow chart of the method for switching between Zigbee firmware and Matter firmware disclosed in the present invention.

[0017] Figure 3 It is the original format of Zigbee firmware and Matter firmware.

[0018] Figure 4 A schematic diagram of the steps of generating a bootloader-based OTA firmware upgrade for the present invention.

[0019] Figure 5 The figure is a schematic diagram of the bootloader firmware startup process disclosed in the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical scheme and advantages of the present invention clearer, the following is further described in detail with reference to the accompanying drawings and embodiments. It should be understood that the optimal embodiments described herein are only used to explain the present invention and are not used to limit the present invention. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0021] The present invention discloses a method for flexibly switching between zigbee firmware and matter firmware through OTA upgrade, so as to adapt the device to different environments and ensure that the firmware can work normally in different environments. Figure 1 The present invention modifies the bootloader based on mcuboot so that it has the ability to adapt to the startup of zigbee firmware and matter firmware at the same time. By identifying different firmware types, the corresponding zigbee or matter startup environment and process are dynamically selected, and then the zigbee firmware or matter firmware is switched to firmware adapted to the matter or zigbee environment through OTA upgrade, so that the device can start the new firmware normally.

[0022] like Figure 2 As shown, the method for switching between zigbee firmware and matter firmware based on OTA upgrade disclosed in the present invention specifically includes the following steps: S1: Obtain device information. Obtain device information of the device to be upgraded through the Zigbee protocol or the Matter protocol, including at least the device's firmware type, firmware version, and related attribute information; S2: Prepare the OTA upgrade package. Add the firmware identifier at the appropriate location of the firmware of the device to be upgraded, and add the firmware information table to the header and tail of the mcuboot firmware respectively, to generate the basic firmware of zigbee or matter, which is used for firmware security and integrity verification when the bootloader is started; then continue to add the OTA header, that is, the information description part of the firmware requested during OTA, and finally convert the matter firmware into OTA firmware that can be used in the zigbee environment, or convert the zigbee firmware into OTA firmware that can be used in the matter environment; S3: Push OTA upgrade package. Push the OTA firmware generated in step S2 above to the device to be upgraded through the gateway; S4: Bootloader starts and device upgrades. First, determine whether there is new firmware in the partition table (i.e., the OTA firmware pushed in S3), verify the bootloader information of the existing new firmware, then read the firmware type, and perform corresponding initialization according to the firmware type, provide different startup environments for matter firmware and zigbee firmware, and perform device OTA upgrade; S5: Start the firmware. Restart the device and start the new firmware.

[0023] When preparing an OTA upgrade package, different firmwares require different firmware identification. Since different chips have different requirements for bin files, the location where the firmware identification is added needs to be adaptively adjusted according to the chip type. As a specific implementation method, this embodiment is based on the 9218 series chip of telink, so the corresponding firmware identification is added in the head position of the firmware that can be modified but does not affect the operation of the entire firmware. Figure 3 and Figure 4 As shown, a firmware identification part is added to the header of the firmware body to form the original firmware. Specifically, the zigbee original firmware includes two parts: the zigbee firmware identification header and the zigbee firmware body, and the matter original firmware includes two parts: the matter firmware identification header and the matter firmware body. The firmware identification is used to identify the firmware type, i.e., zigbee firmware or matter firmware, and also includes the firmware version and firmware magic number information.

[0024] For the original firmware with the firmware logo added, in order to be correctly recognized by mcuboot, it must meet the basic firmware format requirements of mcuboot, that is, the mcuboot header and mcuboot tail in front of the firmware. These two parts include the information table generated by firmware compilation, which is directly encrypted by the tool provided by the bootloader when the firmware is generated, and the corresponding decryption key is saved in the bootloader. The bootloader directly verifies the firmware at startup, identifies whether the firmware is complete and whether it has been tampered with, and then verifies the legitimacy of the firmware. The matter SDK of the 9218 chip used in this solution can directly generate basic firmware that meets the requirements of mcuboot, but for the original zigbee firmware, it is necessary to modify the link script to add the mcuboot header to the head of the firmware to generate the basic firmware that mcuboot can normally recognize. The partition table of the basic firmware needs to be consistent with the partition table of the matter firmware to ensure the normal operation of mcuboot. The default size of the mcuboot header is 0x200, which is mainly used for mcuboot signature. After the bootloader verifies the legitimacy of the firmware, it will read the firmware type information from the firmware identifier and dynamically select the corresponding Zigbee or Matter startup environment and process based on the different firmware types.

[0025] In order to meet the OTA requirements of the firmware, it is necessary to generate an OTA header script, generate the corresponding format according to the input firmware type and firmware version parameter information, and then add it to the generated basic firmware header that meets the mcuboot requirements. During OTA, the information description part of the firmware will be requested from the gateway first, where zigbee specifies the format of the OTA firmware information description part ZigBee OTA header, and matter specifies the format of the OTA firmware information description part Matter OTAheader. After requesting the description information, the legitimacy of this part of the information needs to be verified before normal OTA can be performed. Zigbee's OTA firmware generation needs to confirm the firmware type, firmware version information and other accompanying information. In order to ensure normal recognition during the OTA upgrade process, when calling the script to generate OTA firmware, it is necessary to use the firmware type information and firmware version information running on the device to be upgraded, and generate an information table that can be recognized by the device to be upgraded based on this information, and then add this information to the beginning of the original bin file, so that the matter firmware can be converted into OTA firmware that can be used by zigbee. Similarly, when you need to convert the zigbee firmware into an OTA firmware that can be used by matter, you can use the src / app / ota_image_tool.py script in the matter source code directory to directly generate the upgrade firmware that can be recognized by matter. Matter needs to determine pid and vid to recognize the upgrade firmware. The parameters passed when the zigbee firmware is converted into an OTA firmware that can be used by matter must be parameters that can be recognized by the running matter firmware. If the parameters are incorrect, OTA will fail.

[0026] Figure 5 The schematic diagram of the bootloader firmware startup process disclosed in the present invention is as follows: Figure 5As shown in the figure, when the device to be upgraded is powered on, mcuboot, or bootloader, starts automatically. First, it determines whether there is new firmware in the partition table. Combined with the information table in the mcuboot header part of the firmware and the information table in the mcuboot tail part of the firmware, the legitimacy of the firmware is verified. Since the firmware needs to be signed and encrypted by the tool provided by the bootloader after compilation, the key for decrypting the information table exists in the bootloader. Only after the bootloader successfully decrypts the firmware can it normally identify the integrity of the firmware and whether it has been tampered with. After completing the firmware legitimacy verification, the bootloader goes to the firmware identification position to read the firmware type, and performs corresponding initialization according to the firmware type, providing different startup environments for matter firmware and zigbee firmware respectively. For the matter firmware, initialization only needs to clear the use of all peripherals and use the default interrupt configuration of mcuboot to start the matter firmware normally; for the zigbee firmware, initialization is divided into two startup methods, one of which is that the bootloader initializes the interrupt priority in advance and adjusts the interrupt priority through the plic part, and the zigbee firmware does not need to initialize the interrupt priority again; the other is that the bootloader does not initialize the interrupt priority during the startup process, but the compiled zigbee firmware determines whether the priority in the plic is set before executing normal functions after startup. If it is not set, it actively initializes the interrupt priority and then starts the zigbee firmware normally.

[0027] In summary, the method for switching between zigbee firmware and matter firmware based on OTA upgrade disclosed in the present invention modifies the bootloader based on mcuboot so that it has the ability to adapt to the startup of zigbee firmware and matter firmware at the same time, and dynamically selects the corresponding startup environment and process by identifying different firmware types to ensure the stability and adaptability of firmware startup; generates corresponding OTA firmware of zigbee firmware and matter firmware, and realizes flexible switching between different firmwares through OTA update and upgrade, making firmware switching more convenient and efficient. The present invention not only realizes flexible switching between zigbee firmware and matter firmware, but also improves the multiplexing capability of the system, so that the Internet of Things devices can work normally in different environments.

[0028] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for switching between zigbee firmware and matter firmware based on OTA upgrade, characterized in that: The following steps are involved: Step 1: Obtain device information. Obtain device information of the device to be upgraded through the Zigbee protocol or the Matter protocol, including at least the device's firmware type and firmware version information; Step 2: Prepare the OTA upgrade package and add the firmware identifier to the appropriate position of the firmware; then add the firmware information table to the header and tail of the mcuboot firmware respectively to generate the basic firmware of zigbee or matter, which is used for firmware security and integrity verification when the bootloader is started; finally, add the OTA header, which is the information description part of the firmware request during OTA, to convert the matter firmware into OTA firmware that can be used in the zigbee environment, or convert the zigbee firmware into OTA firmware that can be used in the matter environment; Step 3: Push the OTA upgrade package; Step 4: Device upgrade, bootloader starts, determines whether there is firmware in the partition table, verifies the bootloader information of the existing firmware, reads the firmware type, and performs corresponding initialization according to the firmware type, provides different startup environments for matter firmware and zigbee firmware, and performs device upgrade; Step 5: Restart the device to start the new firmware.

2. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: The firmware identifier in step 2 is added to the firmware header. The firmware identifier can identify the zigbee firmware and matter firmware, and also includes the firmware version and firmware magic number information.

3. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: The basic firmware of zigbee and matter generated in step 2 uses the same firmware partition table to ensure that the firmware can run normally.

4. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: The OTA header of the zigbee firmware in step 2 generates a corresponding format according to the input firmware type and firmware version parameter information by adding an OTA header script, and then adds it to the header of the generated basic firmware. The parameters input by the OTA header script need to be consistent with the firmware parameters of the running zigbee firmware, otherwise the generated OTA firmware cannot be normally recognized by the zigbee OTA.

5. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: The OTA firmware of the matter firmware in step 2 is generated by calling the OTA tool of matter. The firmware parameters passed in the OTA tool need to be consistent with the parameters of the running matter firmware, otherwise the generated OTA firmware cannot be normally recognized by matter OTA, wherein the firmware parameters include pid parameters and vid parameters.

6. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: In step 4, the matter firmware starts the initialization of the environment, specifically including interrupt configuration and initialization of peripherals.

7. The method for switching between zigbee firmware and matter firmware based on OTA upgrade according to claim 1, characterized in that: The initialization of the Zigbee firmware startup environment in step 4 includes two startup modes. One is that the bootloader initializes the interrupt priority, and the Zigbee firmware does not need to initialize the interrupt priority again; the other is that the bootloader does not initialize the interrupt priority, but actively initializes the interrupt priority before executing normal functions after the firmware is started.

Citation Information

Patent Citations

  • OTA upgrading method and system based on protocol conversion

    CN112822199A

  • Embedded device firmware updating method and embedded device

    CN114780122A

  • Differential upgrading method, embedded device and readable storage medium

    CN115904459A

  • PLC upgrading method and device

    CN116009927A

  • Communication connection establishment method, terminal device, storage medium and chip system

    CN116744472A

Cited By

  • Universal OTA architecture and OTA upgrading method and device

    CN121957644A