Section 18.5.4

BLE connection-interval quantization

Full name: Bluetooth Low Energy (BLE) connection-interval quantization.

Definition

BLE connection-interval quantization describes a scheduling effect in Bluetooth Low Energy (BLE) §7.1. Imagine a device gets one chance to transmit every 10 milliseconds. If its packet is ready just before a chance, it can go immediately. If it is ready just after, it waits almost 10 milliseconds. A small change in local processing time can therefore move a packet to the next connection event. Real events may offer several transmission opportunities.

Where it fits

Main entry: Connection interval (§7.7).

The connection interval entry explains how the two devices agree on their schedule. The ordinary interval uses 1.25 ms (millisecond) units. Controllers supporting the Shorter Connection Intervals feature can also negotiate supported intervals on a finer grid. The calculation below works for either schedule once the interval is fixed. Take an idealized model with one chance to send at each connection event, and events at times 0,T,2T,…0, T, 2T, \dots, where TT is the interval. A packet that becomes ready at time tt is sent at the first event at or after tt, at time ⌈t/T⌉T\lceil t / T \rceil\, T, where ⌈x⌉\lceil x \rceil means xx rounded up to a whole number. Its wait for the radio is w=⌈t/T⌉T−tw = \lceil t / T \rceil\, T - t, at least 0 and less than TT.

Let T=10T = 10 ms. A packet ready at 9.80 ms is sent at 10 ms after waiting 10−9.80=0.2010 - 9.80 = 0.20 ms. Add 0.10 ms of local work: the packet is ready at 9.90 ms and still sent at 10 ms. The wait shrinks to 0.10 ms, and the peer sees no change. Now start from 9.95 ms. The same 0.10 ms of work makes the packet ready at 10.05 ms, after the event at 10 ms, so it is sent at 20 ms and the peer sees 10 ms of extra delay. In general, an added delay dd smaller than TT moves the sending time by 0 when d≤wd \le w and by TT when d>wd > w.

Which case occurs depends on the phase, the position of the ready time within the interval. When the phase is uniformly distributed, equally likely to fall anywhere in the interval, the wait ww is uniform between 0 and TT, its mean is T/2T / 2, and an added dd crosses the next event with probability d/Td / T. The mean added delay is then (d/T)×T=d(d / T) \times T = d: on average the peer sees exactly the added time, but it arrives as a whole interval for a few packets. With T=10T = 10 ms and d=0.1d = 0.1 ms, 0.1/10=0.010.1 / 10 = 0.01, so 1% of packets arrive 10 ms later and 99% arrive no later.

When the phase is locked to the schedule, nothing averages out. A device that answers a request received in a connection event starts its work at a fixed point §3.22 of the schedule. In this model, if its processing ends before the next event, every answer leaves one interval after its request, and 100 microseconds of extra processing changes nothing as long as processing still ends before that event. Once processing runs past the next event, every answer leaves one interval later. Plotted as an ECDF §11.17 (empirical cumulative distribution function), the fraction of measured delays at or below each value, quantized delays rise in steps one interval apart, like a staircase.

Limits and common mistakes

Real links depart from the one-chance model. A connection event can carry several packets, so a packet that reaches the controller, the part of the Bluetooth stack that runs the radio, while an event is still running may leave in that event. The controller’s last moment to take a packet for an event can lie before the event starts. A packet that needs retransmission §7.36 may get another opportunity in the same event or in a later one, depending on the remaining event time and the link state. The peripheral latency parameter, called slave latency in older versions of the specification, lets the peripheral, the device that accepted the connection, sleep through a set number of events, so data sent to the peripheral can wait several intervals. Either device can also request a new interval during a connection.

A staircase does not identify its cause. Timer quantization §11.35, the rounding of a measured time to the ticks of the clock that measures it, also produces steps. Compare the step spacing with the connection interval, and compare only delays measured in one clock domain §13.29, the set of timestamps produced by a single clock.

Questions answered

Does an added 100μs100\,\mu\mathrm{s} always add 100μs100\,\mu\mathrm{s} peer delay?

No, an added 100 microseconds (100μs100\,\mu\mathrm{s}) of local work does not always add 100 microseconds of peer delay. Consider a Bluetooth Low Energy (BLE) connection with exactly one chance to send the packet per event. In that model the extra work either preserves the original sending time or moves it to the next event. A real event can hold several packet exchanges. With a 10 ms (millisecond) interval, a packet ready at 9.80 ms leaves at 10 ms, and still leaves at 10 ms when it becomes ready at 9.90 ms. A packet ready at 9.95 ms becomes ready at 10.05 ms, misses the event at 10 ms and leaves at 20 ms, 10 ms later.

In this model, a uniformly random ready time gives a mean added peer delay of 100 microseconds: a fraction 0.1/10=0.010.1 / 10 = 0.01 of packets is delayed by 10 ms, and 0.01×10=0.10.01 \times 10 = 0.1 ms. When the work is tied to the schedule, as with a reply to a request received in a connection event, the added time can delay no packet at all, or every packet by a whole interval.

Related entries: Resolution versus precision versus accuracy (§11.34), Clock domain (§13.29), Response time versus execution time (§9.32), Empirical cumulative distribution function (ECDF) (§11.17), Counter quantization (§11.35), Quantization error in a measured interval (§18.1.3). Further reading: [93].