Why can only 20Byte data be sent at a time in BLE

When working on Bluetooth-related projects, it is estimated that many people are curious about why a maximum of 20Byte of data is sent at a time. Without further ado, the above picture first, and the picture below shows the packet structure of Bluetooth data transmission. The red part is the final packet size we sent (in Notify state).

Untitled-1.png

Before we start, let me mention the difference between Octet and Byte, although both can be translated into bytes. Octet is a group of octets. In the early days of TCP/IP development, the Byte used by some system structures was 10 bits.

Introduction to broadcast packets

broadcast packet header

image.png header part

  1. The head mainly has 1 octet.
  2. PDU type
  3. RFU is reserved
  4. TxAdd send address segment
  5. RxAdd accepts the address segment

length part

  1. The length is mainly 1 octet.
  2. 6octet is the length, and the value is 6-37 (the broadcast packet has a 6octet device address at the end, so it is at least 6 bits).

For the 37 bytes here, my guess is this, I don’t know if it is correct, in order to be compatible with the 5-bit data in the data PUD with a length of 31octet, plus the device address that must be added by 6octet.

broadcast data section

The data is divided into valid data and invalid data (filled with 0) + 6octet device address. Valid data structures are as follows

image.png

  1. The valid data part consists of multiple AD Structures
  2. 1 AD Structure consists of 1 octct length and data (Length)
  3. data consists of AD type (n octct) and AD data (Length - n)

Data PDU

head

image.png

  1. Length is 5 digits 0-31octct, the maximum is 31octet
  2. Subtract the MIC of 4octet 31-4 = 27 octet is the Payload length.

Link Layer L2CAP

image.png

27 - 2 - 2 = 23 octet

notify

image.png

23 - 1 - 2 = 20 octet.

Guess you like

Origin juejin.im/post/7206577654933651516