当前位置:网站首页>Bluetooth development (6) -- literacy of Bluetooth protocol architecture

Bluetooth development (6) -- literacy of Bluetooth protocol architecture

2022-06-11 00:08:00 yuanyun_ elber

Bluetooth protocol architecture literacy

http://www-x-wowotech-x-net.img.abc188.com/content/uploadfile/201601/55182faff2cc9b359b52f6001d239d7720160114142019.gif

The protocol architecture of Bluetooth is really diverse , We've met before , With hci Layer differentiation host and controller The Chu River Han boundary , Then subdivide the two sides ,hci Below the floor lc、lmp layer ,hci There are l2cap and profile.

Let's look at this picture again , This picture is different again ,l2cap Below the floor is logical layer and physical layer.

Are you dizzy again ?

In fact, it's just from different angles , Previous architecture diagrams focused more on software protocols , The emphasis of this figure is on the physical link 、 A large number of abstract baseband concepts such as logical links .

Take a look at the following picture to make it clearer .

 

First of all physical channel.

The most basic condition of Bluetooth communication is that the receiving end and the sending end adjust the frequency to the same frequency band , The frequency band here is physics channel The concept of .

BR、EDR According to whether it supports adaptive frequency modulation basic piconet physical channel and adapted piconet physical channel.

Note that there are only two physical channel From the top physical link Of the connecting line , Why? page scan and inquiry scan There is no? , Because of the connection 、 Scanning these two conditions is a special state of Bluetooth , Use only at certain times , And can't control any properties , Basically host towards controller Next command , It enters this state , So it's not physical link In the embodiment .

Physical link It is an abstract concept , Does not correspond to any entity , For power 、 This layer is responsible for the management of the receipt / delivery cycle ,active、park Corresponding to different power consumption , The upper echelons don't have to know .

Logical The link layer corresponds to different packet formats , We have already talked about passing in chapter three packet header Medium llid To distinguish between acl-c and acl-u The situation of the . Of course, this is only the corresponding figure br/edr acl This link , There are many other links , The basic rule is , Always end with “c” All are control links , such as amp-c、acl-c、le-c wait , Always end with “u” All of them are upper level profile data , such as acl-u、psb-u、le-u wait .

All links , Have corresponding formats , Each format has a corresponding logical transport Layer provides services for it , Including flow control with different formats 、 Retransmission mechanism, etc .

Come to a knowledge point : The difference between logical link and logical channel ——

Many people like to talk about logical links , In fact, it mainly talks about the above controller The concept of layers , But the logical channel , Generally speaking , It's about l2cap Open to the upper layer cid. These are two concepts .

All of these , stay core spec Of controller This is explained in detail in the chapter , Some concepts are abstract , Not easy to understand .

Controller The structure of the protocol stack is relatively simple , Namely LMP and LC Two layers of ,LMP Namely link manager protocol,LC Namely link controller, Because this is usually something inside the Bluetooth module , So the reader may not know much , But understand the specific functions , It's necessary .

Let's take a look at this picture

Than the previous one host The diagram of protocol stack is much simpler, isn't it ?

In fact, it is not simple , There are a lot of things to say about segmentation .

stay HCI Layer the following , First of all LMP,LMP The function of link management is just as the name suggests , All the above physical link、logical link、logical transport All are LMP To manage .

LMP Upward bearing HOST Protocol stack , Receive from HOST Of hci command, You can manage LINK controller And baseband , Send to a remote Bluetooth device LMP pdu( We mentioned above ACL-C Do you remember Bao ? Namely LMP package ), Realize link connection 、 Control and maintenance .

Old rules , Let's take a look at our bags , See what happens during the connection process .

First , our host towards controller Sent the chain building Command

Look at Bluetooth core spec Map in , That's true :

Host After giving the order, I put it down , The rest is LMP Doing it , Look at the air bag ,LMP First, exchange with the remote device feature, See what each other supports , Then sent a LMP host connection request To the opposite end . Take a look at the parts marked in red below , We mentioned earlier LMP Down is the control LC Of ,LC Filled this LMP The head of the bag , Baotou contains flow control 、ARQ、 Package format and other information , The package format here is DM1,ARQN It's a ACK sign , It means this LMP The package needs a reply ; then payload header in LLID It indicates that this package is a ACL-C package , That is to say LMP package .

The remote end receives LMP After package , Will send to host Upload a request to connect event, from host To determine whether to accept the connection , If accepted , It is the following flow chart , We did receive it this time LMP accepted package , Indicates that the connection was successful .

 

This is the time , One acl The logical link has been established , Bluetooth protocol provisions , There can only be one between two devices acl Linked . however sco There can be several links .

Sco It is mainly used for hands-free calls , In a fixed time slot (reserved slots) send out , It mainly ensures the synchronization of communication , Not sure , Data lost is lost .

Take a look at building sco Flow chart of the link :

The same is host Give orders ,lmp perform , No more details , It's quite clear .

 

Link controller The function of will be closer to the bottom .

in general , It is based on the current physical link status , Run a state machine , Execute this status (page?inquiry?connection?park?) Tasks that must be performed , FM transceiver on different physical channels page package 、inquiry Packets or other data packets, etc , perform piconet Switch 、 Master-slave switchover and other work that directly deals with the hardware at the bottom .

The header of each Bluetooth packet is LC Of map, Among them ARQ、FLOW These bits are link controller Plus , it is to be noted that , Bluetooth only ID There is no bag packet header Of .

 

 

 

 

原网站

版权声明
本文为[yuanyun_ elber]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020629284352.html