Communication

This article is about the communication between the drone and various peripherals for debuging, testing and of course flying. Currently the drone can communicate with the wireless joystick and with the PC software (wired and wireless)

 

 

Requirements

Cable

It has to work over a cable to reduce the number of problems that may occur when testing and developing.

Radio

It has to work over the air to control the drone in flight mode.

Protocol

We need a definition how the data is transmitted in to read it at the receivers side.

Safety

Data loss can be fatal for the drone, it could misread a command and responde with any random reaction. 

The commands and data sent are packed in an previously self developed command&data packaging protocol which includes a checksum for data integrity. Once packed in this protocol the frame is once more wrapped to determine the beginning and the end of a packet, this is done with the Serial Line Internet Protocol (SLIP).

Data packet

Data byte Description
HIGH(ID) Each command has an incremental ID to determine Packet loss.
LOW(ID)
Command The command identifier.
Data length The length of the data transmitted in this packet.
Data ... The actual data, ammount of bytes can vary depending on the data length given before.
HIGH(CRC) Checksum over all bytes, without the checksum itself, from the high byte of the ID to the last data byte. The checksum is calculated by the CRC-CCITT (CRC-16) algorithm.
LOW(CRC)

 

For the table above, the first trasnmitted byte is the hight byte of the packet id. The general byte order when sending data is big-ending, while the bit order is LSB first as most serial ports work by default.

Framing (SLIP)

The Serial Line Internet Protocol (SLIP) is defined for IP to determine a packet begin and ending when transmitting over a serial line. It provides minimal overhead and allows an easy algorithm to decode the data, so it fits our application perfectly.

It uses an end character (0xC0) and escape character (0xDB) to escape the and end character if it occurs in the data segment.

Example

Input frame:

... ... 0xC0 ... ... 0xDB ...

Converts to:

... ... 0xDB 0xDC ... .. 0xDB 0xDD ... ... 0xC0

For further documentation on the serial line internet protocol framing, see http://www.ietf.org/rfc/rfc1055.txt

Implementation

Both, the packaging and the SLIP framing was implemented in C previously, named XSie, and has been ported to C# for the PC Software.

For compatibility purpose of further equiptment it is recommanded to receive the data with a baudrate of 115200 baud. The baud rate does not change the actual baud rate over bluetooth, so even when the baud rate is the same data can be transceived but in order to keep up with the data sent from the drone the baud rate should not be lower than 115200 baud for further peripherals.