Home > Articles > Networking > Wireless/High Speed/Optical

  • Print
  • + Share This
This chapter is from the book

1.4 The protocol stack

A key feature of the Bluetooth specification is that it aims to allow devices from lots of different manufacturers to work with one another. To this end, Bluetooth does not just define a radio system, it also defines a software stack to enable applications to find other Bluetooth devices in the area, discover what services they can offer, and use those services.

The Bluetooth stack is defined as a series of layers, though there are some features which cross several layers.

Every block in Figure 1–2 corresponds to a chapter in the core Bluetooth specification. The core specification also has three chapters on test and qualification:

  • Bluetooth Test Mode.
  • Bluetooth Compliance Requirements.
  • Test Control Interface.

Figure 1-2Figure 1–2 The Bluetooth protocol stack.

The Bluetooth specification encompasses more than just the core specification. There are also profiles which give details of how applications should use the Bluetooth protocol stack, and a brand book which explains how the Bluetooth brand should be used.

1.4.1 The OSI Reference Model

Figure 1–3 shows the familiar Open Systems Interconnect (OSI) standard reference model for communications protocol stacks. Although Bluetooth does not exactly match the model, it is a useful exercise to relate the different parts of the Bluetooth stack to the various parts of the model. Since the reference model is an ideal, well-partitioned stack, the comparison serves to highlight the division of responsibility in the Bluetooth stack.

Figure 1-3Figure 1–3 OSI reference model and Bluetooth.

The Physical Layer is responsible for the electrical interface to the communications media, including modulation and channel coding. It thus covers the radio and part of the baseband.

The Data Link Layer is responsible for transmission, framing, and error control over a particular link, and as such, overlaps the link controller task and the control end of the baseband, including error checking and correction.

From now on, it gets a little less clear. The Network Layer is responsible for data transfer across the network, independent of the media and specific topology of the network. This encompasses the higher end of the link controller, setting up and maintaining multiple links, and also covering most of the Link Manager (LM) task. The Transport Layer is responsible for the reliability and multiplexing of data transfer across the network to the level provided by the application, and thus overlaps at the high end of the LM and covers the Host Controller Interface (HCI), which provides the actual data transport mechanisms.

The Session Layer provides the management and data flow control services, which are covered by L2CAP and the lower ends of RFCOMM/SDP. The Presentation Layer provides a common representation for Application Layer data by adding service structure to the units of data, which is the main task of RFCOMM/SDP. Finally, the Application Layer is responsible for managing communications between host applications.

1.4.2 The Physical Layer

Bluetooth devices operate at 2.4 GHz in the globally available, licence-free ISM band. This band is reserved for general use by Industrial, Scientific, and Medical (ISM) applications, which obey a basic set of power and spectral emission and interference specifications. This means that Bluetooth has to be very robust, as there are a great many existing users and polluters of this shared spectrum.

The operating band is divided into 1 MHz-spaced channels, each signalling data at 1 Megasymbol per second so as to obtain the maximum available channel bandwidth. With the chosen modulation scheme of GFSK (Gaussian Frequency Shift Keying), this equates to 1 Mb/s. Using GFSK, a binary 1 gives rise to a positive frequency deviation from the nominal carrier frequency, while a binary 0 gives rise to a negative frequency deviation.

After each packet, both devices retune their radio to a different frequency, effectively hopping from radio channel to radio channel (FHSS—frequency hopping spread spectrum). In this way, Bluetooth devices use the whole of the available ISM band and if a transmission is compromised by interference on one channel, the retransmission will always be on a different (hopefully clear) channel. Each Bluetooth time slot lasts 625 microseconds, and, generally, devices hop once per packet, which will be every slot, every 3 slots, or every 5 slots.

Designed for low-powered portable applications, the radio power must be minimised. Three different power classes are defined, which provide operation ranges of approximately 10 m, 20 m, and 100 m; the lowest power gives up to 10 m range, the highest up to 100 m.

1.4.3 Masters, Slaves, Slots, and Frequency Hopping

If devices are to hop to new frequencies after each packet, they must all agree on the sequence of frequencies they will use. Bluetooth devices can operate in two modes: as a Master or as a Slave. It is the Master that sets the frequency hopping sequence. Slaves synchronise to the Master in time and frequency by following the Master's hopping sequence.

Every Bluetooth device has a unique Bluetooth device address and a Bluetooth clock. The baseband part of the Bluetooth specification describes an algorithm which can calculate a frequency hop sequence from a Bluetooth device address and a Bluetooth clock. When Slaves connect to a Master, they are told the Bluetooth device address and clock of the Master. They then use this to calculate the frequency hop sequence. Because all Slaves use the Master's clock and address, all are synchronised to the Master's frequency hop sequence.

In addition to controlling the frequency hop sequence, the Master controls when devices are allowed to transmit. The Master allows Slaves to transmit by allocating slots for voice traffic or data traffic. In data traffic slots, the Slaves are only allowed to transmit when replying to a transmission to them by the Master. In voice traffic slots, Slaves are required to transmit regularly in reserved slots whether or not they are replying to the Master.

The Master controls how the total available bandwidth is divided among the Slaves by deciding when and how often to communicate with each Slave. The number of time slots each device gets depends on its data transfer requirements. The system of dividing time slots among multiple devices is called Time Division Multiplexing (TDM).

1.4.4 Piconets and Scatternets

A collection of Slave devices operating together with one common Master is referred to as a piconet (see Figure 1–4). All devices on a piconet follow the frequency hopping sequence and timing of the Master.

Figure 1-4Figure 1–4 Point to point and point to multipoint piconets.

In Figure 1–4, the piconet on the left with only one Slave illustrates a point to point connection. The piconet on the right with three Slaves talking to the Master illustrates a point to multipoint connection. The Slaves in a piconet only have links to the Master; there are no direct links between Slaves in a piconet.

The specification limits the number of Slaves in a piconet to seven, with each Slave only communicating with the shared Master. However, a larger coverage area or a greater number of network members may be realized by linking piconets into a scatternet, where some devices are members of more than one piconet (see Figure 1–5).

Figure 1-5Figure 1–5 Scatternets.

When a device is present in more than one piconet, it must time-share, spending a few slots on one piconet and a few slots on the other. On the left in Figure 1–5 is a scatternet where one device is a Slave in one piconet and a Master in another. On the right is a scatternet where one device is a Slave in two piconets. It is not possible to have a device which is a Master of two different piconets, since all Slaves in a piconet are synchronised to the Master's hop sequence. By definition, all devices with the same Master must be on the same piconet.

In addition to the various sources of interference mentioned already, a major source of interference for Bluetooth devices will clearly be other Bluetooth devices. Although devices sharing a piconet will be synchronised to avoid each other, other unsynchronised piconets in the area will randomly collide on the same frequency. If there is a collision on a particular channel, those packets will be lost and subsequently retransmitted, or if voice, ignored. So, the more piconets in an area, the more retransmissions will be needed, causing data rates to fall. This is like having a conversation in a noisy room: the more people talking, the noisier it gets, and you have to start repeating yourself to get the point across.

This effect will happen if there are many independent piconets in one area, and it will also happen to scatternets, since the piconets making up the scatternet do not coordinate their frequency hopping.

1.4.5 Radio Power Classes

The Bluetooth specification allows for three different types of radio powers:

  • Class 1 = 100mW (20 dBm).
  • Class 2 = 2.5mW (4 dBm).
  • Class 3 = 1mW (0 dBm).

These power classes allow Bluetooth devices to connect at different ranges. At the time of writing, most manufacturers are producing Class 3, low power, 1 mW radios. These can communicate for a maximum of around 30 feet (10 m). However, because things like bodies and furniture absorb microwaves, reception may not be reliable at the limit of this range. So, when using 1 mW radios, a more realistic figure for reliable operation in a normal room will probably be 5 m. This provides a low cost, low power communications solution which has plenty of range for a cable replacement technology.

Obviously, higher power radios have longer ranges. The maximum range for a Class 1, 100 mW radio is about 100 metres. There is also a minimum range for a Bluetooth connection. If radios are put too close together, some receivers may saturate, so a few Bluetooth radios may be unreliable on short link lengths (under 10 cm).

A 100 m link needs a high power Class 1 device at both ends, but it is possible to create piconets with a mixture of high and low power devices at different ranges. Figure 1–6 shows a mixture of high and low power devices in different piconets occupying an area.

Figure 1-6Figure 1–6 Piconets made up of different power class devices.

This figure shows piconets which overlap each other. This is possible because each Master has its own frequency hopping sequence, so two piconets are unlikely to be on the same frequency at the same time. If they do meet on the same frequency, after the next frequency hop they will not still be on the same frequency, so the data which may have been lost when the two piconets were on the same frequency can be resent.

1.4.6 Voice and Data Links

Bluetooth allows both time critical data communication such as that required for voice or audio, as well as high speed, time insensitive packet data communication. To carry such data, two different types of links are defined between any two devices. These are SCO (Synchronous Connection Oriented) links for voice communication and ACL (Asynchronous Connectionless) links for data communication.

ACL data packets are constructed from a 72-bit access code, a 54-bit packet header and a 16-bit CRC code, in addition to the payload data. There are a variety of packet types allowing different amounts of data to be sent. The packet which carries the largest data payload is a DH5 packet, which stretches over five slots. A DH5 packet can carry 339 bytes, or 2,712 bits of data. So, 2,858 bits are sent on air for 2,712 bits of information.

A DH5 packet uses up five slots, and the minimum length reply is one slot. Thus, the maximum baseband data rate in one direction is 723.2 kb/s. In this case, with 5-slot packets sent in one direction, the 1-slot packets sent in the other direction will only carry 57.6 kb/s, so this would be an asymmetric link with more data going in the direction using 5-slot packets. If 5-slot packets were sent in both directions, the data rate obtained would be 433.9 kb/s, quite a reduction from the 1 Mb/s data rate on air.

This overhead in both data encoding and frequency hopping is necessary mainly to provide a robust link since the ISM band is a shared resource with many devices, and indeed other communications standards and even noise sources, cohabiting in the same spectrum. In addition, to further reduce the interference problem in the spectrum, national radio regulations limit the power emission per unit time in the ISM band, making a frequency hopping scheme necessary to spread transmissions over the spectrum and over time.

The higher layers of the protocol stack also use up some of the bandwidth, so at the application level, the maximum data rate could be around 650 kb/s.

The SCO links work at 64 kb/s, and it is possible to have up to three full-duplex voice links at once or to mix voice and data. These voice channels give audio communication of a quality one would expect from a modern mobile cellular phone system such as GSM. As such, SCO links are not really suitable for delivering audio of a quality required for music listening.

One alternative to support music delivery is to use an ACL channel to carry audio. Raw CD-quality audio requires 1411.2 kb/s, but with suitable compression, such as MP3, which reduces this bit rate to around 128 kb/s, near CD-quality audio could easily be carried providing the time criticality of the audio was maintained.

  • + Share This
  • 🔖 Save To Your Account