CN-121985326-A - Self-adaptive triggering method and system for broadcasting OTA (over the air) by large number of terminals
Abstract
The invention discloses a self-adaptive triggering large number of terminal broadcasting OTA method and a system, which realize high-efficiency and reliable OTA upgrading of large number of LoRa terminal equipment, avoid communication overhead and time delay caused by traditional point-to-point upgrading, are compatible with different LoRaWAN equipment types through a self-adaptive triggering mechanism, promote system universality, introduce a special upgrading frequency point, isolate upgrading communication from service communication, avoid interference, improve upgrading success rate, greatly reduce the downlink communication times of a concentrator by adopting a broadcasting+missing packet retransmission mechanism, save network resources, support in-situ splicing writing Flash, do not need additional buffer space, reduce the memory requirement of the terminal, automatically roll back and wait for the next round due to upgrading failure, and enhance system robustness.
Inventors
- WANG TIANXIANG
- ZHAN WEIJIE
- LIU YUE
- GU CHAOJIE
- LIU JIAN
Assignees
- 浙江利尔达物联网技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260123
Claims (8)
- 1. An adaptive triggered method for broadcasting OTA by a large number of terminals is characterized by comprising the following steps: step S1, an upper computer transmits configuration information to a concentrator, wherein the configuration information comprises a MAC address list of a LoRa terminal node to be upgraded, radio frequency parameters of each node and an upgrade special frequency point; Step S2, the concentrator adaptively selects a triggering mode according to the LoRaWAN Class type of the target node, after the target node receives the upgrading triggering frame, the target node checks the MAC address and the firmware version of the target node, and if the upgrading condition is met, an upgrading response frame is returned; Step S3, after receiving the upgrade confirmation frame, the target node switches to the special upgrade frequency point and enters an OTA upgrade mode, the upper computer transmits the firmware to be upgraded to the concentrator, and after the integrity of the firmware is checked by the concentrator, the concentrator segments the firmware, and broadcasts a firmware information frame and a firmware segment packet on the special upgrade frequency point; Step S4, the target node writes the effective load into the corresponding address in the FLASH according to the packet sequence number in the fragmented packet to realize in-situ splicing, and if the target node finds the missing packet after receiving the complete partial fragment, the target node reports the missing packet list through a time slot channel two-dimensional dividing machine according to the report sequence number distributed by the concentrator; And S5, after the target node finishes receiving the firmware, performing CRC check, switching and operating the new firmware through Bootloader if the check is successful, and otherwise, returning to a firmware information receiving mode to wait for the next round of upgrading.
- 2. The adaptively triggered large number of terminals broadcast OTA method according to claim 1, wherein said step S1 is implemented by: The upper computer maintains a unique identification list of equipment to be upgraded, the list is imported from an external configuration file by the upper computer, or the upper computer provides a graphical user interface, so that an operator is allowed to manually select registered LoRa terminal equipment, a corresponding MAC address list is automatically generated, and the upper computer transmits the MAC address list to the concentrator; The upper computer explicitly designates a frequency point independent of service communication in the configuration file as an OTA upgrade dedicated channel, the frequency point is issued to a target node by a concentrator through an upgrade confirmation frame, and the node immediately switches to the frequency point after receiving the upgrade confirmation frame and enters a firmware receiving mode.
- 3. The method for broadcasting OTA by a large number of terminals with adaptive triggering as claimed in claim 2, wherein the triggering manner in step S2 is: If the target node is Class A equipment, adopting a passive triggering mode, wherein a concentrator monitors an uplink data frame reported by the target node, and when an uplink packet matched with an MAC address is detected, an upgrade triggering frame is issued in a corresponding RX1 or RX2 receiving window; If the target node is a Class C device, an active triggering mode is adopted, namely the concentrator directly sends an upgrade triggering frame to the target node.
- 4. The adaptively triggered large number of terminals broadcast OTA method according to claim 1, wherein said step S2 is implemented by: A1, judging the LoRaWAN Class type of a target node by the concentrator, acquiring the equipment description information of a terminal to be upgraded from configuration information issued by an upper computer by the concentrator, and if the equipment description information is not explicitly provided, deducing the Class type of the terminal to be upgraded by the concentrator according to a historical communication record or a Capability field reported when the equipment is accessed to the network; A2, selecting a triggering mode and sending an upgrading triggering frame, wherein the triggering mode is selected according to the LoRaWAN Class type of the target node, and the upgrading triggering frame is sent to the node; A3, the target node receives and checks the upgrade trigger frame, after receiving the upgrade trigger frame, the target node executes a check action, if the check fails, the frame is discarded, and if all the checks pass, an upgrade response frame is constructed and returned; and step A4, the concentrator receives the response and transmits an upgrade confirmation frame, monitors the uplink response of the target node in a preset timeout window, immediately constructs the upgrade confirmation frame and transmits the upgrade confirmation frame to the node through a downlink channel if the effective upgrade response frame is successfully received, retries the process for multiple times if the concentrator does not receive the response in the timeout time, marks the equipment upgrade failure if the equipment upgrade failure still occurs, and continues to process the next target.
- 5. The adaptively triggered large number of terminals broadcast OTA method according to claim 1, wherein said step S3 is implemented by: step B1, a target node switches frequency points and enters an OTA upgrading mode, the target node successfully receives and checks an upgrading confirmation frame, analyzes the upgrading special frequency points in the frame, checks whether the frequency points are in a local radio frequency hardware supporting range, discards the frame and returns to a LoRaWAN normal communication mode if the frequency points are not supported, closes monitoring of a current LoRaWAN service channel if the frequency points are legal, configures a radio frequency chip to switch to the upgrading special frequency points, jumps to preset OTA upgrading firmware, and enters a firmware information receiving state; Step B2, the upper computer transmits the firmware to be upgraded to the concentrator, the upper computer reads a locally stored new version firmware file, calculates an integrity check value of the firmware, and sends the complete firmware to the concentrator block by block through a serial port communication protocol, and the concentrator caches the received firmware data to an internal RAM or an external Flash temporary area; step B3, after the firmware transmission is completed, the upper computer sends a firmware ending instruction to the concentrator, an expected check value is attached, the concentrator recalculates the check value for the received complete firmware, compares the calculated value with the check value provided by the upper computer, marks the firmware as valid if the calculated value is consistent with the check value provided by the upper computer, enters a slicing process, returns a check failure error code to the upper computer if the calculated value is inconsistent with the check value provided by the upper computer, and terminates the upgrading task; Step B4, the concentrator carries out slicing processing on the firmware, reads the total length of the effective firmware, divides the firmware into N slices according to the maximum payload limit of 240 bytes/packet, generates a slicing frame structure for each slice, and simultaneously generates a firmware information frame; And B5, broadcasting the firmware information frames and the fragment packets at the special frequency point for upgrading by the concentrator, switching the radio frequency module of the concentrator to the special frequency point for upgrading synchronous with the target node, continuously broadcasting the firmware information frames, and circularly broadcasting all the firmware fragment packets according to the sequence number until the concentrator receives the missing packet for reporting or completing the preset number of rounds.
- 6. The adaptively triggered large number of terminals broadcast OTA method according to claim 1, wherein said step S4 is implemented by: The method comprises the steps that a target node executes in-situ splicing of firmware fragments, continuously monitors downlink broadcasting at an upgrade special frequency point, checks a frame header, a CS checksum and a packet sequence number of each fragment packet after receiving the fragment packet, calculates a Flash write address according to the packet sequence number after the fragment packet passes the check, erases a corresponding page, calls a bottom Flash driver to write a payload into a designated address, marks the fragment as received in a memory bitmap, and continuously and repeatedly does not have new fragments, overtime or receives a fragment end frame; Step C2, the target node detects the missing packet and prepares to report, the target node traverses the receiving state bitmap, compares the total fragment number and scans the received_bitmap to find out all the packet sequence numbers which are not received, generates a missing packet list, reads the unique report sequence number distributed by the concentrator in the upgrade confirmation frame or the firmware information frame, calculates the report channel index and the report time slot number according to the unique report sequence number, enters a waiting state until reaching a designated time slot, switches to a corresponding report channel in the time slot, constructs and sends a report frame containing the frame type, the local MAC address, the missing packet list of compression codes and the CRC check, and starts a response waiting timer at the same time; And step C3, the concentrator performs missing packet summarizing and retransmission, monitors all reporting channels simultaneously in each reporting time slot by utilizing the multi-channel radio frequency capability, successfully demodulates any missing packet reporting frame, immediately replies an ACK response frame to a corresponding node to prevent the missing packet reporting frame from retrying, summarizing all reporting contents, maintaining a global missing packet statistical table, recording the number of times each fragment is requested to be retransmitted, merging to generate a fragment set to be retransmitted, switching back to a main upgrading special frequency point, broadcasting only data packets in the missing fragment set, adopting multi-round transmission and combining with a random interval strategy to improve the receiving success rate of a weak signal node, and opening a round of missing reporting window again after retransmission is finished.
- 7. The adaptively triggered large number of terminals broadcast OTA method according to claim 1, wherein said step S5 is implemented by: step D1, the target node finishes the integrity check after the firmware is received, the node reads the complete firmware mirror image according to TotalSize length from the predefined address after confirming the completion of the firmware reception, calculates a check value byte by adopting a standard, and compares the check value with an expected CRC value provided in a firmware information frame to judge whether the firmware is complete and effective; Step D2, after the CRC check is successful, the node writes an upgrade completion mark and a new firmware version number into the Flash configuration area, calls the MCU Reset interface to trigger the system to restart, reads the mark when the Bootloader is electrified, checks the validity of the new firmware vector table, and resets MSP and PC pointers to jump to the reset_handler of the new firmware to execute the upgraded program; And returning to a firmware information receiving mode after verification failure and waiting for next round of upgrading, after CRC (cyclic redundancy check) failure, clearing a fragment receiving bitmap, resetting a packet counter and a timeout timer by the node, enabling the radio frequency module to reside in a special frequency point for upgrading and re-monitoring a firmware information frame broadcasted by the concentrator, receiving next round of complete firmware transmission, and outputting an error log through a serial port or recording failure times in Flash for diagnosis.
- 8. An adaptive triggered large number of terminals broadcast OTA system, which adopts the adaptive triggered large number of terminals broadcast OTA method according to any one of claims 1-7, and is characterized by comprising an upper computer, a concentrator and a target node module; The upper computer is used for maintaining a unique identification list of the LoRa terminal to be upgraded, providing a graphical interface or a configuration file interface, supporting an operator to select target equipment, designating and managing an OTA upgrading special frequency point, reading a new version firmware file, calculating an integrity check value of the new version firmware file, transmitting configuration information and complete solid data to the concentrator through the serial port, receiving a check result or an error code returned by the concentrator, and realizing task state monitoring; The concentrator is used for receiving configuration information and firmware data issued by the upper computer, identifying the LoRaWAN Class type of the target node, adaptively selecting a triggering mode, sending an upgrade triggering frame to the target node, receiving an upgrade response frame, issuing an upgrade confirmation frame containing an upgrade special frequency point, carrying out integrity check on the received firmware, fragmenting the effective firmware according to 240 bytes/packet at maximum, generating a firmware information frame, broadcasting the firmware information frame and a fragment packet on the upgrade special frequency point, monitoring all reporting channels under a time slot-channel two-dimensional dividing mechanism by utilizing the multi-channel radio frequency capability, receiving a missing packet list of each node, summarizing the missing packet, executing selective retransmission, returning an ACK response frame to the successfully reported node, and inhibiting repeated reporting; And the target node module is used for responding to the trigger frame of the concentrator according to the LoRaWAN Class type, checking the MAC address and the firmware version in the upgrade trigger frame, determining whether to participate in upgrade, checking and switching to an upgrade special frequency point after receiving an upgrade confirmation frame, entering an OTA mode, monitoring broadcasted firmware fragments at the upgrade frequency point, writing the effective load into the Flash corresponding address in situ according to the packet sequence number, tracking the received fragments by using a receiving bitmap, detecting the missing packet after the receiving is finished, reporting the missing list through a time slot channel two-dimensional mechanism according to the reporting sequence number distributed by the concentrator, and executing CRC (cyclic redundancy check) of the complete firmware after the firmware receiving is finished.
Description
Self-adaptive triggering method and system for broadcasting OTA (over the air) by large number of terminals Technical Field The invention relates to the field of firmware upgrading, in particular to a method and a system for broadcasting OTA (over the air) by a large number of terminals triggered in a self-adaptive manner. Background The LoRaWAN OTA upgrading technology is a technology for wirelessly upgrading equipment firmware through LORA radio frequency, and aims to improve the updating efficiency of LoRaWAN equipment and reduce maintenance cost. Because of the limitation of the LoRa radio frequency load, the OTA technology needs to divide the upgrade firmware into data packets smaller than 255 bytes, then sequentially issue the data packets through a gateway, carry out packet assembly and integrity check after receiving all the data packets by a terminal device, write the recovered firmware into a designated storage space, and operate the firmware. The equipment with high storage space requirement in the existing scheme needs to reserve one time of storage space for storing the upgrade firmware, has low upgrade efficiency, is easy to be interfered by normal communication of other equipment which is not upgraded because the equipment shares a downlink channel in the original network for upgrading, and needs to increase redundant data packets, thereby prolonging upgrade time. In view of the foregoing, there is a need for a method and system for adaptively triggering a large number of terminals to broadcast OTA signals to solve the drawbacks of the prior art. Disclosure of Invention Aiming at the defects of the prior art, the invention provides a self-adaptive triggering method and a self-adaptive triggering system for broadcasting OTA by a large number of terminals, which aim to solve the problems. In order to achieve the purpose, the invention provides a technical scheme that a self-adaptive triggering method for broadcasting OTA by a large number of terminals comprises the following steps: step S1, an upper computer transmits configuration information to a concentrator, wherein the configuration information comprises a MAC address list of a LoRa terminal node to be upgraded, radio frequency parameters of each node and an upgrade special frequency point; Step S2, the concentrator adaptively selects a triggering mode according to the LoRaWAN Class type of the target node, after the target node receives the upgrading triggering frame, the target node checks the MAC address and the firmware version of the target node, and if the upgrading condition is met, an upgrading response frame is returned; Step S3, after receiving the upgrade confirmation frame, the target node switches to the special upgrade frequency point and enters an OTA upgrade mode, the upper computer transmits the firmware to be upgraded to the concentrator, and after the integrity of the firmware is checked by the concentrator, the concentrator segments the firmware, and broadcasts a firmware information frame and a firmware segment packet on the special upgrade frequency point; Step S4, the target node writes the effective load into the corresponding address in the FLASH according to the packet sequence number in the fragmented packet to realize in-situ splicing, and if the target node finds the missing packet after receiving the complete partial fragment, the target node reports the missing packet list through a time slot channel two-dimensional dividing machine according to the report sequence number distributed by the concentrator; And S5, after the target node finishes receiving the firmware, performing CRC check, switching and operating the new firmware through Bootloader if the check is successful, and otherwise, returning to a firmware information receiving mode to wait for the next round of upgrading. Optionally, the step S1 is implemented by: The upper computer maintains a unique identification list of equipment to be upgraded, the list is imported from an external configuration file by the upper computer, or the upper computer provides a graphical user interface, so that an operator is allowed to manually select registered LoRa terminal equipment, a corresponding MAC address list is automatically generated, and the upper computer transmits the MAC address list to the concentrator; The upper computer explicitly designates a frequency point independent of service communication in the configuration file as an OTA upgrade dedicated channel, the frequency point is issued to a target node by a concentrator through an upgrade confirmation frame, and the node immediately switches to the frequency point after receiving the upgrade confirmation frame and enters a firmware receiving mode. Optionally, the triggering manner in step S2 is: If the target node is Class A equipment, adopting a passive triggering mode, wherein a concentrator monitors an uplink data frame reported by the target node, and when an uplink packet matched with an MAC ad