Hello
I have a problem with restarting advertising after disconnect event. There are two scenarios:
In this case everything works fine:
- I start advertising
- Device connects
- Device disconnects (It sends Disconnect command)
- I restart advertising in disconnect event
In this case sd_ble_gap_adv_start hangs:
- I start advertising
- Device connects
- Disconnect event occures because I go away from this device and connection gets lost. The other device doesn't send Disconnect event (because it simply too far away).
- I restart advertising in disconnect event and chip hangs
There is my code:
case BLE_GAP_EVT_DISCONNECTED:
m_conn_handle = BLE_CONN_HANDLE_INVALID;
advertising_start();
break;
...
void advertising_start(void)
{
uint32_t err_code;
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;
adv_params.fp = BLE_GAP_ADV_FP_ANY;
adv_params.interval = APP_ADV_INTERVAL;
adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS;
err_code = sd_ble_gap_adv_start(&adv_params); // hangs on this line!
APP_ERROR_CHECK(err_code);
}
I use nRF51822 with SDK 9.00 in peripheral mode with S130 softdevice