BLE technology (two) --- protocol stack architecture and physical layer design (Core_v5.2)

Preface

The previous blog post Bluetooth protocol stack design and evolution has introduced the four major application scenarios and corresponding technical solutions of the Bluetooth protocol. In order to meet the needs of IoT devices, the Bluetooth protocol has added indoor precision positioning technology and large-scale MESH-based Ad hoc networking technology and IPv6 networking technology based on 6LoWPAN have gradually occupied the niche of short-distance and low-rate wireless communication in the wireless technology of the Internet of Things, and the future prospects are promising.
Bluetooth 5.2 protocol architecture
The Bluetooth Technology Alliance SIG has focused on the BLE low-power protocol. The newly launched technical solutions to meet the needs of IoT devices are also based on the BLE protocol. With the release of LE Audio technology, the main application scenarios of Bluetooth devices are It can be carried on the BLE protocol instead of relying on the BR/EDR protocol. Since the BR/EDR protocol is about to be late and it is relatively independent from the LE protocol, the two have no inheritance relationship. The Bluetooth technology will be introduced based on the BLE protocol in the future.

、 、 BLE System Architecture

In contrast to the Bluetooth protocol structure diagram above, shield the BR/EDR Controller on the left and the AMP Controller on the right, leaving only the LE Controller in the middle, and abstract the LE Controller into two levels: Physical Layer and Logic Link Layer (if LE Audio development is required) , Need to highlight Isochronous Adaptation Layer, this article will collapse it into the abstract Link Layer).

There is a HCI host controller interface layer between LE Controller and Host, which defines the communication interface specification between Host and Controller. The earliest Bluetooth was developed with mobile phones. The Bluetooth module and the mobile phone processor chip are both independent chips, and each has many types. In order to ensure the compatibility of the communication between the Bluetooth module and the CPU chip, SIG has defined a unified set of The communication interface specification HCI, as long as it conforms to the HCI standard, different CPU chips and different Bluetooth Controller modules can communicate smoothly through the HCI over UART/USB interface (the middle scheme in the figure below, for example, the CPU chip often uses Bluez to Realize the Host function). In low-power and low-cost IoT devices, Host and Controller are usually placed on the same Soc chip. At this time, there is no need for physical HCI. Host and Controller interact directly through API (Figure below) The scheme on the left, such as Nordic's Bluetooth protocol stack Softdevice, implements the function of the entire Bluetooth protocol stack). The scheme on the right of the figure below needs to use the proprietary communication protocol provided by the Bluetooth chip supplier, and its versatility and compatibility are limited.
Bluetooth protocol stack solution

The Host part directly communicates with the Controller Link Layer by L2CAP (Logical Link Control and Adaptation Protocol) Layer. ISO data streams such as audio are not processed by L2CAP, and directly communicate with the ISO Adaptation Layer more efficiently. The GATT of the BLE protocol has put all service information in the ATT, so there is no need for a separate SDP service discovery protocol. The application layer above the Host is the various Profiles services. The BLE protocol architecture is illustrated as follows (Core_V5.2 adds an isochronous channel for the LE Audio service, which is not explicitly shown in the figure below): The
BLE protocol stack structure
functions of each layer of the BLE protocol stack are described as follows :

  • Physical Layer (PHY) : Specify the wireless frequency band used by BLE (ISM frequency band is divided into 40 channels, each channel occupies 2M Hz bandwidth, bit rate can support up to 2 Mbps, 40 channels are divided into 3 broadcast channels and 37 Data channel, frequency hopping technology is used to switch channels in order to avoid co-frequency interference), modulation and demodulation mode (BLE uses GFSK Gaussian frequency shift keying modulation), radio frequency performance (such as transmit power, receiving sensitivity), etc.;
  • Link Layer (LL) : There are many things to do in this layer, such as which radio frequency channel to choose for communication, how to identify data packets in the air, at which time to send the data packets, how to ensure the integrity of the data, and how to ACK Receiving, how to retransmit, and how to manage and control the link, etc. The LL layer is only responsible for sending or recovering the data, and how to analyze the data is handed over to the above GAP or ATT;
  • Host Controller Interface (HCI) : Defines the communication interface specification between the Host and Controller modules. HCI is mainly used when the Host module and the Controller module implement the BLE protocol stack on two chips respectively to regulate the communication between the two Protocol and communication commands, etc.;
  • L2CAP (Logic link control and adaptation protocol) : Simple encapsulation of the Link Layer, LL only cares about the transmitted data itself, L2CAP must distinguish whether it is an encrypted channel or an ordinary channel, and at the same time manage the connection interval. At the same time, it provides mechanisms such as multiplexing, fragment reassembly, and flow control for upper-layer applications, which are somewhat similar to the concept of TCP protocol Port;
  • SMP (Security Manage Protocol) : used to manage the encryption, authentication and security of BLE connection communication, such as key generation, information encryption, digital signature, authentication and authentication, secure pairing, etc., similar to the functions of the TLS/SSL protocol;
  • ATT (Attribute Protocol) : "Attribute" is a small piece of data that is addressed and labeled. The attribute protocol provides some methods for the peer device to read and modify the value of these attributes (Attribute value). Each attribute consists of four Element composition: Attribute Handle is used to uniquely identify the attribute, Attribute Type (UUID) is used to identify the type of data stored, Attribute Value is used to store the value of the data, Attribute Permissions is used to define the access permissions of the attribute (for example, an attribute value is " 25", the data whose attribute type is "℃" may be placed in the attribute with the handle ID of 0x01DE, and the client has read-only permission for this attribute);
  • GATT (Generic Attribute Profile) : introduces the concepts of "Characteristic", "Service", "Include" relationship between services, and "Descriptor" of characteristics. It also defines some specifications for discovering services, characteristics, and relationships between services. Relationship, and read and modify these characteristic values. Profile can be regarded as an application specification or a set of related services. BLE is a service-oriented modular design. Each service encapsulates a set of related "Attributes" and their access methods (you can compare each "Service" to The "class" in object-oriented programming, both are encapsulation of a set of element data and its operation methods, and both are encapsulated as reusable as possible);
  • GAP (Generic Access Profile) : Defines how the device discovers other devices, connects to other devices, reads the information of other devices and binds to them, and how the device is discoverable, connectable, and bindable Related Profile;
  • Profiles : Application services provided according to business needs, such as blood pressure, heart rate, temperature, power, proximity detection and HID human-computer interaction equipment, etc. Each Profile contains one or more Services (BLE adopts Client/Server architecture, Server implementation And provide corresponding application services externally, Client can discover and access corresponding service data);

Some new concepts introduced by BLE, such as the relationship between Profile, Service, Characteristic, Descriptor, and Attribute are shown in the figure below (each row on the right corresponds to an Attribute, and the four columns correspond to the four elements of each Attribute):
The relationship between Profile/Service/Characteristic/Attribute

二、LE Physical Layer

BLE low energy Bluetooth uses the 2.4 GHz ISM (Industrial Scientific Medical) frequency band to transmit information. This frequency band is the only frequency band that does not require authorization in all countries. Wi-Fi, Bluetooth, Zigbee and other wireless LAN protocols all choose this frequency band for communication. The ISM 2.4 GHz frequency range is 2400-2483.5 MHz, and the frequency range used by BLE is 2402-2480 MHz. The low frequency and high frequency parts of BLE and the ISM 2.4 GHz frequency band boundary reserve 2 MHz and 3.5 MHz respectively.

The BLE frequency band is divided into 40 channels, each of which has a bandwidth of 2 MHz, of which the 37, 38, and 39 channels are broadcast channels (the frequency selection deliberately avoids the most commonly used Wi-Fi 1, 6, 11 To reduce interference), the remaining 37 channels are data channels (in order to improve the broadcast capability, Bluetooth 5.0 adds an extended broadcast function, that is, the data channel is used as the second broadcast channel), the channel distribution is as follows:
BLE physical broadcast channel and data channel frequency allocation
BLE selected Although the ISM frequency band is exempt from authorization, it also means that it is facing serious co-frequency interference (Wi-Fi, Zigbee and other wireless LAN technologies use this frequency band). In order to enhance the anti-interference performance, ISM has designed the following for BLE:

  • The choice of broadcast channel frequency avoids Wi-Fi commonly used channels. At the same time, the frequency difference between the three fixed broadcast channels is at least 24 MHz, so as to avoid serious interference in a certain frequency band and affect all broadcast channel communications;
  • Frequency hopping technology is used to switch regularly between multiple data channels, such as frequency hopping algorithm f n+1 = (f n + hop) mod 37 where hop is a value in the range of 5 – 16, when it is detected When the data channel communication is affected, switch to the next channel to continue communication according to the frequency modulation algorithm. Because the channels before and after the frequency hopping algorithm switch are not continuous, it can avoid the centralized interference of a certain frequency band;
  • Use adaptive frequency hopping technology to avoid the interfered channel. When the interfered channel is detected, it will be marked as a bad channel, and the known bad channel will be mapped to the known good channel to reduce the frequency hopping algorithm jumping to the bad channel. Probability, thereby reducing interference to data channel communication;
  • GFSK frequency shift keying has a shortcoming. The ability to receive consecutive identical bits is relatively poor. If a bit sequence of all 0s or all 1s is encountered, the receiver will consider the transmitter frequency offset. To avoid this problem, BLE uses "whitening" To randomize the data to be sent, the receiving end also uses the “whitener” to restore the original data to avoid transmitting the same bit sequence continuously.

BLE uses GFSK (Gauss frequency Shift Keying) Gaussian frequency shift keying to modulate the transmission data. The channel frequencies introduced above all refer to the center frequency, and the negative frequency offset relative to the center frequency represents bit 0, and the positive frequency offset relative to the center frequency represents bit 1, the modulation bit rate of BLE 4.x is 1 Mbps, and the Bluetooth 5.x version has a new option of 2 Mbps, which lays the foundation for supporting LE Audio audio transmission. The minimum frequency deviation in FSK frequency shift keying increases as the modulation bit rate increases. When the modulation bit rate is 1 Mbps, the minimum frequency deviation is about 185 KHz, and when the modulation bit rate is 2 Mbps, the minimum frequency deviation is about 370 KHz. .
GFSK modulation technology used by BLE
BLE focuses on low power consumption, how to achieve low power consumption? Power consumption is positively related to data transmission rate, transmission time, transmission power, modulation efficiency and other factors. If you want to reduce power consumption, you can reduce the transmission rate, reduce the transmission time, reduce the standby power consumption during non-transmission time, and reduce the transmission time. In terms of transmitting power and improving modulation efficiency, BLE also relies on long-term deep sleep, periodic wake-up and data transmission to greatly reduce average power consumption and extend battery life. The maximum transmit power specified by BLE is +20 dBm, and the minimum transmit power is -20 dBm. It is divided into four power levels. The corresponding power level is selected according to the business's requirements for transmission rate and power consumption.

For BLE to demodulate a valid signal smoothly, there are also regulations on the minimum signal received. BLE has different upper limits of receiving sensitivity for different modulation methods. In the case of constant power consumption, the signal transmission rate is negatively correlated with the transmission distance, that is, the higher the signal transmission rate, the greater the minimum demodulation signal strength (the upper limit of receiving sensitivity is greater). If you want to increase the transmission distance, you can use Modulation technology with lower transmission rate is realized (the upper limit of receiving sensitivity is smaller). There is a path loss for electromagnetic waves propagating in the air. The maximum power loss allowed for BLE propagation in the air = transmit power-receiving sensitivity . By comparing the path loss vs. distance curve of electromagnetic waves in the BLE band, the maximum allowable distance for BLE normal communication can be obtained. For example, Bluetooth 5.0 claims that LE Coded PHY with S=8 (each data bit is represented by 8 symbols) The transmission distance of the modulation method can reach 4 times that of LE Uncoded 1M PHY.
LE Tx Power / Rx Sensitivity / Path loss 关系
For the LE Link Layer state machine and data message structure, see the next blog post: LE Link Layer States + Air Interface Packets (Core_v5.2) .

More articles:

Guess you like

Origin blog.csdn.net/m0_37621078/article/details/107411324