蓝牙概述
蓝牙基础架构
蓝牙分为 BT Host、HCI (Host Controller Interface) 和 BT Controller 三部分:
模块 |
描述 |
|
|---|---|---|
BT Host |
Application |
包含蓝牙 APIs,以及由此实现的 Peripheral、Central、Scatternet、Mesh、A2DP、LE Audio 等应用 |
Framework |
包含以下 lib:
各 lib 的作用:
|
|
Host stack |
lib 路径:\component\bluetooth\rtk_stack\platform\amebaxxx\lib\(km4\kr4\ca32)\(ble_only\dual_mode)\btgap.a 实现了蓝牙上层协议栈的功能,包括 GAP、GATT、L2CAP、ATT 和 SMP 等 |
|
HCI |
Controller 与 Host 唯一的通信接口,两者之间的所有数据交互都通过该接口完成 |
|
BT Controller |
lib 路径:\component\bluetooth\driver\platform\amebaxxx\hci\bt_normal_patch.c 以二进制数组形式提供,实现了蓝牙下层协议栈的功能,包括 Link Layer 和 PHY |
|
蓝牙的基础架构如下图所示:
蓝牙功能支持列表
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | / |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BLE 4.1 | Low Duty Cycle Directed Advertising | |
| MWS Coexistence | / | |
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | / |
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | / |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BLE 4.1 | Low Duty Cycle Directed Advertising | |
| MWS Coexistence | ||
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | / | |
| BLE 5.1 | Periodic Advertising Sync Transfer (PAST) | / |
| LE Connection Oriented AoA/AoD | / | |
| LE Connectless AoA/AoD | / | |
| BLE 5.2 | LE Connected Isochronous Stream (CIS) | / |
| LE Broadcast Isochronous Streams (BIS) | / | |
| LE Power Control |
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | / |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BLE 4.1 | Low Duty Cycle Directed Advertising | |
| MWS Coexistence | ||
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | / | |
| BLE 5.1 | Periodic Advertising Sync Transfer (PAST) | / |
| LE Connection Oriented AoA/AoD | / | |
| LE Connectless AoA/AoD | / | |
| BLE 5.2 | LE Connected Isochronous Stream (CIS) | / |
| LE Broadcast Isochronous Streams (BIS) | / | |
| LE Power Control |
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BR/EDR Max. Link (Theoretical value) | 7 Master + 3 Slave | |
| BLE 4.1 | BR/EDR Secure Connection | |
| Low Duty Cycle Directed Advertising | ||
| MWS Coexistence | ||
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | ||
| BLE 5.1 | Periodic Advertising Sync Transfer (PAST) | |
| LE Connection Oriented AoA/AoD | ||
| LE Connectless AoA/AoD | ||
| BLE 5.2 | LE Connected Isochronous Stream (CIS) | / |
| LE Broadcast Isochronous Streams (BIS) | / | |
| LE Power Control |
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BR/EDR Max. Link (Theoretical value) | 7 Master + 3 Slave | |
| BLE 4.1 | BR/EDR Secure Connection | |
| Low Duty Cycle Directed Advertising | ||
| MWS Coexistence | ||
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | ||
| BLE 5.1 | Periodic Advertising Sync Transfer (PAST) | |
| LE Connection Oriented AoA/AoD | ||
| LE Connectless AoA/AoD | ||
| BLE 5.2 | LE Connected Isochronous Stream (CIS) | / |
| LE Broadcast Isochronous Streams (BIS) | / | |
| LE Power Control |
| Item | Feature | Supported |
|---|---|---|
| Physical | BR/EDR | |
| BLE | ||
| BLE 4.0 | Advertiser | |
| Scanner | ||
| Initiator | ||
| Master | ||
| Slave | ||
| Link Layer Encryption | ||
| BLE Max. Link (Theoretical value) | 8 Master + 3 Slave | |
| BR/EDR Max. Link (Theoretical value) | 7 Master + 3 Slave | |
| BLE 4.1 | BR/EDR Secure Connection | |
| Low Duty Cycle Directed Advertising | ||
| MWS Coexistence | ||
| LE Ping | ||
| LE Link Layer Topology | ||
| LE Scatternet | ||
| BLE 4.2 | LE Data Length Extension | |
| LE Secure Connection | ||
| Link Layer Privacy | ||
| Link Layer Extended Scanner Filter Policies | ||
| BLE 5.0 | LE 2Mbps PHY | |
| LE Long Range | ||
| LE Advertising Extensions | ||
| LE Channel Selection Algorithm #2 | ||
| High Duty Cycle Non-Connectable Advertising | ||
| LE Periodic Advertising | ||
| BLE 5.1 | Periodic Advertising Sync Transfer (PAST) | |
| LE Connection Oriented AoA/AoD | ||
| LE Connectless AoA/AoD | ||
| BLE 5.2 | LE Connected Isochronous Stream (CIS) | |
| LE Broadcast Isochronous Streams (BIS) | ||
| LE Power Control |
蓝牙功能配置
功能 |
配置文件 |
配置项 |
|---|---|---|
Link Layer Privacy |
以 Peripheral 为例: \component\bluetooth\example\ble_peripheral\peripheral.c |
修改 privacy_enable 为 true |
LE Advertising Extensions |
\component\bluetooth\api\include\bt_api_config.h |
修改 RTK_BLE_5_0_AE_ADV_SUPPORT 和 RTK_BLE_5_0_AE_SCAN_SUPPORT 为 1 |
LE Periodic Advertising |
\component\bluetooth\api\include\bt_api_config.h |
修改相应 SoC 的 RTK_BLE_5_0_AE_ADV_SUPPORT,RTK_BLE_5_0_AE_SCAN_SUPPORT,RTK_BLE_5_0_PA_ADV_SUPPORT 和 RTK_BLE_5_0_PA_SYNC_SUPPORT 为 1 |
Periodic Advertising Sync Transfer (PAST) |
\component\bluetooth\api\include\bt_api_config.h |
修改相应 SoC 的 RTK_BLE_5_0_AE_ADV_SUPPORT,RTK_BLE_5_0_AE_SCAN_SUPPORT,RTK_BLE_5_0_PA_ADV_SUPPORT,RTK_BLE_5_0_PA_SYNC_SUPPORT, RTK_BLE_5_1_PAST_SENDER_SUPPORT 和 RTK_BLE_5_1_PAST_RECIPIENT_SUPPORT 为 1 |
SMP OOB |
\component\bluetooth\api\include\bt_api_config.h |
默认开启,修改 RTK_BLE_SMP_OOB_SUPPORT 为 0 关闭 |
LE Data Length Extension |
\component\bluetooth\api\include\bt_api_config.h |
默认开启,修改 RTK_BLE_4_2_DATA_LEN_EXT_SUPPORT 为 0 关闭 |
SET PHYS |
\component\bluetooth\api\include\bt_api_config.h |
默认开启,修改 RTK_BLE_5_0_SET_PHYS_SUPPORT 为 0 关闭 |
LE Power Control |
\component\bluetooth\api\include\bt_api_config.h |
修改 RTK_BLE_5_2_POWER_CONTROL_SUPPORT 为 1 |
EATT |
\component\bluetooth\api\include\bt_api_config.h |
修改 RTK_BT_5_2_EATT_SUPPORT 为 1 |