
Operate in API mode
API frame specifications
Digi XBee Cellular LTE Cat 1 Embedded Modem User Guide
70
API frame specifications
The firmware supports two API operating modes: without escaped characters and with escaped
characters. Use the
AP
command to enable either mode. To configure a device to one of these modes,
set the following
AP
parameter values:
AP command
setting
Description
AP
= 0
Transparent operating mode, UART serial line replacement with API modes
disabled. This is the default option.
AP
= 1
API operation.
AP
= 2
API operation with escaped characters (only possible on UART).
AP
= 3
Reserved, do not use.
AP
= 4
Reserved, do not use.
AP
= 5
Bypass mode. This mode is for direct communication with the underlying chip and
is only for advanced users.
The API data frame structure differs depending on what mode you choose.
The firmware silently discards any data it receives prior to the start delimiter. If the device does not
receive the frame correctly or if the checksum fails, the device discards the frame.
API operation (AP parameter = 1)
We recommend this API mode for most applications. The following table shows the data frame
structure when you enable this mode:
Frame fields
Byte
Description
Start delimiter
1
0x7E
Length
2 - 3
Most Significant Byte, Least Significant Byte
Frame data
4 - n
API-specific structure
Checksum
n + 1
1 byte
API operation-with escaped characters (AP parameter = 2)
Set API to 2 to allow escaped control characters in the API frame. Due to its increased complexity, we
only recommend this API mode in specific circumstances. API 2 may help improve reliability if the
serial interface to the device is unstable or malformed frames are frequently being generated.
When operating in API 2, if an unescaped 0x7E byte is observed, it is treated as the start of a new API
frame and all data received prior to this delimiter is silently discarded. For more information on using
this API mode, refer to the following knowledge base article:
http://knowledge.digi.com/articles/Knowledge_Base_Article/Escaped-Characters-and-API-Mode-2
The following table shows the structure of an API frame with escaped characters: