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:
A CRTP packet consists of a 8bit header followed by 0-31 bytes of data.
7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ | R | Port | Channel | +---+---+---+---+---+---+---+---+ | DATA 0 | +---+---+---+---+---+---+---+---+ : : : : : : : : : +---+---+---+---+---+---+---+---+ | DATA 30 | +---+---+---+---+---+---+---+---+
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.
The wireless interface will add additional header data like CRC when sending the packet and therefore the packet sent to the wireless interface is only a CRTP packet.
TODO
7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ | 0xAA | +---+---+---+---+---+---+---+---+ | 0xAA | +---+---+---+---+---+---+---+---+ | R | Port | Channel | +---+---+---+---+---+---+---+---+ | Packet length | +---+---+---+---+---+---+---+---+ | DATA 0 | +---+---+---+---+---+---+---+---+ : : : : : : : : : +---+---+---+---+---+---+---+---+ | DATA 30 | +---+---+---+---+---+---+---+---+ | CRC | +---+---+---+---+---+---+---+---+
This port is used as a one-way text console. Printouts using printf will be sent on this port and can be read by a receiver if connected.
7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ | CHAR 0 | +---+---+---+---+---+---+---+---+ : : : : : : : : : +---+---+---+---+---+---+---+---+ | CHAR 30 | +---+---+---+---+---+---+---+---+
The contents of the buffer on the copter side is sent if any of the following is fulfulled:
The purpose of the logging is to be able to log variables that are available in the copter during runtime. The available variables are listed using a TOC that can be read from the copter. A logging block can then be registered consisting of there variables and the data will be sent periodically via CRTP to a receiver.
Port | Channel | Function |
5 | 0 | Table of content access |
5 | 1 | Log settings access |
5 | 2 | Log data access |
This port is used to access the loggable variables table of content. The first byte of the message is a message ID, three messages ID are defined:
+---+---+---+---+---+---+---+---+ | R | Port | Channel | +---+---+---+---+---+---+---+---+ | Packet length | +---+---+---+---+---+---+---+---+ | DATA 0 | +---+---+---+---+---+---+---+---+ : : : : : : : : : +---+---+---+---+---+---+---+---+ | DATA 30 | +---+---+---+---+---+---+---+---+
Example of checking the CRC of a TOC to determine if the TOC needs to be refreshed.
Computer Crazyflie -------- --------- Get TOC CRC32 ---> <--- TOC CRC32 [Compare CRC]
Example of downloading TOC contents from Crazyflie.
Computer Crazyflie -------- --------- Reset TOC pointer ---> [Pointer resets] Get next element ---> <--- TOC element .... .... Get next element ---> <--- TOC element Get next element ---> <--- Last TOC element [Fetch complete]
Message ID | Meaning in upstream packets | Meaning in downstream packets |
0 | Reset TOC pointer | Last TOC element |
1 | Get next TOC element | TOC element |
3 | Get TOC CRC32 | TOC CRC32 |
The upstream ID are commands and are sent alone. The downstream have the following formats:
Bytes 1 1 1 Null terminated strings +---+------------+------+----------+--------------+ | 0 | | | | | +---+ Var ID | Type | Group | Name | | 1 | | | | | +---+------------+------+---+------+--------------+ | 3 | Num. Vars | CRC32 | +---+------------+----------+ Bytes 1 1 4
The logging variables are sequentially requested by the receiver until the end. When the last loggable variable is reached it has the ID 0 'Last TOC element'. The reset command permits to reset the TOC pointers so that the next sent TOC element will be the first one. The Get CRC commands also returns the number of loggable variables.
The CRC32 is a hash of the copter's loggable variable TOC. The aim of having this is to be able to cache data on the receiver end and to quickly check the validity of it when connecting.
TODO
TODO
The parameters system aims at making accessible all the gettable and settable parameters of the copter. In the copter a table of parameters is hold and can be retrieved. In this table every parameter name is associated with an ID and a group name. Three ID are used to acces the TOC and the paramareters:
Port | Function |
(0,9,0) | TOC access |
(0,9,1) | Parameter read |
(0,9,2) | Parameter write |
This ports permits to access the parameters table of content. The first byte of the message is a message ID, three messages ID are defined:
Message ID | Meaning in upstream packets | Meaning in downstream packets |
0 | Reset TOC pointer | Last TOC element |
1 | Get next TOC element | TOC element |
3 | Get TOC CRC32 | TOC CRC32 |
The upstream ID are commands and are sent alone. The downstream have the following formats:
Bytes 1 1 1 Null terminated strings +---+------------+------+----------+--------------+ | 0 | | | | | +---+ Param ID | Type | Group | Name | | 1 | | | | | +---+------------+------+---+------+--------------+ | 3 | Num. Param | CRC32 | +---+------------+----------+ Bytes 1 1 4
The parameters are sequentially requested by the PC until the end. When the last parameter is reached it has the ID 0 'Last TOC element'. The reset command permits to reset the TOC pointers so that the next sent TOC element will be the first one. The Get CRC commands also returns the number of parameters.
The CRC32 is a hash of the copter TOC. This is aim at implementing caching of the TOC in the PC Utils to avoid fetching the full TOC each time the copter is connected.
TODO
TODO
TODO