Section 7.1

Bluetooth Low Energy (BLE)

Definition

Bluetooth Low Energy (BLE) is a short-range wireless communication technology designed for devices that must run for months or years on a small battery. It has been part of the Bluetooth Core Specification, published by the Bluetooth Special Interest Group (SIG), since version 4.0 in 2010. BLE devices exchange short packets at agreed moments and switch their radios off in between. BLE is a separate radio system from the original Bluetooth, called BR/EDR (Basic Rate/Enhanced Data Rate) or Bluetooth Classic; the two cannot communicate, although one device can implement both.

The idea

A temperature sensor on a coin-cell battery reports a reading to a phone every second. With illustrative round figures, the battery stores 220 mAh (milliampere-hours: it can supply 1 milliampere for 220 hours), and the radio draws 5 mA (milliamperes) while it is on. A radio that stays on empties the battery in 220/5=44220 / 5 = 44 hours.

BLE keeps the radio off instead. The two devices agree on a schedule, wake together for about a millisecond to exchange a few packets, and sleep until the next agreed moment. A radio that is on for 1 ms in every 100 ms draws on average 0.01×5=0.050.01 \times 5 = 0.05 mA, and the battery then lasts 220/0.05=4400220 / 0.05 = 4400 hours, about six months, before the chip’s small sleep current is counted.

The second idea is layering. Moving one setting from a phone into a sensor’s program involves separate jobs: keeping both devices’ timing in step, choosing channels, resending lost packets, agreeing on keys, encrypting, and naming the data item. The specification gives each job to one layer, and each layer uses the one below it through a defined interface. Knowing which layer owns a job tells you where the job is done, which part of the device can observe it, and what an error in it can affect.

How it works

The specification arranges BLE in layers. From the bottom:

  1. Physical layer: the radio. BLE uses the 2.4 gigahertz (GHz) band, which most countries open to use without a license, divided into 40 channels 2 megahertz (MHz) apart, from 2402 MHz to 2480 MHz. Three of the channels carry advertising, the announcements by which devices find each other; the other 37 carry the data of connections. The basic mode, called LE 1M (LE for Low Energy), sends 1 million bits per second. Version 5.0 added LE 2M, which sends 2 million, and LE Coded, which sends fewer bits per second but reaches farther.

  2. Link Layer §7.6: the formats of packets, advertising and scanning §7.3, setting up connections, the timing of every exchange in a connection, the choice of channel for each exchange (frequency hopping), detection of damaged packets with a 24-bit CRC §4.32 (cyclic redundancy check), acknowledgment and resending of lost packets, and encryption of packets once the devices share a key.

  3. HCI §7.5 (Host Controller Interface): the defined set of commands, events and data packets that connects the layers above it to the two below.

  4. Host protocols:

    • L2CAP §7.15 (Logical Link Control and Adaptation Protocol) divides one connection into numbered channels, and splits and rejoins messages that are too long for one packet.

    • ATT §7.9 (Attribute Protocol) lets a client read and write numbered data items, called attributes, that a server holds.

    • GATT §7.10 (Generic Attribute Profile) groups attributes into services and characteristics, such as a heart-rate service that contains a heart-rate measurement characteristic.

    • The Security Manager carries out pairing §7.17, the procedure by which two devices create shared keys, and exchanges its messages in the Security Manager Protocol (SMP) §7.19.

    • GAP (Generic Access Profile) defines the roles that devices take, such as central and peripheral, and the procedures for discovery, connection and security.

  5. Application: the program that gives the data its meaning. It often follows a profile, a published specification of the services needed for one use, such as heart-rate monitoring.

The Physical layer and the Link Layer together form the Controller §7.4; the Host protocols form the Host. A value that the application sends passes down through ATT, L2CAP and the Link Layer, each of which adds its own bytes, and the receiver removes them in reverse order, as the worked example shows.

Once two devices are connected, the Link Layer runs a fixed schedule. Every connection interval §7.7, the period that the devices agreed, both wake on the next channel of the hopping sequence. The central, the device that started the connection, transmits first, and the peripheral answers 150 microseconds after the central’s packet ends. If the peer stays silent for longer than the supervision timeout §7.8, the Link Layer declares the connection lost.

Worked example

A phone writes a new sampling period of 1000 ms to a sensor over an encrypted connection that uses LE 1M. The bytes grow as the value passes down the layers.

  1. Application: 1000 written as a 2-byte number, least significant byte first. In hexadecimal notation 1000 is 0x03E8, so the bytes are 0xE8, 0x03: 2 bytes.

  2. ATT: a Write Request is 1 byte that names the operation, 0x12, then a 2-byte attribute handle, the number that identifies the attribute (here 0x002A), then the value: 1+2+2=51 + 2 + 2 = 5 bytes.

  3. L2CAP: a 4-byte header, made of 2 bytes of length and 2 bytes of channel number, with channel 0x0004, which is reserved for ATT: 4+5=94 + 5 = 9 bytes.

  4. Link Layer: a 2-byte header, the 9 bytes, and a 4-byte MIC (message integrity §1.9 check), a value that lets the receiver detect a change to the packet’s content, except with probability about 2−322^{-32} for each forged packet: 2+9+4=152 + 9 + 4 = 15 bytes.

  5. Link Layer framing for the radio: a 1-byte preamble, which lets the receiver lock onto the signal, a 4-byte access address, which identifies the connection, and the 3-byte CRC: 1+4+15+3=231 + 4 + 15 + 3 = 23 bytes.

On LE 1M each bit takes 1 microsecond, so the packet occupies the channel for 23×8=18423 \times 8 = 184 microseconds. Only 2 of the 23 bytes are the application’s value; the other 21 belong to the layers. Without encryption the MIC is absent, and the packet has 23−4=1923 - 4 = 19 bytes, which take 19×8=15219 \times 8 = 152 microseconds. The receiving sensor reverses the steps. Its Link Layer checks the CRC and the MIC, L2CAP sees channel 0x0004 and hands the 5 bytes to ATT, ATT finds attribute 0x002A, and the application decides whether to accept 1000 ms as its new sampling period.

Stated precisely

The Bluetooth Core Specification gives the Controller (Physical layer and Link Layer) everything with a deadline measured in microseconds: when and on which channel each packet is sent, whether it arrived intact, whether it must be resent, and its encryption with a key that the Host supplies. It gives the Host (L2CAP, ATT, GATT, the Security Manager and GAP) the meaning of the bytes inside packets, and it defines HCI as the interface between the two. These are logical responsibilities: the specification defines what crosses each interface, not which chip runs each layer. A phone usually has a separate Bluetooth chip for the Controller and runs the Host in its operating system; a small sensor usually runs both on one microcontroller §6.1.

For one Link Layer packet on LE 1M, let PP be the number of bytes it carries from L2CAP, and let M=4M = 4 if the connection is encrypted and M=0M = 0 if it is not. The packet is 1+4+2+P+M+3=P+M+101 + 4 + 2 + P + M + 3 = P + M + 10 bytes long and occupies the channel for 8(P+M+10)8(P + M + 10) microseconds. On LE 2M the preamble is 2 bytes instead of 1, and each bit takes half a microsecond.

BLE and Bluetooth BR/EDR

BR/EDR is the original Bluetooth radio system, still used for continuous streams such as audio to a headset. Basic Rate sends 1 million bits per second; Enhanced Data Rate, added in version 2.0, sends 2 or 3 million. BR/EDR divides the same 2.4 GHz band into 79 channels 1 MHz apart and has packet formats and procedures of its own, so a BLE-only device cannot communicate with a BR/EDR-only device. A dual-mode device implements both as two transports, which usually share the antenna and parts of the Host.

The transports differ most in where pairing happens. In BR/EDR, the two Controllers set up the link, carry out pairing (in its current form called Secure Simple Pairing) and negotiate the length of the encryption key between themselves, with the Link Manager Protocol (LMP); the Host supplies the user’s input and stores the resulting key, called the link key. In BLE, pairing runs in the Host’s Security Manager and produces a long-term key §7.28 (LTK), which the Host hands to the Link Layer. A check on BLE events in the Host, such as LE connections, LE pairing or attribute operations over LE, therefore never observes BR/EDR link setup or key negotiation. The KNOB attack (Key Negotiation of Bluetooth, 2019) [272], a downgrade attack §1.27, exploited this: an attacker in radio range altered the BR/EDR key-length negotiation in LMP so that the key held only 1 byte of unpredictable content, without either Host being notified.

With cross-transport key derivation (CTKD), introduced in version 4.2 together with LE Secure Connections §7.21, the BLE pairing method that version added, two dual-mode devices that have paired over one transport compute the key for the other transport from the key they share, with a fixed key derivation function §5.20, so the user pairs only once: an LTK yields a BR/EDR link key, and a link key yields an LTK. This couples the security of the two transports. A key established over one transport, possibly by an attacker, can replace the key for the other; the BLURtooth attacks, published in 2020 [273], used CTKD to overwrite keys established with authentication §1.6 by keys that an attacker established without it.

Limits and common mistakes

“The message was accepted” needs a layer. A Link Layer acknowledgment means only that the peer’s Link Layer received the packet intact, not that the peer’s Host parsed it or its application acted on it. An ATT Write Response means that the peer’s attribute server accepted the write; what the application does with the value is a separate matter.

Link Layer encryption protects packets on the air between two Controllers. It does not tell the application who the peer is unless pairing authenticated the peer, and it does not protect data once the receiving Link Layer has decrypted it.

Low energy is not automatic. Continuous scanning, or a very short connection interval, keeps the radio on most of the time.

The radio’s bit rate is not the rate of useful data. Headers, the MIC, the CRC, the 150-microsecond gaps and the peer’s replies all take airtime §18.2.19, so on LE 1M an application receives far fewer than 1 million bits of its own data per second.

Features depend on what both devices implement. LE 2M, LE Coded and extended advertising (advertisements longer than 31 bytes of data) date from version 5.0 and LE Secure Connections from version 4.2, and several of them are optional, so a product’s Bluetooth version number does not show which of them it supports.

Questions answered

Which layer owns connection timing, pairing, and application data respectively?

The Link Layer in the Controller owns connection timing, the Security Manager in the Host owns pairing, and the application owns application data, which ATT (Attribute Protocol) and GATT (Generic Attribute Profile) in the Host carry without interpreting. Bluetooth Low Energy (BLE) divides a device into a Controller, made of the radio and the Link Layer, and a Host, made of the higher protocols; the two are joined by the Host Controller Interface (HCI).

Connection timing: the Host requests parameters, such as how often the devices meet (the connection interval), through HCI commands, and the Link Layer then runs the schedule. It fixes the moment of every meeting, picks the channel, sends and acknowledges packets, and declares the connection lost when the peer stays silent too long, without involving the Host packet by packet.

Pairing: the Security Manager exchanges Security Manager Protocol (SMP) messages with the peer and computes the keys; the Controller may help with random numbers, with the elliptic-curve Diffie–Hellman §19.1.5 computation through which the two devices agree on a secret, and with AES (Advanced Encryption Standard) encryption. The Host then hands the key to the Link Layer, which encrypts every packet that carries data or a control message. The Host owns the agreement on keys, and the Controller owns their use on air.

Application data: ATT and GATT deliver an attribute’s bytes and enforce its access rules, such as requiring an encrypted link. The application decides what the bytes mean and whether to obey the request.

Related entries: BLE Controller and Host (§7.4), Link Layer (§7.6), Security Manager Protocol (SMP) (§7.19), Asynchronous completion (§9.28), Host Controller Interface (HCI) (§7.5), Pairing (§7.17), Long-term key (LTK) (§7.28). Further reading: [18, 19, 93, 272, 273].