WO2018202177A1 - Zigbee设备的固件升级方法和装置 - Google Patents

Zigbee设备的固件升级方法和装置 Download PDF

Info

Publication number
WO2018202177A1
WO2018202177A1 PCT/CN2018/085732 CN2018085732W WO2018202177A1 WO 2018202177 A1 WO2018202177 A1 WO 2018202177A1 CN 2018085732 W CN2018085732 W CN 2018085732W WO 2018202177 A1 WO2018202177 A1 WO 2018202177A1
Authority
WO
WIPO (PCT)
Prior art keywords
zigbee
firmware
upgrade
devices
data
Prior art date
Application number
PCT/CN2018/085732
Other languages
English (en)
French (fr)
Inventor
黄秀峰
何海亮
Original Assignee
深圳市欧瑞博科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欧瑞博科技有限公司 filed Critical 深圳市欧瑞博科技有限公司
Publication of WO2018202177A1 publication Critical patent/WO2018202177A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a firmware upgrade method and apparatus for a Zigbee device.
  • Zigbee Zigbee Protocol
  • Zigbee Zigbe Protocol
  • Wi-Fi Wireless Fidelity
  • Zigbee has the advantages of convenient networking and low power consumption. It is widely used in some scenarios with large network scale and high power consumption requirements (such as smart home field).
  • Each Zigbee device has a fixed software system, referred to as firmware. In actual applications, when the firmware in the Zigbee device is defective or the function needs to be expanded, the firmware of the Zigbee device needs to be updated and updated.
  • the existing Zigbee device firmware upgrade scheme uses a one-to-one unicast method to upgrade each Zigbee device one by one, while the devices using the Zigbee protocol communicate with each other at a lower transmission rate, so the Zigbee device is deployed.
  • it takes a long time to upgrade the Zigbee device (each device takes tens of minutes).
  • it takes a long time to complete the upgrade of all devices, resulting in a very long time.
  • the upgrade efficiency is extremely low and the upgrade cost is high.
  • the main purpose of the embodiments of the present invention is to provide a firmware method and apparatus for a Zigbee device, which aims to shorten the firmware upgrade time of the Zigbee device and improve the upgrade efficiency.
  • a firmware upgrade method for a Zigbee device includes the following steps:
  • the gateway groups the accessed Zigbee devices, each group of Zigbee devices having the same type of firmware;
  • the gateway When the gateway receives the firmware upgrade notification, it determines the target group to be upgraded, and performs batch upgrade of the firmware of all Zigbee devices in the target group.
  • the batch upgrading the firmware of all Zigbee devices in the target group includes:
  • the upgrade data is transmitted to all Zigbee devices in the target group in a multicast manner;
  • the upgrade data is transmitted to the Zigbee device in the target group in a unicast manner.
  • the method further includes:
  • the missing upgrade data is transmitted to the Zigbee device in a unicast manner.
  • the threshold is 1 or 2.
  • performing the batch upgrade of the firmware of all Zigbee devices in the target group includes performing a firmware upgrade on all Zigbee devices in the target group by using a differential upgrade method.
  • the grouping, by the gateway, the accessed Zigbee device includes:
  • the gateway reads device information of the accessed Zigbee device, and groups the Zigbee device according to the device information.
  • the device information includes:
  • Another aspect provides a firmware upgrade apparatus for a Zigbee device, the device comprising:
  • a grouping module for grouping the accessed Zigbee devices, each group of Zigbee devices having the same type of firmware
  • the upgrade module is configured to determine a target group to be upgraded when receiving the firmware upgrade notification, and perform batch upgrade of firmware of all Zigbee devices in the target group.
  • the upgrading module includes:
  • a determining unit configured to determine whether the number of Zigbee devices in the target group is greater than a threshold
  • a transmission unit configured to: when the number of the Zigbee devices is greater than a threshold, use the multicast mode to transmit the upgrade data to all the Zigbee devices in the target group; when the number of the Zigbee devices is not greater than the threshold, the unicast mode is adopted.
  • the upgrade data is transmitted to the Zigbee device within the target group.
  • the transmission unit is further configured to:
  • the upgrade data transmission After the upgrade data transmission is completed, it is determined whether there is a Zigbee device that does not receive the complete upgrade data; when there is a Zigbee device that does not receive the complete upgrade data, the missing upgrade data is transmitted to the Zigbee device in a unicast manner.
  • the upgrading module is configured to perform batch upgrade of firmware of all Zigbee devices in the target group by using a differential upgrade method.
  • the grouping module is configured to: read device information of the accessed Zigbee device, and group the Zigbee device according to the device information.
  • a firmware upgrade method for a Zigbee device by dividing a Zigbee device having the same firmware type into a group, and when a firmware upgrade is required, performing batch upgrade of firmware of all Zigbee devices in a group. As a result, multiple Zigbee devices are upgraded at the same time. Compared with the Zigbee device upgrade, the batch upgrade greatly shortens the upgrade time and doubles the upgrade efficiency.
  • the firmware upgrade is performed by using the differential upgrade method, so that only the difference data is transmitted during the data transmission process, thereby greatly reducing the amount of data transmitted by the gateway to the Zigbee device, and achieving the effect of increasing the firmware upgrade speed by dozens or even hundreds of times. It solves the problem that the upgrade cost is too high and the upgrade time is too long, which improves the user experience.
  • FIG. 1 is a flowchart of a firmware upgrade method of a Zigbee device according to a first embodiment of the present invention
  • FIG. 2 is a schematic diagram of grouping Zigbee devices in an embodiment of the present invention.
  • FIG. 3 is a specific flowchart of a gateway sending upgrade data in an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of interaction between a gateway and a Zigbee device in a batch upgrade in a multicast manner according to an embodiment of the present invention
  • FIG. 5 is a block diagram showing a firmware upgrading apparatus of a Zigbee device according to a second embodiment of the present invention.
  • FIG. 6 is a block diagram of the upgrade module of FIG. 5.
  • first, second, and the like in the present invention are used for the purpose of description only, and are not to be construed as indicating or implying their relative importance or implicitly indicating the number of technical features indicated.
  • features defining “first” or “second” may include at least one of the features, either explicitly or implicitly.
  • the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. It is also within the scope of protection required by the present invention.
  • a firmware upgrade method for a Zigbee device according to a first embodiment of the present invention is proposed.
  • the method includes the following steps:
  • the gateway groups the accessed Zigbee devices, and each group of Zigbee devices has the same type of firmware.
  • the gateway (or Zigbee gateway) divides the Zigbee devices with the same firmware into one group.
  • the device information of the accessed Zigbee device can be read, and the Zigbee devices are grouped according to the device information.
  • Information includes device type, plan type, firmware type, firmware version, and so on.
  • the scheme type refers to the Zigbee chip solution, a description that needs to be used in the upgrade, such as the TI scheme, the NXP scheme, the EMBER scheme, etc., and the firmware of different schemes cannot be compatible, that is, different schemes correspond to different firmwares.
  • the gateway reads the unique identification code of the firmware of the Zigbee device, and identifies the firmware type of the Zigbee device according to the unique identification code.
  • the gateway puts the Zigbee device of the same firmware type. Split into the same group.
  • the gateway reads the unique identification code and version number of the firmware of the Zigbee device, and identifies the firmware type and firmware version of the Zigbee device according to the unique identification code and the version number, respectively, when the Zigbee device joins the gateway.
  • the gateway divides the Zigbee devices of the same firmware type and firmware version into the same group.
  • the gateway reads the device type (such as the model) and the solution type of the Zigbee device.
  • the gateway divides the Zigbee devices of the same device type and the solution type into the same group. Zigbee devices with the same device type and scheme type have the same firmware type.
  • the gateway reads the device type, the scheme type, and the firmware version of the Zigbee device.
  • the gateway divides the Zigbee device of the same device type, solution type, and firmware version into the same a group.
  • an example of a firmware upgrade system for a Zigbee device includes a server, a gateway, and a plurality of Zigbee devices.
  • the Zigbee device consists of 9 lights and 8 curtain controllers (referred to as curtains in Figure 2).
  • the gateway will assign 9 lights (lights 1 - 9) with the same firmware type to group A, which will have the same firmware type.
  • Eight curtain controllers (curtains 1 - curtain 8) are assigned to group B.
  • Zigbee devices can be grouped in other manners, as long as each group of Zigbee devices has the same type of firmware, and the present invention will not be described again.
  • step S12 when the gateway receives the firmware upgrade notification of the Zigbee device sent by the server, the gateway first determines the target group of the corresponding Zigbee device according to the device information and/or firmware information in the firmware upgrade notification, and obtains the version number of the new firmware, and determines Whether the version of the new firmware is newer than the version of the existing firmware of the Zigbee device in the target group, and if so, the notification server can be upgraded, receive the upgrade data sent by the server, and send the upgrade data to all Zigbee devices in the target group to Batch upgrade the firmware of all Zigbee devices.
  • the specific process for the gateway to send the upgrade data includes the following steps:
  • the gateway determines whether the number of Zigbee devices in the target group is greater than a threshold. When the number of Zigbee devices is not greater than the threshold, the process proceeds to step S122; when the number of Zigbee devices is greater than the threshold, the process proceeds to step S123.
  • the threshold may be set to 1, that is, when there is only one Zigbee device, it is transmitted in unicast mode; when more than one Zigbee device is used, it is transmitted in multicast mode.
  • the threshold is set to 2, ie when there is only one or two Zigbees When the device is used, it is transmitted in unicast mode; when more than two Zigbee devices are used, it is transmitted in multicast mode.
  • threshold value may also be set to other values according to actual needs, which is not limited by the present invention.
  • the gateway transmits the upgrade data to the Zigbee device in the target group in a unicast manner.
  • the gateway transmits the upgrade data in a unicast manner.
  • the unicast transmission is a one-to-one transmission method, which is a transmission method commonly used in the prior art, and will not be described here.
  • S123 The gateway uses multicast mode to transmit upgrade data to all Zigbee devices in the target group.
  • step S123 when the number of Zigbee devices in the target group is greater than the threshold, the gateway sends an instruction to start multicast upgrade to all Zigbee devices in the target group, and transmits the upgrade data in a multicast manner.
  • the gateway divides the upgrade data into N (N is an integer greater than 0) packets carrying the sequence number (1-N) from small to large, and sends the data through the multicast mode; the Zigbee device
  • the gateway When receiving each data packet, first check to ensure that the received data packet is correct. After the verification is passed, the upgrade data is written to the corresponding firmware upgrade flash area (you can not do any reply to the gateway). After successful, record the serial number of the currently processed packet.
  • Multicast transmission is a one-to-many transmission method, which means that information is simultaneously transmitted to a group of destination addresses, and a point-to-multipoint network connection is realized between the sender and each receiver. It uses the strategy to be the most efficient, because the message is only transmitted once on each network link, and the message is only copied when the link is forked, which can improve data transmission efficiency and reduce congestion in the backbone network. The possibility.
  • the related Zigbee device can enable the multicast fast processing mode to transmit the upgrade data.
  • the fast processing mode all the Zigbee devices in the target group can continuously receive and forward the multicast packet in a short period of time (That is, the broadcast mode of the multicast transmission packet.
  • the fast processing mode when the number of multicast packets buffered by the Zigbee device reaches the threshold, the oldest cached multicast packet is discarded, and the buffer space is vacated for the next new multicast packet, thereby preventing new multicast on the one hand. Failure to receive the packet results in incomplete data reception, and on the other hand, it can increase the transmission speed.
  • the gateway determines whether there is a Zigbee device that does not receive the complete upgrade data; when there is a Zigbee device that does not receive the complete upgrade data, the gateway transmits the Zigbee device to the Zigbee device in a unicast manner. Its missing upgrade data. This ensures that all Zigbee devices in the target group can be successfully upgraded to improve system reliability.
  • the multicast sends a command to upgrade the upgrade data to all Zigbee devices in the target group.
  • This command carries the maximum sequence number N and the Zigbee according to the target group.
  • the maximum random delay T generated by the number of devices.
  • the Zigbee device determines whether it has received all 1-N data packets. If it has been received, it will reply to the gateway with a complete notification of the data packet by unicast. Preferably, a random delay can be made when replying to the notification. T (T>0), to prevent a large number of Zigbee devices in the same time target from replying to the notification, causing network congestion, and thus data transmission failure.
  • the gateway After receiving the complete notification of the data packet, the gateway sends a confirmation message to the corresponding Zigbee device through unicast mode. After receiving the confirmation message, the Zigbee device officially performs the firmware upgrade.
  • the gateway When the gateway does not receive the complete notification of the data packet replied by a Zigbee device in the target group, it is determined that the Zigbee device does not receive the complete upgrade data, and the gateway unicasts the data without fail to complete the upgrade data one by one.
  • the Zigbee device asks for the missing packet sequence number.
  • the Zigbee device compares the serial number recorded when processing the packet and then returns the missing serial number to the gateway.
  • the gateway After receiving the missing serial number, the gateway sends the data packet corresponding to the serial number to the corresponding Zigbee device in unicast mode until all the data packets corresponding to the missing serial number are sent. Finally, until the gateway confirms that all Zigbee devices in the target group have received the complete upgrade data and successfully upgraded.
  • this step can be omitted.
  • the gateway may perform a firmware upgrade for all Zigbee devices in the target group simultaneously by using a differential upgrade method.
  • the upgrade data of the differential upgrade only includes the data of the difference between the new firmware and the old firmware, so the amount of data transmitted is smaller than the entire data of the new firmware, which can improve the upgrade efficiency.
  • the gateway notifies the server that the device can be upgraded, and also sends the device type and firmware version or firmware type and firmware version of the Zigbee device in the target group to the server.
  • the server finds the corresponding firmware according to the device type and firmware version or firmware type and firmware version, and then compares the new and old firmware to the firmware according to the memory map file (.map) in terms of function code segment (data) and data segment (data).
  • the difference in the version data, and then the corresponding version difference description file (hereinafter referred to as the difference description file) is generated, and the difference description file may be referred to as a differential package.
  • the first part of the difference description file describes the address segments of all the same data in the old firmware and the new firmware in the Zigbee device (each address segment includes a start address and an end address) and the target start of the part data in the device firmware download area.
  • the address; the second part describes the difference data (that is, the data that does not exist in the old firmware) and the data check value and the target start address and end address of the part of the data in the device firmware download area.
  • the server notifies the gateway to use the differential upgrade, that is, to use the difference description file to upgrade, and send the difference description file to the gateway.
  • the server After the server generates the difference description file, first determine the size of the difference description file and the original new firmware. The normal difference description file is much smaller than the original new firmware.
  • the gateway is notified to use the difference description file to upgrade and describe the difference.
  • the file is sent to the gateway, and when the difference description file is larger than the original new firmware, the gateway is notified to use the whole package upgrade to send the entire data of the original new firmware to the gateway.
  • the gateway sends the difference description file as the upgrade data into N packets carrying the sequence number (1-N) from small to large.
  • the Zigbee device may need to perform a large amount of data copying when processing the data packet.
  • the gateway performs a delay t (t>0) in the middle of every two data packets sent according to the size of the data processed by the Zigbee device, that is, sends a data packet every t time to ensure that the Zigbee device has Sufficient time to process.
  • the delay t and the magnitude of the processed data amount preferably have a linear positive correlation.
  • the Zigbee device After receiving each data packet, the Zigbee device first checks the data packet to ensure that the received data packet is correct. After the verification is passed, it is determined whether the data packet is a data packet of the difference description file (differential upgrade). . If yes, the same data part of the new and old firmware copies the corresponding data according to the address description to the firmware upgrade flash area according to the address, and the different data parts directly write the received data to the corresponding firmware upgrade flash area; if it is original The new firmware data (package upgrade) is written directly to the corresponding firmware upgrade flash area. After the operation is successful, record the serial number of the currently processed data packet. When the Zigbee device receives all the upgrade data, it officially upgrades the firmware.
  • the difference description file Differential upgrade
  • FIG. 4 a specific process for the gateway to perform batch upgrade of the firmware of the Zigbee device in a multicast manner is shown in FIG. 4, and includes the following steps:
  • the gateway groups the joined Zigbee devices. Make each set of Zigbee devices have the same type of firmware.
  • the gateway receives the upgrade notification, and determines that the group A needs to be upgraded.
  • the gateway receives the difference description file or the new firmware.
  • the server sends a difference description file (or a differential package) to the gateway; when performing a package upgrade, the server sends the new firmware directly to the gateway.
  • the gateway sends an upgrade start command in multicast mode.
  • the number of Zigbee devices in group A is greater than 2.
  • the gateway determines that the multicast batch upgrade condition is met. Therefore, the upgrade start command is sent to all Zigbee devices in group A by multicast.
  • the Zigbee device enters the multicast (broadcast) fast processing mode. After receiving the upgrade start command, each Zigbee device enters the multicast (broadcast) fast processing mode immediately.
  • the gateway sequentially sends the data packet carrying the 1-N serial number by using a multicast mode.
  • the gateway divides the upgrade data into N (N is an integer greater than 0) packets carrying the sequence number (1-N) from small to large, and transmits them in a multicast manner.
  • the Zigbee device performs a corresponding copy or write flash operation on the data packet that passes the verification, and records the corresponding serial number.
  • the gateway sends a command for completing the transmission of the data packet by using a multicast mode.
  • the node that receives the data packet completes the unicast reply packet complete notification (or the notification that the data packet has been received).
  • the node that receives the data packet (that is, the Zigbee device that receives the data packet) preferably makes a random delay T (T>0) when sending the notification.
  • the gateway unicasts which data packets are missing from the node that the data packet is not received.
  • the unicast mode is used to query which packets are missing by the Zigbee device.
  • the node that does not receive the data packet unicast returns the sequence number of the missing data packet.
  • the gateway sends the data packet corresponding to the serial number in a unicast manner.
  • the gateway sends a command for completing the transmission of the data packet by using a multicast mode.
  • the gateway When all the missing Zigbee devices have completed the missing packets, the gateway multicasts the commands for the transmitted packets.
  • the gateway unicast confirmation command can be upgraded.
  • Steps S32-S36 are repeated until a notification of complete packet reply by all Zigbee devices in group A is received.
  • the gateway determines that all Zigbee devices in the group A have been upgraded successfully, and the process ends.
  • the firmware upgrade method of the Zigbee device in the embodiment of the present invention is implemented by grouping the Zigbee devices having the same firmware type into groups.
  • the firmware upgrade is required, the firmware of all the Zigbee devices in the group is upgraded in batches, thereby realizing more Zigbee devices are upgraded at the same time.
  • the batch upgrade greatly shortens the upgrade time and doubles the upgrade efficiency.
  • the firmware upgrade is performed by the differential upgrade method, so that only the difference data is transmitted during the data transmission process, thereby greatly reducing the amount of data transmitted by the gateway to the Zigbee device, and achieving the effect of increasing the firmware upgrade speed by dozens or even hundreds of times.
  • the upgrade time is shortened, which solves the problem of excessive upgrade cost and long upgrade time, which improves the user experience.
  • Zigbee devices with the same firmware type.
  • devices of the same model can be upgraded in batches by using the technical solutions of the embodiments of the present invention, so that the utility model is very practical.
  • the firmware upgrade method of the Zigbee device in the embodiment of the present invention can be applied to a remote upgrade, and can also be applied to a user and a manufacturer to produce a repair upgrade.
  • a firmware upgrade apparatus for a Zigbee device according to a second embodiment of the present invention is proposed.
  • the device is applied to a gateway, and includes a grouping module and an upgrade module, where:
  • Packet module used to group all Zigbee devices that are accessed. Each group of Zigbee devices has the same type of firmware.
  • the grouping module divides the Zigbee devices with the same firmware into a group.
  • the device information of the accessed Zigbee device can be read, and the Zigbee device is grouped according to the device information, where the device information includes the device type, the solution type, and the firmware. Type, firmware version, etc.
  • the scheme type refers to the Zigbee chip solution, a description that needs to be used in the upgrade, such as the TI scheme, the NXP scheme, the EMBER scheme, etc., and the firmware of different schemes cannot be compatible, that is, different schemes correspond to different firmwares.
  • the packet module reads the unique identification code of the firmware of the Zigbee device, and identifies the firmware type of the Zigbee device according to the unique identification code.
  • the grouping module uses the same firmware type. Zigbee devices are grouped into the same group.
  • the packet module reads the unique identification code and version number of the firmware of the Zigbee device, and identifies the firmware type and the firmware version of the Zigbee device according to the unique identification code and the version number respectively, when the Zigbee device joins the gateway.
  • the grouping module divides the Zigbee devices of the same firmware type and firmware version into the same group.
  • the packet module reads the device type (such as the model) and the solution type of the Zigbee device.
  • the grouping module divides the Zigbee device of the same device type and the solution type into the same.
  • a group of Zigbee devices with the same device type and scheme type has the same firmware type.
  • the packet module reads the device type, the scheme type, and the firmware version of the Zigbee device.
  • the group module divides the Zigbee device of the same device type, solution type, and firmware version. Go to the same group.
  • an example of a firmware upgrade system for a Zigbee device includes a server, a gateway, and a plurality of Zigbee devices.
  • the Zigbee device consists of 9 lights and 8 shade controllers.
  • the grouping module divides 9 lights with the same firmware type into group A, and divides 8 curtain controllers with the same firmware type into group B.
  • Zigbee devices can be grouped in other manners, as long as each group of Zigbee devices has the same type of firmware, and the present invention will not be described again.
  • Upgrade module Used to receive the firmware upgrade notification, determine the target group to be upgraded, and perform batch upgrade of the firmware of all Zigbee devices in the target group.
  • the upgrade module When receiving the firmware upgrade notification of the Zigbee device sent by the server, the upgrade module first determines the target group of the corresponding Zigbee device according to the device information and/or the firmware information in the firmware upgrade notification, obtains the version number of the new firmware, and determines the new firmware. Whether the version is newer than the existing firmware version of the Zigbee device in the target group. If yes, the notification server can upgrade, receive the upgrade data sent by the server, and send the upgrade data to all Zigbee devices in the target group for all Zigbee The firmware of the device is upgraded in batches.
  • the upgrade module includes a judging unit and a transmission unit, where:
  • Judging unit used to determine whether the number of Zigbee devices in the target group is greater than a threshold.
  • the transmission unit is configured to: when the number of the Zigbee devices is greater than the threshold, use the multicast mode to transmit the upgrade data to all the Zigbee devices in the target group; when the number of the Zigbee devices is not greater than the threshold, use the unicast mode to the Zigbee in the target group.
  • the device transmits upgrade data.
  • the threshold may be set to 1, that is, when there is only one Zigbee device, the transmission unit transmits in a unicast manner; when more than one Zigbee device, the transmission unit transmits in a multicast manner.
  • the threshold is set to 2, ie when there is only one or two Zigbees In the case of equipment, the transmission unit transmits in unicast mode; when more than two Zigbee devices are used, the transmission unit transmits in multicast mode.
  • the threshold value may also be set to other values according to actual needs, which is not limited by the present invention.
  • the transmission unit When the number of Zigbee devices in the target group is greater than the threshold, the transmission unit sends an instruction to start multicast upgrade to all Zigbee devices in the target group, and transmits the upgrade data in multicast mode.
  • the transmission unit divides the upgrade data into N (N is an integer greater than 0) packets carrying the sequence number (1-N) from small to large, and transmits the data through multicast.
  • Multicast transmission is a one-to-many transmission method, which means that information is simultaneously transmitted to a group of destination addresses, and a point-to-multipoint network connection is realized between the sender and each receiver. It uses the strategy to be the most efficient, because the message is only transmitted once on each network link, and the message is only copied when the link is forked, which can improve data transmission efficiency and reduce congestion in the backbone network. The possibility.
  • the transmission unit determines whether there is a Zigbee device that does not receive the complete upgrade data; when there is a Zigbee device that does not receive the complete upgrade data, the transmission unit uses the unicast mode to the Zigbee. The device transmits its missing upgrade data. This ensures that all Zigbee devices in the target group can be successfully upgraded to improve system reliability.
  • the multicast transmission command is sent to all Zigbee devices in the target group through multicast, and the command carries the maximum sequence number N and according to the target group.
  • the maximum random delay T generated by the number of Zigbee devices.
  • the transmission unit determines that the Zigbee device does not receive the complete upgrade data, and then unicasts the data to the data that is not fully received.
  • the Zigbee device queries the missing packet sequence number. After receiving the missing sequence number, the Zigbee device sends the packet corresponding to the sequence number to the corresponding Zigbee device through unicast mode until all the missing sequence numbers correspond to the data packet. Finished.
  • the transmission unit may omit this step.
  • the upgrade module can perform a firmware upgrade for all Zigbee devices in the target group simultaneously by using a differential upgrade method.
  • the upgrade data of the differential upgrade only includes the data of the difference between the new firmware and the old firmware, so the amount of data transmitted is smaller than the entire data of the new firmware, which can improve the upgrade efficiency.
  • the upgrade module notifies the server that the device can be upgraded, and also sends the device type and firmware version or firmware type and firmware version of the Zigbee device in the target group to the server, so that the server is based on the device type and firmware version or firmware type and firmware.
  • the version generation corresponding version difference description file (hereinafter referred to as the difference description file), the difference description file may also be referred to as a differential package.
  • the first part of the difference description file describes the address segments of all the same data in the old firmware and the new firmware in the Zigbee device (each address segment includes a start address and an end address) and the target start of the part data in the device firmware download area.
  • the address; the second part describes the difference data (that is, the data that does not exist in the old firmware) and the data check value and the target start address and end address of the part of the data in the device firmware download area.
  • the upgrade module After receiving the difference description file sent by the server, the upgrade module sends the difference description file as the upgrade data into N packets carrying the serial number (1-N) from small to large through the transmission unit.
  • the Zigbee device When processing a data packet, a large amount of data copying work may be performed.
  • the transmission unit performs a delay t (t>0) between each two data packets sent according to the amount of data processed by the Zigbee device end, that is, A packet is sent every t time to ensure that the Zigbee device has enough time to process it.
  • the delay t and the magnitude of the processed data amount preferably have a linear positive correlation.
  • the firmware upgrade device of the Zigbee device in the embodiment of the present invention divides the Zigbee devices having the same firmware type into one group, and when the firmware upgrade is required, the firmware of all the Zigbee devices in the group is upgraded in batches, thereby realizing more Zigbee devices are upgraded at the same time. Compared with the Zigbee device upgrades one by one, the batch upgrade greatly shortens the upgrade time and doubles the upgrade efficiency.
  • the firmware upgrade is performed by using the differential upgrade method, so that only the difference data is transmitted during the data transmission process, thereby greatly reducing the amount of data transmitted by the gateway to the Zigbee device, and achieving the effect of increasing the firmware upgrade speed by dozens or even hundreds of times. It solves the problem that the upgrade cost is too high and the upgrade time is too long, which improves the user experience.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a firmware upgrade method for a Zigbee device by dividing a Zigbee device having the same firmware type into a group, and when a firmware upgrade is required, performing batch upgrade of firmware of all Zigbee devices in a group. As a result, multiple Zigbee devices are upgraded at the same time. Compared with the Zigbee device upgrade, the batch upgrade greatly shortens the upgrade time and doubles the upgrade efficiency.
  • the firmware upgrade is performed by using the differential upgrade method, so that only the difference data is transmitted during the data transmission process, thereby greatly reducing the amount of data transmitted by the gateway to the Zigbee device, and achieving the effect of increasing the firmware upgrade speed by dozens or even hundreds of times. It solves the problem that the upgrade cost is too high and the upgrade time is too long, which improves the user experience. Therefore, it has industrial applicability.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明公开了一种 Zigbee设备的固件升级方法和装置,所述方法包括以下步骤:网关对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件;所述网关接收到固件升级通知时,确定需要升级的目标组,并对所述目标组内的所有Zigbee设备的固件进行批量升级。从而实现了多个Zigbee设备同时升级,相对于对Zigbee设备进行逐个升级的方式,批量升级大大缩短了升级时间,成倍的提高了升级效率。同时,采用差分升级方式进行固件升级,使得数据传输过程中只传输差异部分数据,从而大大减少了网关给Zigbee设备传输的数据量,达到了数十倍甚至上百倍提升固件升级速度的效果,有效解决了升级成本过高和升级时间过长的问题,提升了用户体验。

Description

Zigbee设备的固件升级方法和装置 技术领域
本发明涉及通信技术领域,尤其是涉及一种Zigbee设备的固件升级方法和装置。
背景技术
Zigbee(紫蜂协议)是一种类似于Wi-Fi的无线通讯协议,采用 zigbee技术进行通信的设备称为zigbee设备。与Wi-Fi相比,Zigbee具有组网方便、功耗较低的优点,在一些网络规模较大、功耗要求较高的场景(如智能家居领域)中得到广泛的应用。每个Zigbee设备都有套固定软件***,简称为固件,在实际应用中,当Zigbee设备中的固件产生缺陷或者功能需要扩展时,就需要对Zigbee设备的固件进行升级更新。
现有的Zigbee设备的固件升级方案,采用一对一的单播方式逐一对每一个Zigbee设备进行升级,而采用Zigbee 协议的设备之间互相通信的传输速率较低,因此在部署了Zigbee设备的网络中,对Zigbee 设备进行固件升级通常需要耗费较长的时间(每个设备都要数十分钟),特别是当Zigbee设备比较多时,完成所有设备的升级所耗费的时间将会非常长,导致升级效率极低,升级成本较高。
因此,如何缩短Zigbee设备的固件升级的时间,提高升级效率,降低升级成本,是当前亟需解决的技术问题。
技术问题
本发明实施例的主要目的在于提供一种Zigbee设备的固件方法和装置,旨在缩短Zigbee设备的固件升级的时间,提高升级效率。
技术解决方案
为达以上目的,一方面提出一种 Zigbee设备的固件升级方法,所述方法包括以下步骤:
网关对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件;
所述网关接收到固件升级通知时,确定需要升级的目标组,并对所述目标组内的所有Zigbee设备的固件进行批量升级。
可选地,所述对所述目标组内的所有Zigbee设备的固件进行批量升级包括:
判断所述目标组内的Zigbee设备的数量是否大于阈值;
当所述Zigbee设备的数量大于阈值时,采用组播方式向所述目标组内的所有Zigbee设备传输升级数据;
当所述Zigbee设备的数量不大于阈值时,采用单播方式向所述目标组内的Zigbee设备传输升级数据。
可选地,所述采用组播方式向所述目标组内的所有Zigbee设备传输升级数据的步骤之后还包括:
当升级数据传输完毕后,判断是否存在没有收到完整的升级数据的Zigbee设备;
当存在没有收到完整的升级数据的Zigbee设备时,采用单播方式向该Zigbee设备传输其缺失的升级数据。
可选地,所述阈值为1或2。
可选地,所述对所述目标组内的所有Zigbee设备的固件进行批量升级包括:采用差分升级方法对所述目标组内的所有Zigbee设备同时进行固件升级。
可选地,所述网关对接入的Zigbee设备进行分组包括:
所述网关读取接入的Zigbee设备的设备信息,根据所述设备信息对所述Zigbee设备进行分组。
可选地,所述设备信息包括:
固件类型;或者,
固件类型和固件版本;或者,
设备类型和方案类型;或者,
设备类型、方案类型和固件版本。
另一方面提出一种Zigbee设备的固件升级装置,所述装置包括:
分组模块,用于对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件;
升级模块,用于接收到固件升级通知时,确定需要升级的目标组,并对所述目标组内的所有Zigbee设备的固件进行批量升级。
可选地,所述升级模块包括:
判断单元,用于判断所述目标组内的Zigbee设备的数量是否大于阈值;
传输单元,用于当所述Zigbee设备的数量大于阈值时,采用组播方式向所述目标组内的所有Zigbee设备传输升级数据;当所述Zigbee设备的数量不大于阈值时,采用单播方式向所述目标组内的Zigbee设备传输升级数据。
可选地,所述传输单元还用于:
当升级数据传输完毕后,判断是否存在没有收到完整的升级数据的Zigbee设备;当存在没有收到完整的升级数据的Zigbee设备时,采用单播方式向该Zigbee设备传输其缺失的升级数据。
可选地,所述升级模块用于:采用差分升级方法对所述目标组内的所有Zigbee设备的固件进行批量升级。
可选地,所述分组模块用于:读取接入的Zigbee设备的设备信息,根据所述设备信息对所述Zigbee设备进行分组。
有益效果
本发明实施例所提供的一种Zigbee设备的固件升级方法,通过将具有相同固件类型的Zigbee设备分成一组,当需要固件升级时,则对一组内的所有Zigbee设备的固件进行批量升级,从而实现了多个Zigbee设备同时升级,相对于对Zigbee设备进行逐个升级的方式,批量升级大大缩短了升级时间,成倍的提高了升级效率。
同时,采用差分升级方式进行固件升级,使得数据传输过程中只传输差异部分数据,从而大大减少了网关给Zigbee设备传输的数据量,达到了数十倍甚至上百倍提升固件升级速度的效果,有效解决了升级成本过高和升级时间过长的问题,提升了用户体验。
附图说明
图1是本发明第一实施例的Zigbee设备的固件升级方法的流程图;
图2是本发明实施例中对Zigbee设备进行分组的示意图;
图3是本发明实施例中网关发送升级数据的具体流程图;
图4是本发明实施例中以组播方式进行批量升级时网关与Zigbee设备的交互示意图;
图5是本发明第二实施例的Zigbee设备的固件升级装置的模块示意图;
图6是图5中的升级模块的模块示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
本发明的实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
需要说明,本发明实施例中所有方向性指示(诸如上、下、左、右、前、后……)仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。
另外,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
实施例一
参见图1,提出本发明第一实施例的 Zigbee设备的固件升级方法,所述方法包括以下步骤:
S11、网关对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件。
S12、网关接收到固件升级通知时,确定需要升级的目标组,并对目标组内的所有Zigbee设备的固件进行批量升级。
步骤S11中,网关(或称Zigbee网关)将具有相同固件的Zigbee设备分成一组,具体实施时,可以读取接入的Zigbee设备的设备信息,根据设备信息对Zigbee设备进行分组,所述设备信息包括设备类型、方案类型、固件类型、固件版本等。其中,方案类型指的是Zigbee芯片方案,升级中需用到的一个描述,比如TI方案、NXP方案、EMBER方案等,不同方案的固件不能兼容,即不同的方案对应不同的固件。
可选地,网关在Zigbee设备加入时,读取Zigbee设备的固件的唯一标识码,根据唯一标识码识别出Zigbee设备的固件类型,当Zigbee设备加入网关后,网关就把相同固件类型的Zigbee设备分到同一个组。
可选地,网关在Zigbee设备加入时,读取Zigbee设备的固件的唯一标识码和版本号,根据唯一标识码和版本号分别识别出Zigbee设备的固件类型和固件版本,当Zigbee设备加入网关后,网关就把相同固件类型和固件版本的Zigbee设备分到同一个组。
可选地,网关在Zigbee设备加入时,读取Zigbee设备的设备类型(如型号)和方案类型,当Zigbee设备加入网关后,网关就把相同设备类型和方案类型的Zigbee设备分到同一个组,具有相同的设备类型和方案类型的Zigbee设备具有相同的固件类型。
可选地,网关在Zigbee设备加入时,读取Zigbee设备的设备类型、方案类型和固件版本,当Zigbee设备加入网关后,网关就把相同设备类型、方案类型和固件版本的Zigbee设备分到同一个组。
如图2所示,为Zigbee设备的固件升级***一实例,该***包括一个服务器、一个网关和多个Zigbee设备。Zigbee设备包括9个灯和8个窗帘控制器(图2中简称窗帘),网关将具有相同的固件类型的9个灯(灯1-灯9)分到组A,将具有相同的固件类型的8个窗帘控制器(窗帘1-窗帘8)分到组B。
本领域技术人员可以理解,除了上述列举的方式外,还可以采用其它方式对Zigbee设备进行分组,只要保证每组Zigbee设备具有相同类型的固件即可,本发明对此不再一一列举赘述。
步骤S12中,当网关收到服务器发送的Zigbee设备的固件升级通知时,首先根据固件升级通知中的设备信息和/或固件信息确定对应的Zigbee设备的目标组,获取新固件的版本号,判断新固件的版本是否比目标组内的Zigbee设备的现有固件的版本新,如果是,则通知服务器可以升级,接收服务器发送的升级数据,并向目标组内的所有Zigbee设备发送升级数据,以对所有Zigbee设备的固件进行批量升级。
可选地,如图3所示,网关发送升级数据的具体流程包括以下步骤:
S121、网关判断目标组内的Zigbee设备的数量是否大于阈值。当Zigbee设备的数量不大于阈值时,进入步骤S122;当Zigbee设备的数量大于阈值时,进入步骤S123。
所述阈值可以设定为1,即:当只有一个Zigbee设备时,采用单播方式传输;当超过一个Zigbee设备时,则采用组播方式传输。
实践发现,当有两个Zigbee设备时,单播传输实际上比组播传输速度更快,因此,在一可选实施例中,将阈值设定为2,即:当只有一个或两个Zigbee设备时,采用单播方式传输;当超过两个Zigbee设备时,则采用组播方式传输。
当然,所述阈值也可以根据实际需要设定为其它值,本发明对此不作限定。
S122、网关采用单播方式向目标组内的Zigbee设备传输升级数据。
本步骤S22中,当目标组内Zigbee设备的数量不大于阈值时,网关则采用单播方式传输升级数据。单播传输即一对一的传输方式,是现有技术中常用的传输方式,在此不赘述。
S123、网关采用组播方式向目标组内的所有Zigbee设备传输升级数据。
本步骤S123中,当目标组内Zigbee设备的数量大于阈值时,网关则向目标组内的所有Zigbee设备发送一个开始启动组播升级的指令,并采用组播方式传输升级数据。优选地,网关在传输升级数据时,将升级数据分成N(N为大于0的整数)个携带从小到大的序列号(1-N)的数据包,并通过组播方式发送出去;Zigbee设备收到每个数据包时,首先做校验以确保接收到的数据包正确无误,校验通过后,将升级数据写入到对应的固件升级Flash区域(可以不用对网关做任何回复),操作成功后记录下当前处理的数据包的序列号。
组播传输即一对多的传输方式,是指把信息同时传递给一组目的地址,在发送者和每一接收者之间实现点对多点网络连接。它使用策略是最高效的,因为消息在每条网络链路上只需传递一次,而且只有在链路分叉时,消息才会被复制,从而可以提高数据传送效率,减少了骨干网络出现拥塞的可能性。
可选地,相关Zigbee设备收到组播升级指令后,可以开启组播的快速处理模式传输升级数据,快速处理模式即目标组内所有的Zigbee设备都可以短时间内连续接收转发组播包(即组播传输的数据包)的广播方式。在快速处理模式下,当Zigbee设备缓存的组播包的数量达到阈值时,则丢弃最早缓存的组播包,为下一个新的组播包腾出缓存空间,从而一方面防止新的组播包接收失败导致接收到数据不完整,另一方面可以提高传输速度。
进一步地,当升级数据传输完毕后,网关判断是否存在没有收到完整的升级数据的Zigbee设备;当存在没有收到完整的升级数据的Zigbee设备时,网关再采用单播方式向该Zigbee设备传输其缺失的升级数据。从而保证目标组内的所有Zigbee设备都能成功升级,提高***的可靠性。
具体实施时,当网关把升级数据发送完成后,再通过组播向目标组内的所有Zigbee设备发送一条升级数据传输完毕的命令,这条命令携带了最大序列号N和根据目标组内的Zigbee设备的数量生成的最大随机延时T。Zigbee设备收到命令后,判断是否已收全1-N个数据包,如果已经收全则通过单播方式向网关回复一个数据包完整的通知,优选地,回复通知时可以做一个随机延时T(T>0),以防止同一时间目标内有大量的Zigbee设备回复该通知而造成网络拥塞,从而使数据发送失败。网关收到数据包完整的通知后,通过单播方式给对应的Zigbee设备发送一个确认信息,Zigbee设备收到确认信息后正式进行固件升级。
当网关没有收到目标组中某一Zigbee设备回复的数据包完整的通知时,就判定该Zigbee设备没有收到完整的升级数据,网关则通过单播方式逐一地向这些没有收全升级数据的Zigbee设备询问丢失的数据包序列号。Zigbee设备比对处理数据包时记录下来的序列号,然后把缺失的序列号返回给网关。网关收到缺失的序列号后,就把该序列号对应的数据包通过单播方式发送给对应的Zigbee设备,直到所有缺失的序列号对应的数据包发送完毕。最终,直到网关确认目标组内所有Zigbee设备都收到完整的升级数据,并成功升级。
由于Zigbee的组播方式实际采用的就是广播,所以一般情况下Zigbee设备很少出现接收丢包的情况,即使出现也是少数设备,因此,在其它实施例中,也可以省略该步骤。
进一步地,网关可以采用差分升级方法对目标组内的所有Zigbee设备同时进行固件升级。相对于整包升级而言,差分升级的升级数据只包括新固件相对于旧固件的差异部分的数据,因此相比新固件的整个数据来说,传输的数据量更小,可以提高升级效率。
具体实施时,网关通知服务器可以升级的同时,还向服务器发送目标组内的Zigbee设备的设备类型及固件版本或者固件类型及固件版本。服务器根据设备类型及固件版本或者固件类型及固件版本找到对应的固件,然后根据内存映射文件(.map)以函数代码段(code)和数据段(data)为单位比对该固件的新旧两个版本的数据的异同,之后生成对应的版本差异描述文件(以下简称差异描述文件),差异描述文件又可以称为差分包。
差异描述文件第一部分描述了Zigbee设备中的旧固件与新固件中所有相同数据的地址段(每个地址段包括起始地址和结束地址)以及该部分数据在设备固件下载区对应的目标起始地址;第二部分描述的是差异数据(即旧固件中不存在的数据)和数据校验值以及该部分数据在设备固件下载区的目标起始地址和结束地址。
服务器通知网关采用差分升级,即使用差异描述文件方式升级,同时把差异描述文件发送给网关。可选地,服务器生成差异描述文件后,首先判断差异描述文件和原始新版固件的大小,正常情况差异描述文件都会远小于原始新版固件,这时候才通知网关使用差异描述文件方式升级同时把差异描述文件发送给网关,而当差异描述文件大于原始新固件时,则通知网关采用整包升级,把原始新固件的整个数据发送给网关。
网关将差异描述文件作为升级数据分成N个携带从小到大的序列号(1-N)的数据包发送出去,对于差异描述文件,Zigbee设备在处理数据包时可能要进行大量的数据拷贝工作,作为优选,网关根据Zigbee设备端处理数据量的大小,在发送的每两个数据包中间做一个延时t(t>0),即每隔t时间发送一个数据包,以保证Zigbee设备端有足够的时间处理。延时t与处理数据量的大小优选呈线性正相关关系。
Zigbee设备收到每个数据包后,首先对该数据包进行校验以确保接收到的数据包正确无误,校验通过后,再判断此数据包是否是差异描述文件的数据包(差分升级)。如果是,则新旧固件相同的数据部分按照地址描述把相对应的数据按照地址拷贝到固件升级Flash区域,不同的数据部分则直接把接收到的数据写到对应的固件升级Flash区域;如果是原始新固件数据(整包升级)则直接写入到对应固件升级Flash区域。操作成功后记录下当前处理的数据包的序列号。当Zigbee设备接收到所有的升级数据后,则正式进行固件升级。
本发明实施例中,网关以组播方式对Zigbee设备的固件进行批量升级的具体流程如图4所示,包括以下步骤:
S21、网关对加入的Zigbee设备进行分组。使得每组Zigbee设备具有相同类型的固件。
S22、网关接收到升级通知,确定组A需要升级。
S23、网关接收差异描述文件或新固件。当进行差分升级时,服务器向网关发送差异描述文件(或称差分包);当进行整包升级时,服务器直接向网关发送新固件。
S24、网关通过组播方式发送升级启动命令。组A内的Zigbee设备的数量大于2,网关判定满足组播批量升级条件,因此通过组播方式向组A内的所有Zigbee设备发送升级启动命令。
S25、Zigbee设备进入组播(广播)快速处理模式。各Zigbee设备接收到升级启动命令后,立即进入组播(广播)快速处理模式。
S26、网关通过组播方式依次发送携带1-N序列号的数据包。网关将升级数据分成N(N为大于0的整数)个携带从小到大的序列号(1-N)的数据包,并通过组播方式依次发送出去。
S27、Zigbee设备对校验通过的数据包执行相应的拷贝或写入Flash操作,并记录相应的序列号。
S28、网关通过组播方式发送数据包传输完毕的命令。
S29、数据包收全的节点单播回复数据包完整的通知(或数据包已收全的通知)。数据包收全的节点(即数据包收全的Zigbee设备)在发送通知时,优选做一个随机延时T(T>0)。
S30、网关向数据包收全的节点单播确认命令可以升级。
S31、数据包收全的节点正式进入固件升级状态。
S32、网关单播询问数据包没有收全的节点缺失哪些数据包。
当没有收到组A内某些Zigbee设备的数据包完整的通知时,判定该Zigbee设备没有收到完整的升级数据,则通过单播方式询问该Zigbee设备缺失哪些数据包。
S32、数据包没有收全的节点单播返回缺失的数据包的序列号。
S33、网关通过单播方式发送此序列号对应的数据包。
S34、网关通过组播方式发送数据包传输完毕的命令。
当所有缺失数据包的Zigbee设备都已补全缺失的数据包时,网关通过组播方式发送数据包传输完毕的命令。
S35、数据包收全的节点单播回复数据包完整的通知。
S36、网关单播确认命令可以升级。
重复步骤S32-S36,直到收到组A内所有Zigbee设备回复的数据包完整的通知。
S37、网关确定组A内的所有Zigbee设备都已升级成功,结束流程。
本发明实施例的Zigbee设备的固件升级方法,通过将具有相同固件类型的Zigbee设备分成一组,当需要固件升级时,则对一组内的所有Zigbee设备的固件进行批量升级,从而实现了多个Zigbee设备同时升级,相对于对Zigbee设备进行逐个升级的方式,批量升级大大缩短了升级时间,成倍的提高了升级效率。
同时,通过差分升级方式进行固件升级,使得数据传输过程中只传输差异部分数据,从而大大减少了网关给Zigbee设备传输的数据量,达到了数十倍甚至上百倍提升固件升级速度的效果,大大缩短了升级时间,从而解决了升级成本过高和升级时间过长的问题,提升了用户体验。
由于在实际应用场景中,具有相同固件类型的Zigbee设备是很多的,一般来说同一型号的设备都可以通过发明实施例的技术方案进行批量升级,因此实用性很强。本发明实施例的Zigbee设备的固件升级方法,可以适用于远程升级,也可以适用于用户以及厂家生产返修升级。
实施例二
参见图5,提出本发明第二实施例的Zigbee设备的固件升级装置,所述装置应用于网关,包括分组模块和升级模块,其中:
分组模块:用于对接入的所有Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件。
分组模块将具有相同固件的Zigbee设备分成一组,具体实施时,可以读取接入的Zigbee设备的设备信息,根据设备信息对Zigbee设备进行分组,所述设备信息包括设备类型、方案类型、固件类型、固件版本等。其中,方案类型指的是Zigbee芯片方案,升级中需用到的一个描述,比如TI方案、NXP方案、EMBER方案等,不同方案的固件不能兼容,即不同的方案对应不同的固件。
可选地,分组模块在Zigbee设备加入时,读取Zigbee设备的固件的唯一标识码,根据唯一标识码识别出Zigbee设备的固件类型,当Zigbee设备加入网关后,分组模块就把相同固件类型的Zigbee设备分到同一个组。
可选地,分组模块在Zigbee设备加入时,读取Zigbee设备的固件的唯一标识码和版本号,根据唯一标识码和版本号分别识别出Zigbee设备的固件类型和固件版本,当Zigbee设备加入网关后,分组模块就把相同固件类型和固件版本的Zigbee设备分到同一个组。
可选地,分组模块在Zigbee设备加入时,读取Zigbee设备的设备类型(如型号)和方案类型,当Zigbee设备加入网关后,分组模块就把相同设备类型和方案类型的Zigbee设备分到同一个组,具有相同的设备类型和方案类型的Zigbee设备具有相同的固件类型。
可选地,分组模块在Zigbee设备加入时,读取Zigbee设备的设备类型、方案类型和固件版本,当Zigbee设备加入网关后,分组模块就把相同设备类型、方案类型和固件版本的Zigbee设备分到同一个组。
如图2所示,为Zigbee设备的固件升级***一实例,该***包括一个服务器、一个网关和多个Zigbee设备。Zigbee设备包括9个灯和8个窗帘控制器,分组模块将具有相同的固件类型的9个灯分到A组,将具有相同的固件类型的8个窗帘控制器分到B组。
本领域技术人员可以理解,除了上述列举的方式外,还可以采用其它方式对Zigbee设备进行分组,只要保证每组Zigbee设备具有相同类型的固件即可,本发明对此不再一一列举赘述。
升级模块:用于接收到固件升级通知时,确定需要升级的目标组,并对目标组内的所有Zigbee设备的固件进行批量升级。
当收到服务器发送的Zigbee设备的固件升级通知时,升级模块首先根据固件升级通知中的设备信息和/或固件信息确定对应的Zigbee设备的目标组,获取新固件的版本号,判断新固件的版本是否比目标组内的Zigbee设备的现有固件的版本新,如果是,则通知服务器可以升级,接收服务器发送的升级数据,并向目标组内的所有Zigbee设备发送升级数据,以对所有Zigbee设备的固件进行批量升级。
如图6所示,升级模块包括判断单元和传输单元,其中:
判断单元:用于判断目标组内的Zigbee设备的数量是否大于阈值。
传输单元:用于当Zigbee设备的数量大于阈值时,采用组播方式向目标组内的所有Zigbee设备传输升级数据;当Zigbee设备的数量不大于阈值时,采用单播方式向目标组内的Zigbee设备传输升级数据。
所述阈值可以设定为1,即:当只有一个Zigbee设备时,传输单元采用单播方式传输;当超过一个Zigbee设备时,传输单元则采用组播方式传输。
实践发现,当有两个Zigbee设备时,单播传输实际上比组播传输速度更快,因此,在一可选实施例中,将阈值设定为2,即:当只有一个或两个Zigbee设备时,传输单元采用单播方式传输;当超过两个Zigbee设备时,传输单元则采用组播方式传输。当然,所述阈值也可以根据实际需要设定为其它值,本发明对此不作限定。
当目标组内Zigbee设备的数量大于阈值时,传输单元则向目标组内的所有Zigbee设备发送一个开始启动组播升级的指令,并采用组播方式传输升级数据。优选地,传输单元在传输升级数据时,将升级数据分成N(N为大于0的整数)个携带从小到大的序列号(1-N)的数据包,并通过组播方式发送出去。
组播传输即一对多的传输方式,是指把信息同时传递给一组目的地址,在发送者和每一接收者之间实现点对多点网络连接。它使用策略是最高效的,因为消息在每条网络链路上只需传递一次,而且只有在链路分叉时,消息才会被复制,从而可以提高数据传送效率,减少了骨干网络出现拥塞的可能性。
进一步地,当升级数据传输完毕后,传输单元判断是否存在没有收到完整的升级数据的Zigbee设备;当存在没有收到完整的升级数据的Zigbee设备时,传输单元再采用单播方式向该Zigbee设备传输其缺失的升级数据。从而保证目标组内的所有Zigbee设备都能成功升级,提高***的可靠性。
具体实施时,当传输单元把升级数据发送完成后,再通过组播向目标组内的所有Zigbee设备发送一条升级数据传输完毕的命令,这条命令携带了最大序列号N和根据目标组内的Zigbee设备的数量生成的最大随机延时T。传输单元收到Zigbee设备返回的数据包完整的通知后,通过单播方式给对应的Zigbee设备发送一个确认信息,以使Zigbee设备正式进行固件升级。
当没有收到目标组中某一Zigbee设备回复的数据包完整的通知时,传输单元就判定该Zigbee设备没有收到完整的升级数据,则通过单播方式逐一地向这些没有收全升级数据的Zigbee设备询问丢失的数据包序列号,在收到缺失的序列号后,就把该序列号对应的数据包通过单播方式发送给对应的Zigbee设备,直到所有缺失的序列号对应的数据包发送完毕。
由于Zigbee的组播方式实际采用的就是广播,所以一般情况下Zigbee设备很少出现接收丢包的情况,即使出现也是少数设备,因此,在其它实施例中,传输单元也可以省略该步骤。
进一步地,升级模块可以采用差分升级方法对目标组内的所有Zigbee设备同时进行固件升级。相对于整包升级而言,差分升级的升级数据只包括新固件相对于旧固件的差异部分的数据,因此相比新固件的整个数据来说,传输的数据量更小,可以提高升级效率。
具体实施时,升级模块通知服务器可以升级的同时,还向服务器发送目标组内的Zigbee设备的设备类型及固件版本或者固件类型及固件版本,以使服务器根据设备类型及固件版本或者固件类型及固件版本生成对应的版本差异描述文件(以下简称差异描述文件),差异描述文件又可以称为差分包。
差异描述文件第一部分描述了Zigbee设备中的旧固件与新固件中所有相同数据的地址段(每个地址段包括起始地址和结束地址)以及该部分数据在设备固件下载区对应的目标起始地址;第二部分描述的是差异数据(即旧固件中不存在的数据)和数据校验值以及该部分数据在设备固件下载区的目标起始地址和结束地址。
升级模块接收到服务器发送的差异描述文件后,通过传输单元将差异描述文件作为升级数据分成N个携带从小到大的序列号(1-N)的数据包发送出去,对于差异描述文件,Zigbee设备在处理数据包时可能要进行大量的数据拷贝工作,作为优选,传输单元根据Zigbee设备端处理数据量的大小,在发送的每两个数据包中间做一个延时t(t>0),即每隔t时间发送一个数据包,以保证Zigbee设备端有足够的时间处理。延时t与处理数据量的大小优选呈线性正相关关系。
本发明实施例的Zigbee设备的固件升级装置,通过将具有相同固件类型的Zigbee设备分成一组,当需要固件升级时,则对一组内的所有Zigbee设备的固件进行批量升级,从而实现了多个Zigbee设备同时升级,相对于对Zigbee设备进行逐个升级的方式,批量升级大大缩短了升级时间,成倍的提高了升级效率。
同时,采用差分升级方式进行固件升级,使得数据传输过程中只传输差异部分数据,从而大大减少了网关给Zigbee设备传输的数据量,达到了数十倍甚至上百倍提升固件升级速度的效果,有效解决了升级成本过高和升级时间过长的问题,提升了用户体验。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。
应当理解的是,以上仅为本发明的优选实施例,不能因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
工业实用性
本发明实施例所提供的一种Zigbee设备的固件升级方法,通过将具有相同固件类型的Zigbee设备分成一组,当需要固件升级时,则对一组内的所有Zigbee设备的固件进行批量升级,从而实现了多个Zigbee设备同时升级,相对于对Zigbee设备进行逐个升级的方式,批量升级大大缩短了升级时间,成倍的提高了升级效率。
同时,采用差分升级方式进行固件升级,使得数据传输过程中只传输差异部分数据,从而大大减少了网关给Zigbee设备传输的数据量,达到了数十倍甚至上百倍提升固件升级速度的效果,有效解决了升级成本过高和升级时间过长的问题,提升了用户体验。因此,具有工业实用性。

Claims (14)

  1. 一种 Zigbee设备的固件升级方法,包括以下步骤:
    网关对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件;
    所述网关接收到固件升级通知时,确定需要升级的目标组,并对所述目标组内的所有Zigbee设备的固件进行批量升级。
  2. 根据权利要求1所述的Zigbee设备的固件升级方法,其中,所述对所述目标组内的所有Zigbee设备的固件进行批量升级包括:
    判断所述目标组内的Zigbee设备的数量是否大于阈值;
    当所述Zigbee设备的数量大于阈值时,采用组播方式向所述目标组内的所有Zigbee设备传输升级数据;
    当所述Zigbee设备的数量不大于阈值时,采用单播方式向所述目标组内的Zigbee设备传输升级数据。
  3. 根据权利要求2所述的Zigbee设备的固件升级方法,其中,所述采用组播方式向所述目标组内的所有Zigbee设备传输升级数据的步骤之后还包括:
    当升级数据传输完毕后,判断是否存在没有收到完整的升级数据的Zigbee设备;
    当存在没有收到完整的升级数据的Zigbee设备时,采用单播方式向该Zigbee设备传输其缺失的升级数据。
  4. 根据权利要求2所述的Zigbee设备的固件升级方法,其中,所述阈值为1或2。
  5. 根据权利要求1-4任一项所述的Zigbee设备的固件升级方法,其中,所述对所述目标组内的所有Zigbee设备的固件进行批量升级包括:
    采用差分升级方法对所述目标组内的所有Zigbee设备同时进行固件升级。
  6. 根据权利要求1-4任一项所述的Zigbee设备的固件升级方法,其中,所述网关对接入的Zigbee设备进行分组包括:
    所述网关读取接入的Zigbee设备的设备信息,根据所述设备信息对所述Zigbee设备进行分组。
  7. 根据权利要求6所述的Zigbee设备的固件升级方法,其中,所述设备信息包括:
    固件类型;或者,
    固件类型和固件版本;或者,
    设备类型和方案类型;或者,
    设备类型、方案类型和固件版本。
  8. 一种Zigbee设备的固件升级装置,包括:
    分组模块,用于对接入的Zigbee设备进行分组,每组Zigbee设备具有相同类型的固件;
    升级模块,用于接收到固件升级通知时,确定需要升级的目标组,并对所述目标组内的所有Zigbee设备的固件进行批量升级。
  9. 根据权利要求8所述的Zigbee设备的固件升级装置,其中,所述升级模块包括:
    判断单元,用于判断所述目标组内的Zigbee设备的数量是否大于阈值;
    传输单元,用于当所述Zigbee设备的数量大于阈值时,采用组播方式向所述目标组内的所有Zigbee设备传输升级数据;当所述Zigbee设备的数量不大于阈值时,采用单播方式向所述目标组内的Zigbee设备传输升级数据。
  10. 根据权利要求9所述的Zigbee设备的固件升级装置,其中,所述传输单元还用于:
    当升级数据传输完毕后,判断是否存在没有收到完整的升级数据的Zigbee设备;当存在没有收到完整的升级数据的Zigbee设备时,采用单播方式向该Zigbee设备传输其缺失的升级数据。
  11. 根据权利要求9所述的Zigbee设备的固件升级装置,其中,所述阈值为1或2。
  12. 根据权利要求8-11任一项所述的Zigbee设备的固件升级装置,其中,所述升级模块用于:采用差分升级方法对所述目标组内的所有Zigbee设备的固件进行批量升级。
  13. 根据权利要求8-11任一项所述的Zigbee设备的固件升级装置,其中,所述分组模块用于:
    读取接入的Zigbee设备的设备信息,根据所述设备信息对所述Zigbee设备进行分组。
  14. 根据权利要求13所述的Zigbee设备的固件升级装置,其中,所述设备信息包括:
    固件类型;或者,
    固件类型和固件版本;或者,
    设备类型和方案类型;或者,
    设备类型、方案类型和固件版本。
     
PCT/CN2018/085732 2017-05-04 2018-05-04 Zigbee设备的固件升级方法和装置 WO2018202177A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710308382.8A CN107104836A (zh) 2017-05-04 2017-05-04 Zigbee设备的固件升级方法和装置
CN201710308382.8 2017-05-04

Publications (1)

Publication Number Publication Date
WO2018202177A1 true WO2018202177A1 (zh) 2018-11-08

Family

ID=59658028

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/085732 WO2018202177A1 (zh) 2017-05-04 2018-05-04 Zigbee设备的固件升级方法和装置

Country Status (2)

Country Link
CN (1) CN107104836A (zh)
WO (1) WO2018202177A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023232971A1 (de) * 2022-06-03 2023-12-07 Siemens Aktiengesellschaft Effiziente softwareaktualisierung einer vielzahl von kommunikationsfähigen niederspannungselementen

Families Citing this family (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107104836A (zh) * 2017-05-04 2017-08-29 深圳市欧瑞博电子有限公司 Zigbee设备的固件升级方法和装置
CN108449198A (zh) * 2018-01-25 2018-08-24 捷开通讯(深圳)有限公司 一种ota升级的方法、***及存储设备
CN110365510A (zh) * 2018-04-10 2019-10-22 上海仪电(集团)有限公司中央研究院 一种可对网络节点批量ota升级的物联网网关及ota升级方法
CN108920163A (zh) * 2018-06-29 2018-11-30 郑州云海信息技术有限公司 服务器固件升级方法及装置
EP3614789A1 (en) * 2018-08-20 2020-02-26 NXP USA, Inc. Rf transceiver and wireless mesh network
CN108810853A (zh) * 2018-08-25 2018-11-13 咪付(广州)网络科技有限公司 一种基于4g网络无线传感器自动远程升级的***及方法
CN108845820A (zh) * 2018-09-20 2018-11-20 广东美的暖通设备有限公司 固件批量升级方法、***和空调器
CN109656587A (zh) * 2018-11-13 2019-04-19 深圳智链物联科技有限公司 一种设备固件的升级方法及装置
CN109471651B (zh) * 2018-12-27 2022-03-18 北京昊恒天科技有限公司 一种固件升级方法、网关设备及固件升级***
CN110688133A (zh) * 2019-08-28 2020-01-14 深圳绿米联创科技有限公司 分布式固件升级的方法、***、装置及电子设备
CN110875850B (zh) * 2019-09-27 2022-07-29 深圳市中电数通智慧安全科技股份有限公司 一种固件升级方法、***、可读存储介质及终端设备
CN110809262B (zh) * 2019-11-08 2023-09-01 杭州海兴电力科技股份有限公司 一种基于coap协议的物联网设备运维管理方法
CN113141267B (zh) * 2020-01-19 2023-06-20 阿里巴巴集团控股有限公司 固件升级、信息处理方法、装置及设备
CN111585801A (zh) * 2020-04-29 2020-08-25 杭州涂鸦信息技术有限公司 一种ZigBee设备升级方法及相关设备
CN111965989B (zh) * 2020-08-14 2024-01-26 深圳市欧瑞博科技股份有限公司 ***更新方法、装置、智能家居控制面板以及存储介质
CN112015102A (zh) * 2020-08-14 2020-12-01 深圳市欧瑞博科技股份有限公司 智能控制开关的升级方法、装置、智能控制开关以及存储介质
CN111917595A (zh) * 2020-08-14 2020-11-10 深圳市欧瑞博科技股份有限公司 ***升级方法、装置、智能设备以及存储介质
CN112015098A (zh) * 2020-08-14 2020-12-01 深圳市欧瑞博科技股份有限公司 智能家居设备的***升级方法、装置及电子设备
CN112104487B (zh) * 2020-08-31 2023-06-20 北京智芯微电子科技有限公司 物联网终端的远程升级方法、物联网主站及存储介质
CN112306529A (zh) * 2020-11-09 2021-02-02 维沃移动通信有限公司 ***升级方法、装置、设备和存储介质
CN112925538B (zh) * 2021-01-27 2024-05-03 国网北京市电力公司 设备更新方法、***及装置
WO2022179513A1 (zh) * 2021-02-23 2022-09-01 苏州欧普照明有限公司 一种智能设备自动升级方法以及云服务器
CN113641377A (zh) * 2021-07-02 2021-11-12 佛山市淇特科技有限公司 哑设备固件升级方法、装置、设备和存储介质
CN113687849B (zh) * 2021-08-13 2023-12-26 济南浪潮数据技术有限公司 一种固件批量升级方法、装置、设备及存储介质
CN114172899B (zh) * 2022-02-10 2022-05-27 杭州锐思客技术有限公司 基于ZigBee网络的OTA升级方法和***
CN116132974A (zh) * 2023-01-17 2023-05-16 青岛海尔智能家电科技有限公司 用于多节点设备网络中空中下载的方法、设备及存储介质
CN118075256B (zh) * 2024-04-19 2024-06-25 北京飞利信信息安全技术有限公司 一种物联网电表升级方法、***、终端及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102136934A (zh) * 2010-10-21 2011-07-27 华为技术有限公司 实现Zigbee设备远程升级的方法、装置及网络***
CN105847067A (zh) * 2016-05-25 2016-08-10 北京小米移动软件有限公司 Zigbee设备的升级方法和装置
CN105843645A (zh) * 2016-03-24 2016-08-10 浙江风向标科技有限公司 zigbee设备的固件升级方法和装置
CN107104836A (zh) * 2017-05-04 2017-08-29 深圳市欧瑞博电子有限公司 Zigbee设备的固件升级方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102136934A (zh) * 2010-10-21 2011-07-27 华为技术有限公司 实现Zigbee设备远程升级的方法、装置及网络***
CN105843645A (zh) * 2016-03-24 2016-08-10 浙江风向标科技有限公司 zigbee设备的固件升级方法和装置
CN105847067A (zh) * 2016-05-25 2016-08-10 北京小米移动软件有限公司 Zigbee设备的升级方法和装置
CN107104836A (zh) * 2017-05-04 2017-08-29 深圳市欧瑞博电子有限公司 Zigbee设备的固件升级方法和装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023232971A1 (de) * 2022-06-03 2023-12-07 Siemens Aktiengesellschaft Effiziente softwareaktualisierung einer vielzahl von kommunikationsfähigen niederspannungselementen

Also Published As

Publication number Publication date
CN107104836A (zh) 2017-08-29

Similar Documents

Publication Publication Date Title
WO2018202177A1 (zh) Zigbee设备的固件升级方法和装置
CN1874217B (zh) 一种确定路由的方法
CN102802227B (zh) 基于基站直通架构的数据处理方法、设备和***
CN103906087A (zh) 升级接入点的方法、装置和***
CN112532704B (zh) 数据传输方法、装置、电子设备及存储介质
CN102665213A (zh) 数据直通处理方法、设备和***
CN104639298A (zh) 一种数据传输方法、装置及***
CN105554042A (zh) 一种UDP远程传输log的方法及***
CN103368703B (zh) 数据包重传方法、数据包接收方法及装置
CN115361704A (zh) 基于基站mac子层直接传输的c2d通信***及i/o数据通信方法
CN101909007B (zh) 绑定表项生成方法、装置及网络设备
US11165744B2 (en) Faster duplicate address detection for ranges of link local addresses
WO2013091509A1 (zh) 用于链路自适应的方法、装置和***
CN101449539B (zh) 配置连接的方法、无线电信网和移动终端
CN110888892B (zh) 一种区块同步方法、装置及存储介质
CN113132988B (zh) 一种基于令牌验证的路灯控制器无线组网链路入网方法
CN112241279B (zh) 一种自适应的电子控制单元软件升级方法、***及汽车
CN113794751A (zh) 物联网***的数据交互方法、***、设备及存储介质
CN114125800A (zh) 基于nfc的设备配网方法、设备、介质以及产品
CN102752740B (zh) 基于基站分簇架构的数据交互处理方法、设备和***
CN101754055A (zh) 网元标识自动设置方法、标识管理服务器及代理网元
WO2017059599A1 (zh) 升级多住户单元的方法和设备
CN113438659B (zh) 一种远距离lora快速组网电网状态采集器和组网方法
CN113242060B (zh) 接入网络的方法和装置、存储介质及电子装置
CN110233909B (zh) 一种无线网关及网络设备的地址码分配方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18794836

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18794836

Country of ref document: EP

Kind code of ref document: A1