From ab6895f8c419b49e7ad086d99576a671558d2223 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Thu, 1 Jun 2023 08:49:38 +0200 Subject: [PATCH] Updated CRTP version def and doc --- docs/functional-areas/crtp/index.md | 10 +++++----- src/config/config.h | 2 -- src/modules/interface/crtp.h | 2 ++ src/modules/src/platformservice.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/functional-areas/crtp/index.md b/docs/functional-areas/crtp/index.md index 0b46ea7c88..2a904a8193 100644 --- a/docs/functional-areas/crtp/index.md +++ b/docs/functional-areas/crtp/index.md @@ -17,7 +17,7 @@ Unless otherwise noted, this protocol documentation covers `Crazyflie 2.x`, the In order to allow for improvement and breaking change the protocol is versioned. The version is available using the [getProtocolVersion](crtp_platform#get-protocol-version) packet. -The version is currently 5. +The current version is defined in the constant `CRTP_PROTOCOL_VERSION`. When removing functionality from the protocol, packet will be deprecated for at least one version before being removed. Deprecated functionality prints a Warning in the [console](crtp_console). This rule allows for the Crazyflie firmware @@ -35,7 +35,7 @@ The Crayzyflie communication is implemented as a stack of independent layers: + CRTP + <- (port, channel, payload) +-------------------+ + Link + <- Radio link or USB link - +-------------------+ + +-------------------+ + Physical medium + <- radio or USB +-------------------+ @@ -58,7 +58,7 @@ The Crayzyflie communication is implemented as a stack of independent layers: There is currently two actively supported link implementation. They are documented on their own thread: - The radio link implements CRTP link over nRF24 compatible radios - - The USB link implements CRTP link over USB to the Crazylfie 2.x USB port + - The USB link implements CRTP link over USB to the Crazylfie 2.x USB port ### Packet ordering and real-time support @@ -97,7 +97,7 @@ be sent. The NULL packet has been extensively used by links to implement side-channel packets that are communicated outside the CRTP data flows. For example this is used to implement bootloader packets that should be interpreted by the -Crazyflie's nRF51 radio chip without being passed to the STM32 application +Crazyflie's nRF51 radio chip without being passed to the STM32 application processor. ## Port allocation @@ -124,7 +124,7 @@ Connection procedure Generaly speaking CRTP is connection-less and most of the subsystem in the Crazyflie will strive to be stateless. This is not true for all the subsystem or -links though: +links though: - The USB link needs to be enabled in the Crazyflie using a USB control packet - The Radio link maintains two packet counters to ensure that there are no packet loss and strict packet ordering. This is called Safelink and needs to be diff --git a/src/config/config.h b/src/config/config.h index 22c073db6a..e77e9f1f7a 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -46,8 +46,6 @@ #include "trace.h" #include "usec_time.h" -#define PROTOCOL_VERSION 6 - #define CONFIG_BLOCK_ADDRESS (2048 * (64-1)) #define MCU_ID_ADDRESS 0x1FFF7A10 #define MCU_FLASH_SIZE_ADDRESS 0x1FFF7A22 diff --git a/src/modules/interface/crtp.h b/src/modules/interface/crtp.h index f06d7fd0df..197fc20b37 100644 --- a/src/modules/interface/crtp.h +++ b/src/modules/interface/crtp.h @@ -30,6 +30,8 @@ #include #include +#define CRTP_PROTOCOL_VERSION 6 + #define CRTP_MAX_DATA_SIZE 30 #define CRTP_HEADER(port, channel) (((port & 0x0F) << 4) | (channel & 0x0F)) diff --git a/src/modules/src/platformservice.c b/src/modules/src/platformservice.c index e7f618b4c0..28a3846c86 100644 --- a/src/modules/src/platformservice.c +++ b/src/modules/src/platformservice.c @@ -158,7 +158,7 @@ static void versionCommandProcess(CRTPPacket *p) { switch (p->data[0]) { case getProtocolVersion: - *(int*)&p->data[1] = PROTOCOL_VERSION; + *(int*)&p->data[1] = CRTP_PROTOCOL_VERSION; p->size = 5; crtpSendPacketBlock(p); break;