What’s Bluetooth Low Energy (BLE) protocol stack?

- Feb 14, 2020-

The Bluetooth protocol is a type of communication protocol. The BLE protocol stack is the code that implements the Bluetooth low energy protocol. The premise of the BLE protocol stack.

The current Bluetooth protocol is divided into two types of technology: basic rate / enhanced data rate (BR / EDR) and low energy consumption (LE). This article will focus on BLE (Bluetooth Low Energy).

 

1. BLE Bluetooth low energy protocol stack framework

 

To implement a BLE application, you first need a chip that supports BLE radio frequency, then you also need to provide a BLE protocol stack supporting this chip, and finally develop your own application on the protocol stack. It can be seen that the BLE protocol stack is a bridge connecting the chip and the application, and it is the key to realize the entire BLE application. What features does the BLE protocol stack contain? In simple terms, the BLE protocol stack is mainly used to encapsulate your application data layer by layer to generate an air data packet that meets the BLE protocol, that is, to wrap the application data in a series of header and tail.

The Bluetooth protocol specifies two levels of protocols, the Bluetooth Core protocol and the Bluetooth Application layer protocol. The Bluetooth core protocol focuses on the description and specifications of the Bluetooth core technology. It only provides basic mechanisms and does not care how to use these mechanisms. The Bluetooth application layer protocol is based on the Bluetooth core protocol. Define a variety of policies, such as FTP, file transfer, LAN, and so on.

image 

 

The Bluetooth Core protocol includes the BLE Controller and the BLE Host. These two parts have slightly different roles in different Bluetooth technologies (BR / EDR, AMP, LE), but the general functions are the same. The Controller is responsible for defining the hardware-specific specifications such as RF and Baseband, and abstracts logical links for communication (Logical Link); Host is responsible for more friendly encapsulation on the basis of logical links. The details of Bluetooth technology can be shielded to make Bluetooth Application more convenient to use.

 

2. Detailed description of the BLE low-power Bluetooth core protocol layer

 

1.Physical Layer (PHY): The PHY layer is used to specify the wireless frequency band, modulation and demodulation methods and methods used by BLE. It is a 1Mbps adaptive frequency hopping GFSK radio frequency, and works in the license-free 2.4GHz ISM (Industrial, Scientific and Medical) frequency band. Whether the PHY layer is done well or not directly determines the RF indicators such as power consumption, sensitivity, and selectivity of the entire BLE chip.

 

2. Link Layer (abbreviated LL): The LL layer is the core of the entire BLE protocol stack and also the difficulty and focus of the BLE protocol stack. The LL layer has a lot of things to do, such as how much radio frequency channels are selected for communication, how to identify data packets in the air, when to send data packets, how to ensure data integrity, how to receive ACKs, and how Retransmission, and how to manage and control the link, etc. The LL layer is only responsible for sending or retrieving the data, and how to analyze the data is handed over to the GAP or ATT above.

3. Host Controller Interface (HCI): HCI is optional. HCI is mainly used when two chips implement the BLE protocol stack to regulate the communication protocol and communication commands between the two.

4. Generic access profile (GAP): GAP is one of the two ways to analyze the LL layer payload (effective data packet), and it is the simplest one. GAP simply makes some specifications and definitions for the LL payload, so the functions that GAP can implement are extremely limited. GAP is currently used to broadcast, scan and initiate connections.

5 Logical Link Control and Adaptation Protocol (L2CAP): L2CAP encapsulates LL once. LL only cares about the data itself. L2CAP must distinguish between encrypted and ordinary channels. Also manage the connection interval.

6. Security Manager (SM): SMP is used to manage the encryption and security of the BLE connection. How to ensure the security of the connection without affecting the user experience, these are the tasks that SMP should consider.

7. Attribute protocol (abbreviated ATT): In short, the ATT layer is used to define user commands and command operation data, such as reading certain data or writing certain data. In the BLE protocol stack, the developer has the most contact with ATT. BLE introduces the concept of attribute, which is used to describe data one by one. Attribute not only defines data, but also defines the ATT commands that can be used for this data. Therefore, this layer is called the ATT layer.

8. Generic Attribute profile (GATT for short): GATT is used to standardize the data content in attributes, and uses the concept of group to group and manage attributes. Without GATT, the BLE protocol stack can run, but interconnection and interoperability problems will occur. It is precisely because of GATT and various application profiles that BLE gets rid of the compatibility dilemma of wireless protocols such as ZigBee and becomes a shipment. The largest number of 2.4G wireless communication products.