BLE link layer tutorial – Advertising Events, Connection Events

 

Chapter 8 — BLE Link Layer
Part 3: Events — Advertising Events, Connection Events & Timing Parameters
Adv Interval
20 ms – 10.24 s
Adv Delay
0 – 10 ms random
connInterval
7.5 ms – 4.0 s
Hop per Event
1 channel change
Keywords:

BLE advertising events ADV_IND SCAN_REQ SCAN_RSP BLE advInterval advDelay T_advEvent formula BLE connection events BLE anchor point BLE connInterval BLE low duty cycle advertising BLE advertising rotation channels BlueZ advertising setup

8.7 — What Are Events?

In BLE, the physical channel is divided into time slots called events. An event is a bounded window of time during which a specific type of radio activity takes place. Everything that happens over the BLE radio happens inside an event — no transmissions occur outside of them.

There are exactly two types of events, one for each use of the two physical channel types:

📢

Advertising Events

Occur on the 3 advertising channels. Used for device discovery, broadcasting data, and connection setup.

🔗

Connection Events

Occur on the 37 data channels. Used for actual data transfer between a connected Master and Slave.

8.7.1 — Advertising Events

What Happens Inside a Single Advertising Event

Each advertising event is a self-contained activity that happens on one specific advertising channel. Here is the sequence of what can occur within a single event:

Single Advertising Event — Packet Exchange Sequence

📡 Advertiser
ADV_IND
“I exist, connectable”
← waits →
SCAN_RSP
“here’s more info”
Event closed ✓
Move to next ch

broadcast
to all
optional
request
optional
response

🔍 Scanner
← receives ADV_IND →
SCAN_REQ
“send more details”
← receives SCAN_RSP →
Key rules of an advertising event:
• All packets in one event are on the same channel
• The event ends after the optional SCAN_REQ/SCAN_RSP exchange
• The next event uses the next advertising channel in rotation
• SCAN_REQ is optional — the Scanner may just listen without responding

The three packet types explained:

ADV_IND — Advertising Indication. Sent by the Advertiser at the start of every advertising event. This is a general broadcast that says “I exist, I am connectable, here is my address and some basic data.” Any Scanner within radio range receives it.
SCAN_REQ — Scan Request. Sent by the Scanner back to the Advertiser if it wants more information than what the ADV_IND packet contained. For example, if the full device name was too long to fit in the ADV_IND, the Scanner asks for it via SCAN_REQ.
SCAN_RSP — Scan Response. Sent by the Advertiser in reply to a SCAN_REQ within the same event. Contains the additional data that could not fit in the original ADV_IND. Must be sent on the same channel as the ADV_IND that triggered this exchange.
Channel Rotation — How Advertisers Cycle Through Channels 37, 38, 39

An Advertiser does not send just one packet per advertising interval. It sends advertising packets on all three advertising channels consecutively, then waits before repeating. The channel rotation is always in the same order: channel 37 first, then 38, then 39, then back to 37 again.

A sniffer capture of six advertising events shows this rotation clearly:

Six Advertising Events — Channel Rotation Captured by Sniffer

Frame Channel Type Notes
#425 Ch 38 ADV_IND First event — starts on channel 38 this cycle
#426 Ch 39 ADV_IND Second event — next channel in rotation
#427 Ch 37 ADV_IND Third event part 1/3 — Advertiser broadcasts
#428 Ch 37 SCAN_REQ Same event — Scanner requests more info
#429 Ch 37 SCAN_RSP Same event — Advertiser responds. Event closes.
#430 Ch 38 ADV_IND New cycle starts — rotation repeats from 38
#431 Ch 39 ADV_IND Second event of new cycle
#432 Ch 37 ADV_IND Third event of new cycle
Observed timing from sniffer delta timestamps:
Between channels 37→38→39: approximately 300–400 microseconds gap (very fast)
Between last channel of one cycle and first of the next: approximately 39–42 milliseconds (power saving gap)

Notice frames #427, #428, and #429 — they are all on channel 37 and they together form a single advertising event. Even though three packets are exchanged, it is still one event because it is all on one channel without a channel change. This confirms the rule: an advertising event stays on one channel throughout.

Advertising Timing Parameters — advInterval and advDelay

The time between the start of two consecutive advertising events is controlled by two parameters working together. Understanding these is essential for balancing how quickly a device can be discovered against how much battery it uses.

T_advEvent = advInterval + advDelay

T_advEvent = advInterval + advDelay
advInterval
20 ms to 10.24 s
Set by the application
+
advDelay
0 to 10 ms
Random, chosen by stack

Timeline showing two advertising cycles:

advInterval

delay

█ Advertising burst (3 packets on ch37,38,39) — Silent (radio off) — Random delay

Why is there a random delay? The advDelay is deliberately randomised by the BLE stack on every cycle. If two devices happened to be advertising at exactly the same interval, their packets would always collide on the same channels at the same time — every cycle. By adding a small random delay, the two advertising sequences quickly drift apart in time, so collisions only happen occasionally rather than every single cycle.

Short advInterval (e.g. 20 ms)

Packets sent very frequently. A Scanner can find this device almost instantly. Downside: high power consumption because the radio transmits often.

Long advInterval (e.g. 10 seconds)

Packets sent rarely. Very low power consumption. But it may take many seconds for a Scanner to discover the device, which makes connection setup feel slow from the user’s perspective.

The BLE 4.1 specification introduced a low duty cycle directed advertising mode. This is useful when a device wants to reconnect to a specific known peer but does not need the reconnection to happen immediately. In this mode, advertising packets are sent at a very low rate, significantly reducing power consumption. If the peer comes into range, they will eventually discover the device and reconnect. This is the right mode for a fitness tracker that lost Bluetooth contact with its paired phone and is patiently waiting for the phone to come back within range.

/* Setting BLE advertising parameters with BlueZ HCI */
/* Equivalent of: hciconfig hci0 leadv */

#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>

int setup_advertising(int hci_sock)
{
    le_set_advertising_parameters_cp adv_params;
    memset(&adv_params, 0, sizeof(adv_params));

    /* Advertising interval in units of 0.625 ms */
    /* 0x0020 = 32 units × 0.625 ms = 20 ms (fastest/most battery) */
    /* 0x0800 = 2048 units × 0.625 ms = 1280 ms (balanced)         */
    /* 0x4000 = 16384 units × 0.625 ms = 10240 ms (slowest/lowest) */
    adv_params.min_interval = htobs(0x0800); /* 1280ms */
    adv_params.max_interval = htobs(0x0800);

    /* Advertising type:                                            */
    /* 0x00 = ADV_IND    (connectable undirected — most common)     */
    /* 0x01 = ADV_DIRECT_IND (connectable directed — fast connect)  */
    /* 0x02 = ADV_SCAN_IND   (scannable undirected — beacon mode)   */
    /* 0x03 = ADV_NONCONN_IND (non-connectable — broadcast only)    */
    adv_params.advtype = 0x00; /* ADV_IND */

    /* Use all three advertising channels */
    adv_params.chan_map = 0x07; /* bits: ch39=1, ch38=1, ch37=1 */

    /* No filter — respond to all scan requests and connect requests */
    adv_params.filter_policy = 0x00;

    struct hci_request rq = {
        .ogf    = OGF_LE_CTL,
        .ocf    = OCF_LE_SET_ADVERTISING_PARAMETERS,
        .cparam = &adv_params,
        .clen   = LE_SET_ADVERTISING_PARAMETERS_CP_SIZE,
    };

    return hci_send_req(hci_sock, &rq, 1000);
}

8.7.2 — Connection Events

What Happens Inside a Connection Event

Once two BLE devices are connected, all data transfer happens inside connection events. A connection event is a scheduled window of time during which the Master and Slave exchange data on a single data channel. The channel changes between events using the adaptive frequency hopping algorithm discussed earlier.

The start of a connection event is called an Anchor Point. This is an important concept because it is the fixed timing reference that both Master and Slave synchronise to. The Anchor Point is always controlled by the Master — the Master defines when connection events start.

Connection Events — Anchor Points and Channel Hopping

← connInterval (e.g. 50 ms) →

Anchor Point 1 — channel f(k)
Master
DATA PDU →
DATA PDU →
Slave
← ACK/DATA

Both devices sleep here — radio off

Anchor Point 2 — channel f(k+1) — different channel!
Master
DATA PDU →
Slave
← ACK/DATA

Key rules of connection events:

  • All packets within one connection event are on the same frequency — no hopping during an event
  • Channel hopping occurs at the start of each new event — frequency changes between events
  • The Master always transmits first at the Anchor Point — the Slave listens and responds
  • The Slave always responds to a Master packet; the Master may or may not respond to Slave packets
  • Either device (Master or Slave) can close the connection event
Connection Event Timing Parameter — connInterval

The connInterval is the time between the start of two consecutive connection events — equivalently, the time between two successive Anchor Points. It is expressed as a multiple of 1.25 milliseconds and must be in the range of 7.5 ms to 4.0 seconds.

connInterval Range and Trade-offs

7.5 ms
fastest
4.0 s
slowest
Short connInterval
e.g. 7.5 ms
✓ Low latency data
✓ Responsive app feel
✗ Higher power use
✗ Radio wakes often
Long connInterval
e.g. 1 second
✓ Very low power
✓ Long battery life
✗ High latency
✗ Slow data exchange

The connInterval is negotiated between the Master and Slave during connection setup and can be renegotiated during an active connection. For example, a heart rate monitor streaming data every second would want a short interval during active monitoring, but could request a longer interval when idle to save battery.

/* Requesting a connection interval update from a Peripheral (Slave) */
/* This uses the L2CAP Connection Parameter Update Request           */
/* In BlueZ, the application triggers this via the GATT layer        */

/* hcitool command equivalent: */
/* hcitool lecc --interval 40 --latency 0 --timeout 500 AA:BB:CC:DD:EE:FF */
/* --interval 40 = 40 × 1.25ms = 50ms connection interval                 */
/* --latency  0  = 0 events can be skipped (slave latency)                 */
/* --timeout 500 = 500 × 10ms = 5s supervision timeout                    */

/* In a C program using BlueZ GATT: */
/* bt_gatt_client_set_conn_params() can request new parameters from host  */

Part 3 Complete

You understand both event types, all advertising packet types, the timing parameters that control them, and the Anchor Point concept for connection events. Part 4 covers the remaining connection parameters, BLE topology scenarios, and the link layer packet format.

Leave a Reply

Your email address will not be published. Required fields are marked *