calling pm_peers_delete cause fatal error
why does it happened?
nRF5_SDK_17.0.2_d674dde/ble_app_multirole_lesc

calling pm_peers_delete cause fatal error
why does it happened?
nRF5_SDK_17.0.2_d674dde/ble_app_multirole_lesc

Likely because you are trying to call adv_scan_start() in main(), but it's already advertising.
delete_bonds() -> event PM_EVT_PEERS_DELETE_SUCEEDED -> adv_scan_start() called in pm_evt_handler()
, then you call adv_scan_start() again in main(), and get NRF_ERROR_INVALID_STATE.
Sigurd said:If you want to "force" delete_bonds to be called, then set erase_bonds= true instead
alternatively, you could try this:
advertising_init();
delete_bonds(); // Scanning and advertising is started by PM_EVT_PEERS_DELETE_SUCEEDED.
// Start execution.
NRF_LOG_INFO("LE Secure Connections example started.");
// Enter main loop.
for (;;)
{
idle_state_handle();
}
so it seems like the adv_scan_start() cause this so can I add delete_bonds() to a button without error?
i need to try to stop advertising,but it seems like it cannot be stop using
err_code=sd_ble_gap_adv_stop(m_advertising.adv_handle);
APP_ERROR_CHECK(err_code);
the same error shows as above
so how to stop advertise correctly
nvm I think I fix those I need to stop both
err_code=sd_ble_gap_adv_stop(m_advertising.adv_handle);
APP_ERROR_CHECK(err_code);
err_code=sd_ble_gap_scan_stop();
APP_ERROR_CHECK(err_code);