当前文档版本为 v1.1.0,您可以访问当前页面的 开发中 版本以获取最近可能的更新。

BLE Controller

1 概述

panchip ZDK和NDK支持两版BLE Controller,分别是Origin BLE Controller和Spark BLE Controller。用户可以根据项目特点和这两个BLE Controller的特性来选择使用的BLE Controller。Spark BLE Controller 是磐启全新支持的BLE controller,未来主推的方向, 当然SDK也提供了方便的方式让用户能快速在这两个BLE Controller之间切换。

Origin BLE Controller和Spark BLE Controller如何配置选择将在接下来的章节讲解。

2 Origin BLE Controller

Origin BLE Controller 也就是SDK0.0.0 到 SDK1.0.0 中一直使用的 Controller,作为从机已有了丰富的量产产品,例如:鼠标,键盘,扫码枪等等。

2.1 Origin BLE Controller 支持Features

(1) 支持BLE Core 5.2

(2) 支持LL Encryption

(3) 支持Data Length Exchange

(4) 支持LL Ping

(5) 支持2M PHY/Coded PHY

(6) 支持CSA#2

(7) 支持多达8 connection (这与MCU资源相关)

(8) 支持connection 数任意配置

(9) Extended adv

(10) Extended scan

(11) periodic adv

(12 ) periodic sync

(13) CTE (AOA, AOD)

(11) LL Privacy

3 Spark BLE Controller

Spark BLE Controller 是panchip最新支持的BLE Controller,它和磐启芯片深度贴合,并深度挖掘芯片自身功能和性能。

3.1 相比Origin BLE Controller,Spark BLE Controller 具有如下优点:

  • 更低的功耗

  • 更好的多连接调度器和时间利用率以及数据吞吐率

  • 更好的蓝牙多连接稳定性

  • 支持连接更多的蓝牙设备(多达20个connection,这与MCU资源相关)

  • 更少的资源消耗 (flash 资源)

3.2 Spark BLE Controller支持Featrues:

(1) 支持BLE Core 5.0

(2) 支持LL Encryption

(3) 支持Data Length Exchange

(4) 支持LL Ping

(5) 支持2M PHY/Coded PHY

(6) 支持CSA#2

(7) 支持多达20 connection (这与MCU资源相关)

(8) 支持connection 数任意配置

(9) Extended adv (正在适配中)

(10) Extended scan (正在适配中)

(11) LL Privacy(正在适配中)

3.3 Spark BLE Controller的配置

3.3.1 磐启ZDK中使用Spark BLE Controller

目前,在磐启ZDK中有如下工程默认使用了Spark BLE Controller:

  • samples_panchip/bluetooth/peripheral_hr

  • samples_panchip/bluetooth/multi_roles

  • bluetooth/solutions/electric_meter

  1. 使能Spark BLE Controller

    如果用户需要使用Spark BLE Controller,需要将宏CONFIG_BT_SPARK_BLE_CONTROLLER_EN设置为y,并rebuild工程。

  2. 配置Master和Slave Connection个数

  • 宏CONFIG_BT_CTLR_MAX_MST_CONN用于配置BLE Controller支持的最大Master Connection的个数,默认为1。

  • 宏CONFIG_BT_CTLR_MAX_SLAVE_CONN用于配置BLE Controller支持的最大Slave Connection的个数,默认为1。

    小技巧

    需要注意的是,上述宏配置影响资源消耗。配置值越大消耗资源越多。因此用户需要根据实际项目需求选择合适的connection个数

  1. 配置More Data个数

    宏CONFIG_BT_CTLR_MORE_DATA_NUM可以配置单个connection event中最多可以连续传输数据的次数,默认值为4。

    小技巧

    注:pan108x芯片最多支持单个connection event中传输6次数据。对于多连接来说,需要慎重选择该值。

  2. 配置加密时间

    宏CONFIG_BT_CTLR_LL_ENC_TIME用于配置LL加密的时间。这个值与DLE和more data有关系。这个值至少是50us,当DLE=251B且more data = 6时,这个值至少是250us。

    小技巧

    注:这个值不能设置的过大,过大的值将带来功耗的增加

  3. 设置本地sleep clock 精度

    宏CONFIG_BT_SPARK_BLE_CONTROLLER_LOCAL_SCA用于设置local device sleep clock 精度。

3.3.2 磐启NDK中使用Spark BLE Controller

参考之前sample文档的描述。