nRF5 SDK for Thread and Zigbee v1.0.0
BLE HRS and Thread CoAP Server with FreeRTOS Example

This BLE-Thread dynamic multiprotocol example requires you to run any complementary example on the second board, i.e. an example containing Thread CoAP Client functionality, for example:

This example application is based on the ble_app_proximity 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 may 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, utilizing 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:

Setup

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

Testing

  1. Prepare two nRF52840 Preview Development Kits and an Android smartphone (you can also use an iOS smartphone).
  2. On the smartphone, install nRF Connect for Mobile.
  3. Run the following commands to flash the simple_coap_client example to one of the boards and switch it on. LED 1 will start blinking (attaching to a Thread network) and, after a few seconds, it will turn solid (attached to a Thread network or Thread network created):
    $ cd <InstallFolder>/examples/thread/simple_coap_client/hex
    $ nrfjprog -f nrf52 -r --program nrf52840_xxaa.hex --chiperase
  4. Build the example according to the instructions in Building examples.
  5. Flash SoftDevice and the example according to the instructions in Running examples and switch the board on. LED 1 will start blinking (BLE advertising).
  6. Open nRF Toolbox and tap HRM.
  7. Tap CONNECT and select Thread_HRS. You can now see data sent by HRS example.
  8. Observe that BSP_LED_0 is solid, which indicates that BLE connection has been established.
  9. You can control blinking of BSP_LED_2 and BSP_LED_3 on the node by pressing BSP_BUTTON _1 on the CoAP Client node.
  10. Pair a client with a server. Press BSP_BUTTON_3 on a server node to enable pairing. Then, press BSP_BUTTON_3 on any client node to pair the two nodes.
  11. 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.

Documentation feedback | Developer Zone | Subscribe | Updated