BLE Central and Peripheral with Pingpong OTA Example

Source Code Path: example/ble/central_and_peripheral_with_pingpong_ota

Supported Platforms

Projects with flash table programmed in mpi5

Overview

This example demonstrates how the platform can function as both GAP central and peripheral, as well as GATT client and server simultaneously. It also shows how to upgrade the project using the pingpong method

Example Usage

  1. The Finsh commands for this example can be printed by entering ‘diss help’ to show command usage.

  2. When acting as a peripheral device, it will start advertising on boot with a name formatted as SIFLI_APP-xx-xx-xx-xx-xx-xx, where xx represents the device’s Bluetooth address. You can connect using a mobile BLE APP.

  3. When acting as a central device, you can search for other peripheral devices through finsh commands and initiate connections.

  4. When acting as a GATT server, you can perform write and read operations on the mobile terminal, or enable CCCD, and the device will update the characteristic value every second.

  5. When acting as a GATT client, you can search and display the server’s database through finsh commands, and perform read or write operations on characteristic values.

  6. Connect the board through the SIFLE BLE APP, select a file, and perform the upgrade

Hardware Requirements

Before running this example, you need to prepare:

Compilation and Flashing

Switch to the example project directory and run the scons command to compile:

> scons --board=sf32lb58-lcd_n16r64n4 -j8

Switch to the example project/build_xx directory, run uart_download.bat, and select the port as prompted to download:

$ ./uart_download.bat
     Uart Download
please input the serial port num:5

For detailed steps on compilation and downloading, please refer to the relevant introduction in Quick Start.

Expected Results

After the example starts:

  1. It can be discovered and connected by the mobile BLE APP, allowing corresponding GATT characteristic read/write operations.

  2. It can search for other BLE devices, connect and search the connected device’s GATT database, and perform GATT read/write operations.

  3. It can be upgraded using the APP

Troubleshooting

Reference Documentation

Update History

Version

Date

Release Notes

0.0.1

07/2025

Initial version

No newline at end of right file.