XBEE模块API帧说明
DIGI XBEE RPO模块API帧说明
注明1:
[1]到[6]需测试XBEE PRO模块验证其结果。
[1]发送选项0x08不被支持。
[2]发送API帧,最大RF数据负载不是72字节,由AT指令中NP命令查看。
[3]64bit目标地址可以设为0,作为协调器地址。
[4]最大广播半径是32。
[5]在节点识别指示器(0x95)中,AT指令中NO命令可以被用包含DD参数。
[6]14)节点识别指示器帧的结构需确定。
注明2:
nBytes代表字段的大小是可变的。
注明3:
API帧中的转义字符(Escape Characters),A T指令中AP命令参数等于2时。
UART帧的收发就需要注意以下方面:
当发出或者到一个串口的数据帧时,特殊数据值必须进行转义,这样的帧就不会与数据帧序列干扰。为了转义干扰数据字节,插入0x7D,其后的字节与0x20异或。
需要转义的数据字节有:0x7E,0x7D,0x11,0x13。
转义字符不参于检验和运算。
DIGI XBEE RPO模块API不同类型帧的详细说明:
API Frame Names Values
Modem Status 0x8A
A T Command 0x08
A T Command - Queue Parameter V alue 0x09
A T Command Response 0x88
Remote Command Request 0x17
Remote Command Response 0x97
ZigBee Transmit Request 0x10
Explicit Addressing ZigBee Command Frame 0x11
ZigBee Transmit Status 0x8B
ZigBee Receive Packet (AO=0) 0x90
ZigBee Explicit Rx Indicator (AO=1) 0x91
ZigBee IO Data Sample Rx Indicator0x92
XBee Sensor Read Indicator (AO=0) 0x94
Node Identification Indicator (AO=0) 0x95
1)MODEM状态帧(RF模块状态信息从模块发出)(什么条件产生此帧)
API标志符:0x8A
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x8A(1Byte)
Identifier specific Data(1Byte)---返回modem具体状态
0=Hardware reset
1=Watchdog timer reset
2=Associated
3=Disassociated
4=Synchronization lost(Beacon-enabled only)
5=Coordinator realignment
6=coordinator started
Checksum:0xFF-( Frame Data各个元素的和)(1Bytes)
返回头部
2)AT命令帧(使用API帧允许对所有模块参数寄存器进行查询或者设定)
API标志符:0x08
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x08(1Byte)
Identifier specific Data(n Bytes)---[Frame ID] + [A T command] + [Parameter V alue]
[Frame ID]:1Byte, Identifies the UART data frame for the host to correlate with a subsequent ACK(acknowledgement).If set to ‘0’, no response is sent.
[A T command]:2 Bytes, Command Name - Two ASCII characters that identify the A T Command.
[Parameter V alue]:n Bytes, If present, indicates the requested parametevalue to set the
Given register.If no characters present, register is queried.
Checksum:0xFF-( Frame Data各个元素的和)(1Bytes)
返回头部
3)AT命令-队列参数值帧(使用API帧允许模块参数可以被排列或者设定)(相对“AT命令”类型,新的参数被排队而不被应用,直到“AT命令”类型,或者AC命令发出).
API标志符:0x09
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x09(1Byte)
Identifier specific Data(n Bytes)--- [Frame ID] + [A T command] + [Parameter V alue]
[Frame ID]:1Byte, Identifies the UART data frame for the host to correlate with a subsequent ACK(acknowledgement).If set to ‘0’, no response is sent.
[A T command]:2Bytes, Command Name - Two ASCII characters that identify the A T Command. [Parameter V alue]:n Bytes, If present, indicates the requested parametevalue to set the given register.If no characters present, register is queried.
返回头部
4)AT命令反馈帧(对AT命令的反馈,一些命令将会反馈多个帧)
API标志符:0x88
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x88(1Byte)
Identifier specific Data(n Bytes)---[ Frame ID]+[ A T Command]+[ Status]+[ V alue]
[Frame ID]: 1Byte,Identifies the UART data frame being reported.Note: If Frame ID = 0 in
A T Command Mode, no A T Command Response will be given.
[A TCommand]:2Bytes,Command Name -Two ASCII characters that identify the A T Command. [Status]:1Byte
0 = OK
1 = ERROR
2 = Invalid Command
3 = Invalid Parameter
[V alue]: nByte,The HEX (non-ASCII) value of the requested register.
返回头部
5)远程AT命令请求帧(允许远程对模块参数寄存器进行查询或者设定)
API标志符:0x17
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x17(1Byte)
Identifier specific Data(n Bytes)---[FrameID] + [64-bit-Destination-Address] + [16-bit DestinationNetwork Address] + [Command Options] + [Command Name]+[Command Data] [FrameID]: 1Byte,Identifies the UART data frame for the host to correlate with a subsequent ACK(acknowledgement).If set to ‘0’, no A T Command Response will be given.
[64-bit-Destination-Address]:8Bytes,Set to match the 64-bit address of the destination, MSB first,LSB last. Broadcast =0x000000000000FFFF.
[16-bit-Destination-Network-Address]:2Bytes,Set to match the 16-bit network address of the destination, MSBfirst, LSB last. Set to 0xFFFE for broadcast TX, or if the network
address is unknown.
[Command Options]: 1Byte,0x02 - Apply changes on remote. (If not set, AC command must be Sent before changes will take effect.)All other bits must be set to 0.
[Command Name]:2Bytes, Name of the command
[Command Data]: nBytes,If present, indicates the requested parameter value to set the given register. If no characters present,the register is queried.
返回头部
6)远程命令反馈(相对于远程AT命令请求)
API标志符:0x97
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x97(1Byte)
Identifier specific Data(n Bytes)---[Frame ID] + [64-bit Responder Address] + [16-bit Responder Network Address] + [A T Command]+[Status] + [V alue]
[Frame ID]: 1Byte, Identifies the UART data frame being reported.Matches the Frame ID of the Remote Command Request the remote is responding to.
[64-bit Responder Address]: 8Bytes,Indicates the 64-bit address of the remote module that is responding to the Remote A T Command request
[16-bit Responder Network Address]: 2Bytes,Set to the 16-bit network address of the remote. Set to 0xFFFE if unknown.
[A T Command]:2Bytes,Command Name -Two ASCII characters that identify the A T Command. [Status]:1Byte
0 = OK
1 = ERROR
2 = Invalid Command
3 = Invalid Parameter
[V alue]: n Bytes,The HEX (non-ASCII) value of the requested register.
返回头部
7)Zigbee发送请求帧(TX请求消息将使模块发出RF包)TX包帧
API标志符:0x10
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x10(1Byte)
Identifier specific Data(n Bytes)---[FrameID] + [64-bit-Destination-Address] + [16-bit DestinationNetwork Address] + [Broadcast Radius] + [Options] + [ RF Data] [FrameID]: 1Byte,Identifies the UART data frame for the host to correlate with a subsequent ACK(acknowledgement).If set to ‘0’, no A T Command Response will be given.
[64-bit-Destination-Address]:8Bytes,Set to match the 64-bit address of the destination, MSB first,LSB last. Broadcast =0x000000000000FFFF.
[16-bit-Destination-Network-Address]:2Bytes,Set to match the 16-bit network address of the destination, MSBfirst, LSB last. Set to 0xFFFE for broadcast TX, or if the network
address is unknown.
[Broadcast Radius]: 1Byte, Sets maximum number of hops a braodcast transmission can traverse. If set to 0, the TX raidus will be set to the maximum hop value (10). [Options]:1Bytes, 0x08 =Send multicast transmission. (Unicast set if not sent.) All other bits Must be set to 0.
[RF Data]: nBytes, Up to 72 Bytes per packet
返回头部
8) Explicit Addressing ZigBee命令帧(帧中允许应用层区域“终端和簇ID”被指定)
API标志符:0x11
API帧的结构:
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x11(1Byte)
Identifier specific Data(n Bytes)---[FrameID] + [64-bit-Destination-Address] + [16-bit DestinationNetwork Address] + [Source endpoint] + [Destination endpoint] + [Cluster ID] + [Profile ID] +[Broadcast Radius]+ [Options] + [RF Data]
[FrameID]: 1Byte,Identifies the UART data frame for the host to correlate with a subsequent ACK(acknowledgement).If set to ‘0’, no A T Command Response will be given.
[64-bit-Destination-Address]:8Bytes,Set to match the 64-bit address of the destination, MSB first,LSB last. Broadcast =0x000000000000FFFF.
[16-bit-Destination-Network-Address]:2Bytes,Set to match the 16-bit network address of the destination, MSBfirst, LSB last. Set to 0xFFFE for broadcast TX, or if the network
address is unknown.
[Source endpoint]: 1Byte,Source endpoint for the transmission.
[Destination endpoint]: 1Byte, Destination endpoint for the transmission.
[Cluster ID]:2 Bytes,Cluster ID used in the transmission
[Profile ID]:2 Bytes, Profile ID used in the transmission
[Broadcast Radius]: 1Byte, Sets the maximum number of hops a broadcast transmission
can traverse. If set to 0, the transmission radius will be set tothe network maximum hops value. [Options]:1Bytes, Set to 0
[RF Data]: nBytes, RF data size must be less than oequal to the maximum number of
RF data bytes (NP command).
返回头部
9)ZigBee发送状态帧(TX状态帧,TX请求完成时,模块会发出状态信息,这个信息将给出数据包是否被成功发送,或者发送失败)
API标志符:0x8B
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x8B(1Byte)
Identifier specific Data(n Bytes)---[FrameID] + [Remote Network Address]+ [Transmit Retry Count] + [Delivery Status] + [Discovery Status]
[FrameID]:1Byte, Identifies UART data frame being reported.
[Remote Network Address]: 2Byte, 16-bit Network Address the packet was delivered to
(if success). If not success, this address matches the Destination Network Address that was provided in the Transmit Request Frame.
[Transmit Retry Count]: 1Byte, The number of applicationtransmission retries that took place. [Delivery Status]: 1Byte,
0x00 = Success
0x02 = CCA Failure?
0x15 = Invalid destination endpoint
0x21 = Network ACK Failure
0x22 = Not Joined to Network
0x23 = Self-addressed
0x24 = Address Not Found
0x25 = Route Not Found
[Discovery Status]: 1Byte,
0x00 = No Discovery Overhead
0x01 = Address Discovery
0x02 = Route Discovery
0x03 = Address and Route Discovery
返回头部
10)ZigBee接收帧(RX包帧,模块收到RF包时,将把RF信息发出到UART)
API标志符:0x90
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x90(1Byte)
Identifier specific Data(n Bytes)---[64-bit Address] + [16-bit Network Address]+ [Options] + [RF Data]
[64-bit Address]:8Bytes
[16-bit Network Address]:2 Bytes
[Options]:1Byte,
0x01 - Packet Acknowledged
0x02 - Packet was a broadcast packet
[RF Data]:nBytes, Up to 72 Bytes per packet
返回头部
11) ZigBee Explicit RX指示器帧(模块收到RF包时,将把RF 信息发到UART,AO=1)
API标志符:0x91
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x91(1Byte)
Identifier specific Data(n Bytes)---[64-bit Source Address] + [16-bit Source Network Address] + [Source endpoint] + [Destination endpoint] + [Cluster ID] + [Profile ID] + [Broadcast
Radius] + [Options] + [RF Data]
[64-bit Source Address]:8Bytes,
[16-bit Source Network Address]:2Bytes,
[Source endpoint]: 1Byte,Source endpoint for the transmission.
[Destination endpoint]: 1Byte, Destination endpoint for the transmission.
[Cluster ID]:2 Bytes, Cluster ID the packet was addressed to.
[Profile ID]:2 Bytes, Profile ID the packet was addressed to. (Multiple profile IDs
not yet supported.)
[Broadcast Radius]: 1Byte, Sets the maximum number of hops a broadcast transmission
can traverse. If set to 0, the transmission radius will be set tothe network maximum hops value. [Options]:1Bytes,
0x01 – Packet Acknowledged
0x02 – Packet was a broadcast packet
[RF Data]: nBytes, RF data size must be less than equal to the maximum number of
RF data bytes (NP command).
返回头部
12) ZigBee IO数据采样Rx 指示器帧(模块从远程设备收到I/O采样帧时,会将数据帧发出到串口)
API标志符:0x92
API帧的结构:
API帧中字段说明:
Start Identifier:0x7E(1Byte)
Frame Data Length:MSB---LSB(2Bytes)
Frame Data:API Identifier + Identifier specific Data(cmd Data)
Frame Data详细说明:
API Identifier---0x92(1Byte)
Identifier specific Data(nBytes)---[64-bit Address] + [16-bit Network Address] + [Receive Options] + [Num Samples] + [Digital Channel Mask] + [Analog Channel Mask] + [Digital Samples] + [Analog Samples]
[64-bit Address]:8Bytes,
[16-bit Network Address]:2Bytes,
[Receive Options]:1Byte,
0x01 - Packet Acknowledged
0x02 - Packet was a broadcast packet
[Num Samples]:1Byte,Number of sample sets included in the payload. (Always set to 1) [Digital Channel Mask]:2Bytes,Bitmask field that indicates which digital IO lines on the remote have sampling enabled (if any)
[Analog Channel Mask]:1Byte, Bitmask field that indicates which Analog IO lines on the remote have sampling enabled (if any).
[Digital Samples]:2Bytes, If the sample set includes any digital IO lines (Digital Channel Mask > 0), these two bytes contain samples for all enabled digital inputs. DIO lines that do not have sampling enabled return 0. Bits in these 2 bytes map the same as they do in the Digital Channels Mask field.
[Analog Samples]: 2 bytes each sample, If the sample set includes any analog input lines (Analog Channel Mask > 0), each enabled analog input returns a 2-byte value indicating the A/D measurement of that input. Analog samples are ordered sequentially from AD0/DIO0 to AD3/DIO3, to the supply voltage.
返回头部
13)XBee传感器读取指示器帧(暂不)
14)节点识别指示器帧(当模块发送节点信息给协调器以标志它自己时,协调将收到这个帧.“AO=0”.这个帧的数据部分与节点发现反馈帧相似.“AT指令中的ND命令”)
(帧的结构需通过模块验证)
余锡钱,09-08-28整理
DIGI XBEE RPO模块重要的A T命令说明(调试过程中验证):