Api Escaped Operating Mode (Api 2) - Digi XBee Zigbee Mesh Kit User Manual

Radio frequency (rf) module
Table of Contents

Advertisement

API escaped operating mode (API 2)

API non-escaped (API 1) operation relies solely on the start delimiter and length bytes to differentiate API frames. If bytes in a packet are lost, the length
count will be off, and the next API frame (packet) will also be lost. API escaped (API 2) operation involves escaping character sequences in an API frame in
order to improve reliability, especially in noisy RF environments.
The basic frame structure of both API modes is the same, but in API escaped (API 2) mode, all bytes except for the start delimiter must be escaped if
needed. The following data bytes must be escaped in API 2 mode:
0x7E: Start delimiter
n
0x7D: Escape character
n
0x11: XON
n
0x13: XOFF
n
API 2 mode guarantees all the 0x7E bytes received are start delimiters: this character cannot be part of any of the other frame fields (length, data, or
checksum) since it must be escaped.
To escape a character:
1. Insert 0x7D, the escape character.
2. Append it with the byte to be escaped, XORed with 0x20.
In API 2 mode, the length field does not include any escape character in the frame and the checksum is calculated with non-escaped data.
Example: Escape an API frame
To express the following API non-escaped frame in API 2 mode:
Frame Data
Start Delimiter Length
Frame type Data
7E
00
0F
17
The 0x13 byte must be escaped:
13
01 00
A2 00 40 AD 14 2E FF FE 02 4E 49 6D
Checksum

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the XBee Zigbee Mesh Kit and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents