Tuesday, March 19, 2024

Understanding Reliability In Bluetooth Technology

By Martin Woolley

The highlights below discuss the intricacies of Bluetooth reliability in an in-depth manner and address the many connectivity obstacles for optimal use of this wireless communication technology. Effective data transmission and reception requires a careful grasp of packet delivery over different instances of time.

Like other wireless communication technologies, Bluetooth also uses radio. But radio as a medium for encoding and conveying data is not reliable as there are all sorts of challenges present. So not just Bluetooth, any communication technology that is built on radio at the physical layer has to contend with a whole range of fundamental problems. But with the right stack design and the right processes in the various layers, a highly reliable radio communication can be established.

Collision taking place on channel number 2
Fig. 1: Collision taking place on channel number 2

In simple words, a reliable Bluetooth communication takes place when the data transmitted equals the data received and any intended action relating to that data happens as expected. In the real world, however, there can sometimes be more nuanced definitions, subject to different reliability parameters involved. For example:

Tolerance for failure

A 99.9999% success rate may be deemed reliable.

Latency

A low system delay is required for intended actions to be observed within 500 milliseconds of data transmission.

- Advertisement -

Transactions

Series of updates where either all changes are applied successfully or none of the changes are made.

Resilience

The system successfully processes operations even after certain components face failure/deterioration.

Missed packets in unsynchronised communication
Fig. 2: Missed packets in unsynchronised communication

- Advertisement -

Challenges to radio based technologies

Radio communications take place within channels of the radio spectrum. If two devices transmit on the same channel at the same time, they corrupt each other—resulting in data loss. This is known as collision. The probability of its occurrence is determined by the recurrence and time taken for transmission. Adding to that is the transmission speed and packet size.

Energy decrease with distance
Fig. 3: Energy decrease with distance

As you all know, Bluetooth uses the 2.4GHz band, which is also known as ISM. Wi-Fi, ZigBee, and DECT phones can use this band as well.

Radios in Bluetooth devices are generally half-duplex, that is, they can both transmit and receive but not at the same time. Take for instance a scenario where a packet is transmitted on a channel by device A to device B.

For the reception, device B must be actively listening on the correct channel at the same time. If it is not listening, or is on a different channel, the packets will not be received. The proportion of time a device spends listening is called the Rx duty cycle. Do not forget, a device can listen only on a single channel at a time.

Signal strength also has a huge impact. One is likely to experience more errors when signal strength is low (due to it being relatively close to background noise). The Bluetooth core specification states that a bit error rate (BER) of up to 0.1% is permitted. Anything beyond that is not acceptable.

The signal strength at which a radio can stay within this limit is known as its receiver sensitivity. So, if you are a product designer, choosing a radio with good receiver sensitivity is important.

Stack implementations often include several buffers for temporary packet storage. If the rate of packet arrival into a buffer exceeds the rate of packet consumption for a long enough period of time, the buffer will start to overflow and data will be lost.

Reliability challenges addressed by GFSK

The way in which radio signal properties are used for representing digital data is known as modulation scheme. The schemes based on frequency tend to be less susceptible to interference due to noise than those which are based on amplitude.

GFSK shifts a central carrier frequency upwards or downwards to represent 1 or 0
Fig. 4: GFSK shifts a central carrier frequency upwards or downwards to represent 1 or 0

Bluetooth uses a special frequency based modulation scheme called Gaussian frequency shift keying (GFSK). It works by shifting a central carrier frequency upwards or downwards to represent either 1 or 0.

But abrupt changes in frequency can generate noise. Therefore, GFSK adds a filter, which causes frequency transitions to be smooth and less noisy. GFSK is a good fundamental platform on which to base your wireless communication.

Bluetooth packet fields

A Bluetooth packet has various fields. At the beginning is the preamble, which is 8-bit long and contains an alternating pattern of 1s and 0s. It is used for finding the precise transmitter frequencies and to set the radio’s gain control.

The fields in a Bluetooth packet
Fig. 5: The fields in a Bluetooth packet

Access address, which is 32-bit long, contains a special value, which means the packet can be received by any Bluetooth device or a unique identifier for a specific connection. Since a Bluetooth controller will be receiving both relevant and irrelevant signals, it must be able to distinguish and accurately pick out the relevant ones.

At the far end, there is the cyclic redundancy check (CRC) that detects cases of transmitted data being unintentionally changed or corrupted due to collisions. It is performed by comparing the CRC calculated by the transmitter with the CRC calculated by the receiver. If they are not the same, then corruption must have occurred, and the packet is discarded.
The message integrity code (MIC), also called a message authentication code (MAC), is a security feature that aids the detection of data deliberately tampered with (as opposed to accidentally through collisions).

Error correction

There is a variant of the stack’s physical layer (PHY) called the LE Coded PHY, which allows Bluetooth to not only detect errors but also correct them in packets up to certain limits. This aids communication at a low signal to noise ratio (SNR).

The further from the transmitter you go, the lower the signal strength and worse the SNR will become, making it harder to keep the BER low. But with forward error correction (FEC), you can work at a low SNR and therefore things continue to be reliable at a much longer range.

Spread spectrum

One of the important ways in which Bluetooth addresses the reliability challenges is through various ways in which it employs spread-spectrum techniques. So, rather than using a single channel for all packets, they get transmitted across a set of different channels, thus minimising any likelihood of collisions.

Reliable handling of Bluetooth communications

While connecting, devices agree on certain communication parameters, including several that are related to timing, such as how often a radio can be used for servicing this connection. The radio has to be shared potentially across lots of different connections. This particular parameter is called the connection interval.

At the start of the connection interval, devices take turns to transmit and receive with a gap of 150 microseconds in between packets. The precise, agreed timing parameters that control connections provide coordination between the transmit and receive behaviours of the two devices and makes communication reliable.

Connection oriented communication

Spread spectrum in connection oriented communication looks like this: Bluetooth LE divides the 2.4GHz band into 40 channels, each 2MHz wide. Three of them are used for advertising (that’s dedicated to connectionless communication). The other 37 are used when two connected devices communicate.

2.4GHz band divided into 40×2MHz channels
Fig. 6: 2.4GHz band divided into 40×2MHz channels
A simplified illustration of connection use and radio sharing
Fig. 7: A simplified illustration of connection use and radio sharing

At each connection event, the used channel changes at random. So, in this way, packet transmission gets dotted around the ISM band. In addition, the system notes any non-performing channel (due to CRC failures or spectrum interference) and removes it. Thus, efficient communication is ensured, even when a part of the ISM band is saturated. This whole behaviour is known as adaptive frequency hopping (AFH). AFH significantly reduces the probability of collisions and allows Bluetooth devices to function well even in very difficult radio environments.

Adaptive frequency hopping distributing communication across channels
Fig. 8: Adaptive frequency hopping distributing communication across channels

As stated earlier, signal strength can greatly impact reliability and FEC is one of the techniques used to address this. But, in addition, be aware that radio receivers work best when the level of the received signal stays within a certain range (known as the golden range). There is a Bluetooth feature called LE power control, which allows connected devices to request dynamic changes to transmission power levels so that the received signal strength stays within this golden range. This is particularly useful when the distances between devices vary during normal use.

Avoiding buffer overflow

To mitigate the reliability challenges of buffer overflow, the rate of flow of packets has to be managed. This can be done using a technique known as flow control, which is used in many different communication technologies.

Flow control
Fig. 9: Flow control

The Bluetooth Low Energy L2CAP layer of the stack applies flow control when required and supports a variety of different flow control modes. For example, if you are using the enhanced attribute protocol at the top of the stack, then it uses the Enhanced Credit Based Flow Control Mode within the L2CAP layer, allowing the receiving device to communicate to the transmitting device its current capacity to receive packets. If that is zero, then the receiver’s buffer is full and the transmitter will wait before resuming packet transmission again.

Flow control technique
Fig. 10: Flow control technique

So, it is a dynamic flow control strategy, which prevents buffer overflow.

Bluetooth LE reliability for connectionless communication

In Bluetooth, connectionless communication is called advertising. In the basic case, copies of each packet are broadcast on each channel in random channel order. Their time intervals are solely controlled by the broadcasting device, without any coordination with the transmitter. There is also another form of advertising called extended advertising, which uses all 40 Bluetooth LE channels.

The use of three channels in basic advertising is less sophisticated than adaptive frequency hopping in a connection. But the advertising channels are deliberately placed far apart from each other so that interference in one part does not block communication completely.

Basic advertising happens at defined intervals, but it includes some random timing variation in the scheduling of packet transmission of up to ten milliseconds. This is to avoid persistent collisions with nearby devices that happen to be transmitting or advertising on the same schedule.

Bluetooth connectionless communication does not attempt to coordinate the activities of the advertising device with that of the receiving devices. However, there is a special advertising mode called periodic advertising, which makes the timing of the advertising completely deterministic and precise.

Periodic advertising
Fig. 11: Periodic advertising

And scanning devices can also discover the periodic advertising schedule of the broadcasting device so that they can synchronise their scanning activity precisely with it.

This way, devices can more reliably and efficiently receive broadcast data than with the basic form of advertising.

Bluetooth mesh networks

Bluetooth mesh allows creation of large networks, having tens and thousands of devices. It is a special way of using Bluetooth LE where the mesh stack sits on top of the Bluetooth LE controller.

Bluetooth mesh defines bearers, which provide different ways of using the Bluetooth LE controller for the communication of mesh messages. And the bearers provide support for both connectionless and connection-oriented communication.

Addressing Bluetooth mesh issues

Mesh nodes can be configured to automatically retransmit messages at defined intervals, so that multiple copies get rapidly retransmitted. And, consequently, the probability of message loss drops dramatically when you send multiple copies. If you want to ensure that messages are acted upon by all receiving devices at the same time (even if they do not receive the same copy), that can be done too by exercising a delay parameter, which is available in many of the mesh message types.

Fig. 12 shows message being transmitted three times at 50ms intervals. Here, the first copy has a delay parameter of 100ms and is received by four of the six target lights.

Message being transmitted three times at 50ms intervals
Fig. 12: Message being transmitted three times at 50ms intervals

Fig. 13 shows the second copy is sent 50ms later and is received by the 5th of the six lights.

Second copy is sent 50ms later and is received by the 5th of the six lights
Fig. 13: Second copy is sent 50ms later and is received by the 5th of the six lights

And then the final copy has no delay specified (Fig. 14). It is received by the second of the six lights. Then all six nodes execute the requested state change in unison, exactly 100ms after the light switch was pressed. This avoids what is known as the popcorn effect, where lights do not come on at the same time.

Final copy has no delay specified
Fig. 14: Final copy has no delay specified

Bluetooth mesh-multipath delivery

A common network design strategy for Bluetooth mesh is to build multiple redundant paths (Fig. 15) across the network by thoughtfully enabling the relay function in a subset of your nodes. Then, when you send a message, all of these paths are available in principle. In practice, if one path is unavailable due to the duty cycle of a node, there is a probability that one of the other paths will be available and your transmitted message will get to its destination at the end of the path.

Multiple redundant paths across the network
Fig. 15: Multiple redundant paths across the network

The article is based on the talk ‘Understanding reliability in Bluetooth technology’ by Martin Woolley, senior developer relations manager, EMEA at Bluetooth SIG at February edition of Tech World Congress and India Electronics Week 2021. A comprehensive paper on the subject, written by Martin, is available from the Bluetooth SIG website at

Understanding Reliability in Bluetooth® Technology

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators