Ruben Laguna's blog

Mar 12, 2009 - 2 minute read - api at command electronics examples frame response xbee

Example of XBee API frames

Some examples of XBee API Frames.

Modem status frame

7E 00 02 8A 06 6F

7E    : API Frame
00 02 : Length
8A    : Modem status
06    : Coordinator started
6F    : checksum FF – ((8A +06) & FF) = 6F

AT Command API Frame: MY

frame format
7e 00 04 08 52 4D 59 FF

7E    : API Frame
00 02 : Length
08    : AT Command Frame id
52    : Frame id
4d 59 : MY (4d 59) (4d ⇒ M, 59 ⇒ Y) Get the 16-bit network address of the module.
FF    : checksum ff = ff – ((08+52+4d+59) & ff)

AT Command Response: MY

command response frame structure
7e 00 07 88 52 4d 59 00
00 00 7f

7E    : API Frame
00 07 : Length
88    : AT Command Response API Identifier
52    : Frame id
4d 59 : MY (4d 59) (4d ⇒ M, 59 ⇒ Y) Get the 16-bit network address of the module.
00    : Status 0=OK
00 00 : MY value, 00 000 not set
7f    : checksum ff = ff – ((08+52+4d+59) & ff)

Explicit Addressing Zigbee Command Frame:

7E 00 1D 11 01 00 13 A2 00
40 3E 25 75 00 00 01 01 04
02 01 04 00 00 18 01 01 00
00 00 29 63 CE 9F

7E                         : Start frame
00 1D                      : Length (29 bytes)
11                         : explicit addressing transmit
01                         : Frame id
00 13 A2 00 40 3E 25 75    : 64 bit address
00 00                      : 16 bit address
01                         : source endpoint
01                         : destination endpoint
04 02                      : cluster id (temperature measurement cluster id/ Measurement and sensing functional domain)
01 04                      : profile id (home automation profile)
00                         : broadcast radius
00                         : options
18 01 01 00 00 00 29 63 CE : payload
9F                         : checksum

Let’s analyze the payload

18 01 01 00 00 00 29 63
CE

18 : // 00011000 0×18 / general command = 00/ manufacturer specific = 0/ direction =1/ disable default 
/ reserved = 000
01: transaction sequence
01: read response
00 00: attribute identifier
(temperature)
00: status success
29: attribute data type = 29 signed 16 bit integer
63 CE: temp value (25550 / 100)

References:

  1. XBee® & XBee-PRO® ZB ZigBee® PRO RF Modules
  2. xbee manual
  3. What is API (Application Programming Interface) Mode and how does it work?
  4. Zigbee specification
  5. Zigbee Home Automation Public Application Profile
  6. Zigbee Cluster Library