Low power Bluetooth Development learning 0523

Source: Internet
Author: User

7.3.4 Header

The content of the header depends on whether the message is a broadcast message or a data message.

There are 7 types of broadcast messages,
Adv_ind----General Broadcast Instructions
Adv_direct_ind----Directional connection indication
Adv_nonconn_ind---non-connected indication
Adv_scan_ind------can be scanned for indication
Scan_req----Active Scan request
SCAN_RSP----Active Scan response
Connect_req-----Connection Request

7.3.5 length

7.3.6 Net charge

7.4 Channel

Low power Bluetooth channel width of 2MHz, not classic Bluetooth 1MHz

7.4.1 Frequency hopping

The FM algorithm is used in the data connection

7.4.2 Adaptive Frequency hopping

7.5 Device Discovery

There are 4 different types of broadcasts: generic, directional, non-connected, and discoverable.

7.5.1 General Broadcast

A generic broadcast can be issued without a connection, in other words, without a master-slave device.

7.5.2 directed broadcast

The directed broadcast event is to establish the connection as quickly as possible. This message consists of two addresses: the broadcaster
Address of the user and the originator's address.

7.5.3 Non-connected broadcast

A device that does not want to be connected uses a non-connected broadcast event.

7.5.3 can be found broadcast

You can broadcast the data and scan it accordingly, but you cannot establish a connection.

7.6 Broadcast

7.7 Establishing the connection

7.7.1 Access Address

The access address used by the connection is always provided by the main device. Addresses are randomly generated, and random generation enhances privacy
, the scanner has no way of knowing which two devices are communicating.

7.7.2 CRC initialization

7.7.3 Send Window

7.7.4 Connection Events

A connection event is the process of sending packets to and from the primary device and from one device to another. The connection event is made
Always at one frequency, each packet waits for 150US to be sent after the last packet has been sent out.

The connection interval determines the interaction between the primary device and the slave device: it can be any value within the 7.5ms-4s, but
Must be an integer multiple of 1.25ms.

7.7.5 Channel diagram

Adaptive frequency hopping channel diagram a bitmask of data channels used to mark the channel's good or bad.

7.7.6 Sleep Clock accuracy

7.8 Sending data

Unencrypted packets passed to the controller can carry a maximum of 27 bytes of data.

7.8.1 Data Header

7.8.2 Logical Link Identifier

The logical link identifier (LLID) is used to determine which of the following types of data messages belong:

Link-layer control messages (one-by-one)------for managing connections
High-level message start (Ten)-------can also be used for a complete message
High-level gratitude continuation (01)

The host is capable of sending data larger than 27 bytes, but because it cannot be placed into a single link-layer packet, it must be
Support segmentation. This is done by labeling the packet "high-level message start" or "high-level message continuation".

7.8.3 Serial Number

In a packet, the sequence number is represented by a bit, and the bit is set to 0 in the first packet sent.
The next time the device sends a new packet, the value alternates between 1 and 0.

7.8.4 Confirmation

If the device successfully receives a message with a serial number of 0, the next expected serial number should be in its confirmation message
Set to 1, otherwise the packet with the serial number 0 will be re-transmitted.

7.8.5 more Data

In the header of the data channel message, there is the last----more bits of data to inform the peer device of its own
Other data is ready to be sent.

7.9 Encryption

7.10 Managing Connections

Connection management involves sending control messages at the link layer, including the following seven link-layer control procedures:

Update Connection parameters
Changing the adaptive frequency hopping channel diagram
Encrypted link
Re-encrypt link
switching function bits
Exchange version Information
Terminating link

7.10.1 Connection Parameter Update

When the connection is established, the primary device sends the connection parameters through the connection packet.

The instantaneous is actually a connection event counter, and the corresponding connection event comes with the new parameters.

7.10.2 Adaptive Frequency hopping

New channel diagram

The instantaneous concepts mentioned here are completely different from those in the connection update.
It determines a point in time at which connection events after that point in time will use the Insights Channel graph.

To re-channel the update request, you must wait for the transient to pass later.
Link-layer control procedures do not allow the channel graph to be changed from the device, or even communicate its own channel conditions to the main device.

7.10.3 Start Encryption

Only links that have not been encrypted can initiate encryption. When the link is encrypted, you need to create a random number (nonce) and a
Session key (SK).

7.10.4 Restart Encryption

7.10.5 version Switching

7.10.6 function Switching
The end device uses the function information to determine what the device can do.

7.10.7 terminating the connection

The last link layer control procedures for the termination procedures.

To terminate the link, the device first sends a terminating instruction message (ll_terminatb_ind), waiting for the link layer
Confirm the message and disconnect it.

7.11 Robustness

7.11.1 Adaptive Frequency hopping

7.11.2 Strong CRC

7.12 for low power optimization

The main methods are as follows:
Using short messages
The physical layer uses a high bit rate
Provides low overhead
Optimize the appropriate mechanism
Single channel connection Events
Sub-rate Connection events
Using offline encryption

7.12.1 Short Message

7.12.2 High bit rate

When sending data, the radio requires a large amount of current. Most of the current is used to run a 2.4GHz oscillator,
To modulate the wireless signal.

7.12.3 Low Overhead

7.12.4 Confirmation mechanism

The link layer Confirmation mechanism has an interesting nature, and it does not require immediate validation of the packet. This is classic Bluetooth
And a fundamental difference between low-power Bluetooth.

7.12.5 single-channel connection events

7.12.6 Sub-rate connection event

8th Chapter Host/Controller Interface

8.1 Introduction

The host Controller Interface (HCI) is the interface between the main and the controller, which mainly accomplishes two tasks:
One is to send commands you give to the controller and accept events from the controller,
The other is to send and receive data from peer devices.

8.3.2 Command Packet

The host executes the command by sending a command packet to the controller.

Each HCI packet comes with one of the following three message type encodings:
Command = 0x01
data = 0x02
event = 0x04

8.2.2 3-Wire UART

0xF for link Establishment 0x0 used to confirm

The 3-wire UART has 3 main modes:
Link Establishment
Activity status
Low voltage State

Link Establishment channel is used to confirm the operation mode of the peer device, configuration parameters and automatic detection baud rate.

8.3 Logical interface

Channels (channel)
Packet format (packet format)
Flow control

8.3.1 HCI Channel

Once the controller has established a connection with another device, the underlying HCI interface of the controller creates an HCI channel that uses
A connection handle (connection handle) to identify this HCI channel.

8.3.2 Command Packet

The host executes the command by sending a command packet to the controller.

Total of three basic command types in low power Bluetooth
Configuring the state of a controller
Request to perform a specific action
Manage Connections

1. Configuring the Controller status
We can consider the controller as a large state machine with a series of parameters that can be configured.

2. Request a specified action
Some commands can request the controller to perform the specified operation without altering the device state or connection status.

3. Manage Connections

8.3.3 Event Packet

The HCI event packet consists of an event type encoding, a parameter's length field, and an event parameter.
Low power Bluetooth has the following three basic types of events:
General Command Completion events
Common Command Status Events
Specific command Completion events

1. General Command Completion events

When the host sends a command to the controller, the controller returns a generic command completion event immediately after execution.

2. General Command Status Events

3. Specific command Completion events

8.3.4 Data Packets

8.3.5 Command Flow control

8.4 Configuration of the Controller

Before the controller communicates with the peer device, the host can perform the following related operations on the controller:
Resets the state of the controller, reads the device address, sets the event mask, reads the stream cache, reads the controller's supported
Feature list, generate random numbers, encrypt data, set random addresses, configure whitelist, and more

8.4.1 Reset the controller to a known state

8.4.2 Read Device Address

Many low-power Bluetooth devices have pre-set device addresses that can be read by the host.
If the address of the device returns full 0. At this point, the host needs to generate a random address for the controller, otherwise it cannot
Data transmission.

8.4.3 Setting the event mask

If the host does not understand the controller's events, it will cause operational problems. One way to solve the problem
is to set the event mask so that the host tells the controller that those events can be accepted, those that are unacceptable. Such a controller
Only those events that are accepted are sent.

8.4.4 Read buffer size

8.4.5 read the functions supported by the Controller

Another way to ensure that the host and controller is compatible is to first confirm that the host sends commands to the controller
Functions supported by the controller.

8.4.6 read the state supported by the controller

8.4.7 Random Number

8.4.8 Encrypting data

8.4.9 Set Random Address

If the controller does not have a fixed address, it is replaced with a random address.

8.4.10 White List

8.5 Broadcasting and observation

The most basic communication model between the two low-power Bluetooth devices is broadcast (broadcasting) and
Observe the model. Both broadcast and scan to transmit data.

8.5.1 Broadcast

The configuration parameters include the minimum and maximum interval of the broadcast, ranging from 20ms-10.24s.

8.5.2 Passive Scan

8.6 Initiating the connection

8.6.1 connecting with whitelist devices

8.7 Connection Management

8.7.1 Update Connection

8.7.2 Update Channel Map

8.7.3 Exchange Feature List

Part III

9th Chapter
Logical link control and adaptation protocol

Logical link Control and adaptation protocol (Logical link controls and adaptation Protocol,l2cap)
is a multiplexing layer that allows low-power Bluetooth to multiplex three different channels. He also supports the segmentation of data and
Reorganization function, so that larger messages can be transmitted in the underlying radio.

9.1 Background

9.2 L2cap Channel

A channel is a sequence of packets that connect a pair of services on a two device. Allows multiple channels to be enabled simultaneously between two devices.

Low power Bluetooth only supports fixed channels. The fixed-letter Dow is a two-device connection that already exists without any configuration
The channel of the parameter.

In Bluetooth, each channel identifier is a 17-bit number.

Low power Bluetooth uses 3 channels altogether:
Channel identifier 0x0004 for attribute protocol
Channel 0x0005 for low power Bluetooth signaling channels
Channel 0x0006 for Security management

9.3 L2CAP Packet Structure

All low-power Bluetooth devices must support 27-byte packets in the space transfer----4 bytes to l2cap,23 bytes for the information payload.

9.4 Low Power signaling channel

Low-power signaling is used for host-level signaling.

The command opcode supported by the low-power signaling channel is as follows:
Command denied
Connection parameter update request
Connection parameter Update response

9.4.1 Command denied

10th Chapter Properties

10.1 Background

Low power Bluetooth Last used three protocols: Logical Link Control and adaptation Protocol (L2CAP), security management
Protocol (SM) and attribute Protocol (AP).

10.1.1 Compact Protocol

10.1.2 Ubiquitous Data

10.1.3 Data and Status

Several common states of 10.1.4

External state, internal state, and abstract state.

10.1.6 Services and Specifications

10.2 Properties

A property is a tagged data that can be addressed.

10.2.1 Properties Overview

A property consists of three numeric values: An attribute handle, a property type, and a property value.

10.2.2 Property Handle


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.