The BLE device itself is divided into Host and Controller, which does not correspond to two devices, but a hierarchical distinction of one device. As shown below (use the network to copy the picture, delete it for infringement):
Controller part (Controller):
1. Physical layer (PHY): RF characteristics, running in 2.4GHz ISM band, 40 channels with 2MHz channel gap, 3 broadcast channels, 37 adaptive automatic frequency modulation channels;
2. Link layer (LL): RF control layer, the control chip works in the following five states:
Standby 准备
Advertising 广播
Scanning 监听
Initiating 发起连接
Connected 已连接
3. Control interface layer (HCI): Communication layer, which provides a standardized interface between Host and Controller, which can be implemented by software api or controlled by hardware interface uart, spi, and usb;
Host part (Host):
1. Logical link control and adaptive protocol layer (L2CAP): equivalent to express, packaging data;
2. Security management layer (SM layer): Security service layer, which provides pairing and distribution of secret keys, and realizes secure connection and data exchange;
3. Attribute Protocol Layer (ATT): Allows a device to display a specific piece of data to another device, called an "attribute", the device displaying the "attribute" is called a server, and the paired device becomes a client; link layer The state (master slave) and the ATT role of the device are independent of each other;
4. Generic Access Profile Layer (GAP):
5. Generic attribute profile layer (GATT): defines the service framework for using ATT, and specifies the structure of the profile;