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

ble_uart example with bonding

Using nrf52 DK , SDK 12.2 , and armgcc.

I want to use BLE_UART but I also want to bond.

I started with the BLE_UART example code and added peer manager and FDS.

I have no issue connecting and UART works fine but I still can't bond. FDS is also working fine.

I use nRF Connect app (android) and can connect fine but when I try to bond, th elog just says Bonding Failed.

What am I missing?

Any help would be appreciated.

--edit

main.c

added main.c file

-- end edit

Parents
  • Hi,

    You are not dispatching BLE events to the peer manager. Your function ble_evt_dispatch() looks like this:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_params_on_ble_evt(p_ble_evt);
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
    }
    

    But should look like this:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_state_on_ble_evt(p_ble_evt);
        ble_conn_params_on_ble_evt(p_ble_evt);
        pm_on_ble_evt(p_ble_evt);
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
    }
    
Reply
  • Hi,

    You are not dispatching BLE events to the peer manager. Your function ble_evt_dispatch() looks like this:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_params_on_ble_evt(p_ble_evt);
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
    }
    

    But should look like this:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_state_on_ble_evt(p_ble_evt);
        ble_conn_params_on_ble_evt(p_ble_evt);
        pm_on_ble_evt(p_ble_evt);
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
    }
    
Children
Related