FSC-BT936B AT命令集
介绍
描述
本设计指南适用于工程师开发 FSC-BT936B 蓝牙模组, 介绍了该蓝牙模组的AT指令集以及功能,本文档同样适用FSC-BT1116, FSC-BT906等模块
指令说明
规范说明
适用于整个文档
{} : 包括与{…}中的内容为可选项
<< : 主机发给模组的 COMMAND
>> : 模组回复主机的 RESPONSE/EVENT
指令格式
所有的指令使用 AT 开头,使用 <CR><LF> 结尾
<CR> 代表回车符,对应 HEX 为 0x0D
<LF> 代表换行符,对应 HEX 为 0x0A
若指令包含参数,参数应使用 = 分隔
若指令包含多项参数,参数应使用 , 分隔
若指令有响应返回,响应使用 <CR><LF> 开始,使用 <CR><LF> 结束
模组应当总是返回指令执行的结果 (成功返回 OK,失败时返回 ERR<code>)
Error Code |
Meaning |
|---|---|
001 |
Failed |
002 |
Invalid parameter |
003 |
Invalid state |
004 |
Command mismatch |
005 |
Busy |
006 |
Command not supported |
007 |
Profile not turned on |
008 |
No memory |
Others |
Reserved for future use |
Event格式
所有的事件使用<CR><LF>开始, 使用<CR><LF>结束
若事件包含参数, 参数应位于 “=” 后面
若事件包含多项参数, 参数应使用 “,” 分割
使用命令AT+SEP替换默认分隔符以防止冲突
部分事件使用 “-” 替换 “+”
指令表
通用指令
AT+HELP - 查询固件功能和命令说明
Command |
AT+HELP |
Response |
<FIRMWARE FUNCTION: appropriate working scenario >
<OTA PATH: latest suitable firmware path on server for upgrade On-The-Air>
<ENABLED PROFILES: LINKS: ON/OFF>
…
…
<COMMAND SUMMARY: DESCRIPTION: PROFILE CATEGORY>
|
Description |
使用help命令获取基本摘要信息 |
Note
如需升级最新版本请参考 空中升级说明
AT+SEP - 读/写Event分隔符
Command |
AT+SEP{=Param} |
|
设置范围0x01~0xFF,默认: ‘,’ , 其中‘0’表示0xFF |
Response |
返回当前分隔符 |
Description |
events/responses的参数可能包含与默认分隔符相同的值,
使用此命令替换默认分隔符以防止冲突。
(通常将默认分隔符“,”替换为十六进制值“xFF”)
|
AT+VER - 读取固件版本
Command |
AT+VER |
Response |
+VER=Param1,Param2,Param3 |
|
模块类型 |
|
固件版本 |
|
生产日期 |
Note |
升级固件后,生产日期不会变化 |
AT+BAUD - 读/写串口波特率
Command |
AT+BAUD{=Param} |
|
9600/19200/38400/57600/115200(default)/128000/
230400/256000/460800/512000/921600
|
Response |
+BAUD=Param1,Param2,Param3 |
|
返回当前所有支持的波特率 |
Description |
模块将在接收到这条指令后,马上切换波特率 |
AT+I2SCFG - 设置I2S格式
Command |
AT+I2SCFG{=Param} |
|
以10进制位字段表示,每位表示 |
|
0:disable; 1:enable |
|
0:master; 1:slave |
|
0:FS=48000Hz;1:FS=44100Hz |
|
00: I2S standard format
10: PCM short frame format
|
|
00: bit depth=16bits
10: bit depth=32bits (only 16bits of MSB effective)
11: bit depth=32bits (only used for PCM mode)
|
Response |
+I2SCFG=Param |
Note |
重启生效 |
Example:常用组合配置如下:
0 |
模拟模式 |
1 |
I2S Master; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz |
3 |
I2S Slave; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz |
65 |
I2S Master; Sample rate=48000Hz; Resolution=32bits; Bit clock= 48000*32*2ch=3.072Mhz |
67 |
I2S Slave; Sample rate=48000Hz; Resolution=32bits; Bit clock= 48000*32*2ch=3.072Mhz |
113 |
PCM Master; Sample rate=48000Hz; Resolution=16bits; Bit clock= 48000*16*2ch=1.536Mhz |
AT+MICGAIN - 设置麦克风音量
Command |
AT+MICGAIN{=Param1,Param2} |
|
A2DP的MIC增益 (0~15, default:8) |
|
HFP的MIC增益 (0~15, default:8) |
Description |
调整MIC增益 |
AT+SPKVOL - 设置扬声器音量
Command |
AT+SPKVOL{=Param1,Param2} |
|
A2DP的音量 (0~15, default:8) |
|
HFP的音量 (0~15, default:8) |
Description |
调整输出音量 |
AT+REBOOT - 软件复位
Command |
AT+REBOOT |
Response |
OK |
Description |
模块将复位 |
AT+RESTORE - 恢复出厂设置
Command |
AT+RESTORE |
Response |
OK |
Description |
模块将恢复为出厂设置 |
AT+BTEN - 开关蓝牙
Command |
AT+BTEN{=Param} |
|
0-关闭蓝牙 1-打开蓝牙 |
AT+PROFILE - 蓝牙Profile配置
Command |
AT+PROFILE{=Param} |
|
以10进制位字段表示,每位表示 |
|
SPP (Serial Port Profile) |
|
GATT Server (Generic Attribute Profile) |
|
GATT Client (Generic Attribute Profile) |
|
HFP-HF (Hands-Free Profile Handsfree) |
|
HFP-AG (Hands-Free Profile Audio Gateway) |
|
A2DP Sink (Advanced Audio Distribution Profile) |
|
A2DP Source (Advanced Audio Distribution Profile) |
|
AVRCP Controller (Audio/Video remote controller Profile) |
|
AVRCP Target (Audio/Video remote controller Profile) |
|
HID Keyboard (Human Interface Profile) |
|
PBAP Server (Phonebook Access Profile) |
Response |
+PROFILE=Param |
Description |
无法同时启用GATT Server and Client, HFP Sink and Source,
A2DP Sink and Source,AVRCP Controller and Target
|
AT+STAT - 查询当前连接状态
Command |
AT+STAT |
Response |
+HFPSTAT=1
-HFPSTAT=1
+A2DPSTAT=1
-A2DPSTAT=1
+PEERSTAT=000000000000,0,0
-PEERSTAT=000000000000,0,0
|
Response |
+HFPSTAT=3
+HFPDEV=789987D0E5C5,Redmi Buds 6 青春版
-HFPSTAT=1
+A2DPSTAT=3
+A2DPDEV=789987D0E5C5,Redmi Buds 6 青春版
-A2DPSTAT=1
+PEERSTAT=789987D0E5C5,3,3
-PEERSTAT=000000000000,0,0
|
Description |
查询主副头盔A2DP/HFP连接状态信息,+代表主头盔,-代表副头盔 |
AT+DEVSTAT - 读设备状态
Command |
AT+DEVSTAT |
Response |
+DEVSTAT=Param |
|
以10进制位字段表示, |
|
0: Power Off; 1: Power On |
|
0: BR/EDR Not Discoverable; 1: BR/EDR Discoverable |
|
0: BLE Not Advertising; 1: BLE Advertising |
|
0: BR/EDR Not Scanning; 1: BR/EDR Scanning |
|
0: BLE Not Scanning; 1: BLE Scanning |
Example:常用组合和描述
0 |
Device power off |
1 |
Device power on |
3 |
Device power on, BR/EDR Discoverable |
5 |
Device power on, BR/EDR Not Discoverable, BLE Advertising |
7 |
Device power on, BR/EDR Discoverable, BLE Advertising |
13 |
Device power on, BR/EDR Not Discoverable, BLE Advertising, Scanning nearby BR/EDR devices |
AT+ADDR - 读BR/EDR蓝牙MAC地址
Command |
AT+ADDR |
Response |
+ADDR=Param |
|
模块的BR/EDR蓝牙MAC地址(12 Bytes ASCII) |
AT+LEADDR - 读BLE蓝牙MAC地址
Command |
AT+LEADDR |
Response |
+LEADDR=Param |
|
模块的BLE蓝牙MAC地址(12 Bytes ASCII) |
AT+NAME - 读/写BR/EDR蓝牙名称
Command |
AT+NAME{=Param1{,Param2}} |
|
BR/EDR蓝牙名称(1~31 Bytes ASCII) |
|
使能MAC地址后缀(0/1,default:1)
0: 关闭后缀
1: 开启后缀“-XXXX”(MAC地址后4Byte)
|
Response |
+NAME=Param |
|
蓝牙名称 |
Description |
如果存在参数则设置蓝牙名称,否则只是读取 |
AT+LENAME - 读/写BLE蓝牙名称
Command |
AT+LENAME{=Param1{,Param2}} |
|
BLE蓝牙名称(1~25 Bytes ASCII) |
|
使能MAC地址后缀(0/1,default:1)
0: 关闭后缀
1: 开启后缀“-XXXX”(MAC地址后4Byte)
|
Response |
+LENAME=Param |
AT+SSP - 读/写BR/EDR配对模式
Command |
AT+SSP{=Param} |
|
Pairing mode (0~3, default:2)
(0) Legacy pairing, use pin code for pairing
(1) Secure simple pairing, auto pairing
(2) Secure simple pairing, display yes/no in pairing
(3) Secure simple pairing, passkey compare,
user need to accept/reject pair request with command AT+CFM
|
Response |
+SSP=Param |
Note |
重启生效 |
AT+PIN - 读/写配对密码
Command |
AT+PIN{=Param} |
|
配对密码(4~15 Bytes ASCII, default:0000) |
Response |
+PIN=Param |
Description |
当+SSP=0时,配对密码有效 |
AT+CFM - 接受/拒绝远端的配对请求
Command |
AT+CFM=Param1, Param2 |
|
远端设备的MAC地址(12Bytes) |
|
0-拒绝远端的配对请求
1-接受远端的配对请求
|
Description |
当+SSP=3时,CFM命令有效 |
AT+COD: 读/写设备类型
Command |
AT+COD=Param |
|
设备类型(6 bytes ASCII, default:5A020C) |
Response |
+COD=Param |
相关配置参考 COD.
AT+PAIR: 读/写BR/EDR/BLE可发现模式
Command |
AT+PAIR=Param |
|
Mode(0-3)
0: Leave BR/EDR/BLE discoverable mode (stop advertising/broadcasting)
1: Enter BR/EDR discoverable mode (start broadcasting)
2: Enter BLE discoverable mode (start advertising)
3: Enter BR/EDR/BLE discoverable mode (start advertising/broadcasting)
|
Description |
如果未连接设备(BR/EDR或BLE),模块将始终可被发现;
如果与远程设备连接,模块将不可被发现,除非收到此命令
|
AT+PAGE: 读/写BR/EDR可连接模式
Command |
AT+PAGE=Param |
|
Mode(0-1)
0: Leave BR/EDR connectable mode (stop paging)
1: Enter BR/EDR connectable mode (start paging)
|
Description |
如果未连接设备,模块将始终处于可连接模式,
如果与远程设备连接,模块将不可连接,除非收到此命令
|
AT+SCAN - 搜索附近的设备
Command |
AT+SCAN=Param1{,Param2{,Param3}} |
|
扫描方式(0~2)
0: 停止扫描
1: 扫描附近BR/EDR设备
2: 扫描附近BLE设备(部分程序不支持)
3: 扫描附近BR/EDR/BLE设备(部分程序不支持)
|
|
(1~48)扫描时间. unit:1.28s, default:12.8s |
|
(1~25 Bytes ASCII)过滤名称. |
Description |
格式说明参考: +SCAN - 扫描结果 |
AT+PLIST - 读取/清除配对记录
Command |
AT+PLIST{=Param} |
|
(0/1~8/12 Bytes MAC address)
(0) 清除所有配对记录
(1~8) 清除指定索引的配对记录
(MAC) 清除指定地址的配对记录
|
Response1 |
+PLIST=Param1, Param2, Param3{,Param4} |
|
(1~8) 配对设备序号 |
|
以10进制位字段,设备连接的profile,参考AT+PROFILE |
|
(MAC)配对设备的MAC地址 |
|
(UTF8)配对设备的蓝牙名称 |
Response2 |
+PLIST=E 配对记录查询完成 |
AT+DSCA - 断开所有连接
Command |
AT+DSCA{=Param} |
|
断开指定地址的设备(12 Bytes ASCII),参数缺省则断开所有已连接的蓝牙 |
Description |
模块断开与远程设备的所有蓝牙连接 |
AT+AUDROUTE - 音频路由管理
Command |
AT+AUDROUTE{=Param} |
|
Note: HF1 & HF2 means peer Bluetooth headphones
0 Stop audio routing
1 Route music (a2dp streaming) from Module to HP1/HP2 simultaneously
2 Route voice call (hfp sco) between Module and HP1
3 Route voice call (hfp sco) between Module and HP2
4 Route voice call (hfp sco) between HP1 and HP2 (intercom mode)
5 Route voice call (hfp sco) from Module to HP1/HP2 simultaneously
6 Route music (a2dp streaming) from Module to HP1 only
7 Route music (a2dp streaming) from Module to HP2 only
|
Description |
HP1/HP2分别代表主副耳机
|
AT+FOCUS - 选择连接的音频设备
Command |
AT+FOCUS{=Param1{,Param2}} |
|
(12 Bytes ASCII)目标设备MAC地址/耳机1 |
|
(12 Bytes ASCII)目标设备MAC地址/耳机2 |
Description |
BT936B/BT1116支持链接两个耳机,BT930M只支持链接一个耳机;
设置地址后,模组会自动定时链接该地址,除非FOCUS地址被清除
|
HFP指令
AT+HFPSTAT - 读HFP状态
Command |
AT+HFPSTAT |
Response |
+HFPSTAT=Param1{,Param2{,Param3}}
-HFPSTAT=Param1{,Param2{,Param3}}
|
Description |
格式说明参考: +HFPSTAT - HFP状态 |
AT+HFPSR - 读/写HFP采样率
Command |
AT+HFPSR{=Param} |
|
HFP通话时的采样率, 可配置: 0/8000/16000/48000 默认0 |
Response |
+HFPSR=Param |
Description |
该参数将覆盖AT+I2SCFG中的语音通话设置,并以该参数设置HFP I2S的采样率 |
A2DP/AVRCP指令
AT+A2DPSTAT - 读A2DP状态
Command |
AT+A2DPSTAT |
Response |
+A2DPSTAT=Param
-A2DPSTAT=Param
|
Description |
格式说明参考: +A2DPSTAT - A2DP状态 |
AT+A2DPSR - 写A2DP采样率
Command |
AT+A2DPSR{=Param} |
|
A2DP采样率, 可配置: 44100/48000 (默认48000) |
Response |
+A2DPSR=Param |
Description |
若手机音频是44.1k, 需设置模组AT+A2DPSR=44100
若手机音频是48k, 需设置模组AT+A2DPSR=48000
|
AT+AVRCPSTAT - 读AVRCP状态
Command |
AT+AVRCPSTAT |
Response |
+AVRCPSTAT=Param |
Description |
格式说明参考: +AVRCPSTAT - AVRCP状态 |
SPP指令
AT+SPPSTAT - 读SPP状态
Command |
AT+SPPSTAT |
Response |
+SPPATAT=Param |
Description |
格式说明参考: +SPPSTAT - SPP状态 |
AT+SPPCONN - 建立SPP连接
Command |
AT+SPPCONN{=Param} |
|
目标设备MAC地址(12 Bytes ASCII) |
AT+SPPDISC - 断开SPP连接
Command |
AT+SPPDISC |
Description |
断开当前与远程设备的SPP连接 |
AT+SPPSEND - 通过SPP发数据
Command |
AT+SPPSEND=Param1,Param2 |
|
Payload length (1~492) |
|
Payload (1~492 Bytes UTF8) |
Description |
如果透传模式开启,该指令将会被禁用 |
GATT指令
AT+GATTSTAT - 读GATT状态
Command |
AT+GATTSTAT |
Response |
+GATTATAT=Param |
Description |
格式说明参考: +GATTSTAT - GATT状态 |
AT+GATTDISC - 断开GATT连接
Command |
AT+GATTDISC |
Description |
断开当前与远程设备的GATT连接 |
AT+GATTSEND - 通过GATT发数据
Command |
AT+GATTSEND=Param1,Param2 |
|
Payload length (1~492) |
|
Payload (1~492 Bytes UTF8) |
Description |
如果透传模式开启,该指令将会被禁用 |
Events表
通用指示
+PWRSTAT - 上电状态
Format |
+PWRSTAT=Param |
|
0-Powering off 1-Powering on(booting) |
Description |
在上下电状态下,不建议使用AT命令 |
+SCAN - 扫描结果
Format1 |
+SCAN =Param1,Param2,Param3, Param4,Param5,Param6 |
|
索引 |
|
RSSI (-127 ~ -1) |
|
设备地址类型 (0~3)
(0) BR/EDR address
(1) LE public address
(2) LE random address
(3) iOS device with Carplay support
|
|
MAC地址 (12 Bytes ASCII) |
|
BR/EDR设备名称或者LE设备广播数据 |
|
设备类型(6 Bytes ASCII) |
Format2 |
+SCAN=E: 停止扫描 |
+PAIRREQ - 配对请求
Format |
+PAIRREQ=Param1,Param2{,Param3} |
|
Passkey (000000~999999) |
|
当前配对设备的MAC地址(12 Bytes ASCII) |
|
当前配对设备的名称 |
+PAIRED - 配对结果
Format |
+PAIRED=Param1,Param2 |
|
配对结果 (0)-成功 (1~255)-失败原因 |
|
当前配对设备的MAC地址(12 Bytes ASCII) |
HFP指示
+HFPSTAT - HFP状态
Format |
+HFPSTAT=Param1{,Param2{,Param3}} |
|
(0~10)
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
(4) Outgoing call
(5) Incoming call
(6) Active call
|
|
电话号码, 当状态>3 |
|
电话名称, 如当前号码无名称,将显示号码 |
Note |
BT936B、BT906系列模块参数2,不存在 |
+HFPDEV - HFP远端设备信息
Format |
+HFPDEV=Param1{,Param2} |
|
(12 Bytes ASCII), 当前HFP连接远端设备的MAC地址 |
|
(UTF8), 当前HFP连接远端设备的名称 |
+HFPAUDIO - HFP语音音频状态
Format |
+HFPAUDIO=Param |
|
(0) HFP语音音频断开连接,音频输入/输出切换到远端设备
(1) HFP语音建立连接,音频输入/输出切换到模块
|
+HFPBATT - HFP远端设备电池电量
Format |
+HFPBATT=Param |
|
(0~9) 远程设备的电池电量 |
+HFPVR - HFP远端设备语音唤醒
Format |
+HFPVR=Param |
|
0-停止唤醒语音 1-唤醒语音 |
Description |
此事件用来指示唤醒远端语音设备,如siri |
A2DP/AVRCP指示
+A2DPSTAT - A2DP状态
Format |
+A2DPSTAT=Param |
|
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
(4) Paused
(5) Streaming
|
+A2DPDEV - A2DP远端设备信息
Format |
+A2DPDEV=Param1{,Param2} |
|
(12 Bytes ASCII), 当前A2DP连接远端设备的MAC地址 |
|
(UTF8), 当前A2DP连接远端设备的名称 |
+AVRCPSTAT - AVRCP状态
Format |
+AVRCPSTAT=Param |
|
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
|
+CTPAUSE - 暂停
Description |
远端设备发送暂停命令 |
+CTPLAY - 播放
Description |
远端设备发送播放命令 |
+CTSTOP - 停止
Description |
远端设备发送停止命令 |
+CTBACK - 上一曲
Description |
远端设备发送上一曲命令 |
+CTFWD - 下一曲
Description |
远端设备发送下一曲命令 |
+PEERSTAT - PEER状态
Format |
+PEERSTAT=Param1,Param2,Param3 |
|
(12 Bytes ASCII), 当前连接设备的MAC地址 |
|
当前连接耳机、音箱等设备 A2DPSTAT状态 |
|
当前连接耳机、音箱等设备 HFPSTAT状态 |
-PEERSTAT - PEER状态(第二路连接)
Format |
-PEERSTAT=Param1,Param2,Param3 |
|
(12 Bytes ASCII), 当前连接设备的MAC地址 |
|
当前连接耳机、音箱等设备 A2DPSTAT状态 |
|
当前连接耳机、音箱等设备 HFPSTAT状态 |
Note |
第二路链接仅BT1116、BT936、BT906系列模块支持 |
+PEERDEV - PEER远端设备的信息
Format |
+PEERDEV=Param1,Param2,Param3 |
|
(12 Bytes ASCII), 当前连接远端设备的MAC地址 |
|
(UTF8), 当前连接远端设备的名称 |
|
当前连接设备的Profile, 参考AT+PROFILE指令 |
SPP指示
+SPPSTAT - SPP状态
Format |
+SPPSTAT=Param |
|
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
|
+SPPDATA - SPP接收数据
Format |
+SPPDATA=Param1,Param2 |
|
Payload length |
|
Payload |
GATT指示
+GATTSTAT - GATT状态
Format |
+GATTSTAT=Param |
|
(0) Unsupported
(1) Standby
(2) Connecting
(3) Connected
|
+GATTDATA - GATT接收数据
Format |
+SPPDATA=Param1,Param2 |
|
Payload length |
|
Payload |