This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Panic while deleting a peer entry after device reset

Hi all,

I am using SDK14.1.0

Steps of my execution are -

1) My requirement is to make bond when making connection to the android APP. I have done following initialization sequence-

log_init();
 timers_init();
 //System API for schedule initialisation - queue size 10
 buttons_leds_init(&erase_bonds);
 ble_stack_init();
 gap_params_init();
 gatt_init();
 advertising_init();
 services_init();
 conn_params_init();
 peer_manager_init();
 
 //Application API for initialisation of device configuration
 init_configuration();
 //Application API for setting of device configuration - LED- buzzer beeps/blink ,interval settings etc
 set_configuration();
 //System API for BLE advertising status check timer: timeout same as advertising timeout
    delete_bond();
  // No bond deletion at reset for now!!!!!
 // Enter main loop.
----
Bond was created after connection with Phone.

2) Do hardware reset. In device initialization I want to delete all the bonds created in step (1). I have called following function for delete bond

void delete_bond(void)
{
 ret_code_t  err_code;
 err_code = pm_peers_delete();
 APP_ERROR_CHECK(err_code);
 NRF_LOG_INFO("delete bond error code = %d",err_code);
 // disable the autoconnection in case of bond deleted.
 AUTOCONNECTION_ENABLE = false;
}

But I am getting a fatal error at Following code 

ret_code_t err_code;
    NRF_LOG_INFO("Erase bonds!");
    err_code = pm_peers_delete();
    APP_ERROR_CHECK(err_code);
Please suggest me for any sequence correction or wrong function usage. You can refer to any sample too that can showcase bond deletion logic.
Thanks,
sandeep
Related