Operate in API mode
API frame specifications
Frame data
Start
Frame
type
delimiter
Length
Checksum
Data
8
1
2
3
4
5
6
7
9
...
n
n+1
API frame type
Single byte
0x7E
MSB
LSB
Data
n
Frame type is the API frame type identifier. It determines the type of API frame and indicates
how the Data field organizes the information.
n
Data contains the data itself. This information and its order depend on the what type of frame
that the Frame type field defines.
Checksum
Checksum is the last byte of the frame and helps test data integrity. It is calculated by taking the hash
sum of all the API frame bytes that came before it, except the first three bytes (start delimiter and
length).
The device does not process frames sent through the serial interface with incorrect checksums, and
ignores their data.
Calculate and verify checksums
To calculate the checksum of an API frame:
1. Add all bytes of the packet, except the start delimiter 0x7E and the length (the second and
third bytes).
2. Keep only the lowest 8 bits from the result.
3. Subtract this quantity from 0xFF.
To verify the checksum of an API frame:
1. Add all bytes including the checksum; do not include the delimiter and length.
2. If the checksum is correct, the last two digits on the far right of the sum equal 0xFF.
Example
Consider the following sample data packet: 7E 00 0A 01 01 50 01 00 48 65 6C 6C 6F B8
Byte(s)
7E
Description
Start delimiter
Length bytes
00 0A
01
API identifier
01
API frame ID
50 01
00
Destination address low
Option byte
XBee/XBee-PRO S2C 802.15.4 RF Module User Guide
111