Registered User mNo edit summary |
Registered User mNo edit summary Tag: 2017 source edit |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:STM32WBA Bluetooth<sup>®</sup> LE – Health Thermometer Sensor}} | {{DISPLAYTITLE:STM32WBA Bluetooth<sup>®</sup> LE – Health Thermometer Sensor}} | ||
== | ==Health Thermometer Profile== | ||
Health Thermometer Profile (HTP) <ref>[https://www.bluetooth.com/specifications/specs/health-thermometer-profile-1-0/ Health Thermometer profile specification]</ref> is a Generic Attribute Profile (GATT) based low-energy profile defined by the '''Bluetooth<sup>®</sup> Special Interest Group'''.<ref>[https://www.bluetooth.com/learn-about-bluetooth/tech-overview Bluetooth<sup>®</sup> SIG]</ref><br> | Health Thermometer Profile (HTP) <ref>[https://www.bluetooth.com/specifications/specs/health-thermometer-profile-1-0/ Health Thermometer profile specification]</ref> is a Generic Attribute Profile (GATT) based low-energy profile defined by the '''Bluetooth<sup>®</sup> Special Interest Group'''.<ref>[https://www.bluetooth.com/learn-about-bluetooth/tech-overview Bluetooth<sup>®</sup> SIG]</ref><br> | ||
Health Thermometer Profile is a combination of a Health Thermometer Collector and a Health Thermometer Sensor to connect and exchange data in different applications.<br> | Health Thermometer Profile is a combination of a Health Thermometer Collector and a Health Thermometer Sensor to connect and exchange data in different applications.<br> | ||
Line 114: | Line 114: | ||
|}<br> | |}<br> | ||
=== Advertising data === | ===Advertising data=== | ||
At start up, '''Health Thermometer''' application starts advertising with an interval of approximatively 80-100ms.<br> | At start up, '''Health Thermometer''' application starts advertising with an interval of approximatively 80-100ms.<br> | ||
Data advertised are composed as follows: | Data advertised are composed as follows: | ||
Line 198: | Line 198: | ||
|}<br> | |}<br> | ||
== | ==Requirements== | ||
=== Software and system requirements === | === Software and system requirements=== | ||
The following list contains the required software as well as the required minimum IDE version: | The following list contains the required software as well as the required minimum IDE version: | ||
*IAR Embedded Workbench for ARM (EWARM) toolchain V9.20.1, plus a patch available in WBA Firmware Package: ''STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/EWARMv8_STM32WBAx_V1.2.zip'' | *IAR Embedded Workbench for ARM (EWARM) toolchain V9.20.1, plus a patch available in WBA Firmware Package: ''STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/EWARMv8_STM32WBAx_V1.2.zip'' | ||
Line 208: | Line 208: | ||
* STM32CubeProgrammer<ref name="Stm32CubeProg" >[https://www.st.com/en/development-tools/stm32cubeprog.html STM32CubeProgrammer software]</ref> | * STM32CubeProgrammer<ref name="Stm32CubeProg" >[https://www.st.com/en/development-tools/stm32cubeprog.html STM32CubeProgrammer software]</ref> | ||
=== Hardware requirements === | === Hardware requirements=== | ||
NUCLEO-WBA52CG<ref name="Nucleo package" >[https://www.st.com/en/evaluation-tools/nucleo-wba52cg.html NUCLEO-WBA5CG board]</ref> is necessary to install the application. | NUCLEO-WBA52CG<ref name="Nucleo package" >[https://www.st.com/en/evaluation-tools/nucleo-wba52cg.html NUCLEO-WBA5CG board]</ref> is necessary to install the application. | ||
{|style="margin-left: auto; margin-right: auto;" | {|style="margin-left: auto; margin-right: auto;" | ||
Line 218: | Line 218: | ||
|}<br> | |}<br> | ||
===Compatible collector applications === | ===Compatible collector applications=== | ||
The STM32CubeWBA Health Thermometer Sensor project is compatible with the following collectors: | The STM32CubeWBA Health Thermometer Sensor project is compatible with the following collectors: | ||
*[[Connectivity:BLE_smartphone_applications#ST_BLE_Sensor | '''ST BLE Sensor''']] | *[[Connectivity:BLE_smartphone_applications#ST_BLE_Sensor | '''ST BLE Sensor''']] | ||
Line 224: | Line 224: | ||
*[https://applible.github.io/Web_Bluetooth_App_WBA/ '''Web bluetooth interface'''] | *[https://applible.github.io/Web_Bluetooth_App_WBA/ '''Web bluetooth interface'''] | ||
== | ==STM32WBA Health Thermometer Sensor example description== | ||
=== Project directory === | === Project directory === | ||
The '''''"BLE_HealthThermometer"''''' application is available by downloading '''STM32CubeWBA MCU Package'''<ref name="STM32CubeWBA MCU Package">[https://www.st.com/en/embedded-software/stm32cubewba.html STM32CubeWBA MCU Package]</ref>.<br> | The '''''"BLE_HealthThermometer"''''' application is available by downloading '''STM32CubeWBA MCU Package'''<ref name="STM32CubeWBA MCU Package">[https://www.st.com/en/embedded-software/stm32cubewba.html STM32CubeWBA MCU Package]</ref>.<br> | ||
Line 230: | Line 230: | ||
Refer to [[Connectivity:STM32WBA_Build_BLE_Project|How to Build a Bluetooth® LE project]] wiki page for project directory information. | Refer to [[Connectivity:STM32WBA_Build_BLE_Project|How to Build a Bluetooth® LE project]] wiki page for project directory information. | ||
=== Project description === | ===Project description=== | ||
==== Structure | ====Structure==== | ||
Software project structure illustrating the most important parts: | Software project structure illustrating the most important parts: | ||
Line 258: | Line 258: | ||
<br clear=all> | <br clear=all> | ||
==== Application initialization ==== | ====Application initialization==== | ||
The different steps of the application initialization are described below: | The different steps of the application initialization are described below: | ||
Line 299: | Line 299: | ||
|} | |} | ||
==== GAP and GATT initialization and interaction ==== | ====GAP and GATT initialization and interaction==== | ||
{|style="margin-left: auto; margin-right: auto;" | {|style="margin-left: auto; margin-right: auto;" | ||
|- | |- | ||
Line 346: | Line 346: | ||
****Notify application of the Measurement Notification - '''HTS_Notification(HTS_MEI_INDICATE_ENABLED/DISABLED_EVT)''' | ****Notify application of the Measurement Notification - '''HTS_Notification(HTS_MEI_INDICATE_ENABLED/DISABLED_EVT)''' | ||
=== How to use the Bluetooth® Low Energy Health Thermometer application === | ===How to use the Bluetooth® Low Energy Health Thermometer application=== | ||
Once the '''Bluetooth® Low Energy Health Thermometer''' application is installed on the STM32WBA platform, launch the [[Connectivity:BLE_smartphone_applications#ST_BLE_Toolbox | '''ST BLE ToolBox''']] smartphone application. | Once the '''Bluetooth® Low Energy Health Thermometer''' application is installed on the STM32WBA platform, launch the [[Connectivity:BLE_smartphone_applications#ST_BLE_Toolbox | '''ST BLE ToolBox''']] smartphone application. | ||
Line 354: | Line 354: | ||
* Temperature measurement indication is provided to remote every 10 s. | * Temperature measurement indication is provided to remote every 10 s. | ||
=== UART debug trace === | ===UART debug trace=== | ||
Thanks to the [[Connectivity:STM32WBA_BLE_Hardware_Setup#Debug log via UART interface| debug log via UART interface]] , it is possible to trace the application project. | Thanks to the [[Connectivity:STM32WBA_BLE_Hardware_Setup#Debug log via UART interface| debug log via UART interface]] , it is possible to trace the application project. | ||
Line 433: | Line 433: | ||
|} | |} | ||
== | ==References== | ||
<references /> | <references /> | ||
<noinclude> | <noinclude> |
Revision as of 13:39, 17 April 2024
1. Health Thermometer Profile
Health Thermometer Profile (HTP) [1] is a Generic Attribute Profile (GATT) based low-energy profile defined by the Bluetooth® Special Interest Group.[2]
Health Thermometer Profile is a combination of a Health Thermometer Collector and a Health Thermometer Sensor to connect and exchange data in different applications.
The Health Thermometer Sensor:
- Measures the temperature and exposes it via the Health Thermometer Service[3]
- Contains the Device Information Service to be identified by the remote device
- Is the GATT server
The Health Thermometer Collector:
- Accesses the information exposed by the Health Thermometer Sensor and can for example display it to the end user or store it on nonvolatile memory for later analysis.
- Is the GATT client
This wiki page is the description of the Health Thermometer Sensor project provided within the STM32CubeWBA MCU Package[4]
The table below describes the structure of Health Thermometer Sensor services:
Bluetooth® LE Health Thermometer Service specification | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Health Thermometer is exported as a Service:
- Temperature Measurement characteristic (TEMM):
- Sends a temperature measurement, and updates related flags.
- Temperature Type characteristic (MNBS):
- One of two methods used to describe the type of temperature measurement in relation to the location on the human body where the temperature was measured.
- Intermediate Temperature characteristic (INT):
- Sends intermediate temperature values to a device for display purposes while the measurement is in progress.
- Measurement Interval characteristic (MEI):
- Enables and controls the interval between consecutive temperature measurements.
Device Information (DIS) is exported as a Service:
- Manufacturer Name String characteristic (MANS):
- Name of the manufacturer of the device.
- Model Number String characteristic (MONS):
- Model number assigned by the device vendor.
- System ID characteristic (SYID):
- Structure containing an Organizationally Unique Identifier (OUI) followed by a manufacturer-defined identifier and is unique for each individual instance of the product.
1.1. Advertising data
At start up, Health Thermometer application starts advertising with an interval of approximatively 80-100ms.
Data advertised are composed as follows:
HealthThermometer Advertising packet | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Manufacturer data are encoded following STMicroelectronics BlueST SDK v2 as described below:
STMicroelectronics Manufacturer Advertising data | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2. Requirements
2.1. Software and system requirements
The following list contains the required software as well as the required minimum IDE version:
- IAR Embedded Workbench for ARM (EWARM) toolchain V9.20.1, plus a patch available in WBA Firmware Package: STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/EWARMv8_STM32WBAx_V1.2.zip
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.37, plus a patch available in WBA Firmware package: STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/Keil.STM32WBAx_DFP.1.0.0.zip
- STM32CubeIDE toolchain V1.12.0 [5].
The following programmer software is required to flash the board with an already generated binary:
- STM32CubeProgrammer[6]
2.2. Hardware requirements
NUCLEO-WBA52CG[7] is necessary to install the application.
2.3. Compatible collector applications
The STM32CubeWBA Health Thermometer Sensor project is compatible with the following collectors:
3. STM32WBA Health Thermometer Sensor example description
3.1. Project directory
The "BLE_HealthThermometer" application is available by downloading STM32CubeWBA MCU Package[4].
Refer to How to Build a Bluetooth® LE project wiki page for project directory information.
3.2. Project description
3.2.1. Structure
Software project structure illustrating the most important parts:
3.2.2. Application initialization
The different steps of the application initialization are described below:
3.2.3. GAP and GATT initialization and interaction
and The Bluetooth® Low Energy Health Thermometer application initialization is done within app_ble.c
- Initialize the Bluetooth® Low Energy stack - initialize the device as peripheral - configure and start advertising: ADV parameters, local name, UUID - APP_BLE_init()
- Call the services controller initialization SVCCTL_Init() - svc_ctl.c
- Manage the GAP event - SVCCTL_App_Notification()
- HCI_LE_CONNECTION_COMPLETE - provides information of the connection interval, slave latency, supervision timeout
- HCI_LE_CONNECTION_UPDATE_COMPLETE- provides the new information of the connection
- HCI_DISCONNECTION_COMPLETE - informs the application about the link disconnection and the reason
The Services management is done by the service controller, svc_ctl.c
- Initialize the number of registered handler - SVCCTL_Init()
- Manage events - SVCCTL_UserEvtRx()- from the Bluetooth® Low Energy Host Stack and redirect them to the gap event handler - SVCCTL_App_Notification
The application level of the Health Thermometer is done with hts_app.c:
- Initialization of the services:
- Health Thermometer Service - HTS_Init() - hts.c
- Initialization of the context of the application
- Receive notification from the Health Thermometer Service - HTS_Notification()
- When temperature measurement characteristics are enabled by remote, simulate the temperature measurement every second (HTS_APP_Measurement) and increase the energy expended to transfer to the remote device (collector) - HTS_UpdateValue()
The Health Thermometer Service hts.c manages the specification of the service:
- Service Init - HTS_Init()
- Register Health Thermometer Event Handle to Service Controller - SVCCTL_RegisterSvcHandler(HTS_EventHandler);
- Initialize Service UUID – add Health Thermometer service as Primary services
- Initialize Temperature measurement (TEMM) characteristic
- Initialize Temperature Type (MNBS) characteristic
- Initialize Intermediate Temperature (INT) characteristic
- Initialize Measurement Interval (MEI) characteristic
- Manage the GATT event from Bluetooth® Low Energy Stack - HTS_EventHandler()
- ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE
- Reception of a Write Command: Measurement Interval Characterictic Value
- Send an aci_gatt_write_response() with an OK or KO status.
- Reception of a Write Command: Measurement Interval Characterictic Value
- ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
- Reception of an attribute modification - Temperature Measurement Value : ENABLE or DISABLE Indication
- Notify application of the Measurement Notification - HTS_Notification(HTS_TEMM_INDICATE_ENABLED/DISABLED_EVT)
- Reception of an attribute modification - Intermediate Temperature Value : ENABLE or DISABLE Notification
- Notify application of the Measurement Notification - HTS_Notification(HTS_INT_NOTIFY_ENABLED/DISABLED_EVT)
- Reception of an attribute modification - Measurement Interval Value : ENABLE or DISABLE Indication
- Notify application of the Measurement Notification - HTS_Notification(HTS_MEI_INDICATE_ENABLED/DISABLED_EVT)
- Reception of an attribute modification - Temperature Measurement Value : ENABLE or DISABLE Indication
- ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE
3.3. How to use the Bluetooth® Low Energy Health Thermometer application
Once the Bluetooth® Low Energy Health Thermometer application is installed on the STM32WBA platform, launch the ST BLE ToolBox smartphone application.
Then, scan and connect the device called HT_XX (where XX is replaced by the last byte of the BD address) to the application.
Once the Bluetooth® LE connection is established and the notification enabled by the smartphone (by clicking on Health Thermometer icon):
- Intermediate temperature notification is provided to remote every 1 s.
- Temperature measurement indication is provided to remote every 10 s.
3.4. UART debug trace
Thanks to the debug log via UART interface , it is possible to trace the application project.
To enable the traces within the project, enable them within app_conf.h as described below:
/**
* Enable or Disable traces in application
*/
#define CFG_DEBUG_APP_TRACE (1)
Health Thermometer - Initialization phase | Connected Phase |
---|---|
==>> Start Ble_Hci_Gap_Gatt_Init function
Success: hci_reset command
Success: aci_hal_write_config_data command -
CONFIG_DATA_PUBADDR_OFFSET
Public Bluetooth Address: 00:80:e1:2a:7c:ea
Success: aci_hal_write_config_data command -
CONFIG_DATA_IR_OFFSET
Success: aci_hal_write_config_data command -
CONFIG_DATA_ER_OFFSET
Success: aci_hal_set_tx_power_level command
Success: aci_gatt_init command
Success: aci_gap_init command
Success: aci_gatt_update_char_value - Device Name
Success: aci_gatt_update_char_value - Appearance
Success: hci_le_set_default_phy command
Success: aci_gap_set_io_capability command
Success: aci_gap_set_authentication_requirement command
Success: aci_gap_configure_whitelist command
==>> End Ble_Hci_Gap_Gatt_Init function
Services and Characteristics creation
Success: aci_gatt_add_service command: DIS
Success: aci_gatt_add_char command : MANS
Success: aci_gatt_add_char command : MONS
Success: aci_gatt_add_char command : SYID
Success: aci_gatt_update_char_value MANS command
Success: aci_gatt_update_char_value MONS command
Success: aci_gatt_add_service command: HTS
Success: aci_gatt_add_char command : TEMM
Success: aci_gatt_add_char command : MNBS
Success: aci_gatt_add_char command : INT
Success: aci_gatt_add_char command : MEI
Success: aci_gatt_update_char_value MEI command
End of Services and Characteristics creation
==>> aci_gap_set_discoverable - Success
==>> Success: Start Advertising
|
>>== HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE -
Connection handle: 0x0001
- Connection established with @:5f:6e:a2:95:0d:a5
- Connection Interval: 48.75 ms
- Connection latency: 0
- Supervision Timeout: 5000 ms
>>== HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
- Connection Interval: 7.50 ms
- Connection latency: 0
- Supervision Timeout: 5000 ms
>>== HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE
- Connection Interval: 48.75 ms
- Connection latency: 0
- Supervision Timeout: 5000 ms
ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
HTS_TEMM_INDICATE_ENABLED_EVT
ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
HTS_INT_NOTIFY_ENABLED_EVT
ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
HTS_MEI_INDICATE_ENABLED_EVT
|
4. References