This application aims to implement an example of Continuous Glucose Monitoring in The Bluetooth SIG CGM Profile using the Thunderboard EFR32BG22
The Bluetooth SIG CGM Profile is a Bluetooth Low Energy (BLE) profile that can help people with diabetes to more efficiently manage their blood sugar levels. By providing users with real-time glucose data, this profile helps them to detect low/high blood sugar levels earlier, which can prevent serious complications.
This project focuses on managing and interacting with the Continuous Glucose Monitoring service in Bluetooth part, not about the used biological sensors and analog front-end (AFE). Generally, there are no common biological sensors and AFE solutions for the BGM/CGM product in the market; manufacturers have their own proprietary solutions.
- GSDK v4.4.0
NOTE: Tested boards for working with this example:
Board ID | Description |
---|---|
SLTB010A | EFR32BG22 Thunderboard Kit – SLTB010A |
BRD4166A | Thunderboard Sense 2 - EFR32MG12 - EK4166A |
This application uses the LightBlue App to connect to the Thunderboard EFR32BG22 via Bluetooth for continuous glucose monitoring.
To test this application, you can either create a project based on an example project or start with a "Bluetooth - SoC Empty" project based on your hardware.
-
From the Launcher Home, add your product name to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project with the filter "glucose".
-
Click Create button on Bluetooth - Continuous Glucose Monitoring example. Example project creation dialog pops up -> click Create and Finish and Project should be generated.
-
Build and flash this example to your board.
-
Create a Bluetooth - SoC Empty project for your hardware using Simplicity Studio 5.
-
Copy all the .h and .c files in inc and src folders into the project root folder (overwriting all existing files).
-
Import the GATT configuration:
-
Open the .slcp file in the project.
-
Select the CONFIGURATION TOOLS tab and open the Bluetooth GATT Configurator.
-
Find the Import button and import the attached gatt_configuration.btconf file.
-
Save the GATT configuration (ctrl-s).
-
-
Install the software components:
-
Open the .slcp file in the project.
-
Select the SOFTWARE COMPONENTS tab.
-
Install the following components:
- [Application] → [Timers] → [Sleep timer]
- [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
- [Application] → [Utility] → [Log]
- [Platform] → [Board] → [Board Control]: Enable Virtual COM UART.
-
-
Build and flash this project to your board.
Note: Do not forget to flash a bootloader to your board, see Bootloader for more information.
The application is based on the Bluetooth - SoC Empty example. Since the example already has the Bluetooth GATT server, advertising, and connection mechanisms, only minor changes are required.
There are two major services: Continuous Glucose Monitoring service and OTA service.
The Continuous Glucose Monitoring (CGM) Service exposes glucose measurement and other data related to a personal CGM sensor for healthcare applications. This service has UUID 0x181F
and contains 7 characteristics.
- [Service] Continuous Glucose Monitoring -
0x181F
- [Char] CGM Measurement -
2AA7
- [N] Notify the Continuous Glucose Monitoring reports
- [Char] CGM Feature -
2AA8
- [R] Get the CGM service feature
- [Char] CGM Status -
2AA9
- [R] Get the current status from the CGM Sensor
- [Char] CGM Session Start Time -
2AAA
- [R] Get Measurement Session Start Time
- [W] Set Measurement Session Start Time
- [Char] CGM Session Run Time -
2AAB
- [R] Get Measurement Session Run Time
- [Char] Record Access Control Point -
2A52
- [W] Enables functions including counting records, transmitting records and clearing records based on filter criterion
- [I] Get status from the function requests
- [Char] CGM Specific Ops Control Point -
2AAC
- [W] Set CGM-specific settings of the device
- [I] Get status from the CGM settings
- [Char] CGM Measurement -
Where R = Readable, W = Writeable, N = Notify and I = Indicate.
Used for OTA upgrade, please refer to AN1086: Using the Gecko Bootloader with the Silicon Labs Bluetooth® Applications for more information.
This application has two roles:
- A CGM sensor
- A collector, which is typically a smartphone or tablet.
After the application is initialized, the collector scans for the CGM sensor device with the advertising name: "silabs-cgm" and connects to it. Once the connection is established, the collector configures the CGM Specific Ops Control Point characteristic to set CGM-specific functionality and settings on the sensor device, such as the CGM Communication Interval or sending a calibration value to the device.
After configuration, the collector uses the Record Access Control Point characteristic to enable functions such as counting records, transmitting records, and clearing records based on filter criteria. The filter criteria in the Operand field are defined by the service that references this characteristic, and they specify the format of a record (which may be comprised of one or more characteristics) and the sequence of transferred records.
When the measurement session ends, the measurement reports can be displayed in the CGM Measurement characteristic.
Please refer to Bluetooth SIG CGM introduction.md in the doc folder for more information.
Open the LightBlue app, filter silabs-CGM and connect it.
Please refer to CGM specifications in the doc folder for below process
-
Open the LightBlue app, connect silabs-CGM.
-
Find the Continuous Glucose Monitoring service.
-
Set indicate of 0x2AA7 characteristic (CGM Measurement) and 0x2A52 characteristic (Record Access Control Point).
-
Write HEX 0401 to 0x2A52.
-
There will be 1 indication (0x05008025) in 0x2A52, which means that there are 9600 (0x2580) records by default.
There are two ways that a client can receive the CGM Measurement Characteristic values:
- Periodic
- Requested
-
Set Notify of 0x2AA7 characteristic (CGM Measurement)
-
Set indicate of 0x2AAC characteristic (CGM Specific Ops Control Point).
-
Write HEX 1A to 0x2AAC, which means start session - you can find this test case in CGMS.TS.p6: CGMS/SEN/CGMCP/BV-22-C [CGM Specific Ops – ‘Start Session'].
-
There will be 1 indication in 0x2AAC to show start session success.
-
The sensor (Thunderboard) will continuously send the notifications to 0x2AA7 characteristic until writing 0x1B to 0x2AAC (stop session).
-
Write "1B" to 0x2AAC to stop the session.
- Set Notify of 0x2AA7 characteristic (CGM Measurement)
- Set indicate of 0x2A52 characteristic (Record Access Control Point),
- Write HEX 0105 to 0x2A52, which means the reporting of the first record.
- There will be 1 notification in 0x2AA7, which is the first record.
You can download the CGM specification from https://www.bluetooth.com/specifications/specs/, which is already in the doc folder of this repository.
Here you can watch a tutorial video about the Bluetooth PTS Test in Chinese: https://www.bilibili.com/video/BV1w44y1a7Hj?spm_id_from=333.999.0.0