I am using KW38 BLE with SDK 2.6.6 on both central and peripheral devices. The central device is used to update connection interval with the following function:
void BleApp_SetConnectionInterval(deviceId_t peerDeviceId, uint32_t interval)
timeout = interval * 5 / 10U;
interval /= 1.25;
Gap_UpdateConnectionParameters(peerDeviceId, interval, interval, gConnReqParams.connLatency, timeout, gConnReqParams.connEventLengthMin, gConnReqParams.connEventLengthMax);
The central calls this function 3 times:
1) right after connection to peripheral: it sets interval to 600ms
2) after some time, upon an external event: it sets interval to 4 seconds
3) after 1 minute since case 2: it sets interval back to 600ms
The problem is that the third interval setting is applied after 30-40 seconds from function call!
if (connectionEvent->eventData.connectionUpdateComplete.status == gBleSuccess_c)
LOG_I("connection parameters updated: interval %d, timeout %d", connectionEvent->eventData.connectionUpdateComplete.connInterval, connectionEvent->eventData.connectionUpdateComplete.supervisionTimeout);
The problem is that it takes so long to get this event!
/* Accept/refuse connection updates automatically */
#define gConnUpdateAlwaysAccept_d 1
Question: how long should the connection parameter update take, in theory?
I think at most 1 old connection interval (for the command to go) + 1 new connection interval (for the response to be received). In case 3, I would expect about 4.6 seconds, not 40.
Hi @FedericoWegher ,
I reproduced the issue that you reported and I opened an internal discussion. I will come back with updates.
Hi @FedericoWegher ,
According to Core Spec, in a procedure which involves a PDU with an Instant field the master should allow a minimum of 6 connection events that the slave will be listening for before the instant occurs.
LL_CONNECTION_UPDATE_IND does have an Instant field so a delay of minimum 6 connection intervals should be expected.
In our implementation, a delay of 15 connection interval was chosen. You will receive an improved version of controller library which will use the minimum delay possible in accordance with specification(6) in top of MR2 release.
If you need more details please let us know.