380 likes | 779 Views
INTRODUCTION TO BLUETOOTH. Andrey Shomer & Daniel Yudelevich. Sources. What’s Bluetooth?. Wireless protocol for exchanging data over short distances from fixed and mobile devices Initially proposed as a wireless equivalent to RS-232 (COM ) Developed and maintained by Bluetooth SIG.
E N D
INTRODUCTION TO BLUETOOTH AndreyShomer & Daniel Yudelevich
What’s Bluetooth? • Wireless protocol for exchanging data over short distances from fixed and mobile devices • Initially proposed as a wireless equivalent to RS-232 (COM) • Developed and maintained by Bluetooth SIG
Bluetooth – What doest it mean? • Named after Harald I Bluetooth (Danish HaraldBlåtand) who united Scandinavian tribes – just like bluetooth unites different devices. • The Bluetooth logo unites the Runic alphabetic characters "H", which looks similar to an asterisk, and a "B", which are the initials for Harald Bluetooth. If you look close enough you can see both embodied in the logo.
Timeline The Bluetooth 1.0 Releases Headset, laptop, printer Bluetooth 1.2 Released. Keyboard, Mouse, GPS. Bluetooth is 802.15.1 Bluetooth SIG formed of five companies First Devices Appear 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 Bluetooth 2.0 + EDR 1 billion bluetooth devices 10 years – 2 billion products 5 million chipsets per week. SIG welcomes its 8000 member
Technology Overview • Audio
Radio Layer • Equivalent to Physical Layer of the Internet Model • Operates in the 2.4 GHz ISM band (May interfere with 802.11b and 802g and DECT telephones) • Bandwidth is divided into 79 RF channels which are ordered from channel number 0-78 and are spaced 1 MHz beginning at 2402 GHz • Lower Guard Band – 2MHz, Upper Guard Band - 3.5 MHz
Baseband Layer • Basic Bluetooth communication is performed in a Master-Slave manner • Each Master and its connected slave(s) form a Piconet • A Master can have up to 7 active slaves • Slave may send data only if was poled by a Master
Piconet Clock • All timing and scheduling activities in the Piconet shall be done according to single clock - the Master clock. • The clock is derived from the native device’s clock by adding an offset • All clocks in the devices run at the same nominal rate, but mutual drift causes inaccuracies . • The offsets in the slaves must be regularly updated
Bluetooth Packet Format • Two formats are defined Basic Rate Packet and Enhanced Data Rate Packet • EDR was introduced in Bluetooth 2.0 Basic Rate Packet Access Code Header Payload Enhanced Data Rate Packet Access Code Header Guard Sync Payload Trailer GPSK DPSK
Addressing and access codes • 48 bits address • 3 Type of access codes derived from the address • Device access code (DAC) (Device’s LAP) • Channel access code (CAC) (Piconet Master’s LAP) • Inquiry access code (IAC) (Paged Device’s LAP) LAP( 24 bit) UAP (8 bit) NAP (16 bit) Preamble Sync Word Trailer
Physical Channels • Pseudo-random RF channel hopping sequence • Sequence is algorithmically derived from the Piconet Master’s address • The frequency hopping in the Piconet physical channel is determined by the Piconet clock • The maximum hop rate is 1600 hops/s in the connection state and 3200 hops/s in the inquiry and page substates • 4 Physical channel types are defined
Frequency Hopping Prevents Collisions 1 2 3 4 2413 1 2 3 4 1234
Physical Channels Types • Adapted Physical Channel • May be based on less than the full 79 frequencies of the basic Piconet physical channel. • Basic Channel • The basic Piconet physical channel is defined by the master of the Piconet. • The master controls the traffic on the Piconet physical channel by a polling scheme • Characterized by a pseudo-random hopping through all 79 RF channels. • Inquiry Scan Physical Channel • Used in Inquiry and Inquiry Scan Modes • Same characteristics as Page Scan Physical Channel • Page Scan Physical Channel • Used in Page and Page Scan Modes • Follows a slower hopping pattern than the basic Piconet physical channel • Short pseudo-random hopping sequence through the RF channels.
Channels are divided into timeslots • The basic Piconet physical channel is divided into time slots, each 625 μs in length. The time slots are numbered according to the most significant 27 bits of the Bluetooth clock of the Piconet master. • The master transmission shall always start at even numbered time slots and the slave transmission shall always start at odd numbered time slots • Due to packet types that cover more than a single slot, master transmission may continue in odd numbered slots and slave transmission may continue in even numbered slots • Frequency does not change during on packet transmission • Packet may extend up to 5 timeslots
Timeslots – contd. • Consider the following Piconet Slave 1 Slave 2 Master
Timing/Hoping Example Frequency 1 1 2 2 Time
Packet Exchange Examples Basic Physical Channel
Packet Exchange Examples Page Scan Physical Channel Same Frequencies used in the first and second 635ns periods
Setting up a Piconet – Inquiry Mode • A Bluetooth device enters the Inquiry mode with the goal of making its presence known • Another Bluetooth device enter Inquiry Scan mode to detect inquiring devices • The device performing inquiry sends ID packet containing an IAC – inquiry access code (GIAC or DIAC) • Once an inquiring device is detected, scanning device responds with FHS packet • Continues until scanning device decides its enough ID s FHS
Setting up a Piconet – Paging Mode • The device formerly performing inquiry enters page mode • In the page mode the paging device continuously transmits an ID packet containing slave’s access code • The device that responded to an inquiry may enter the page scan mode • On receiving a page message with its access code the scanning device responses with an FHS • Master then responses with another FHS FHS s FHS
Connection Established • Paging device becomes master • Scanning device becomes slave (roles may be exchanged) • Clocks and hoping sequences are synchronized Slave Master Clean my buttons! Okay…
Active Mode • Both master and slave actively participate on the channel. • Up to seven slaves may be in the active mode at any given time. • The master schedules the transmission based on traffic demands to and from the different slaves. In addition, it supports regular transmissions to keep slaves synchronized to the channel. • Slaves in the active mode listen in the master-to-slave slots for packets. These devices are known as active slaves. If an active slave is not addressed, it may sleep until the next new master transmission. • Slaves can derive the number of slots the master has reserved for transmission from the packet header • Only the slave that is may return a packet in the next slave-to-master slot. If no valid packet header is received, the slave may only respond in its reserved SCO or eSCO slave-to-master slot
Park Mode • When a slave does not need to participate on the Piconet channel, but still needs to remain synchronized to the channel, it can enter PARK state • The parked slave wakes up at regular intervals to listen to the channel in order to re-synchronize and to check for broadcast messages. • Synchronization and channel access of the parked slaves is done by means of a Beacon Train
Park Mode – Beacon Train • To support parked slaves, the master establishes a beacon train when one or more slaves are parked. • The beacon train consists of one beacon slot or a train of equidistant beacon slots which is transmitted periodically with a constant time interval. • The beacon train serves four purposes: 1. Transmission of master-to-slave packets which the parked slaves can use for re-synchronization 2. Carrying messages to the parked slaves to change the beacon parameters 3. Carrying general broadcast messages to the parked slaves 4. Unparking of one or more parked slaves • Access window is defined where the parked slaves can send requests to be unparked.
Logical Transport • Different types of logical transports may be established. • Synchronous Connection-Oriented (SCO) logical transport • Extended Synchronous Connection-Oriented (eSCO) logical transport • Asynchronous Connection-Oriented (ACL) logical transport • Active Slave Broadcast (ASB) logical transport • Parked Slave Broadcast (PSB) logical transport
L2CAP Layer • Abbreviation for Logical Link Control and Adaptation Protocol. • A link-layer protocol between Bluetooth devices with multiple services • Makes use of ACL logical transport (does not support SCO). • Passes data to the HCI, or to the directly to the Link Manager in a hostless system • Note that L2CAP transports data, not audio (though protocols like VoIP are regarded as data and would use L2CAP if transferred over BT systems)
L2CAP Functions • Multiplexing between different higher layer protocols, allowing them to share lower layer links. • Segmentation and reassembly to allow transfer of larger packets than lower layers support. • Group management, providing one way transmission to a group of other Bluetooth devices. • Quality of service management for higher layer protocols
Multiplexing using channels • L2CAP provides multiplexing to allow several higher layer links to pass across a single ACL connection. • L2CAP uses channel numbers to label packets so when they are received they can be routed to the correct place. • Since L2CAP entities must also communicate between themselves to control channels, a special channel number is reserved for receiving multi cast packets. The channel numbers are negotiated as connections are set up.
L2CAP can work in CO mode (meaning each channel is bidirectional) or in CL mode where channels have one direction (Master to multiple slaves) • Channel Assignment:
Command Packets Consists of one or more L2CAP commands, each with four fields: • Code – identifies type of command • Identifier – used to match request with reply • Length – length of data field for this command • Data – additional data for command, if necessary
L2CAP Configuration Options • The L2CAP_ConfigReq commands packet can negotiate terms with other L2CAP layers, those options will affect the MTU, Flush timeout and QoS. • MTU – The maximum transmission size in bytes the device is willing to accept, it will reject any payload larger with a reject message containing the MTU it can handle • Flush Timeout – The ammount of time in ms the device will try to transmit an L2CAP packet segment before it gives up. If the segment can't get through during that period – the entire packet is flushed. • QoS – The quality of service option can select best effort, or guaranteed QoS. Values such as token rate, token bucket size, peak bandwidth, latency and delay variation can also be negotiated.
QoS Parameters • Service Type – whether the link guarantees it's settings, will make an attempt to achieve them or possible offer no service at all. • Token rate – the rate at which data may be sent on a link • Token rate bucket size – this is a measure of how much storage will be available in the stack for data. Bursty links ill most likely need more storage that even-flow links. • Peak Bandwidth – the maximum rate that back to back packets can be sent, that is to say packets all dedicated to one link and no other links getting to transfer in between them. • Latency – the delay between data being ready to send and being send out over the radio for the first time. • Delay variation – the spread between the maximum and minimum delay across the link. • If QoS is not configured the device should use the following default values: Service Type: Best effort, Token Rate :0x00000000, Token Bucket size :0x00000000 (no bucket needed), Peak BW :0x00000000 (unknown), Latency\Delay Variation :0xFFFFFFFF (don't care)