stopping advertize after dfu

hi 

after success dfu operation the firmware start to run

then i am getting stuck write after err_code = sd_ble_gap_device_name_set(&sec_mode, new_name, DYNAMIC_NAME_LEN);

because i need to stop the advertizing after the DFU

if am am cancelling the if ()  and stopping anyway i am getting error 0x3004

what is the difference between running from start or from dfu?

how can i know if the advertize is running?

thank you

nati 

if (m_advertising_running) {
// Safe to stop or update advertising
bsp_board_led_off(LEDBUTTON_LED);
// Stop current advertising (safe even if not running)
err_code = sd_ble_gap_adv_stop(m_adv_handle);
if (err_code != NRF_SUCCESS && err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
}

GetDataUUID(new_manuf_data);
if(NumSent++ >= NumRec)
{
NumSent = 0;
MemAdr = 0x21000;
}
// ==== Set GAP device name ====
ble_gap_conn_sec_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

err_code = sd_ble_gap_device_name_set(&sec_mode, new_name, DYNAMIC_NAME_LEN);
APP_ERROR_CHECK(err_code);

Related