This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Slow BLE throughput with Nexus 5X

Hi,

I am trying to transfer large amounts of data over BLE, to a large amount of devices so speed is critical.

So far, i am able to send the nRF51422 (S110 V8.0.0) a 48Kbyte chunk of data in 12.6 seconds which is roughly 32kBits a second if i am right, which is far from the value of 125kbits i have seen in another thread.

Writes in the app are queued, so whenever onCharacteristicWrite is called, another 20 byte packet is sent to the device. Also i use the BluetoothGatt#requestConnectionPriority to get a better connection interval prior to the transfer.

To my understanding, via this method of transferring, the nexus 5 should transfer 6 packets per interval, which should be around 10mS, resulting in much faster speed than i have now.

At the minute packets seem to be going to the device at a rate of around 5mS which would indicate that there are multiple packets being sent during the interval, as i think it cannot be lower than 7.5mS (if it was sending 6, then the interval would be 32mS).

The nRF51 is configured to accept a connection interval between 7.5 and 100mS.

Is there a different method i should be using in the app, or some missed config on the nRF51?

  • I guess you are calling requestConnectionPriority() with CONNECTION_PRIORITY_HIGH? Then you should get 11.25-15ms connection interval, but I would check what the actual connection interval is, see this.

    As far as I know Nexus 5 supports 6 packets of 20 bytes per connection interval.

    With 15ms connection interval and 6 packets of 20 bytes in every connection interval you should be able to achieve a throughput of 6 * 20 * 8/0.015 = 64kbps. But this is assuming that you have no packet loss, that you fill all packets with 20 bytes, that Android allows you to send 6 packets in every connection interval.

    I would check the actual connection interval, and then I would use a sniffer to see what is actually happening on air. Also keep in mind that you will have to process the packets in the peripheral quickly.

  • Hi Pettter,

    i am calling requestConnectionPriority() with CONNECTION_PRIORITY_HIGH.

    Before i call that i get this as my connection interval, ..\Main\blemain.c,402: CONN INTERVAL = 36

    after i call it, i get this ..\Main\blemain.c,402: CONN INTERVAL = 58

    That is the raw value of p_ble_evt->evt.gap_evt.params.connected.conn_params.max_conn_interval.

    The nexus 5X is running Android 7.1.1, and the app is built on the nougat SDK.

  • Here are some things from the bluetooth log for you if they are useful

    "386","13.985244","host","controller","HCI_CMD","18","Sent LE Connection Update" 0000 01 13 20 0e 02 00 24 00 24 00 00 00 d0 07 00 00 0010 00 00

    "387","13.993223","controller","host","HCI_EVT","7","Rcvd Command Status (LE Connection Update)" 0000 04 0f 04 00 01 13 20

    "388","14.054963","controller","host","HCI_EVT","13","Rcvd LE Meta (LE Connection Update Complete)" 0000 04 3e 0a 03 00 02 00 24 00 00 00 d0 07

  • I also would like to ask, is the minimum interval of 11.5mS a nougat thing? I remember it being able to handle 7.5mS on earlier android versions.

    If i was to get a custom rom or downgrade is it possible to get a bit more speed?

  • That is in 1.25ms units, so then you start off with a connection interval of 36 * 1.25ms = 45 ms, and then it gets updated to 58 * 1.25ms = 72.5ms. With 6 packets with 20 bytes in each you end up with a maximum throughput of:

    6 * 20 * 8 / 0.0725 = 13.241 kbps.

Related