查看文章 |
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:
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:
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.
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: 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.
|