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

Peer manager causes fault due to invalid connection handle.

Hello all!

I'm trying to optimize power consumption for project based on nRF51802 and external host MCU. My current platform and toolchain:

1. nRF51802 as Bluetooth controller at custom board.

2. Segger Embedded Studio. Release 3.34b.

3. Soft Device S130 V2.0.1.

4. SDK version 12.3.0.

All had been working fine while it wasn't using peer manager library. I do need it since nRF51802 supposed to be put in sleep mode and it should store bonding information for further connections. Device freezes on pairing stage for first pairing occurence or on restoring secured connection in rare cases when bonding procedure was successfull. 

After some debugging I found that "sm_smd_evt_handler" is fed by event with zero connection handle, however connection is already established and GAP related functions doesn't rise any errors. I wonder how it can be as all events submitted by SoftDevice are common for all handlers. I know that handlers order in event dispatcher does matter, I think I put them correct. 

Please see details below. 

Any help would be apreciated! 

static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    ble_conn_params_on_ble_evt(p_ble_evt);
    ble_conn_state_on_ble_evt(p_ble_evt);    
    pm_on_ble_evt(p_ble_evt); 
    ble_evt_handler(p_ble_evt);
   
}

Related