After flashing softdevice, the ble_advertising_evt_handler_t doesn't get called, only after flashing the program for the 4th time.
/**@brief Function for initializing advertising module.
*/
static void ble_advertise_init(void) {
ble_advdata_t advdata;
ble_adv_modes_config_t options;
// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = true;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
memset(&options, 0, sizeof(options));
options.ble_adv_fast_enabled = true;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = 0;
APP_ERROR_CHECK(ble_advertising_init(&advdata, NULL, &options, ble_on_advertising_evt, NULL));
}
/**@brief Function for starting the advertising.
*/
static void ble_advertise_start(void) {
ret_code_t err_code;
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
if(err_code != NRF_SUCCESS){
APP_ERROR_CHECK(err_code);
}
}
Does anyone had this problem, or have any idea how to solve it?