The dynamic BLE-Thread Template example demonstrates the usage of the dynamic 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 nRF52840 device operates simultaneously on Thread and BLE. It joins the Thread network as a Thread FTD device. It also acts as a BLE Peripheral device sending BLE connectable advertisements.
This example provides OpenThread’s built-in command line interface (CLI), and automatically attaches to the Thread network.
Description
LED assignments:
- BSP_LED_0: Network state:
- Blinking - BLE advertising.
- Solid - Connected over BLE.
Button assignments:
- BSP_BUTTON_0: Wake up from BLE sleep mode.
Setup
You can find the source code in the following folder: <InstallFolder>\examples\multiprotocol\ble_thread\ble_thread_dyn_template
Testing
- Prepare at least one nRF52840 Preview Development Kit and an Android smartphone.
- On the smartphone, install nRF Connect for Mobile.
- Compile and program the SoftDevice and the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
- Connect to the device from nRF Connect (the device is advertising as 'Nordic_Template'). Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Disconnect the device in nRF Connect and observe that the BSP_INDICATE_ADVERTISING state is indicated.
- 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.
- Run the
state
command to check the state of the device in the Thread network: The actual state may differ, depending on when the device joined the network.