BLE Intercom Example

Source path: example/ble/talkback

Supported Platforms

  • sf32lb52-lchspi-ulp

  • sf32lb52-nano series

  • sf32lb52-lcd series

  • sf32lb56-lcd series

  • sf32lb58-lcd series

Overview

  1. This example demonstrates how to implement BLE-based voice intercom functionality on this platform.

  2. It leverages BLE 5.0’s Periodic Advertising and Periodic Advertising Sync features to achieve low-power, low-latency wireless intercom.

  3. Supports multi-device networking, with up to 3 devices simultaneously connected for intercom.

  4. Uses Opus audio codec technology to ensure high-quality voice transmission.

Using the Example

  1. After power-on, this example automatically starts scanning to discover nearby intercom devices and establishes connections.

  2. It also starts advertising so that other devices can discover this device.

  3. Press the KEY1 button on the development board (corresponding to the silkscreen on the board) to start speaking; press KEY1 again to stop speaking.

  4. When other devices are speaking, this device will automatically play their audio.

  5. Supports system status viewing and debugging via Finsh commands.

Hardware Requirements

Before running this example, you need:

  • A development board supported by this example

  • At least two development boards for intercom testing

  • Audio input/output devices (microphone and speaker)

Hardware Connections

Connect the microphone and speaker according to the development board guide. sf32lb52-lcd_n16r8 sf32lb52-nano_n16r16 sf32lb52-lchspi-ulp

Compiling and Flashing

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

> scons --board=eh-lb525 -j32

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

$ ./uart_download.bat

     Uart Download

please input the serial port num:5

For detailed compilation and download steps, please refer to the Quick Start Guide.

Expected Results

After the example starts:

  1. The system automatically initializes the BLE and audio modules.

  2. Starts scanning for nearby intercom devices and establishing connections.

  3. When the KEY1 button is pressed to start speaking, other devices can hear clear audio; press KEY1 again to stop speaking.

  4. When other devices are speaking, this device will automatically play the audio.

  5. The serial port outputs relevant log information for debugging and system status monitoring.

Troubleshooting

  1. If other devices cannot be found, check:

    • Ensure all devices are on the same network (using the same DEFAULT_NETWORK_CODE)

    • Verify that BLE functionality is properly enabled

    • Confirm that devices are within effective range

  2. If audio quality is poor, check:

    • Whether the microphone and speaker are correctly connected

    • Whether audio parameter configurations (sample rate, bit depth, etc.) are appropriate

    • Whether there is electromagnetic interference

  3. If the button is unresponsive, check:

    • Whether the button pin configuration is correct

    • Whether the button driver is properly loaded

    • Whether the button hardware connection is reliable

Reference Documentation

Revision History

Version

Date

Description

0.0.1

12/2025

Initial version