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

changing Connection interval after connection established?

Hi,

the system that i designed based on nRF51822 have two mode :

the first mode is the normal mode where the nrf should have a high connection interval of 2 to 3 seconds in order to save the power. The nrf should collect data from the on-board sensors and save them into the nrf FLASH memory and at the same time it should notify the phone about these new value. This operation is done every minutes. The connection interval is suitable for this task and it allows less power consumption.

The second mode is the high speed mode where the connection interval should be as lower as possible. In this mode the user should activate the data transfer from the phone in order to transfer data stored inside the nRF flash into the phone for storage purposes. In this mode the connection interval should be above 100ms in order to offer a reasonable data transfer rate.

The problem is that i don't know how or if it's possible to switch the connection interval when the nRF is already connected to the phone.

Do you have any solution or proposition ? Should i just disconnect and reconnect again with the new connection interval parameters ?

Here's the code where i enter the connection interval parameter :

#define MIN_CONN_INTERVAL                MSEC_TO_UNITS(2000, UNIT_1_25_MS)           /**< 

Minimum acceptable connection interval (0.1 seconds). */
#define MAX_CONN_INTERVAL                MSEC_TO_UNITS(3000, UNIT_1_25_MS)           /**< Maximum acceptable connection interval (0.2 second). */

....
....
....

static void gap_params_init(void)
{	......
	......

gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
gap_conn_params.slave_latency     = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;


err_code = sd_ble_gap_ppcp_set(&gap_conn_params);

.....
.....
}

Thanks,

Parents Reply Children
No Data
Related