0

Gap Connection Event Length changes when using different smartphones

grihlo gravatar image

asked 2018-01-12 17:00:45 +0100

updated 2018-01-12 22:51:45 +0100

First about my setup: custom devices with NRF52832 chips (SoftDevice 132 v.4.0.2), android smartphones Nexus 5x and 6p.

I'm trying to connect as many BLE devices (peripherals) as it is possible to a smartphone (central) within the fixed connection interval of 30 ms. The GAP event length is set to 2 (in 1.25 => 2.5ms) for each BLE device. Therefore the theoretical amount of maximum central links with this CI is 12 (2.5 *12 = 30). So here is what I saw using Nexus 5x.

D0 and D1 - radio ON signals of first and second BLE devices

image description

The event length between two central links is set to 2.5 ms - as I expected. After that I tried with Nexus 6p:

image description

The event length changed to 3.7 (3.75) ms.

Is there any way to overcome this problem or it will always vary on different smartphones?

Note that you can't set the GAP event length using Android BLE stack.

edit retag flag offensive close delete report spam

Comments

What exactly do you mean with GAP event length? Do you mean Connection Event length for the Link Layer? How exactly do you set it? Are you running the smartphone as master or slave?

Emil Lenngren ( 2018-01-12 21:57:56 +0100 )editconvert to answer

Sorry, that it isn't that detailed described. Yes, I meant Connection Event length for the link layer. Smartphone is master (central) and ble devices are slaves (peripherals). I will edit the question.

grihlo ( 2018-01-12 22:16:25 +0100 )editconvert to answer

How do you set the Connection Event length? Have you compiled a custom version of the Android source code and changed the parameter here (https://android.googlesource.com/plat... ) and here https://android.googlesource.com/plat... ?

Emil Lenngren ( 2018-01-12 22:22:16 +0100 )editconvert to answer

I have set connection event length only for BLE devices and I didn't changed it in Android code. Since Ble is still for me kind of a Blackbox, I assumed that connection event length on smartphone would be automatically adapted to connection event length on devices.

grihlo ( 2018-01-12 22:40:24 +0100 )editconvert to answer

I'm not sure I follow... Exactly where in your code do you "set connection event length"? And you are not meaning Connection Interval here? Or are you talking about Nordic's "connection bandwidth"? (https://devzone.nordicsemi.com/questi...)

Emil Lenngren ( 2018-01-12 22:46:08 +0100 )editconvert to answer

I'm setting connection event length like in this post using ble_cfg.conn_cfg.params.gap_conn_cfg.event_length = 2; (in 1.25 units -> 2,5 ms)

I assume that it is equal to Nordic's BLE_CONN_BW_LOW in older version (3.x.x) of SofDevice.

grihlo ( 2018-01-12 23:05:12 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
1
Emil gravatar image

answered 2018-01-12 23:31:01 +0100

The connection event length setting you set in a device will only affect how the device, when it acts as master schedules multiple connections. A setting in a slave cannot affect how another master schedules the connections.

As you might know, the BLE protocol works that in each connection event, the two devices (master and slave) exchange at least one packet each (possibly empty). Master always starts and the slave always have to respond to a packet from the master device, unless it needs to use the radio for something else. The master may send another packet after it received the response from the slave.

The only thing you configure when you configure the connection event length in a slave is for how long time in a connection event the slave will respond to the master's packet. As you can probably guess, the master doesn't know this value and definitely not on the connection setup (since at that time the slave hasn't sent any packet=information at all).

Since there is no API in Android to set the connection event length (as you can see the Android host stacks set the values to 0, which means "don't care"), we are restricted to whatever the Bluetooth controller in the phone picks, which will be very different between different manufacturers.

Also note that for some reason the Google guys have hardcoded maximum number of Bluetooth connections to 7 in standard Android so you won't be able to do what you are trying (reach 12). Note that the Nexus 6P can actually handle 15 connections, but to do that you need to change that maximum number of connections parameter in Android's source code and compile your own OS.

edit flag offensive delete publish link more

Comments

Thank you for helping. It is a pity that Android BLE API doesn't allow to change it.

grihlo ( 2018-01-12 23:46:29 +0100 )editconvert to answer

Just want to add to Emil's explanation: Increasing the connection event lenght on a peripheral will also affect how much memory is used for buffers on the peripheral. This is calculated in the SD, but max should be 7 tx buffers.

run_ar ( 2018-01-15 08:53:20 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower

Stats

Asked: 2018-01-12 17:00:45 +0100

Seen: 222 times

Last updated: jan. 12