日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

BLE 包结构及传输速率

發布時間:2025/3/21 编程问答 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 BLE 包结构及传输速率 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

根據Bluetooth 4.0 BLE部分協議:

BLE中物理層physical layer的傳輸速率是1Mbps,除了這個外,數據傳輸速率與包大小、CPU處理時間相關。

包結構:

1.總體結構:

?

preamble(1 Byte)+ Access Address(4 Bytes)+ PDU + CRC(3 Bytes)

preamble = 10101010 or 01010101

Access Address = 0x8e89bedd6

2. 廣播包

PDU =??Header(2 Bytes)+ Payload (37 Bytes max.)

Header:??1)0000 - connected undirected advertising event 可連接非定向廣播事件

???2)0001 -?connected directed advertising event 可連接定向廣播事件

???3)0010 - non-connected undirected advertising event 不可連接非定向廣播事件

4)0011 -?response to scan request form scanner掃描請求響應

?????5)0101 - connect request by initiator連接請求

6)0110?-connected directed advertising event 可發現非定向廣播事件

?

  • 非定向廣播包(Undirected advertising packets)

Payload ?= AdvA (6 Bytes) + AdvData (31 Bytes max.) ;?

?

?

//?AdvA ?contains advertiser‘s public address if TxAdd = 1, or a random address if TxAdd = 0;?

//?AdvData advertising data;

  • 定向廣播包(Directed advertising packets)

Payload ?= AdvA (6 Bytes) + InitA(6 Bytes) ;?

//?AdvA ?contains advertiser‘s public address if TxAdd = 1, or a random address if TxAdd = 0;?

//?InitA contains initiator's address if RxAdd = 1, or a random address if RxAdd = 0;

?

?

3. 掃描請求及掃描響應

?

PDU =??Header(2 Bytes)+ Payload (37 Bytes max.)

Header:??1)0011 - scan request for further information from advertiser 掃描請求

???2)0100 -?response to scan request from scanner 掃描響應

?

  • 掃描請求

Payload ?= ScanA (6 Bytes) + AdvA(6 Bytes) ;

// ScanA ?contains Scanner's public address if TxAdd = 1, or a random address if TxAdd = 0;?

//?AdvA ?contains advertiser‘s public address if TxAdd = 1, or a random address if TxAdd = 0;?

  • 掃描響應

Payload ?= ?AdvA(6 Bytes) + ScanRspData(0~31Bytes);

// ScanRspData data from advertiser’s host;?

//?AdvA ?contains advertiser‘s public address if TxAdd = 1, or a random address if TxAdd = 0;?

?

?

3. 連接請求

?

PDU =??Header(2 Bytes)+ Payload (34 Bytes)

Header:0101 - connect request by initiator

Payload?=InitA(6 Bytes)+ AdvA(6bytes)+ LLData(22 Bytes)

LLData 包含連接信息,詳細結構參考bluetooth 4.0 協議。

4. LL 數據通道及控制包

?

PDU =??Header(2 Bytes)+ Payload (27 Bytes max.)

Header:詳細說明參考bluetooth 4.0 協議;

?

  • LL 數據通道

?

Payload ?= 0~27 bytes

?

  • LL?控制包

Payload = 1~23 Bytes

?

若只考慮藍牙設備連接之后,評估數據傳輸速率

?

  • 最大包長度:preamble(1 Byte)+ Access Address(4 Bytes)+ PDU(29 Bytes) + CRC(3 Bytes)= 41 Bytes
  • 射頻PHY傳輸速率 1Mbps

則傳輸有效payload 27字節耗時:41*8/1 = 328 us

?

一個27字節的傳輸周期 :328 + 150 + 80 + 150 = 708 us,若能持續傳輸,即傳輸速度:38KB/s,這樣顯然功耗不會低,也不符合BLE協議規范,真正的傳輸速度受連接事件間隔和間隔內能傳輸數據包數目相關。

如果連接時間間隔設置到7.5ms(協議規定最小值),一個連接事件傳輸3個包,則傳輸速率大約是10.8kB/s,一個連接事件能傳輸幾個包與連接設備密切相關,看到很多CC2540實測數據,時間間隔7.5ms和一個傳輸時間3個包以上很多都達不到,51內核是其重要原因之一,在?http://processors.wiki.ti.com/index.php/CC2540_Data_Throughput有5.9KB/s,也有在論壇看到有40ms間隔,2個包,即1.4KB/s成功的案例,以后有時間我再實測下速度。

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的BLE 包结构及传输速率的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。