Network OTA
Overview
BK Wi-Fi Mesh OTA is an upgrade solution based on BK IDK OTA for BK Wi-Fi MESH, aiming to achieve a simple and efficient upgrade for BK Wi-Fi MESH.
BK Wi-Fi Mesh OTA first downloads the upgraded firmware to the root node, and then the root node distributes the upgraded firmware in fixed-size packages to each child node directly connected to it one after another. After the child nodes receive and verify the firmware successfully, they continue to distribute the downloaded upgraded firmware to their directly connected child nodes. Once all child nodes have completed downloading and upgrading the firmware, the root node sends a restart command to all child nodes to realize the overall upgrade of the entire network.
Features
Breakpoint Resuming: The root node forwards the firmware upgrade in fixed-sized packets to the child nodes. Each child node records the specific download progress of its firmware upgrade. In case the download process is interrupted, when it resumes, the child node will provide the current status of the upgrade and request the data from the point where the previous firmware upgrade was interrupted.
Firmware Forwarding:Each node stores the downloaded firmware upgrade data directly in the OTA partition for easy upgrade and to reduce the number of data copies. When data needs to be forwarded, it is read and sent directly from the OTA partition.
Firmware Checking:The generated firmware includes a version number and a CRC check code, which are used to verify the version upgrade information and to prevent issues with incomplete firmware downloads.
Process
BK Wi-Fi Mesh OTA Upgrade Process
Step 1: Firmware Download
HTTP method:
1 . The user establishes communication with the root node via UART, BLE, or Wi-Fi, etc.
2 . The user sends the network location of the upgrade firmware to the root node.
3 . The root node uses BK IDK’s HTTP method to download the upgrade firmware from the host based on the network location.
4 . If the data is complete, the root node distributes the upgrade firmware to child nodes in sequence; otherwise, it returns the upgrade firmware download failure.
UART method:
1 . The user sends the upgrade firmware directly to the root node’s OTA partition via UART.
2 . After the transfer is complete, verify the integrity of the upgrade firmware. If the data is complete, distribute the upgrade firmware to child nodes in sequence; otherwise, return the upgrade firmware download failure.
Step 2: Firmware Distribution
1 . The root node sequentially notifies the child nodes of an OTA upgrade.
2 . After receiving the upgrade command, if there is no OTA data cached, the child node initializes the OTA module and returns the upgrade status.
3 . The root node starts distributing data and sends the required?? of the upgrade firmware to the child nodes based on the child node’s return status (if there is a breakpoint resuming, it will return the breakpoint data position).
4 . After the root node sends the upgrade firmware, it notifies the child nodes that the data transmission is complete. The child nodes verify the integrity of the upgrade firmware and return the verification results to the root node, and then start the same firmware distribution process as the root node.
5 . When all child nodes connected to other child nodes complete the upgrade firmware download or exceed the retry count, the child node reports the upgrade status to the root node.
6 . After the root node receives the return value of step 4, it repeats step 1 until all child nodes have completed the upgrade firmware download or exceed the retry count.
7 . After the root node receives the return value of step 5, it checks whether all child nodes have completed the download.
Step 3: Version Upgrade
1 . After all child nodes have completed the download of the upgrade firmware, the root node notifies all child nodes to restart.
2 . The user establishes communication with the root node through UART, BLE, or Wi-Fi, etc., checks the firmware version, and completes the upgrade.
Partition Table
OTA API Description
Over-The-Air Upgrade
By invoking the bk_wifi_mesh_ota_start interface, notify the OTA module of the root node about the network location of the firmware upgrade file. If the current network is a wide area network, the root node will automatically initialize OTA information, then connect to the server to download the upgrade firmware and complete the over-the-air upgrade process. If the current network is a local area network, the mobile device needs to stay close to the root node, and the mobile hotspot information needs to be sent to the root node, allowing the root node to connect to the mobile hotspot, and then complete the same operations as in the wide area network.
Serial Port Upgrade
Invoke the bk_wifi_mesh_ota_start interface to notify the root node’s OTA module to prepare for the upgrade and initialize the OTA module;
Invoke the bk_wifi_mesh_ota_data_write interface to send the upgrade firmware in packages of 1k in size one after another;
After all the data is transmitted, invoke the bk_wifi_mesh_ota_finish interface to notify the OTA module to check whether the transmitted upgrade firmware is verified and start the upgrade process in the MESH network.
User Downloads Firmware to the OTA Partition
1、User downloads the firmware to the OTA partition of the root node;
2、Invoke the bk_wifi_mesh_ota_start interface to notify the root node’s OTA module to prepare for the upgrade and initialize the OTA module;
3、Invoke the bk_wifi_mesh_ota_finish interface to notify the OTA module to check whether the transmitted upgrade firmware is verified and start the upgrade process in the MESH network.
Note
BK IDK OTA Reference: http://docs.bekencorp.com/armino/bk7236/en/v2.0.1/developer-guide/bootloader_ota/index.html