Bluetooth® systems consists of a host and a controller. The BT SIG has created a standard protocol for the host to communicate with the controller. This is called the Host Controller Interface (HCI) which is specified in the BT Core 4.1 specification Volume 2 Part E. The HCI provides a uniform command interface to a Controller. There are some commands which are not listed in the specifications and they are specific to the device itself. These commands are vendor-specific commands (VS) generally used for testing and debugging purposes. For further details on testing command sequences, refer to CC256x Testing Guide.
As shown in the diagram above, the host (MSP430) sends HCI commands to the controller (CC256x). The controller then sends HCI events to the host as a response to the HCI commands. All HCI commands follows this format for all packets:
First Byte | Next Bytes |
---|---|
HCI Packet Type | HCI packet (variable length) |
All HCI commands starts with a byte describing type of packet while the remaining bytes is dependent on the type of HCI packet.
Here is a list of important HCI packet types:
HCI Packet Type | Packet Type Indicator | Direction |
---|---|---|
HCI command packet | 0x01 | Host to baseband controller |
HCI event packet | 0x04 | Baseband controller to host |
Bluetooth® is a registered trademark of Bluetooth SIG.
All trademarks are the property of their respective owners.
Most of the HCI packets consist of command packets. The host sends these command packets according to the structure detailed in the tables below and the controller sends responses through event packets back to the host. Command packets are used to configure many aspects of the Bluetooth system ranging from the link layer to the baseband layer.
You can also refer to the Core 4.1 Specification Volume 2, Part E, for the format of these HCI packets.
After the first byte,the remaining bytes depends on what type of packet it is. Of these two packet types, the structure of the HCI command packet is:
First Last |
||
---|---|---|
16 bit Opcode | 8 bit Length | Parameters(0,1,3,...,N) |
Here is a description of the above HCI command packet structure:
Fields | Descriptions |
---|---|
Opcode | 16 bit unique Opcode for HCI command |
Length | Length of parameters in bytes |
Parameters | Specific parameters associated with each command |
Taking the command HCI_Read_BD_ADDR, this is an example of a command packet consisting of outgoing data to the controller:
Packet Type | Opcode | Opcode | Length |
---|---|---|---|
0x01 | 0x09 | 0x10 | 0x00 |
In this case, the length is zero so no parameters follows afterwards.