Appendix E. Bluetooth Low Energy Primer

Last modified by Microchip on 2023/11/10 11:11

BM70 Compact Demo Board User's Guide

E.1 GAP Roles: Peripheral and Central

When two Bluetooth Low Energy (BLE) devices want to be connected, one device must be in central role and the other in peripheral role. The peripheral device advertises to show its connectable status, while the Central device scans service advertisements, and if needed, initiates a connection to the Peripheral device. Once connected, either end of the connection can choose to bond. Once bonded, all security-related keys are saved and security processes are waived when reconnecting. The bonded peripheral device can only perform direct advertise and is therefore unable to connect to a device other than its bonded peer.

Back to Top

E.2 GATT Service: Client and Server

Similar to Bluetooth Classic, BLE uses the concept of profiles to ensure interoperability between different devices. As illustrated in Figure E-1, BLE profiles are a collection of services. All BLE services are built on top of the Generic Attribute Profile (GATT) where GATT defines the accessibility of attributes called characteristics. The main functionality of the BLE profiles is built around the characteristics. For those devices that maintain the value of characteristics in a service, that device is the Server of the service. On the other hand, devices that acquire data from their peer are called Clients.

GATT SERVICE DATA EXCHANGE INFOGRAPHIC

FIGURE E-1: GATT SERVICE

Each service and its characteristics can be identified by their Universally Unique Identifier (UUID). The UUID can be a short form (16-bit) or long form (128-bit). As specified by Bluetooth Core Specifications, all Bluetooth SIG-adopted (public) services and characteristics have short UUIDs (16-bit), while user-defined private UUIDs are in long form (128-bit). For the details of Bluetooth SIG adopted services and characteristics, please refer to the "Intro to Bluetooth Generic Attribute Profile (GATT)" page.

The accessibility of each characteristic is defined by an 8-bit characteristic property in bitmap format, as shown in Table E-1.

Table E-1: Characteristic Properties

PropertyBitmap ValueDescription
Extended Property(1)0x80Additional property available
Authenticated Write(1)0x40Write characteristic with authentication from Client to Server
Indicate0x20Indicate value of characteristic with acknowledgment from Server to Client
Notify0x10Notify value of characteristic without acknowledgment from Server to Client
Write0x08Write value of characteristic with acknowledgment from Client to Server
Write without response0x04Write value of characteristic without acknowledgment from Client to Server
Read0x02Read value of characteristic. Value is sent from Server to Client
Broadcast(1)0x01Broadcast value of characteristic

Note (1): These features will be supported in future firmware releases

As shown in Figure E-1, the GATT client can access the characteristics in the GATT server in the Peripheral device. When connected, the GATT client reads the GATT server service and characteristic UUIDs. The characteristic values can be accessed by the GATT client using Write, Read, Indication, and Notifications.

Write-REQ enables the GATT client to update characteristic values on the Peripheral's GATT server. The write requests can be performed using RN4870 CHW and CUW commands. Refer to section "4.6 Accessing GATT Service Using UART Commands And SmartDiscover App" for more information on GATT characteristic access commands.

Write-CMD performs an unacknowledged write from a GATT client to the GATT server. This is allowed for the Transparent UART Write procedure on the RN4870 when the SR,0100 command is used.

A GATT client sends Read-REQ to read a characteristic value on the Peripheral's GATT server. The read requests can be performed using RN4870 CHR and CUR commands.

Notifications and Indications are unsolicited updates sent from the GATT server to the GATT client. The GATT client must enable the Notification and Indication on a characteristic to receive the updates. On the RN4870 module, this is done by using the CUW or CHW command to write a non-zero value to the Notification Characteristic. When the RN4870 in Client mode receives a notification, the %WC,hhhh,ddddddd% message is returned on UART in Command mode.

Back to Top