This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sd_ble_gap_adv_start error 18 NRF_ERROR_CONN_COUNT

Hi, I am upgrading to SDK 11.0.0 and S130 v2.0.0 from SDK 9.0.0 and S130 1.0.0 and I am stuck with an error when I call sd_ble_gap_adv_start. Here's the code that now fails (worked with the previous SDK&SD versions):

ble_gap_adv_params_t adv_params;
memset (&adv_params, 0, sizeof (adv_params));
adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
adv_params.p_peer_addr = NULL;                           // Undirected advertisement
adv_params.fp          = BLE_GAP_ADV_FP_ANY;
adv_params.interval    = 1600;
adv_params.timeout     = 0;
err_code = sd_ble_gap_adv_start(&adv_params);
APP_ERROR_CHECK(err_code);

sd_ble_gap_adv_start returns error 18 NRF_ERROR_CONN_COUNT " or "maximum connection count exceeded". I am trying to setup a 0 central and 1 peripheral configuration. I've followed the SD130 2.0.0 migration doc and used devzone.nordicsemi.com/.../ to find the RAM requirements.

Here are the steps I followed for the softdevice setup:

  uint32_t err_code;
  ble_enable_params_t ble_enable_params;
  err_code = softdevice_enable_get_default_config(0, 1, &ble_enable_params);
  APP_ERROR_CHECK(err_code);
  //Check the ram settings against the used number of links
  CHECK_RAM_START_ADDR(0,1);
  // Enable BLE stack.
  err_code = softdevice_enable(&ble_enable_params);
  APP_ERROR_CHECK(err_code);
  // Initialize SoftDevice. Use NRF_CLOCK_LF_SRC_RC
  nrf_clock_lf_cfg_t clock_lf_cfg = {
    .source = NRF_CLOCK_LF_SRC_RC,
    .rc_ctiv = 4,     // Check temperature every 4 seconds
    .rc_temp_ctiv = 1, // Calibrate at least every 8 seconds even if the temperature hasn't changed
  };
  err_code = sd_softdevice_enable(&clock_lf_cfg, softdevice_fault_handler);
  APP_ERROR_CHECK(err_code);
  sd_nvic_EnableIRQ(SWI2_IRQn);

  // Enable BLE stack
  memset(&ble_enable_params, 0, sizeof(ble_enable_params));
  ble_enable_params.gatts_enable_params.service_changed = IS_SRVC_CHANGED_CHARACT_PRESENT;
  uint32_t x = 536877312;//0x20001900
  err_code = sd_ble_enable(&ble_enable_params, &x);
  APP_ERROR_CHECK(err_code);
  ble_gap_addr_t addr;
  sd_ble_gap_address_get(&addr);
  sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);
  sd_ble_gap_appearance_set(BLE_APPEARANCE_GENERIC_DISPLAY);
  ble_gap_conn_params_t m_connection_param = {400, 800, 0, 400};
  sd_ble_gap_ppcp_set(&_gap_conn_params);
  sd_ble_gap_tx_power_set(-4);

I haven't found any relevant pointers in the forum so far so any help is appreciated. florin

Related