nRF5 SDK for Thread and Zigbee v4.1.0
BLE and Thread Template Example

Table of Contents

This information applies to the following SoCs: nRF52833 and nRF52840.
This example requires the following SoftDevice: S140

Important: Before you run this example, make sure to program the SoftDevice.

Warning
There is an issue in the nRF5 SDK for Thread and Zigbee v4.1.0 that causes higher-than-usual sleep power consumption for all multiprotocol examples when using nRF52840. See workaround on DevZone.

The Switched BLE-Thread Template example demonstrates the usage of the switched multiprotocol method. This example is a merge of a simplified version of BLE Peripheral Template and Thread CLI Example applications.

For more information about multiprotocol support, see Multiprotocol support with BLE/Bluetooth.

The nRF52 device can operate in the following modes:

Description

By default, the application starts in the BLE Peripheral mode. To select a mode, press the buttons on the nRF52 Development Kit (see thread_multi_switched_template_example_setup_button).


Setup

You can find the source code and the makefile in the following folder: <InstallFolder>\examples\multiprotocol\ble_thread\ble_thread_swi_template

LED assignments

The example uses LED assignments as described in Thread BSP LED and button reference for the following LEDs:

The LED assignments are different for the following LEDs:

Button assignments

The following buttons reserved for user application purposes are assigned in this example:

Testing

The following testing procedure uses the nRF52840 device.

  1. Prepare at least one nRF52840 Preview Development Kit and an Android smartphone.
  2. On the smartphone, install nRF Connect for Mobile.
  3. Compile and program the SoftDevice and the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  4. Connect to the device from nRF Connect (the device is advertising as Nordic_Template). Observe that the BSP_INDICATE_CONNECTED state is indicated.
  5. Disconnect the device in nRF Connect and observe that the BSP_INDICATE_ADVERTISING state is indicated.
  6. Switch from BLE mode to Thread mode by pressing Button 3.
  7. Observe that LED2 lights up, and so does LED1 after the node is attached to the Thread network.
  8. Connect to the board through UART. The application uses the following UART settings:
    • Baud rate: 115200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: None
    Refer to OpenThread CLI reference for complete reference of the OpenThread Command Line Interface.
  9. Run the state command to check the state of the device in the Thread network:
    > state
    leader
    Done
    Note
    If there are any other Thread devices using the same channel and PANID, the observed state can be router or child.
  10. Switch from Thread mode to BLE mode again by pressing Button 4.

Documentation feedback | Developer Zone | Subscribe | Updated