Objective
This lab exercise will have you configure/deploy the GATT Heart Rate Service on a BM70 and update the characteristics dynamically using the appropriate op-codes. Results will be monitored via a smartphone application.
You will:
- Configure/Deploy the Heart Rate Service on a BM70 using the User Interface (UI) Configuration Tool.
- Deploy appropriate BM70 op-codes to dynamically update server characteristics using the Manual Pattern Tool.
- Monitor updated characteristic values using a smartphone application.
Materials
Hardware Tools
- BM70 PICtail
- Android Smartphone (Lab tested with BLU Advance 5.0).
- OS version 4.4 or higher
- BT 4.0 or higher hardware
- Apple Smartphone
- OS version 5 or later
- BT 4.0 or higher hardware
Software Tools
- User Interface (UI) Configuration Tool
- Manual Pattern Test Tool
- Smart Discover App (iOS)
- Smart Discover App (Android)
Be sure to install the MCP2200 USB drivers before starting. Also, download/extract the UI Configuration Tool as well as the Manual Pattern Test Tool to your PC using the links above.
Exercise Files
File | Download |
Installation
Instructions |
||
---|---|---|---|---|
Windows | Linux | Mac OSX | ||
Lab 2 Configuration
|
| | | |
Connection Diagram
Procedure
GATT Server Configuration
1
Place the Module in Test Mode
After connecting the PICtail to your PC, place the module in Test Mode by setting SW7 in the ON position, then press SW5 (reset) to reset the module. Also, ensure the jumpers are all set as shown:
With Jumper JP8 shorted, LED0 will be lit (BLUE) indicating the module is in Test Mode, as shown above.
4
Change the Device Name
Under the Device Information section set the Name Fragment to lab3p-XXXX where XXXX are the last 4 digits of the BM70 MAC address. This identifier will become the GAP Service Device Name characteristic.
This Lab exercise was developed for a classroom environment having many radios. Appending the last 4 digits of the MAC address to the Device Name aids in identifying a specific board during advertising.
The device name should be unique. Also, since the advertising packet is pretty small (31 byte max. payload), suggest you limit the name ID to fewer than 8 characters (i.e. for the 10-character device name shown, if you try to add a 16-byte private service to the ADV payload, you will get an error message).
GATT Server Interaction
In the first interaction you will:
- Establish a BLE connection between the smartphone app and the BM70
- As a BLE Client (Smartphone), enable notifications on the Heart Rate Measurement characteristic
- As a BLE Server (BM70), update the characteristic using op-code 0x38 Send_Characteristic_Value
- As BLE Client, instantly see these updates appear in the app
13
Enable Notifications
Select (Tap) the Heart Rate Measurement characteristic, then enable notifications on that characteristic by toggling the Enable Notify switch to the ON position. By doing this, the app (GAP Central, GATT Client) will be able to receive updates to this characteristic as soon as the GATT Server updates it.
"Enabling Notifications" = Writing 0x0001 to the Heart Rate Measurement Client Characteristic Configuration Descriptor (CCCD) Attribute Value (Handle 0x8003 from step 6 above). This procedure is performed by the GATT client (SmartDiscover app in this case).
15
Expand GATT Table
You should see the fully parsed GATT Table display. Scroll down to the Heart Rate Service and click on Heart Rate Measurement Value Attribute (Handle 0x8002) as shown below.
Notice that the GATT Connection Handle Value (0x00) and Characteristic Handle (0x8002) are populated in the GATT R/W dialog.
17
Send Different Characteristic Values
The same sequence may be completed in the GATT Server tab by selecting Opcode 0x38, Connection Handle 0x00, Char Value Handle 0x8002, and Characteristic Value 0x00A0 and then pressing Send.
Try sending different Characteristic Values and note the immediate update on the app.
Conclusions
- Several Public GATT Services are available to be loaded into the GATT Table of the BM70
- Profiles are loaded via the UI Configuration Tool
- 2 op-codes are available to update characteristics on the server
- 0x38: Send Characteristic Value which is used for notify-enabled characteristics
- 0x39: Update Characteristic Value which is used for read-only characteristics