When advertising mode is enabled, the BLE device will start to transmit special packets carrying advertising information as Payload Data Units (PDU) on the RF channels dedicated for this purpose. BLE is utilizing a common structure of over the air packets for advertizing and data channels. A full break down of over the air interface can be found in , , . This article only describes the part of it related to the advertising mode.
Click on image to enlarge.
Figure 2: The advertising channel carries the device's discovery and connection establishment information; a non-connectable undirected advertising PDU contains device MAC address and up to 31 octets of data formatted as AD structures.
As shown in Figure 2
, BLE over the air packets consist of the Preamble (1 octet), Access Address (4 octets), Payload Data Unit (PDU) (up to 39 octets) and CRC (3 octets). For data channels, the Access Address is different for each LL connection between 2 devices, but for advertising channels it has the same 32-bit value (0x8E89BED6).
An advertising channel PDU has a header and actual payload. The header contains information about the size of the payload and its type: advertising channels are used for exchanging information before making a connection between devices. Hence, different payload types are supported to broadcast information about the device's ability (on inability) to support a connection, to request more information or to respond with additional device information and to request the initiation of a data connection with another device.
Considering all available advertising types, only one will be suitable for a device which can only broadcast information but not support full functionality of the BLE stack. A non-connectable undirected advertising type signals to scanning devices that the advertising device will not support a data connection - only broadcast information.
This type of advertising contains a MAC address (6 octets using IEEE format) of the device sending the information and actual information up to 31 octets.
The BLE channel plan consists of 37 data communication channels and 3 dedicated advertising channels used for device discovery, connection initiation and broadcast. Advertising channels are allocated in different parts of the spectrum to provide immunity against interference from 802.11/Wi-Fi.
An advertising event comprises sending advertising data on each enabled advertising RF channel (1 to 3 channels may be selected in configuration). The time between two consecutive advertising events is defined as an advertising interval and can be configured from 100ms to 10.24sec (value multiple of 0.625 ms) for a non connectable undirected advertising type.
In order to minimize advertising package collusion from multiple collocated devices, a random delay interval (0 to 10ms) is added before each advertising event.
Enabling advertising functionality with the help of a BLE controller
Generally speaking, a BLE advertising device can be implemented using just a 2.4GHz GFSK transmitter which supports the required specification for the BLE PHY layer and a small MCU which will periodically send a pre-assembled BLE Advertising packet to the radio part for transmission. A MCU in this case has to manage configured advertising time intervals with random delays and switching between different advertising channels during the advertising event.
In addition, if an advertising message is dynamic and the advertising packets have to be reassembled, a MCU has to calculate a new CRC value and whitening the data in the packet before transmission as it is required in the BLE specification.
Another option is to use a dedicated BLE controller IC which will take care of all the nuances of BLE Adverting packet assembly, transmission timing and RF channel management. A BLE controller supports a set with a few dozen HCI commands typically used by the host part of the stack to communicate with the LL .
But in the case of a TX-only device, the advertising mode can be fully controlled with just 3 HCI commands.
command is used to set the data for the advertising payload. The maximum size of the advertising data is 31 octets and it has to be formatted according to the BLE specification described later in the paper.
command is used to set the advertising parameters. Along with other parameters, this command sets the advertising type (in this case it has to be non-connectible undirected advertising), values for minimum and maximum duration of advertising intervals and enabled advertising channels.
command is used to request the Controller to start or stop advertising. The Controller manages the timing of the advertisement interval based on the parameters sent by the command described earlier, the LE_Set_Advertising_Parameters
. The BLE controller will continue to broadcast advertising information until this command is sent again with the request to stop advertising.
It shrinks the size of the BLE stack for an advertizing only device down to implementation of those 3 HCI commands and depending on particular implementation and additional functionality (e.g. SPI/UART driver), it will typically take less then 1Kb of MCU memory!