Understanding BLE Architecture: Protocol Stack Overview

<\/script>\n
'; }, get iframeSnippet() { const domain = '{ SITE_DOMAIN }'; const type = '{ embed_type }'; const slug = '{ embed_slug }'; return ''; }, get activeSnippet() { return this.method === 'script' ? this.scriptSnippet : this.iframeSnippet; }, copySnippet() { navigator.clipboard.writeText(this.activeSnippet).then(() => { this.copied = true; setTimeout(() => { this.copied = false; }, 2000); }); } }" @keydown.escape.window="open = false" @click.outside="open = false">

Embed This Widget

Theme


      
    

Widget powered by . Free, no account required.

PHY, Link Layer, L2CAP, ATT, GATT, and GAP explained

| 2 min read

BLE Protocol Stack Architecture

The BLE protocol stack is a layered architecture where each layer provides services to the layer above it. Understanding the stack is essential for debugging, optimization, and implementing custom profiles. The Bluetooth SIG defines the full stack in the Core Specification.

Protocol Stack Layers

The stack divides into Controller (hardware/firmware) and Host (software), separated by the HCI interface.

Layer Section Responsibility
Application Host Business logic, user data
ATT">GATT Host Service/characteristic data model
ATT Host Attribute read/write protocol
SMP Host Pairing, key distribution
GAP Host Discovery, connection management
L2CAP Host Logical channels, segmentation
HCI Interface Host–Controller transport
Link Layer Controller Scheduling, encryption, CRC
PHY Controller Radio modulation, channel selection

PHY to Application: Data Flow

  1. PHY — Transmits/receives bits using GFSK modulation. Three PHY modes: LE 1M (1 Mbps), LE 2M (2 Mbps), LE Coded (125/500 kbps with FEC for long range).
  2. Link Layer — Manages advertising, connection events, frequency hopping, and AES-128 encryption using the channel map.
  3. L2CAP — Multiplexes ATT, SMP, and other channels. EATT enables multiple concurrent ATT bearers.
  4. ATT/GATT — Defines a client/server model. The GATT server hosts services containing characteristics and descriptors.
  5. SMP — Negotiates pairing and bonding, including key generation for LESC.

GAP and GATT Roles

GAP defines four device roles:

GAP Role Behavior Typical Device
Broadcaster Advertises, never connects Beacon
Observer Scans, never connects Gateway logging beacons
Peripheral Advertises, accepts connections Sensor, wearable
Central Scans, initiates connections Smartphone, hub

GATT roles (Client/Server) are independent of GAP roles. A smartphone is simultaneously a GAP Central and a GATT Client; a sensor node is a GAP Peripheral and a GATT Server. Hybrid configurations exist — a hub can be both a GATT Server (for downstream devices) and a GATT Client (toward cloud).

Use the GATT Profile Browser to explore standard GATT service structures. For connection-phase tuning, see Connection Parameters Optimization.

Frequently Asked Questions

The BLE stack is split into a controller layer (PHY, Link Layer, HCI) and a host layer (L2CAP, ATT, GATT, GAP, SMP). On a single-chip SoC like the nRF52840, both layers run on the same processor but are logically separated by a software HCI. On a dual-chip design such as a Linux host connected to a radio module via UART, they run on physically separate chips.

GAP (Generic Access Profile) governs device visibility and connection establishment. It defines roles (Central, Peripheral, Broadcaster, Observer), advertising modes, connection procedures, and security requirements. GAP sits at the top of the host stack and determines whether a device is discoverable and connectable.

L2CAP (Logical Link Control and Adaptation Protocol) provides multiplexing so that multiple higher-layer protocols (ATT, SMP, LE Credit-Based Flow Control channels) can share a single BLE connection. It also handles segmentation and reassembly of ATT packets larger than the Link Layer PDU size, enabling the MTU extension negotiated during connection setup.

Once a connection is established, the Link Layer uses AFH (Adaptive Frequency Hopping) across the 37 data channels following a pseudo-random sequence seeded by the hop increment and channel map agreed during connection setup. Channels with persistent interference can be removed from the map by the Central using a LL_CHANNEL_MAP_IND control procedure.

Yes, our guides range from beginner introductions to advanced topics. Each guide indicates its difficulty level and prerequisites so you can find the right starting point.