Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
The CRTP (Crazy RealTime Protocol) is the name of the protocol used to communication with the Crazyflie. The protocol is used for multiple physical layers:
The CRTP packet consists of 32 bytes of data:
+------+------+ | PORT | DATA | +------+------+ | PORT | <31 | +------+------+ 1 x
The ports numbers are composed of: Priority, task number and message number. * The priority is set by the 2 MSB of the port number. It permit to each task to chose in a per message basis the priority of its messages * The task number is used by CRTP to distribute the messages to the different tasks in the copter * Finally the message number is composed by the two LSB and permit to have 4 different communication channel per task.
A proposed notation is P:T:N, P is the priority, T is the task number and N the message number. The port number is then built as follow:
+---+---+---+---+---+---+---+---+ | P P | T T T T | N N | +---+---+---+---+---+---+---+---+ #define PORT(P,T,N) ((P<<6) | (T<<2) | N)
'NOTE:
' This is currently being changed!
Below is the structures for the packages both for the wired serial interface and for the wireless interface. The limitation for the length of the data is set so that it will fit inside one packet for the wireless transmission.
Wireless: +------+------+ | PORT | DATA | +------+------+ | PORT | <31 | +------+------+ 1 x The wireless firmware adds ADDRESS, PID, LENGTH and CRC automatically.
Serial port: +-------+------+--------+------+-----+ | START | PORT | LENGTH | DATA | CRC | +-------+------+--------+------+-----+ | 0xAAAA| PORT | <31 | DATA | CRC | +-------+------+--------+------+-----+ 2 1 1 x 1 :byte
*Port* | *Target* |
000 | Console |
*1* | Acc Log |
*2* | Gyro Log |
*3* | IMU Log |
*4* | MultiLog 1 |
*5* | MultiLog 2 |
*6* | PID Settings |
*7* | Command |
*8* | Copter information |
*9* | Parameters |
*13* | Flight control |
0:13:0 | Send/Receive yaw, pith, roll and throttle |
*15* | Link layer reserved |
3:15:0 | Echo (profiling) |
3:15:1 | Source (profiling) |
3:15:2 | Sink (profiling) |
3:15:3 | NULL packet |
#console
This port is used as a simulation of the text based console. The idea is to map putc/getc there (and, by extention, it should be the target of printf).
The packet format contains only the datas to send/receive (this is a bidirectional port): <pre> +——–+
Data |
+——–+
1-31 :bytes
</pre>
From the copter side a _fair_ behavior should be to have a buffer and to send a new packet if at least one of the 3 following condition is fullfil: * The output buffer (of 31bytes) is full * A “newline” character has to be send (\n and/or \r) * A flush command as been issued