Lecture #17 - Personal Area Networks: Part 1
In this lecture we start to investigate technologies used to create Personal Area Networks (PANs). A PAN is used to interconnect devices within the range of an individual. Examples of this include connecting a computer to a printer, connecting a mouse or keyboard to a computer and connecting a headset to a mobile phone. A number of wired and wireless technologies can be used for PANs including USB, Bluetooth, IrDA and IEEE1394 (aka Firewire).
USB - The Universal Serial Bus
The Universal Serial Bus (USB) was introduced in 1996 and provides a serial interface that is extremely easy to use. USB has since become a defacto standard and can be found in most peripherals and many consumer devices.
USB has been highly successful, with more than 2 billion devices having USB interfaces in 2008. Some of the reasons for its success include:
- It is relatively simple to use.
- Provides power as well as communications.
- Hot pluggable (no need to power everything off before connecting/disconnecting).
- Reasonably high data rates.
USB Network Structure
A USB network forms a tree structure of up to seven levels. At the root of the tree is a host controller and root hub. The host controller is responsible for controlling all communication between all attached USB devices. The root hub provides interfaces to which additional USB devices can be attached.
Tiers 2 to 6 of the tree may contain other hubs or "functions" (eg. a mouse, printer or hard drive). Tier 7 can contain only functions.
USB Physical Layer
All USB data is carried by 4 wire cable. The cables are fitted with a USB Series A plug on the upstream end (facing the host). The downstream end may be permanently wired into a device or may be fitted with a USB Series B plug.
USB Series A Plug USB Series B Plug
This forces users to wire their networks correctly, they just can't do it any other way. In addition to the standard USB-A and USB-B interfaces, the smaller Mini-A, Micro-A and Micro-B interfaces were introduced, allowing for USB to be used in consumer devices such as cameras and portable music players. All USB cables should have an "A" interface on one end and a "B" interface on the other.
Two wires are used to carry 5 volt power to low consumption devices such as mice (< 500 mA). Higher power consuming devices may have their own separate power supply.
The other two wires are used to carry half duplex balanced differential data. Depending on the bit rate, the data circuit may be unterminated or may be terminated at both ends.
USB 1.0 Low Speed 1.5 Mbps Unterminated USB 1.0 Full Speed 12 Mbps Terminated USB 2.0 High Speed 480 Mbps Terminated
USB Bit Level Protocol
USB data signals are "differential" ie. two wires are required to convey one bit. Usually these wires carry opposite signals. The USB specification defines two normal data signal states.
"J" D+ line = 400mV, D- line = 0mV "K" D+ line = 0mV, D- line = 400mV
- All packets begin with a prominent preamble and synchronising flag (like Ethernet). This is a bit sequence KJKJ.....KJKJKK.
- Following the preamble, packets have a header which depends on the type of the packet. There are 16 different types. See later in this lecture.
- Packets are NRZI encoded. As detailed previously, NRZI maintains a constant voltage for the duration of a data bit. Data ONES are encoded as a change in level at the beginning of a bit. ZEROES are encoded as "no change" at the beginning of a bit.
- Packets are "bit stuffed" to guarantee that the preamble and headers are unmistakable and that there are regular changes in the signal (to aid clock recovery). Bit stuffing consists of inserting a '0' after any six consecutive '1' bits.
- Normally, the two data lines carry a "J" or a "K". Both data lines may be dropped to zero volts for special signalling purposes.
How USB Works
All communications are initiated by the host controller and must pass through the host controller.
To discover the existence of new functions, the host regularly polls all the hubs. Each hub records the connection of a new function. Upon discovering the new function, the host installs any new drivers needed, has a chat to the function to assign it an address and carries out any initialisation required by the function.
Since the host controls all communications, the USB protocol uses a 3 or 4 way handshake to invite a function to pass data back to the host:
A similar sequence is used to send data to a function:
USB Packet Types
USB defines 16 different major packet types (and many other minor types). The main ones are:
OUT Address + endpoint number for a host to endpoint transaction IN Address + endpoint number for a endpoint to host transaction ACK Receiver accepts error free data. There are three other similar handshake packets. DATA Four types of data packet. SPLIT Provides additional transaction types. SOF Distributes timing information.
IN, OUT and SETUP packets
PID Identifies packet type. This is followed by the complement of the type (for error checking). If not correct, the packet is rejected. ADDR Address of an endpoint (hub? or function). 127 can be addressed. ENDP Endpoint number. Each function can handle 16 different communication channels. Many functions implement separate control and data channels. CRC Five bit CRC covering Address and Endpoint.
Data Packets
ACK, NAK, STALL, NYET and ERR packets
Start-of-Frame Packets
SOF packets are issued by the host controller at regular intervals (every 1.000ms +/- 0.0005ms for full speed connections or every 125us +/-0.0625us for high speed connections). Frames are numbered for the use of functions that need to "know the time".
SOF frames don't cause any receiving function to generate a return packet.
The standard doesn't make obvious what a "transmitting" function does in response to a SOF. It may be that the function uses the timing information for its own purposes but doesn't communicate any resulting data until next polled by the host controller.
Bluetooth
Bluetooth is a wireless networking protocol intended to replace all of the wire presently used to connect things together. It allows devices to form small networks (piconets) consisting of a master station and one or more slave stations. Slave stations may be members of one or more piconets, as may masters (forming irregular scatternets).
Bluetooth Protocols
Bluetooth is implemented in a layered manner, similar to Ethernet/TCP/IP.
The lowest levels are Bluetooth specific. Higher layers use established protocols, enabling existing data services to be easily carried:
Bluetooth Radio
Technical stuff:
- Short range, typically <30m. Transmitter power typically 1mW, but up to 100mW may be used. Higher power devices must implement "power control" ie. be able to reduce their power automatically if conditions permit.
- Operating frequency = 2400MHz to 2483.5MHz Industrial Scientific and Medical (ISM) radio band.
- Bluetooth uses frequency hopping spread spectrum to allow a number of networks to be co-located without interference. The hopping sequence is determined by the Master station. The Master and the Active Slave take turns at sending packets.
- Channel spacing = 1MHz.
- Channels used 23 or 79 depending on location.
- Modulation Gaussian Frequency Shift Keying (A form of Digital Frequency Modulation).
- Data rate 1Mbps
- Hopping rate = 1 every 625us. Normally, each hop conveys one data packet. Packets can be extended to take five hop periods (staying on the same frequency).
- Channel data rates can be up to 723/57.6Kbps assymetric or 440/440Kbps symmetrical.
Baseband
The Baseband protocol actually controls some of the aspects mentioned already:
- Frequency hopping pattern.
- Formation of piconets.
- Packaging of bits.
In addition the Baseband protocol can reserve time slots to form two different types of data link:
- Synchronous Connection-Oriented (SCO)
- Asynchronous Connectionless (ACL)
ACL packets are used for data only, while the SCO packet can contain audio only or a combination of audio and data. All audio and data packets can be provided with different levels of FEC or CRC error correction and can be encrypted.
Furthermore, the different data types, including link management and control messages, are each allocated a special channel.
Logical Link Control and Adaptation Protocol
L2CAP provides connection-oriented and connectionless data services to the upper layer protocols with protocol multiplexing capability, segmentation and reassembly operation, and group abstractions.
L2CAP permits higher level protocols and applications to transmit and receive L2CAP data packets up to 64 kilobytes in length.
Although the Baseband protocol provides the SCO and ACL link types, L2CAP is defined only for ACL links.
Cable Replacement Protocol - RFCOMM
RFCOMM is a serial "cable replacement" protocol emulating RS-232 control and data signals over Bluetooth baseband. RFCOMM emulates up to 60 circuits between two devices (including about 7 RS-232 handshaking signals for each circuit). Data rates may be artificially limited so that Bluetooth doesn't overload any slow hardware.
Audio
The audio model is relatively simple within Bluetooth. Any two Bluetooth devices can send and receive audio data between each other just by opening an audio link. Audio data is carried in SCO packets and is routed directly to and from Baseband. It does not go through L2CAP.
Link Manager Protocol
The link manager protocol is responsible for link set-up between Bluetooth devices. This includes security aspects like authentication and encryption by generating, exchanging and checking of link and encryption keys and the control and negotiation of baseband packet sizes.
Furthermore it controls the power modes and duty cycles of the Bluetooth radio device, and the connection states of a Bluetooth unit in a piconet.
Service Discovery Protocol (SDP)
Discovery services are crucial part of the Bluetooth framework. These services provide the basis for all the usage models. Using SDP, device information, services and the characteristics of the services can be queried and after that, a connection between two or more Bluetooth devices can be established.
IrDA: The Infra Red Data Association
This is a standard for short range (about 1 metre) communication between portable computers, PDAs (and just about anything else so its proponents claim).
IrDA links are bi-directional half duplex and can have data rates up to 16Mbps. The protocols used form a layered family like the Internet model.
At the bottom of the heap, the Physical layer details the characteristics of the infra-red emitters and detectors. It also specifies the type of modulation used. There seem to be a couple of different encoding schemes, depending on data rate:
- Up to 1.152 Mbps RZI is used - somewhat like manchester encoding (details unclear)
- 4 Mbps - Each character consists of 4 "chips". Within each chip, four possible symbols can be sent (a one bit and 3 zeroes). Thus each chip can convey two binary bits and 4 chips together convey a byte.
Above this layer, the Data Link Layer defines how link access and management is done.
Finally, the highest layer implements flow control.
References
USB.org - Universal Serial Bus
Copyright © 2007-2008 Joel Sing
Copyright © 2006 Phil Rice

