BLE interval randomly changed to 40 in HIDS Samples

I'm developing a BLE mouse using the central_hids, peripheral_hids and the LLPM samples.

When I power both receiver and mouse, the mouse is very responsive for the first few seconds thanks to LLPM, after which the interval of the BLE connection gets set to 40, which being higher than LLPM makes the system lose performance (the mouse lags).

I can see this from the `le_param_updated()` callback below:

static void le_param_updated(struct bt_conn *conn, uint16_t interval,
                             uint16_t latency, uint16_t timeout)
{

        if (interval == INTERVAL_LLPM)
        {
                printk("--------------------Connection interval updated: LLPM (1 ms)\n");
        }
        else
        {
                printk("--------------------PARAM CHANGED strangely: %d\n", interval);
        }
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
    .connected = connected,
    .disconnected = disconnected,
    .security_changed = security_changed,
    .le_param_updated = le_param_updated,
};

Log info from the central/receiver:

00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> --------------------PARAM CHANGED strangely: 40
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0
00> Notification, id: 3, size: 4, data: 0x0 0x0 0x0 0x0

This change of interval makes it so that I need to re-set the interval to LLPM by re-calling `enable_llpm_short_connection_interval()` (taken from the LLPM sample).

Basically after the mouse boots up I need to wait a few seconds before it has usable latency, which is not optimal.

The connection interval gets changed only if there is a peripheral connected to it, after a few seconds.

I cannot figure out why/where this change in interval is coming from in the central_hids sample.

Steps to reproduce:

- take the central hids sample, put this code in and let it connect to the peripheral hid sample:

static void le_param_updated(struct bt_conn *conn, uint16_t interval,
							 uint16_t latency, uint16_t timeout)
{
	if (interval == 0x0D01)
	{
		printk("Connection interval updated: LLPM (1 ms)\n");
	}
	else
	{
		printk("Connection interval changed strangely: %d-%d\n", interval, latency);
	}
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected = connected,
	.disconnected = disconnected,
	.security_changed = security_changed,
	.le_param_updated = le_param_updated};

Any idea why the interval is being set to 40?

Thanks

Parents Reply Children
No Data
Related