Hi,
SDK: nRF5_SDK_00.11.00 ; S132 SoftDevice v2.0.0
I am working now to migrate my application from DM to PM (in order to better handle pairing&bonding).
Sometimes the application will not start advertising, I start to advertise using:
static uint32_t augu_ble_start_advertising(void)
{
uint32_t err_code;
err_code = advertising_enable_disable_(1);
if (NRF_SUCCESS != err_code)
{
AUGU_LOG_PRINTF_ERR("ERROR: advertising_enable_disable_(1) ; error code: %d\n", err_code);
}
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
if (NRF_SUCCESS != err_code)
{
AUGU_LOG_PRINTF_ERR("ERROR: ble_advertising_start(BLE_ADV_MODE_FAST) ; error code: %d\n", err_code);
}
return err_code;
}
void augu_on_adv_evt(ble_adv_evt_t ble_adv_evt) { switch (ble_adv_evt) { case BLE_ADV_EVT_IDLE: AUGU_LOG_PRINTF_WRN("ADV EVENT: BLE_ADV_EVT_IDLE (%d)\n", ble_adv_evt); augu_ble_main_fsm(AUGU_BLE_FSM_EVENT_ADV_IDLE); break; case BLE_ADV_EVT_SLOW: AUGU_LOG_PRINTF_WRN("ADV EVENT: BLE_ADV_EVT_SLOW (%d)\n", ble_adv_evt); break; case BLE_ADV_EVT_FAST: AUGU_LOG_PRINTF_WRN("ADV EVENT: BLE_ADV_EVT_FAST (%d)\n", ble_adv_evt); break; default: AUGU_LOG_PRINTF_ERR("ADV EVENT: received unhandled ADV event (%d)\n", ble_adv_evt); break; } }
This happens most often after flashing the application - it will not start advertising (only after 2-4 reset cycles)
I am looking for the root cause of that because I am not sure it will happen only after flashing, and I surely don't want to solve it with a patch.
BTW,
I tried to start to advertise in a loop (some kind of while until I get the 1st event) but after 8 retires still adv didn't start (only resetting the device 2-4 times solved this)
Best regards,
Erez.