Page 1 of 1

BLE connection parameters update

Posted: Wed May 10, 2017 12:37 pm
by frax84
Hello,
i'm stuck in understanding how the connection parameters (min & max connection interval, latency and timeout) of a BLE connection are stored and how can they be manipulated in the GATT SERVER.

Based on my knowledge central and peripheral device negotiate the connection parameters. I coded a Gatt client that sends connection parameters at the connection request time but i don't find how they are manipulated in the Gatt server side.
I found a struct (esp_ble_conn_update_params_t) that stores these parameters and a function (esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params) ) that can be used to modify their values but nothing of these is actually called in the gatt server side.

Summarizing:
1) How and where are the connection parameters stored? Is it public? Can be exposed?
1) when the gatt client requests a dynamic update of the connection parameters what kind of callback event is generated in the gatt_handler?
2) what are the min & max connection interval i can use? Are they set using the N * 0.625 msec method? (Documentation is missing)

Thank you,
frax

Re: BLE connection parameters update

Posted: Fri May 12, 2017 4:36 pm
by frax84
Bump!

Re: BLE connection parameters update

Posted: Tue Nov 07, 2017 8:36 pm
by ayavilevich
bump...

Re: BLE connection parameters update

Posted: Wed Nov 08, 2017 3:31 am
by Lucas.Hutchinson
The min an max connection interval are set by the BLE spec.

The minimum is 6 (6*1.25 = 7.5ms).
I cant remember the max off the top of my head.

this is a function that i use to adjust the connection interval on the client side of my application

Code: Select all

void gatt_client_update_connection_params(uint8_t channel, uint8_t* remote_bda)
{
    esp_ble_conn_update_params_t conn_params;
    memcpy(conn_params.bda, remote_bda, BLE_MAC_ADDR_LEN);
    conn_params.min_int = 0x06; // x 1.25ms
    conn_params.max_int = 0x20; // x 1.25ms
    conn_params.latency = 0x00; //number of skippable connection events
    conn_params.timeout = 0xA0; // x 6.25ms, time before peripheral will assume connection is dropped.

    esp_ble_gap_update_conn_params(&conn_params);
}
This will result in the event "ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT" which would be in the callback that you have set as your gap callback.

Since this function is a feature of the GAP layer in the stack, this function should be able to be used by both a gatt_peripheral and a gatt_central.

Hope this helps.