BLE_HeartRate_Thread Application Description

How to use the Concurrency mode BLE/Thread with BLE Heart Rate profile and COAP messages transmission over Thread.

This application demonstrates the BLE/Thread concurrency mode. The device is configured to attach to a Thread Leader and then sends COAP message every one second. This device is also configured in BLE with Heart Rate profile, starts advertising and is available to accept incoming connection in BLE.

Keywords

Connectivity, Concurrency, BLE, BLE protocol, Thread, COAP, STM32WBA

Directory contents

Hardware and Software environment

How to use it?

Minimum requirements for the demo:

In order to make the program work, you must do the following:

In a Thread network, nodes are split into two forwarding roles: Router or End Device.
The Thread Leader is a Router that is responsible for managing the set of Routers in a Thread network.
An End Device (or child) communicates primarily with a single Router.

Our Application uses two devices :

After the reset of the Thread_Coap_Generic device, it will be in Leader mode (Green LED2 ON).
Then power on the BLE_HeartRate_Thread device, it will be in Child mode (Red LED3 ON).

Once attached to the Thread Leader (Thread_Coap_Generic device), the Thread Child (BLE_HeartRate_Thread device) starts sending COAP command (Non-Confirmable) to the Thread Leader every one second. The Thread Leader will receive COAP commands to toggle its blue LED1.

    
  ___________________________                       ___________________________
  |  BLE_HeartRate_Thread   |                       | Thread_Coap_Generic     |
  |_________________________|                       |_________________________|  
  |                         |                       |                         |
  |              every 1sec |                       |                         |
  |               or SW1 -->|======> COAP =========>| BLUE LED TOGGLE (ON/OFF)|
  |                         | Resource "light"      |                         |
  |                         | Mode: Multicast       |                         |
  |                         | Type: Non-Confirmable |                         |
  |                         | Code: Put             |                         |
  |                         |                       |                         |
  |                         |                       |                         |
  |                SW2 -->  |=====> COAP ==========>|-------->                |
  |                         | Resource "light"      |         |               |
  |                         | Mode: Multicast       |  CoapRequestHandler()   |
  |                         | Type: Confirmable     |         |               |
  |                         | Code: Put             |         |               |
  |                         |                       |         v               |
  |                         |                       |  CoapSendDataResponse() |
  |                         |                       |         |               |
  |                         |                       |         v               |
  | CoapDataRespHandler()<--|<===== COAP <==========| <-------                |
  |                         |                       | BLUE LED TOGGLE (ON/OFF)| 
  |                         |                       |                         |  
  ---------------------------                       ---------------------------
  | Role : Child            |                       | Role : Leader           |
  |                         |                       |                         |
  | LED : Red               |                       | LED : Green             |
  |                         |                       |                         |
  |_________________________|                       |_________________________|

  

During Thread activity, the BLE_HeartRate_Thread device is also configured in BLE with Heart Rate profile, performs advertising and is available to accept incoming connection in BLE.

On the android/ios device, enable the Bluetooth communications, and if not done before:

Traces