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

What's the actual connection interval used?

Hi,

I'm trying to get the actual connection interval used between my nRF51822 device and iOS device. I have read this article, but I cannot get it worked. I used sd_ble_gap_ppcp_get() function in BLE_GAP_EVT_CONNECTED and BLE_GAP_EVT_CONN_PARAM_UPDATE events, but I always got two different values for max_conn_interval and min_conn_interval. And they were the values I set for MAX_CONN_INTERVAL and MIN_CONN_INTERVAL. Is there any thing I did wrong? Can someone help me to get the actual connection interval?

Thanks and Regards, Calvin

Parents
  • Hi

    As an introduction to how the connection parameter update procedure works, look at this thread.

    The Peripheral Preferred Connection Parameters (ppcp) contains e.g. the MIN_CONN_INTERVAL and MAX_CONN_INTERVAL values which is set into the GAP service with call to function sd_ble_gap_ppcp_set(). If you read that with sd_ble_gap_ppcp_get() you will only get the same preferred peripheral values again, but not the actual connection parameters chosen by the central. If you use the Master Control Panel to connect to the device and discover services, you will see the values that you set with sd_ble_gap_ppcp_set() in a characteristic with name SlavePreferredConnectionParameters

    image description

    Try e.g. the ble_app_template example. Start the application in the debugger and set a breakpoint as shown below

    image description

    Then if you connect with the Master Control Panel, discover services and enable services, then you will see five seconds later that execution stops at the breakpoint. If you then watch "m_current_connection_params" variable, then you can see that both min and max values are 0x0190, which is 400 decimal which is equal to 500ms since the connection interval is represented in 1.25ms steps. In the ble_app_template example MIN_CONN_INTERVAL = 500ms and MAX_CONN_INTERVAL = 1000ms, so in this case, Master Control Panel has chosen 500ms connection interval.

Reply
  • Hi

    As an introduction to how the connection parameter update procedure works, look at this thread.

    The Peripheral Preferred Connection Parameters (ppcp) contains e.g. the MIN_CONN_INTERVAL and MAX_CONN_INTERVAL values which is set into the GAP service with call to function sd_ble_gap_ppcp_set(). If you read that with sd_ble_gap_ppcp_get() you will only get the same preferred peripheral values again, but not the actual connection parameters chosen by the central. If you use the Master Control Panel to connect to the device and discover services, you will see the values that you set with sd_ble_gap_ppcp_set() in a characteristic with name SlavePreferredConnectionParameters

    image description

    Try e.g. the ble_app_template example. Start the application in the debugger and set a breakpoint as shown below

    image description

    Then if you connect with the Master Control Panel, discover services and enable services, then you will see five seconds later that execution stops at the breakpoint. If you then watch "m_current_connection_params" variable, then you can see that both min and max values are 0x0190, which is 400 decimal which is equal to 500ms since the connection interval is represented in 1.25ms steps. In the ble_app_template example MIN_CONN_INTERVAL = 500ms and MAX_CONN_INTERVAL = 1000ms, so in this case, Master Control Panel has chosen 500ms connection interval.

Children
No Data
Related