XM-15B Comandos AT
XM-15B Comandos AT
XM-15B Comandos AT
1,brief introduction
XM-15B Bluetooth module (hereinafter referred to as the module) realized
Bluetooth spp specification, conform to the standard of Bluetooth 2.1 + EDR, has
two working modes: mode of command and data, in the data model module can be
divided into (Master), from the slave and the loop (loopback) three roles. When the
module is in command mode to perform all of the following AT command, the user can
send AT commands to the module, the module for setting parameters or send control
commands. The module is not connected to any equipment (blue lights), in command
mode, you can receive AT at any time
Command in command mode, the module can be set according to the role of being
connected or active connection to other Bluetooth devices. After the module and
other Bluetooth devices to connect (blue light Chang Liang), automatically enters
data mode.
The core module of XM-15B XM-05 and on the floor built-in power management
chip and 5V and 3.3V TTL signal conversion circuit can be also compatible 3/3.3/5V
of several different voltage signal, the module of TXD output pin high level VCC-
0.3v
2, product features
1, compatible with mainstream CSR Bluetooth chip, standard Bluetooth
V2.1+EDR protocol through Bluetooth BQB authentication.
2, quick start, need only 0.3 seconds to complete the entire module
(including Bluetooth protocol stack initialization).
3, built-in hardware watchdog, never crashes.
4, better compatibility, with built-in Windows protocol stack, IVT,
Widcomm (Broadcom), compatible with Android system, compatible with
the market almost all mobile phone android.
5, built-in RC reset circuit, POR, Brown-Out, LVR power supply voltage
monitoring circuit, reset is stable and reliable, without external
reset
Circuit
第 1 页/共 23 页
6, the built-in power supply connection reverse protection circuit.
7, the built-in power management chip, power supply voltage range: 3.0V~6V.
8, built-in TTL signal level conversion circuit, compatible with 3/3.3/5V signal, TXD high level output voltage VCC.
9, the default parameters: 9600 baud rate, pair number 1234 and work mode from the machine.
10, size: 15.5 mm x 37.5mm module x 4.0mm (excluding pin).
11, working current: match: 4 ~ 12mA pairing is not communication: 4 ~ 12Ma communication: 12mA no sleep. 12,
maximum transmit power: +10db (higher than CSR Bluetooth module)
13, communication distance: open under the condition of 30M (up to 60 meters, but do not guarantee the normal use
of the environment around 15M).
14, for the GPS navigation system, electricity and gas meter system, production control system of industrial field,
can be seamlessly connected with Bluetooth mobile phone, notebook computer, computer with Bluetooth adapter,
PDA equipment etc..
3k
序号 引脚 描述
1 CE/CLR CE:
The power switch module, high -, low - pass, built-in pull-
up resistor can be suspended.
CLR:
Clear memory address
This pin customers have special instructions, to the CE pin,
if you need to purchase CLR function.
That must buy before or after customers contact us to modify
their own internal resistance jumper.
2 VCC The power input pin voltage range 3.0~6.0V
3 GND land
4 TXD UART data output, high voltage VCC-0.3
5 RXD UART data input voltage range 0~VCC
The state of the control signal output pin, and the same blue
6 STATE lights.
第 2 页/共 23 页
四、 module production
单位 mm
A B C D E
37.5 15.5 1.4 2.54 4.0
Give power to the module, the module is not connected to any device, as the command mode, the
blue light flashing module connected to other blue
Dental equipment, automatically enters data mode, the blue indicator light
1, in order to ensure the mode, the blue indicator light has been flashing.
2, the use of serial communication tools, such as CommPro provided by the company and set up
the correct serial parameters (the default baud rate 9600, data bits 8 bits, 1 stop bit bit,
no parity bit, no flow control).
AT+ROLE=1\r\n 3, serial port to send characters, successful return "OK \ R \ n" in which we as
a carriage return linefeed (i.e. ASCII 0x0D,
0x0A).
4, the serial port to send characters "AT+CLASS=000000\r\n", "OK\r\n back". (this step is to
connect the equipment according to the category code from optional use)
第 3 页/共 23 页
5、 The power on again, the main module module, automatic search from the module to
establish a connection.
Note: we can also use the parameter setting tool "BTModuleSettings (XM-15B).Exe set.
第 4 页/共 23 页
七、 The AT instruction
All instructions must be in command mode to be
sent, otherwise they would not have any response.
All AT instructions are to enter newline end, is \r\n
(0x0D 0x0A), the returned response also enter
newline end.
The default parameters: serial baud rate 9600, 8 data
bits, 1 stop bit, no parity, no flow control.
1、 测试指令
指令 响应 参数
AT OK 无
2、 模块复位指令(重启)
指令 响应 参数
AT+RESET OK 无
3、 获取软件版本号
指令 响应 参数
AT+VERSION? +VERSION:<ver> ver: 软件版本号
OK
举例说明:
……
5、 获取模块蓝牙地址
指令 响应 参数
AT+ADDR? +ADDR:<bda> bda: 模块蓝牙地址
第 5 页/共 23 页
XM-15B 产品规格书
OK
6、 设置/查询模块设备名称
指令 响应 参数
AT+NAME=<deviceName> OK deviceName: 模块设备名称
AT+NAME? +NAME:<deviceName>
OK
OK
AT+NAME?
+NAME:Hello World
OK AT+NAME=XM-
15B
OK
AT+NAME?
+NAME:XM-15B
OK
7、 获取远程蓝牙设备名称
指令 响应 参数
1. +RNAME:<deviceName> peerBDA: 需要获取名称的蓝牙地
AT+RNAME?<peerBDA> OK 址
2. FAIL deviceName: 获取到的蓝牙名称
(UTF-8 编码)
模块蓝牙设备地址为:00:1B:35:88:00:01,设备名称为:
XiangMa AT+RNAME?001B35880001
+RNAME:XiangMa
OK
8、 设置/查询—模块角色
第 6 页/共 23 页
XM-15B 产品规格书
指令 响应 参数
AT+ROLE=<nRole> OK nRole: 参数取值如下:
0——从角色(Slave)
OK 2——回环角色(Slave-Loop)
默认值:0
模块角色说明:
Slave( 从角色 ) ——被动连接;
Slave-Loop(回环角色)——被动连接,接收远程蓝牙主设备数据并将数据原样返回给远程蓝
牙主设备;
9、 设置/查询—设备类别码
指令 响应 参数
AT+CLASS=<nCod> OK nCod:设备类别码
蓝牙设备类别码实际上是一个 24
位的参数,该参数用于指出设备类
OK 默认值:001f00 (十六进制)
具体设置见附件 1:设备类别码说
明
为了能有效地对周围诸多蓝牙设备实施过滤,快速查询或被查询自定义蓝牙设备,用户可以将模块设
置为非标准蓝牙设备类,如:001f3f(十六进制)。
10、设置/查询—查询访问码
指令 响应 参数
AT+IAC=<iacLap> 1、OK——成功 iacLap:查询访问码
2、FAIL——失败 默认值:9e8b33
AT+IAC? +IAC:<iacLap> 具体设置见附件 2:查询访问码说
OK 明
OK
AT+IAC?
+IAC:9e8b3f
OK
11、设置/查询—查询访问模式
第 7 页/共 23 页
XM-15B 产品规格书
指令 响应 参数
AT+INQM=<inqMode>,<numRsp>, 1、 OK——成功 inqMode:查询模式
<inqLength> 2、 FAIL——失败 0——inquiry_mode_standard
1——inquiry_mode_rssi
+INQM:<Param1>,<Param2>, numRsp:最多蓝牙设备响应数, 0 表示无
AT+ INQM? <Param3> 限制
OK inqLength:最大查询超时
超时范围:1~48
(折合成时间:1.28 秒~61.44 秒)
默认值:1,0,8
举例:
AT+INQM=1,9,48 ——查询模式设置:带 RSSI 信号强度指示,超过 9 个蓝牙设备响应
则终止查询,设定超时为 48xl.28=61.44 秒。
OK
AT+INQM?
+INQM:1, 9, 48
OK
12、设置/查询—配对码
指令 响应 参数
AT+PSWD=<pinCode> OK pinCode:配对码
AT+PSWD? +PSWD:<pinCode> 默认名称:“1234”
OK
13、设置/查询—串口参数
指令 响应 参数
AT+UART=<nBaudRate>, OK nBaudRate:波特率(bits/s)
<nStopBits>,<nParityBits> 取值如下(十进制):
1200
2400
4800
9600
19200
38400
57600
+ 115200
AT+ UART? UART=<nBaudRate>,<nStopBits>, nStopBits:停止位
<nParityBits> 0——1 位
OK 1——2 位
nParityBits:校验位
0——None (无校验)
1——Odd (奇校验)
第 8 页/共 23 页
XM-15B 产品规格书
2——Even (偶校验)
默认设置:9600,0,0
举例:设置串口波特率:115200,2 位停止位,偶校验
AT+UART=115200,1,2
OK
AT+UART?
+UART:115200,1,2
OK
14、设置/查询—连接模式:
指令 响应 参数
AT+CMODE=<nMode> OK nMode:
0——指定蓝牙地址连接模式
(指定蓝牙地址由绑定指令设置)
AT+CMODE? +CMODE:<nMode> 1——任意蓝牙地址连接模式
OK (不受绑定指令设置地址的约束)
默认连接模式:0
15、设置/查询—绑定蓝牙地址
蓝牙地址表示方法:NAP UAP LAP(十六进制)
指令 响应 参数
AT+BIND=<bda> OK bda——绑定的蓝牙地址
AT+BIND? +BIND:<bda> 默认绑定蓝牙地址:
OK 000000000000 (表示没有绑定地
址, 要清除绑定地址,也可以发
送这个地址)
连接后模块上的蓝色 LED 熄
灭 命令及响应如下:
AT+POLAR=1,0
OK
AT+POLAR?
+POLAR=1,0
OK
17、设置/查询查询扫描、呼叫扫描参数
指令 响应 参数
AT+IPSCAN=<Param1>,<Param2>, OK Param1:查询扫描时间间隔
<Param3>,<Param4> Param2:查询扫描持续时间
+IPSCAN: <Param1>,<Param2>, Param3:寻呼扫描时间间隔
AT+IPSCAN? <Param3>,<Param4> Param4:寻呼扫描持续时间
OK 上述参数均为十进制数。
默认值:1024,36,1024,36
举例说明:
AT+IPSCAN=1234,500,1200,250
OK
AT+IPSCAN?
+IPSCAN:1234,500,1200,250
18、设置/查询—SHIFF 节能参数
指令 响应 参数
AT+SNIFF=<max>,<min>, OK max:最大时间
<attempt>,<timeout> min:最小时间
+SNIFF: <max>,<min>, attempt:尝试时间
AT+SNIFF? <attempt>,<timeout> timeout:超时时间
上述参数均为十进制数。
默认值:200,32,1,8
0,0,0,0 表示不主动进入 Sniff
19、设置/查询—安全、加密模式
指令 响应 参数
第 10 页/共 23 页
XM-15B 产品规格书
20、删除指定配对设备
指令 响应 参数
AT+RMSAD=<bda> OK bda:蓝牙设备地址
举例说明:
从配对列表中删除蓝牙地址为:12:34:56:ab:cd:ef 的设
备
AT+RMSAD=123456abcdef
OK ——删除成功
或
AT+RMSAD =123456abcdef
FAIL——配对列表中不存在12:34:56:ab:cd:ef 蓝牙设备
21、删除所有配对设备
指令 响应 参数
AT+RMAAD OK 无
举例说明:
从配对列表中删除所有蓝牙设备
AT+RMAAD
OK
22、查找指定的配对设备
指令 响应 参数
AT+FSAD=<bda> 1、 OK——成功 bda:蓝牙设备地址
2、 FAIL——失败
举例说明:
从配对列表中查找蓝牙设备:12:34:56:ab:cd:ef
at+fsad=123456abcdef
OK ——配对列表中存在 12:34:56:ab:cd:ef 蓝牙设备。
at+fsad=123456abcdef
FAIL ——配对列表中不存在 12:34:56:ab:cd:ef 蓝牙设备。
23、获取已配对设备数
第 11 页/共 23 页
XM-15B 产品规格书
指令 响应 参数
AT+ADCN? +ADCN:<Param> Param:配对列表中蓝牙设备数
OK
举例说明:
at+adcn?
+ADCN:0 ——0 表示没有已经蓝牙设备
OK
24、获取最后使用的配对设备地址
指令 响应 参数
AT+MRAD? +MRAD:<bda> bda:最近使用过的蓝牙设备地址
OK
举例说明:
AT+MRAD?
+MRAD:000000000000 ——000000000000 表示最近没有使用任何已配对设备
OK
25、获取蓝牙模块工作状态
指令 响应 参数
stateDesc:模块工作状态
返回值如下:
“INITIALIZED”——初始化状态
AT+STATE? +STATE:<stateDesc> “READY” ——准备状态
OK “PAIRABLE”——可配对状态
“PAIRED”——配对状态
“INQUIRING”——查询状态
“CONNECTING”——正在连接状态
“CONNECTED”——连接状态
“DISCONNECTED”——断开状态
“UNKNOWN”——未知状态
举例说明:
AT+STATE?
+STATE: PAIRABLE ——可配对状态
OK
27、查询蓝牙设备
第 12 页/共 23 页
XM-15B 产品规格书
指令 响应 参数
AT+INQ +INQ: <bda>,<cod>,<rssi>, bda:蓝牙地址
OK cod:设备类
rssi:RSSI 信号强度
举例说明 1:
at+iac=9e8b33 ——查询任意访问码的蓝牙设备
OK
at+class=000000 ——查询各种类型的蓝牙设备
OK
——查询模式:带 RSSI 信号强度指示,超过 9 个蓝牙设备响应则终止查
at+inqm=1,9,48 询,
设定超时为 48x1.28=61.44 秒。
At+inq ——查询周边蓝牙设备
+INQ:001b35880001,001f00,-20
+INQ:001b35880001,001f00,-22
+INQ:001b35880001,001f00,-23
+INQ:001b35880001,001f00,-20
+INQ:001b35880001,001f00,-55
+INQ:001b35880001,001f00,-27
+INQ:001b35880001,001f00,-20
+INQ:001b35880001,001f00,-24
+INQ:001b35880001,001f00,-22
OK
举例说明 2:
at+iac=9e8b33 ——查询任意访问码的蓝牙设备
OK
at+class=1f1f ——查询设备类为 0x1f1f 的蓝牙设备 OK
——查询模式:带 RSSI 信号强度指示,超过 9 个蓝牙设备响应则终止查
at+inqm=1,9,48 询,
设定超 时为 48x1.28=61.44 秒。
At+inq ——过滤、查询周边蓝牙设备
+INQ:001b35880001,001f1f,-20
+INQ:001b35880001,001f1f,-22
+INQ:001b35880001,001f1f,-33
+INQ:001b35880001,001f1f,-20
+INQ:001b35880001,001f1f,-25
+INQ:001b35880001,001f1f,-27
+INQ:001b35880001,001f1f,-20
+INQ:001b35880001,001f1f,-24
+INQ:001b35880001,001f1f,-22
OK
举例说明 3:
at+iac=9e8b3f ——查询访问码为 0x9e8b3f 的蓝牙设备
OK
第 13 页/共 23 页
XM-15B 产品规格书
28、取消查询蓝牙设备
指令 响应 参数
AT+INQC OK 无
29、设备配对:
指令 响应 参数
AT+PAIR=<bda>,<timeoutSec> 1、OK——成功 bda:远程设备蓝牙地址
2、FAIL——失败 timeoutSec:连接超时(秒)
与远程蓝牙设备:12:34:56:ab:cd:ef 配对,最大配对超时 20 秒
at+pair=123456abcdef,20
OK
30、设备连接
指令 响应 参数
AT+LINK=<bda> 1、OK——成功 bda:远程设备蓝牙地址
2、FAIL——失败
举例说明:
与远程蓝牙设备:12:34:56:ab:cd:ef 建立连接
at+link=123456abcdef ——连接蓝牙设备 12:34:56:ab:cd:ef,如果之前没有匹配,
会根据需要进行匹配。
OK
31、断开连接
指令 响应 参数
1、+DISC:SUCCESS——断开连接成功
OK
2、+DISC:LINK_LOSS——连接丢失
OK 无
AT+DISC 3、+DISC:NO_SLC——没有 SLC 连接
OK
4、+DISC:TIMEOUT——断开超时
OK
5、+DISC:ERROR——断开错误
第 14 页/共 23 页
XM-15B产品规格书
OK
32、进入节能模式
指令 响应 参数
AT+ENSNIFF=<bda> OK bda:设备蓝牙地址
33、退出节能模式
指令 参数 响应
AT+EXSNIFF=<bda> OK bda:设备蓝牙地址
34、退出命令模式
指令 参数 响应
AT+EXIT OK 无
第 15 页/共 23 页
XM-15B 产品规格书
附录 1
设备类别码
The Class of Device/Service (CoD) field has a variable format. The format is indicated using the 'Format Type field' within the CoD. The length of the Format
Type field is variable and ends with two bits different from '11'. The version field starts at the least significant bit of the CoD and may extend upwards.
In the 'format #1' of the CoD (Format Type field = 00), 11 bits are assigned as a bit-mask (multiple bits can be set) each bit corresponding to a high level
generic category of service class. Currently 7 categories are defined. These are primarily of a 'public service' nature. The remaining 11 bits are used to
Any reserved but otherwise unassigned bits, such as in the Major Service Class field, should be set to 0.
Figure 1: The Class of Device/Service field (first format type). Please note the order in which the octets are sent on the air and stored in memory. Bit number
The Major and Minor classes are intended to define a general family of devices with which any particular implementation wishes to be associated. No
assumptions should be made about specific functionality or characteristics of any application based solely on the assignment of the Major or Minor device
class.
14 (reserved)
15 (reserved)
第 16 页/共 23 页
XM-15B 产品规格书
[Ref #1 See Generic Access Profile (Please refer to the Generic Access Profile within the respective Core Specification)]
The Major Class segment is the highest level of granularity for defining a Bluetooth Device. The main function of a device is used to determine the major class
grouping. There are 32 different possible major classes. The assignment of this Major Class field is defined in Table 1.3.
0 0 1 1 1 Wearable
0 1 0 0 0 Toy
0 1 0 0 1 Health
[Ref #2: Used where a more specific Major Device Class code is not suited (but only as specified in this document). Devices that do not have a major class
The 'Minor Device Class field' (bits 7 to 2 in the CoD), are to be interpreted only in the context of the Major Device Class (but independent of the Service Class
field). Thus the meaning of the bits may change, depending on the value of the 'Major Device Class field'. When the Minor Device Class field indicates a
device class, then the primary device class should be reported, e.g. a cellular phone that can also work as a cordless handset should use 'Cellular' in the
0 0 0 0 0 1 Desktop workstation
0 0 0 0 1 0 Server-class computer
0 0 0 0 1 1 Laptop
第 17 页/共 23 页
XM-15B 产品规格书
0 0 0 0 0 1 Cellular
0 0 0 0 1 0 Cordless
0 0 0 0 1 1 Smart phone
0 0 0 Fully available
0 0 1 1 - 17% utilized
0 1 0 17 - 33% utilized
0 1 1 33 - 50% utilized
1 0 0 50 - 67% utilized
1 0 1 67 - 83% utilized
1 1 0 83 - 99% utilized
1 1 1 No service available
The exact loading formula is not standardized. It is up to each LAN/Network Access Point implementation to determine what internal conditions to report as a
utilization percentage. The only requirement is that the number reflects an ever-increasing utilization of communication resources within the box. As a
recommendation, a client that locates multiple LAN/Network Access Points should attempt to connect to the one reporting the lowest load.
第 18 页/共 23 页
XM-15B 产品规格书
0 0 0 0 1 0 Hands-free Device
0 0 0 0 1 1 (Reserved)
0 0 0 1 0 0 Microphone
0 0 0 1 0 1 Loudspeaker
0 0 0 1 1 0 Headphones
0 0 0 1 1 1 Portable Audio
0 0 1 0 0 0 Car audio
0 0 1 0 0 1 Set-top box
0 0 1 0 1 1 VCR
0 0 1 1 0 0 Video Camera
0 0 1 1 0 1 Camcorder
0 0 1 1 1 0 Video Monitor
0 1 0 0 0 0 Video Conferencing
0 1 0 0 0 1 (Reserved)
0 1 0 0 1 0 Gaming/Toy
0 1 Keyboard
1 0 Pointing device
Bits 6 and 7 independantly specify mouse,keyboard or combo mouse/keyboard devices. These may be combined with the lower bits in a multifunctional
device.
第 19 页/共 23 页
XM-15B 产品规格书
0 0 0 0 Uncategorized device
0 0 0 1 Joystick
0 0 1 0 Gamepad
0 0 1 1 Remote control
0 1 0 0 Sensing device
0 1 0 1 Digitizer tablet
X X X 1 Display
X X 1 X Camera
X 1 X X Scanner
1 X X X Printer
X X X X All other values reserved
Bits 4 to 7 independantly specify display, camera, scanner or printer. These may be combined in a multifunctional device.
0 0 Uncategorized, default
The Minor Class segment is the lowest level of granularity for defining a Bluetooth Device. There are 64 different possible minor classes.
0 0 0 0 0 1 Wrist Watch
0 0 0 0 1 0 Pager
0 0 0 0 1 1 Jacket
0 0 0 1 0 0 Helmet
第 20 页/共 23 页
XM-15B 产品规格书
0 0 0 1 0 1 Glasses
0 0 0 0 0 1 Robot
0 0 0 0 1 0 Vehicle
0 0 0 1 0 1 Game
0 0 0 0 0 0 Undefined
0 0 0 0 1 0 Thermometer
0 0 0 0 1 1 Weighing Scale
0 0 0 1 0 0 Glucose Meter
0 0 0 1 0 1 Pulse Oximeter
0 0 1 0 0 0 Step Counter
Example:
PC: 0x120104
NOTEBOOK: 0x12010C
Headphones: 0x200404
第 21 页/共 23 页
XM-15B 产品规格书
附录 2
通用及设备特定的查询访问码(DIAC)
# LAP 值 用途
表 1:查询访问码:
说 明,请参考通用访问配置文件。