DFU V2 PAN User Application Example
Source code path: example/dfu_v2/bt_pan/app
Supported Platforms
sf32lb52-lcd_n16r8_hcpu
sf32lb52-lchspi-ulp_hcpu
sf32lb52-nano_a128r16_hcpu
Overview
This example demonstrates the user application side of the PAN (Bluetooth PAN network / HTTP) upgrade channel of DFU V2: the device gets online through a Bluetooth PAN link, actively queries an OTA server for the version, writes the pending firmware info to flash, then reboots and hands off to the loader subprogram for the actual download and installation.
Usage Instructions
After flashing, the application brings up the Bluetooth stack, sets the local name to
sifli_pan(orBT_DEVICE_NAME), and enables HID/PAN auto-reconnect. First pair the device with a phone so the device can get online through the phone’s PAN network sharing; once HID is connected the application automatically initiates the PAN connection, and the serial log linePAN connectedindicates the network channel is ready.Drive the upgrade flow from the serial finsh console:
ota_version— Show the current firmware version.ota_check— Register the device with the OTA server (https://ota.sifli.com) and query the latest version. If the server reports a newer version, the firmware list is parsed and written to flash.ota_print— Optional; print the firmware info stored in flash (name, URL, address, size, CRC32, etc.).ota_go— After confirming pending entries exist in flash, write the update flags, wait 2 seconds, then reboot.
Helper commands:
ota_clearwipes the firmware info from flash;pan_cmdprovides PAN debug subcommands such asdel_bond,conn_pan, andautoconnect.
Hardware Requirements
Before running this example, prepare:
One development board supported by this example (Supported Platforms).
A phone that can provide PAN network sharing.
Compilation and Flashing
Switch to the example project directory and run the scons command to compile (<board> is one of the three boards above):
> scons --board=<board> -j8
For example:
> scons --board=sf32lb52-lcd_n16r8_hcpu -j8
Building the user application automatically pulls in the sibling loader subprogram as a child project via AddDFU_PAN_V2.
For detailed compilation and download steps, please refer to the Quick Start Guide.
Expected Results
After the example starts:
The application sets the local name to
sifli_pan; after pairing with a phone it automatically initiates the PAN connection, the serial log showsPAN connected, and the network channel is ready.Run
ota_check; if the server has a newer version, the firmware info is written to flash.After running
ota_gothe device reboots and hands off to the loader, which downloads the firmware over the PAN network, writes it directly to the target partition, then reboots back into the new user application.Run
ota_versionagain and see the version change to confirm a successful upgrade.
Troubleshooting
Reference Documentation
Update History
Version |
Date |
Release Notes |
|---|---|---|
0.0.1 |
06/2026 |
Initial version |