Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What CRC length for combining multiple GATT transfers?

I have the super typical problem of needing long data transfer greater than the 20 byte MTU size.

I have a basic protocol that has the total length of a long message coming, some flags, and a CRC. This is for transferring 20*n bytes between device and app. So my first GATT transfer has a little overhead and then some data, the next transfers in the same characteristic/GATT buffer will have all data until I'm finished and the other end can assemble it all as a block on the receiving side.

So my characteristic over time would look like:

[flags + crc + len + data]   [data]   [data]   [data]

What I'm trying to figure out (among why no one has established any sort of standard for this) is what is an appropriate CRC length and polynomial. 4 bytes standard CRC-32?

I plan to transfer up to 2K of data in this "long transfer" method. BUT.... BLE messages already have a CRC per message. So I know each GATT message will be correct if I get an event, what I wouldn't know is if the phone or device missed a message (using notification/indication already). I want to be sure before I spend any time on this message that it's all there without relying on timeouts specifically. So what I'm really doing isn't typical counting bits to see my CRC length, I'm counting messages. Once 10 messages have come in I'll know that's all of them and can check the CRC from the first message to confirm it.

Any advice for how long the CRC should be to reasonably be sure I've revived all the messages I need to?

Related