My First Viking Longship
Communications: xBee Radio
Home
The Game

Water Craft

Helm

Communications

     Protocol
     xBee
     Pairing
Gems of Wisdom
Media
The xBee radio is a device that wirelessly communicates data sent to it by a microcontroller. When transmitting, the xBee sends out the data packet asynchronously transmitted to it by the microcontroller. When receiving, the xBee only forwards transmissions that are addressed to it (or broadcast for everyone) to the microcontroller. Use of the xBee is fairly similar to reading/writing to a port. So long as the byte order outlined below is followed, data will transmit from one xBee to another.

Receiver

·         12 bytes are shifted in from xBee DO UART port - some are useful

·         Byte order

0.    Start Delimiter (always 0x7E)

1.    Length – MSB (should be 0)

2.    Length – LSB (should be 8)

3.    API identifier (0x81 for received transmission)

4.    Source address – MSB

§  xBee address of sender – unique to each craft/helm/admiral

§  0xBC for helm or admiral addressing helm

§  0xAF for craft or admiral addressing craft

5.    Source address – LSB

§  Specific # of craft/helm (0x01 through 0x0C)

§  FF for Admiral

6.    Signal strength indicator

7.    Options

§  Bit 1 high for direct address (only sent to this radio)

§  Bit 2 high for PAN broadcast (sent to all radios)

8.    ME218 byte 0

9.    ME218 byte 1

10. ME218 byte 2

11. Checksum

§  Σdataframe + checksum = 0xFF

Transmitter

·         Write to xBee DI port (UART)

·         Byte order

0.    Start Delimiter (always 0x7E)

1.    Length – MSB (should be 0)

2.    Length – LSB (should be 8)

3.    API identifier (0x01 for transmit request)

4.    Frame ID

§  Number indicating this particular message

§  Set to 0x00 to disable message sent response

5.    Destination Address – MSB (0xFFFF for broadcast)

§  xBee address of receiver – unique to each craft/helm/admiral

§  0xBC for helm

§  0xAF for craft

6.    Destination Address – LSB

§  Specific # of craft/helm (0x01 through 0x0C)

§  FF for Admiral

7.    Options

§  Set to 0x00 to enable ACK

8.    ME218 Byte 0

9.    ME218 Byte 1

10. ME218 Byte 2

11. Checksum

§  checksum = 0xFF – Σdataframe

Checksum: Not including frame delimiters and length, add up all bytes keeping only the lowest 8 bits of the result and subtract from 0xFF.



The validity of incoming packets was determined by checking the first four bytes of the packet. If the first four bytes matched their expected values, then the packet was determined "valid" and processed. A state machine outlining this process may be found by clicking the thumbnail below:
xBee receive process