使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程

基于 AT 固件测试 BLE5.0 Long Rang 模式,可以使用如下方式:

1、设置 BLE5.0 Coded PHY 模式

  • 在 BLE Client 端,可以使用 “AT+BLESETPHY” 设置当前连接的 PHY 模式为 Coded PHY 模式。

  • 在 BLE Server 端 , 可以使用 “AT+BLEADVPARAM” 指令设置 Coded PHY 模式

2、增大 BLE RF Power

  • 可以使用 “AT+RFPOWER” 指令来设置 BLE RF Power

    AT+RFPOWER=,15,15,15
    

以下将提供基于 AT 固件使用 2 个 ESP32-C3 设备,测试 BLE5.0 Long RangCoded PHY 扩展广播数据透传的 AT 指令序列

可参考“Bluetooth LE AT 示例”

  • Bluetooth LE 客户端读写服务特征值

  • Bluetooth LE 服务端读写服务特征值

  • Bluetooth LE 连接加密

  • 两个 ESP32-C3 开发板之间建立 SPP 连接,以及在 UART-Bluetooth LE 透传模式下传输数据

  • ESP32-C3 与手机建立 SPP 连接,以及在 UART-Bluetooth LE 透传模式下传输数据

BLE Server 发数据给 BLE Client 的 AT 指令序列

  • BLE Server 端的 AT 指令序列
AT+RESTORE

AT+CWMODE=0

AT+BLEINIT=2            //ESP32-C3 初始化为 BLE Server 模式
AT+SYSMSG=7

AT+RFPOWER=,15,15,15    // 设置 BLE5.0 RF  Power

AT+BLEADVPARAM=40,40,6,0,7,0,,,3,3           // 设置 BLE5.0 扩展广播模式和 Coded PHY 模式

AT+BLEGATTSSRVCRE             

AT+BLEGATTSSRVSTART          

AT+BLEGATTSCHAR?

AT+BLEADDR?              

AT+BLEADVDATA="0201060303F0AB0409636263"               //设置 BLE 广播数据和名称

AT+BLEADVSTART           

AT+BLESPPCFG=1,1,6,1,5      //建立 BLE 连接之后设置此参数

AT+BLESPP        //在 BLE Client 端完成 0100 步骤后执行此指令

+++              //不带换行,退出 BLESPP 透传模式


使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第1张图片

  • BLE Client AT 指令序列
AT+RESTORE

AT+CWMODE=0

AT+BLEINIT=1             //ESP32-C3 初始化为 BLE Client 模式

AT+SYSMSG=7

AT+RFPOWER=,15,15,15           // 设置 BLE TX power

AT+BLESCAN=1,1,2,"cbc"         //以指定 NAME 扫描 BLE 设备

AT+BLECONN=0,"7c:df:a1:a4:a0:a2"        //与指定 MAC 设置建立 BLE 连接

AT+BLESETPHY=0,3                //设置 BLE5.0 Coded PHY 模式

AT+BLEGATTCPRIMSRV=0            //GATTC 发现 BLE 连接号为 0 的基本服务

AT+BLEGATTCCHAR=0,3

AT+BLEGATTCWR=0,3,6,1,2

0100                // hex 十六进制格式输入 0100 ,不带换行

使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第2张图片

测试结果

使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第3张图片


BLE Client 发数据给 BLE Server 的 AT 指令序列

可参考“两个 ESP32-C3 开发板之间建立 SPP 连接,以及在 UART-Bluetooth LE 透传模式下传输数据”

BLE Server AT 指令序列

AT+CWMODE=0

AT+BLEINIT=2                     //ESP32-C3 初始化 BLE server 模式

AT+SYSMSG=7

AT+RFPOWER=,15,15,15             // 设置 BLE RF power

AT+BLEADVPARAM=40,40,6,0,7,0,,,3,3                     //设置 BLE5.0 扩展广播模式和 Coded PHY 模式
  
AT+BLEGATTSSRVCRE           

AT+BLEGATTSSRVSTART          

AT+BLEGATTSCHAR?

AT+BLEADDR?               

AT+BLEADVDATA="0201060303F0AB0409636263"               //设置 BLE 广播数据和名称,需在 BLEADVPARAM 之后设置

AT+BLEADVSTART            

使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第4张图片

BLE Client AT 指令序列

AT+CWMODE=0

AT+BLEINIT=1            //ESP32-C3 初始化 BLE Client 模式

AT+SYSMSG=7

AT+RFPOWER=,15,15,15    // 设置 BLE RF Power

AT+BLESCAN=1,1,2,"cbc"

AT+BLECONN=0,"7c:df:a1:a4:a0:a2"

AT+BLESETPHY=0,3                   //设置 BLE5.0 Coded PHY 模式

AT+BLEGATTCPRIMSRV=0

AT+BLEGATTCCHAR=0,3

AT+BLESPPCFG=1,3,5,3,7

AT+BLESPP     

+++
         

使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第5张图片

测试结果

使用 2 个 ESP32-C3 & ESP-AT 测试 BLE5.0 Long Rang 模式进行数据透传的流程_第6张图片

你可能感兴趣的:(AT,应用,(AT,Application),bash,linux,网络,ESP-AT)