Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

32 bytes CRTP packets not supported #48

Closed
ataffanel opened this issue Apr 13, 2015 · 5 comments
Closed

32 bytes CRTP packets not supported #48

ataffanel opened this issue Apr 13, 2015 · 5 comments
Labels

Comments

@ataffanel
Copy link
Member

The Crazyflie radio supports 32 bytes packets however this line limits the max packet size to 31: https://github.com/bitcraze/crazyflie-firmware/blob/crazyflie2/modules/interface/crtp.h#L33

When the CRTP data size is set to 31 (to send 32 bytes packet), 32bytes packet are dropped somewhere. This needs to be fixed.

@AlexisTM
Copy link

AlexisTM commented Feb 27, 2019

Isn't it simply because CRTP_MAX_DATA_SIZE is the data which is prepended by a byte of the size of the message? It is using CRTP_MAX_DATA_SIZE+1 for the full message.

typedef struct _CRTPPacket
{
uint8_t size; //< Size of data
union {
struct {
union {
uint8_t header; //< Header selecting channel and port
struct {
#ifndef CRTP_HEADER_COMPAT
uint8_t channel : 2; //< Selected channel within port
uint8_t reserved : 2;
uint8_t port : 4; //< Selected port
#else
uint8_t channel : 2;
uint8_t port : 4;
uint8_t reserved : 2;
#endif
};
};
uint8_t data[CRTP_MAX_DATA_SIZE]; //< Data
};
uint8_t raw[CRTP_MAX_DATA_SIZE+1]; //< The full packet "raw"
};
} __attribute__((packed)) CRTPPacket;

@ataffanel
Copy link
Member Author

The source of this problem is that CRTP_MAX_DATA_SIZE is set to 30 and not to 31 as it should (which would make 32 bytes max packet including the 1 byte header).

Though last time I tried to fix it (in 2015...), setting CRTP_MAX_DATA_SIZE to 31 was causing 32bytes packet to be dropped somewhere and I never put/had the time to look where the packet was dropped (or if this was still a problem).

@AlexisTM
Copy link

AlexisTM commented Mar 5, 2019

Could it be that the radio adds a CRC for the last byte?

@ataffanel
Copy link
Member Author

In theory no, the nRF24 radio handles 32 bytes payload independently of the CRC (the CRC is added outside of the payload). Though, for Crazyflie 2.0 we implement the radio ourselves in the nRF51 so it is possible that there is a bug there.

@knmcguire
Copy link
Contributor

#29 increased the packet size to 60, so that fixes this issue. However we still might need to address the issue that this cannot be even bigger than it already is. But that is not part of this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants