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

SDK15 nRF52810 need to delete bonded data when try to connect with previos bonded device.

Hi!

SDK15, nRF52810, S110 (peripherial)

I have bonded pair with central device. Now I erase all data in this central device.The periph device has bonded data. I restarted both devices and set central to bonding mode. Now I want in the periph first erase data than bond again.

It is possible to do with next:

    bool bonding = button_is_pressed();
    ...
    if(bonding && pm_peer_count())
    {
        err_code = pm_peers_delete();
        APP_ERROR_CHECK(err_code);
        nrf_delay_ms(500);
        sd_nvic_SystemReset();
    }

All works fine.

Now I want to change logic to next:

If on the periph device pressed button, I ready to bond. But before bond, need to erase bond data.

And at this case we have problem- If periph has stored bonded data before, I get case 

case PM_EVT_BONDED_PEER_CONNECTED:

If there delete bonded data, project fall.

I mean, If I try to bond with any new central device- I get case

case BLE_GAP_EVT_CONNECTED:

where possible delete bonded info.

But in the case to bond with previos bond device, which data was stored, I get directly event  

case PM_EVT_BONDED_PEER_CONNECTED:

where I can't to delete this.

Is it possible to decide it?

Parents Reply Children
No Data
Related