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

[Bug Report] device manager connection instance

I found a possible bug in device manager in SDK 8.1.0 for S120. If you set for example DEVICE_MANAGER_MAX_BONDS 2 and try to bond another device, you get "No free connection instances available" result from device manager. When you get that, err_code is set to NRF_ERROR_NO_MEM, which is fine. But device manager then doesn't notify main application on this event, because variable notify_app is set only if err_code was NRF_SUCCESS. This happens in function: dm_ble_evt_handler(ble_evt_t * p_ble_evt)

err_code = connection_instance_allocate(&index);

        //Connection instance is successfully allocated.
        if (err_code == NRF_SUCCESS)
        {
            //Application notification related information.
            notify_app           = true;
            event.event_id       = DM_EVT_CONNECTION;
            handle.connection_id = index;

            m_connection_table[index].conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            m_connection_table[index].state       = STATE_CONNECTED;
            m_connection_table[index].peer_addr   =
                p_ble_evt->evt.gap_evt.params.connected.peer_addr;    etc...

Notify_app variable should be set no matter what the connection_instance_allocate(&index); function returns. In my case, this makes the app go into hardfault after bonding scan times out, but I don't know if this is related to this issue or not.

Parents Reply Children
No Data
Related