百度空间 | 百度首页 
 
查看文章
 
A Bluetooth protocol stack for embedded use
2009年04月25日 星期六 11:56
Magnus Unemyr of IAR Systems, describes a tool designed to make it quicker and easier to configure and optimize a Bluetooth protocol stack for a project.

Bluetooth wireless technology is one of the most interesting newmeans of communication for embedded systems. Thousands of products from many different manufacturers will most probably contain Bluetooth functionality for short distance data and/or sound transmission.

Bluetooth products communicate over the radio and therefore no optical connection is needed (which is not the case for IrDA). This means communication can be made with devices in another room or in a closed briefcase - see figure 1.

Fig 1: Two products communicating over a wireless Bluetooth radio link

The communication distance is usually up to 10ms, but there is also a version of the radio interface with signal amplification that can communicate up to 100ms. Maximum communication speed is around 700KB/s.

All products using Bluetooth wireless technology must follow the communication protocols documented in the Bluetooth specification. The advantage of this is interoperability &endash; all products from different manufacturers function well together.

The Bluetooth specification is a highly technical document (over 1500 pages) describing all the functionality that must be implemented in order to build a product that complies with the Bluetooth specification.

A Bluetooth protocol stack is a software library that implements the communication protocol as defined in the Bluetooth specification. The deep technical expertise and huge need for development resources to develop a Bluetooth protocol stack makes it practically impossible for most companies to develop their own stack.

The stack must also pass the official Bluetooth test suites that have been defined by the Bluetooth SIG (Special Interest Group). In order to include Bluetooth technology in their products, the vast majority of all companies will therefore purchase a commercial Bluetooth protocol stack from a third party supplier. Developing a Bluetooth protocol stack internally cannot be financially motivated.

This article gives an overview of the functionality in a Bluetooth protocol stack, as well as some of the design decisions taken by IAR Systems' development team when developing a compact stack for embedded systems.

A Bluetooth protocol stack is a software component that implements the communication protocols defined in the Bluetooth specification. The stack communicates with the Bluetooth hardware (usually via UART or USB), and presents an easy-to-use high-level API by which the application program can use the different services in the stack.

A Bluetooth protocol stack can be divided into two parts; the core and the profiles.

The core consists of:

  • Host Controller Interface which provides a standardized communications protocol between the stack and the Bluetooth module. HCI communication packets can be transmitted over UART, RS232, USB, or PC Card interface.

  • Logical Link Control and Adaptation Protocol allows multiple communication channels to share a single Bluetooth link (multiplexing). L2CAP also handles segmentation and assembly of long messages.

  • RFCOMM implements the functionality needed for a virtual RS232 link, including modem control signals. Most of the application profiles use RFCOMM to send and receive data.

  • Service Discovery Protocol provides functionality to publish supported Bluetooth functionality (SDP server), as well as to query other Bluetooth products for Bluetooth functionality (SDP client).

The Bluetooth specification also defines how Bluetooth should be used within specific application fields (each application usage is defined in its own profile). A number of profiles have already been defined, and more are expected to be developed in the future. Some of the most important profiles are:

  • Generic Access Profile is mandatory and is used to manage connections between different Bluetooth products. GAP exposes a high-level API that can be used by the application program to configure the stack and manage connections to different Bluetooth products.

  • Service Discovery Application Profile is mandatory and is used to query other Bluetooth products for supported services and functionality. SDAP exposes a high-level API that can be used by the application program to query other Bluetooth products for supported functionality.

  • Serial Port Profile provides emulated virtual serial ports over a Bluetooth radio link. SPP exposes a high-level API that can be used by the application program to transmit and receive data in a way that is very similar to a standard serial port.

  • Headset Profile provides functionality for linking sound between an audio gateway (usually a GSM phone) and a headset. HSP exposes a high-level API that can be used by the application program to establish and manage the sound link.

There are also many other profiles for different purposes, e.g. file transfer, network access, and dial-up network connections. New profiles are being specified for e.g. cars, audio/video, digital cameras and printer management.

When a Bluetooth protocol stack has been purchased an application program must be developed to use the stack functionality by calling the different API functions. The stack takes care of all the complex communication rules that are defined in the specification and manages the communication with the Bluetooth module.

Table 1 contains a few examples of API functionality provided by a stack (in this case the IAR Systems stack) to an application program for a few different profiles.

Profile

API function

Description

Serial

Port

Profile

SPP_AddPortRq()

SPP_RemovePortRq()

SPP_OpenRq()

SPP_CloseRq()

SPP_WriteRQ()

. . .

Creates a virtual serial port

Deletes a virtual serial port

Opens a virtual serial port

Closes a virtual serial port

Prints data to a virtual serial port

. . .

Headset

Profile

HSP_OpenVoiceRq()

HSP_CloseVoiceRq()

HSP_VolumeRq()

. . .

Opens a sound channel

Closes a sound channel

Adjusts the volume

. . .

There are several Bluetooth protocol stacks on the market, but most of them are not optimized for small embedded systems. Many stacks are developed for work stations or large embedded systems. At a later stage some of them are adapted to small embedded systems, which can often cause problems. Stacks requiring 50-100KB ROM, or even more, are not at all unusual. This is often far too much for a small embedded system.

These are some important issues worth considering when choosing a Bluetooth protocol stack:

  • Size

  • Portability

  • Configurability

Size: The size of a Bluetooth protocol stack is not important for personal computers, work stations, and large embedded systems. For most embedded systems, however, a compact stack using a minimum of memory is very important, as it can reduce production costs when large volumes are produced.

详细请看:http://www.embedded.com/story/OEG20020613S0017


类别:移动开发(windows mobile) | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu