Up: Bluetooth

Frequency hopping

Some details about the radio connection, inquiry and paging.

Hopping and synchronizing

The radio band used in Bluetooth contains 79 bands of 1MHz each. Rather than trying to find a free one to use, Bluetooth devices change frequency at regular intervals, following an hopping sequence that depends on the BDADDR of the master. Time slots are allocated for packets sent from the master and answers coming from a slave.

Example of an hopping sequence:
2409Mhz -------------------------
2408Mhz -----------====----------
2407Mhz --====-------------------
2406Mhz -----------------------==
2405Mhz ------=====--------------
2404Mhz -------------------====--
2403Mhz ==-----------------------
2402Mhz ---------------====------

In order for this to work, the slaves must know the BDADDR and the clock of the master. This is obtained during paging: the master sends packets that are specific to this aim, the FHS packets, which contain both its BDADDR and its clock.

The FHS packet, in which BDADDR and clock are always of the sender:
+-----+-----+-----+-----+-----+-----+-----+-------+-----+
| ... | LAP | ... | UAP | NAP | CoD | ... | clock | ... |
+-----+-----+-----+-----+-----+-----+-----+-------+-----+
BDADDR = LAP-UAP-NAP

Upon receiving this packet, the slave compares the clock with its own clock and computes the difference. It does not update its own clock, as this would forbid participation as a slave in other piconets. Rather, it stores this difference. When interacting with the master it adds it to its clock, obtaining the clock of the master. For this reason, the difference is called clock offset. This method produces a sort of virtual clock that is synchronized with that of the master.

With the BDADDR and the clock of the master, the slaves know when to change frequency and to which, because the frequency hopping sequence is fully determined from the BDADDR and the clock of the master.

During the time the connection is up, the slave keeps comparing the time it receives a packet and the time it expected it, and updates the clock offset consequently.

Inquiring and paging

Inquiring and paging are not done on a fixed frequency but on their own hopping sequences of 20 frequencies (out of the overall 79). A device that would answer to inquiries or paging requests is supposed to periodically listen to these requests, but the master does not know at which frequency it will. Therefore, it has to send the request a certain number of times.

In particular, enough inquiry requests are sent for all slaves in range to get one. A slave answers with its own FHS packets, which contain its BDADDR and its clock.

The BDADDR and the clock of the slave determine the hopping sequence to use for paging. An estimate of the slave clock suffices. This means that after the slave has answered an inquiry, or if it has been connected to the master not too long ago, paging succeed. After some time of not connecting, the clocks of the master and the slave drift apart, and paging may timeout.

This explains why the slave needs to be visible and an inquiry performed, even if its BDADDR is known, when:

Hopping sequence intersections

Since packets are transmitted on the radio, a packet of a piconet may be received by another. To reduce the chances of this happening, the master and the slaves of a piconet change radio frequency at fixed intervals following a pseudorandom hopping sequence that depends on the BDADDR of the master. While this reduces the possibility of interferences, there are only 79 frequencies available, meaning that a sequence is likely to intersect that of another piconet at some point. This is why every packet is preceded by an access code that identifies the piconet.