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

pc-ble-driver - Connection Request Failed, reason 4

Hi, I am trying to connect 4 devices with the pc-ble-driver. Therefore I modified the heartrate example.

3 Devices are connecting fine - on the 4th connection request I get: Connection Request Failed, reason 4 => No Memory for operation

In ble_stack_init() ble_enable_params.gap_enable_params.central_conn_count is set to 4.

If I try to connect 4 devices with nRFConnect 2.1.0 instead - all is working fine!

What is the difference here?

Also I am still facing the question: Which optimisations in FW or on pc-ble-driver side can I perform for maximum throughput with pc-ble-driver to 4 central(only) connections?

regards

Frederik

  • Just did some further testing: setting MAX_PEER_COUNT to 6 seems to work for 4 devices. Is this a bug?

  • MAX_PEER_COUNT should not cause this error, unless you have modified the example to use this define in another way. Is the error returned from the call to sd_ble_gap_connect()? From the API documentation, NRF_ERROR_NO_MEM is caused by "The configured memory pool (see ble_conn_bw_counts_t) is not large enough for the bandwidth selected for this connection". Are you setting BLE_COMMON_OPT_CONN_BW using sd_ble_opt_set() in your code? What value do you pass to p_conn_bw_counts in param to sd_ble_enable()?

  • Oh im sorry, there was some missing information about MAX_PEER_COUNT - I modified the example to use MAX_PEER_COUNT to be also used by ble_enable_params.gap_enable_params.central_conn_count as mentioned above.

    So it's still the error described in the post:

    - ble_enable_params.gap_enable_params.central_conn_count = 4 doesn't work for 4 devices.
    - ble_enable_params.gap_enable_params.central_conn_count = 5 doesn't work for 4 devices
    - ble_enable_params.gap_enable_params.central_conn_count = 6 works for 4 devices 
    

    It's the parameter passed to sd_ble_enable()

  • Hi,

    The problem is that the parameter ble_enable_params.common_enable_params.p_conn_bw_counts for sd_ble_enable() is set to NULL, while the BLE_COMMON_OPT_CONN_BW option is set to BLE_CONN_BW_HIGH. If p_conn_bw_counts is set to NULL, the stack will only reserve RAM for the default setting, which is BLE_CONN_BW_MID for BLE_GAP_ROLE_CENTRAL. See this and this infocenter page for more details.

    The solution is either to provide valid p_conn_bw_counts parameter to sd_ble_enable():

    ble_conn_bw_counts_t ble_conn_bw_counts;
    memset(&ble_conn_bw_counts, 0, sizeof(ble_conn_bw_counts));
    ble_conn_bw_counts.rx_counts.high_count = MAX_PEER_COUNT;
    ble_conn_bw_counts.tx_counts.high_count = MAX_PEER_COUNT;
    ble_enable_params.common_enable_params.p_conn_bw_counts = &ble_conn_bw_counts;
    

    Or to change ble_options_set() to use medium bandwidth configuration:

    common_opt.conn_bw.conn_bw.conn_bw_rx = BLE_CONN_BW_MID;
    common_opt.conn_bw.conn_bw.conn_bw_tx = BLE_CONN_BW_MID;
    

    Best regards,

    Jørgen

Related