API escaped operating mode
API escaped operating mode (AP=2) is similar to API mode except that when working in API escaped mode, some bytes of the API frame specific data must be escaped. Since XCTU is compatible with both API and API escaped operating modes, you do not need to manually escape characters.
API escaped operating mode increases the reliability of RF transmission by preventing conflicts with special characters such as the start-of-frame byte (0x7E). API non-escaped (API=1) operation relies solely on the start delimiter and length bytes to differentiate API frames. In API escaped mode, on the other hand, those special bytes are escaped. Since 0x7E can only appear at the start of an API packet, a module can always "assume" that a new packet has started if 0x7E is received at any time while in API escaped mode.
Escape characters
When sending or receiving an API frame in API escaped mode, specific data values must be escaped (flagged) so they do not interfere with the data frame sequence.
To escape a data byte, insert 0x7D and follow it with the byte to be escaped XOR'd with 0x20. The data bytes that need to be escaped are as follows:
- 0x7E: Frame delimiter
- 0x7D: Escape
- 0x11: XON
- 0x13: XOFF
Note XCTU automatically escapes the appropriate characters when interacting with API escaped radio modules.