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

sd_ble_gap_adv_start hangs after disconnect

Hello

I have a problem with restarting advertising after disconnect event. There are two scenarios:

In this case everything works fine:

  1. I start advertising
  2. Device connects
  3. Device disconnects (It sends Disconnect command)
  4. I restart advertising in disconnect event

In this case sd_ble_gap_adv_start hangs:

  1. I start advertising
  2. Device connects
  3. 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).
  4. 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

Parents
  • We use S130 9.0.0.

    Chip: N51822 QFAAGO 1403AN

    Now we make ine more experiment. We took Bluegiga BLED112 BLE dongle, and made connection.

    When I went far away with notebook from out device the supervisor timeout occured but after disconnect our device continued to advertise - everything was alright.

    When I pulled out USB dongle during communication our device received disconnect event, but advertising didn't start

Reply
  • We use S130 9.0.0.

    Chip: N51822 QFAAGO 1403AN

    Now we make ine more experiment. We took Bluegiga BLED112 BLE dongle, and made connection.

    When I went far away with notebook from out device the supervisor timeout occured but after disconnect our device continued to advertise - everything was alright.

    When I pulled out USB dongle during communication our device received disconnect event, but advertising didn't start

Children
No Data
Related