分类: 嵌入式
2016-07-21 08:58:55
Bluetooth Low Energy (BLE) is designed for low data rate applications, like control signals, sensor readings, etc. However, occasionally there is a need for higher data rates with BLE. The theoretical over-the-air data rate of BLE is 1 Mb/s, but that’s the PHY layer transfer rate between devices and doesn’t account for protocol overhead. The maximum achievable data rate is closer to 10kB/s but this is device dependent, as we’ll explain below.
[]
There are multiple connection parameters (defined in Bluetooth 4.0 specification, Volume 3, Part A, Section 4.20) that will determine the throughput. Keep in mind that higher throughput will result in more power consumption.
This defines how often that the central communicates with the peripheral. There can be a maximum of four packets sent per connection interval, and each packet can have up to 20B of payload. According to the BLE specification, the allowable range for connection parameters is from 7.5mSec to 4000mSec. The Connection Interval is the parameter that most affects data rate. Think of the Connection Interval as the train schedule: for example, trains leave the station every half hour. Each train can have 1-4 cars, and each car can hold 0 to 20 bytes. So if you have a 20 ms Connection Interval, then the theoretical maximum for sending a message and receiving the ACK is 80 bytes (of data) in 40 mS (one Connection Interval to send, plus one Interval to receive the ACK). But trains leave whether full or not. So you might only send 20 bytes every 80 mS — or less.
This is the number of connection intervals that the slave is allowed to skip. For example, if the connection interval is 20mSec and slave latency is 4, then if the peripheral wants to then it only needs to answer the master every 80mSec. Slave latency is useful if you want to mostly stay asleep, but then burst out data at a faster rate occasionally. In this case, the peripheral only needs to respond to the master every 80mSec to keep the connection alive, but if it has a lot of data then it can send data every 20mSec. Slave Latency is any value between 0 and 499, though it cannot exceed: ((supervisionTimeout / connInterval) – 1)
This parameter specifies the maximum amount of time that either the master or slave can go before receiving a link-layer packet. Both slave and master device maintain their own “Supervision timer”, which resets to zero every time a packet is received. If supervision timer ever reaches the supervision timeout, the device considers the connection lost, and exits the connection state (returning to the advertising, scanning, or standby state). The Connection Supervision Timeout is in the range of 100ms and 32.0s. It Must be larger than (1 + slaveLatency) * (ConnInterval).
This is the number of packets that can be sent in each connection interval. According to the Bluetooth specification, the maximum packets per connection interval is 6, but iOS limits this to 4.
Here you may set the Connection Parameters to their maximum values, with a Connection Interval as low as 7.5mSec to give the highest throughput.
Recall earlier where we mentioned that the maximum achievable data rate is device dependent. According to the Apple, the connection parameters are restricted as follows:
If Bluetooth Low Energy HID is one of the connected services of an accessory, connection interval down to 11.25 ms may be accepted by the Apple product.
Theoretical maximum throughput for iOS is: 80B per 40mSec, which results in 2kB/Sec. Using Notifications / Indications may increase this.
Connection Parameters for Android are device dependent, but some devices can support a Connection Interval as short as 7.5mSec. YMMV.