User Manual
XBee® Wi-Fi RF Modules
© 2012 Digi International, Inc. 61
Checksum
To test data integrity, a checksum is calculated and verified on non-escaped data.
To calculate: Not including frame delimiters and length, add all bytes keeping only the
lowest 8 bits of the result and subtract the result from 0xFF.
To verify: Add all bytes (include checksum, but not the delimiter and length). If the
checksum is correct, the sum will equal 0xFF.
API Examples
Example: Create an API AT command frame to configure an XBee baud rate to 230,400
(set BD to 0x08). The frame should look like (in hex):
7E 00 05 08 01 42 44 08 68
Where:
0x0005 = length excluding checksum
0x08 = AT Command API frame type
0x01 = Frame ID (set to non-zero value for transmit status)
0x4244 = AT Command ('BD')
0x08 = value to set command to
0x68 = Checksum
The checksum is calculated as [0xFF - (0x08 + 0x01 + 0x42 + 0x44 + 0x08)]
Example: Send a remote command to a module who’s IP address is 192.168.0.103 (C0
A8 00 67) to set DIO1/AD1 as a digital input (D1=3) and apply changes to force the IO
update. The API remote command frame should look like (in hex):
7E 00 0E 07 01 00 00 00 00 C0 A8 01 64 02 44 31 03 B0
Where:
0x000E = length (14 bytes excluding checksum)
0x07 = Remote Command API frame type
0x01 = Frame ID
0x00000000 C0A80067 = Remote address (Pad first 4 bytes with 00)
0x02 = Apply Changes (Remote Command Options)
0x4431 = AT command ('D1')
0xB0 = Checksum
API UART and SPI Exchanges
AT Commands
The following image shows the API frame exchange that takes place at the UART or SPI
when sending an AT command request to read or set a module parameter. The
response can be disabled by setting the frame ID to 0 in the request.