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

You need to add DEBUG as preprocessor define for the error to be printed.

can you elaborate on it? hardly understand what u are talking about

It shows as the pictures
why is this happening
main.c 282
static void adv_scan_start(void) {
ret_code_t err_code;
scan_start();
// Turn on the LED to signal scanning.
bsp_board_led_on(CENTRAL_SCANNING_LED);
// Start advertising.
err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Advertising");
}
it still keeps crashing and rebooting
while am I using the release mode it did not happen
but why
If it's ble_advertising_start() that returns error 8 (NRF_ERROR_INVALID_STATE), then looking at the doc here , it means that the advertising module is not initialized. i.e. advertising_init() need to be called before adv_scan_start()
it means that the advertising module is not initialized. i.e. advertising_init() need to be called before adv_scan_start()

but i have already called
OK, it could be that underlaying function sd_ble_gap_adv_start() that also returns NRF_ERROR_INVALID_STATE
* @retval ::NRF_ERROR_INVALID_STATE adv_handle is not configured or already advertising.
2 delete_bonds could perhaps trigger this.

Try to remove the first call to delete_bonds().
If you want to "force" delete_bonds to be called, then set erase_bonds= true instead
but why cant i direct use delete_bonds func even I remove the second one it still happened
adv_handle is not configured or already advertising.
also did you mean delete_bond() will call advertise start function? how to fix that?
but why cant i direct use delete_bonds func even I remove the second one it still happened
adv_handle is not configured or already advertising.
also did you mean delete_bond() will call advertise start function? how to fix that?
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);