BLE Packet Structure Reference

Comprehensive reference for Bluetooth Low Energy packet formats — advertising PDU layout, AD structure encoding, common AD type codes, and GATT/ATT protocol opcodes.

Advertising PDU Structure

Every BLE advertising packet on the physical layer follows this structure. The access address 0x8E89BED6 is fixed for all advertising channel PDUs.

Field Size Description
Preamble 1 byte 0xAA — alternating bits for receiver synchronization
Access Address 4 bytes 0x8E89BED6 — fixed for advertising channels
PDU Header 2 bytes PDU type, TxAdd, RxAdd, payload length
Payload 6–37 bytes AdvA (6B advertiser address) + AdvData (0–31B)
CRC 3 bytes 24-bit CRC over Header + Payload
Example on-air bytes AA D6BE898E 4006 B4994C64E1F8 0201061106... A3B2C1
Preamble Access Addr PDU Header Payload CRC

PDU Header Format

The 2-byte PDU header encodes the advertising type, address flags, and payload length.

Bits Field Description
0–3 PDU Type Advertising PDU type (see values below)
4–5 RFU Reserved for future use
6 TxAdd 0 = public address, 1 = random address
7 RxAdd 0 = public address, 1 = random address
8–13 Length Payload length in bytes (6–37)
14–15 RFU Reserved for future use

PDU Type Values

Value Name Description
0000ADV_INDConnectable undirected advertising
0001ADV_DIRECT_INDConnectable directed advertising
0010ADV_NONCONN_INDNon-connectable undirected advertising
0011SCAN_REQScan request from scanner
0100SCAN_RSPScan response from advertiser
0101CONNECT_INDConnection request
0110ADV_SCAN_INDScannable undirected advertising

AD Structure Format

The advertising data (AdvData) portion of the payload consists of one or more AD structures, each using Length-Type-Value encoding.

Field Size Description
Length 1 byte Number of bytes that follow (Type + Data)
AD Type 1 byte Data type identifier (see table below)
AD Data Length−1 bytes Type-specific payload data
Example AD structure 02 01 06
Length = 2 Type = 0x01 (Flags) Data = 0x06 (LE General + BR/EDR Not Supported)

Multiple AD structures are concatenated. For example, 02 01 06 07 09 41 69 72 42 4C 45 contains two structures: Flags (0x06) and Complete Local Name ("AirBLE").

Common AD Type Codes

These are the most frequently encountered AD type codes in BLE advertising data, as defined by the Bluetooth SIG.

Code Name Description
0x01FlagsDiscoverable mode, BR/EDR support flags
0x02Incomplete 16-bit Service UUIDsPartial list of 16-bit service class UUIDs
0x03Complete 16-bit Service UUIDsComplete list of 16-bit service class UUIDs
0x04Incomplete 32-bit Service UUIDsPartial list of 32-bit service class UUIDs
0x05Complete 32-bit Service UUIDsComplete list of 32-bit service class UUIDs
0x06Incomplete 128-bit Service UUIDsPartial list of 128-bit service class UUIDs
0x07Complete 128-bit Service UUIDsComplete list of 128-bit service class UUIDs
0x08Shortened Local NameShortened UTF-8 device name
0x09Complete Local NameComplete UTF-8 device name
0x0ATX Power LevelTransmit power level, signed int8 in dBm
0x0DClass of DeviceClass of Device field (3 bytes)
0x14List of 16-bit Service Solicitation UUIDsUUIDs the device is looking for
0x16Service Data — 16-bit UUID16-bit UUID (2B LE) + service-specific data
0x19Appearance16-bit appearance value (device icon hint)
0x1FList of 32-bit Service Solicitation UUIDs32-bit UUIDs the device is looking for
0x20Service Data — 32-bit UUID32-bit UUID (4B LE) + service-specific data
0x21Service Data — 128-bit UUID128-bit UUID (16B LE) + service-specific data
0xFFManufacturer Specific DataCompany ID (2B LE) + manufacturer payload

GATT/ATT Protocol

After a BLE connection is established, data exchange uses the Attribute Protocol (ATT). Each ATT PDU begins with a 1-byte opcode followed by operation-specific parameters.

Field Size Description
Opcode 1 byte ATT operation code (includes auth flag in bit 6, command flag in bit 7)
Parameters variable Operation-specific data fields

Common ATT Opcodes

Opcode Name Description
0x01Error ResponseServer reports an error for a prior request
0x02Exchange MTU RequestClient requests a larger MTU size
0x03Exchange MTU ResponseServer replies with supported MTU
0x04Find Information RequestDiscover attribute handles and types (descriptors)
0x05Find Information ResponseReturns handle-UUID pairs
0x08Read By Type RequestRead characteristics by UUID within handle range
0x09Read By Type ResponseReturns matching attribute values
0x0ARead RequestRead an attribute value by handle
0x0BRead ResponseReturns the requested attribute value
0x10Read By Group Type RequestDiscover services (primary/secondary)
0x11Read By Group Type ResponseReturns service handle ranges and UUIDs
0x12Write RequestWrite an attribute value (with confirmation)
0x13Write ResponseServer confirms the write succeeded
0x1BHandle Value NotificationServer pushes value update (no confirmation)
0x1DHandle Value IndicationServer pushes value update (requires confirmation)
0x1EHandle Value ConfirmationClient confirms receipt of indication
0x52Write CommandWrite without response (fire-and-forget)