This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Do I need checksum to ensure my data is intact?

I am sending and receiving streams of data over BLE.

Do I need to add a checksum byte for every GATT write/notification/indication to ensure that my data is not corrupt during BLE data transfer? Or is there already some lower layer system to ensure that does not happen?

Parents
  • Every btle packet already contains a checksum. So the data is already protected. Of course checksums are not foolproof but you probably don't need to add more.

  • To expand on this, every packet contains a CRC field to verify data consistency. CRCs are very sensitive to single bit flips, but there is of course a possibility that your corrupted transmission ends up having the same CRC. Every data packet is also whitened before going through the air, as to reduce the risk even further. De-whitening and removal of CRC happens long before you receive the packet, so you do not see this.

    In addition to this, encrypted connections also contain a Message Integrity Check (MIC). This uses the IETF RFC 3610 algorithm with AES-128 (NIST FIPS-197) to create a 4 byte field for message authentication. If, by chance, a corrupted message passes CRC, the MIC check will likely fail and disconnect the link before anything is given to the application.

Reply
  • To expand on this, every packet contains a CRC field to verify data consistency. CRCs are very sensitive to single bit flips, but there is of course a possibility that your corrupted transmission ends up having the same CRC. Every data packet is also whitened before going through the air, as to reduce the risk even further. De-whitening and removal of CRC happens long before you receive the packet, so you do not see this.

    In addition to this, encrypted connections also contain a Message Integrity Check (MIC). This uses the IETF RFC 3610 algorithm with AES-128 (NIST FIPS-197) to create a 4 byte field for message authentication. If, by chance, a corrupted message passes CRC, the MIC check will likely fail and disconnect the link before anything is given to the application.

Children
No Data
Related