Arm Mbed OS support forum

Change BLE connection interval

Hi all

I am using the mbed heartrate example on mbed (with nrf52_EK) and I was trying to change the BLE connection interval (let’s say to the minimum - 7.5ms) to perform some tests.

A piece of code I found online is the following
but It gives erros and doesn’t compile…

Any solutions or suggestions?


void updateConnectionParams()
    BLE &ble = BLE::Instance();
    if (ble.getGapState().connected) {
        gap_params.connectionSupervisionTimeout = 500;
        gap_params.minConnectionInterval = 6; // It is unit of 1.25 ms
        gap_params.maxConnectionInterval = 6;
        gap_params.slaveLatency = 0;
        LOG("Request a connection params update!\n");
        if (, &gap_params) != BLE_ERROR_NONE) {
            LOG("Error sending the request!\n");

@mreiscarneiro Here is an example code I have used in the past so I can update the connection parameter when an IPhone connects to my BLE Device.

//iphones connection intervals.
const uint16_t MinConnectionInterval = 512; 
const uint16_t MaxConnectionInterval = 532;
const uint16_t SlaveLatency = 2;
const uint16_t ConnectionSupervisionTimeout = 600;

void BleDongle::UpdateConnectionParameter() {
    if(m_bIsConnected) {
        //update the connection parameters to set better power management.
        ble_error_t error =,
        if(error != BLE_ERROR_NONE) {
            logError("Unable to Update connection parameters with BLE Error: %d\n", error);
        else {
            logDebug("Updated Connection Parameters successfully!!!");