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

calling pm_peers_delete cause fatal error

calling pm_peers_delete cause fatal error

why does it happened?

nRF5_SDK_17.0.2_d674dde/ble_app_multirole_lesc

Parents Reply
  • 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();
        }

Children
Related