This BLE-Thread dynamic multiprotocol example requires you to run on the second board any complementary example that contains Thread CoAP Server functionality, for example:
For more information about multiprotocol support, see Multiprotocol support with BLE/Bluetooth.
The Thread FreeRTOS CoAP Server example uses the thread-safe variants of the OpenThread libraries that do not support hardware acceleration (see Mandatory libraries). This example is not supported on Keil.
This example application is based on the Heart Rate Application with FreeRTOS example available in nRF5 SDK v13.0.0. It has been extended to support dynamic switching between two connection modes, BLE and Thread, at the same time (concurrently). Thread operates on the 802.15.4 radio during Bluetooth low energy radio's inactive time (using Timeslot API). Depending on the Bluetooth low energy connection interval, nRF52840 SoC can spend up to 99% of the radio time on Thread protocol.
This example also supports the Thread CoAP Server role, as described in the Simple CoAP Server example.
The application works similarly to ble_app_hrs_freertos
, using the BLE HRS Profile. When not using BLE, nRF52840 SoC acts as a Thread CoAP Server controlling BSP_LED_2 and BSP_LED_3.
LED assignments:
Button assignments:
You can find the source code and the makefile in the following folder: <InstallFolder>\examples\multiprotocol\ble_thread\ble_thread_dyn_hrs_coap_srv_freertos
simple_coap_client
example to one of the boards and switch it on. LED 1 starts blinking (attaching to a Thread network) and, after a few seconds, it turns solid (attached to a Thread network or Thread network created): You can now control the blinking of BSP_LED_2 and BSP_LED_3 on this server node by pressing BSP_BUTTON_0 on the client node.