Hi,
I need to be able to change the GAP parameters of my connection for only a short period of time to save battery life but have high throughput when I need it. My firmware will only need to send data for a few seconds every 5 minutes, and the nRF52 will be in deep sleep for the rest of those 5 minutes. If I try to update the connection parameters before and after sending data, the firmware crashes. I suspect it could be because the new connection interval isn't fully set before we start sending data. I have also read that requesting connection parameter updates more frequently than every 30 seconds isn't recommended, so how can I go about doing this so that it is stable and I won't have to leave deep sleep 30 seconds after sending data?
This is the basic flow I need:
wake up
set fast connection interval
send ble data // only takes a few seconds
set slow connection interval
go back to sleep
Here is the code I have tried that crashes:
uint32_t err_code;
ble_gap_conn_params_t fast_gap_conn_params = { // set fast interval };
err_code = ble_conn_params_change_conn_params(&fast_gap_conn_params);
APP_ERROR_CHECK(err_code);
ble_send_data(data, data_size); // my own send function
ble_gap_conn_params_t slow_gap_conn_params = { // set slow interval };
err_code = ble_conn_params_change_conn_params(&slow_gap_conn_params);
APP_ERROR_CHECK(err_code);
Any help would be appreciated. Thanks!