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

sd_ble_gap_connect(); FAIL Connection Request Failed, reason 0x00000005

Hello,

I am trying to do make a connection with sd_ble_gap_connect();

First i am scanning all the devices arond and i am filtering with my functions using with ble_gap_evt_adv_report_t;

After that i am trying to connect a device which i had it's peer address from adv_report;

            if(ibeacon_uuid_match(p_scan_evt->params.filter_match.p_adv_report))
            {  
                m_peer_addr = p_scan_evt->params.filter_match.p_adv_report->peer_addr;
                if (m_conn_handle == BLE_CONN_HANDLE_INVALID)
                {   
                    u_int8_t err_code = sd_ble_gap_connect(&m_peer_addr,
                                                  &m_scan_param,
                                                  &m_connection_param,
                                                  APP_IPSP_TAG);

                    if (err_code != NRF_SUCCESS)
                    {
                        NRF_LOG_INFO("Connection Request Failed, reason 0x%08lX", err_code);
                                NRF_LOG_INFO("sd_ble_gap_connect() returned: %s\n",
                        nrf_strerror_get(err_code));
                    }
                    APP_ERROR_CHECK(err_code);
                    }

But sd_ble_gap_connect returns 0x00000005.

here is my other connection parameters:

    static ble_gap_scan_params_t const m_scan_param =
{
    .active        = 0x00,
    .interval      = 100,
    .window        = 50,
    .filter_policy  = BLE_GAP_SCAN_FP_ACCEPT_ALL, // Do not use whitelist.
    .scan_phys      = BLE_GAP_PHY_AUTO,            // Automatic PHY selection.
    .timeout        = 0,                          // Never stop scanning unless explicit asked to.

};

static const ble_gap_conn_params_t m_connection_param =
{
    .min_conn_interval = (uint16_t)MIN_CONN_INTERVAL,   // Minimum connection 50
    .max_conn_interval = (uint16_t)MAX_CONN_INTERVAL,   // Maximum connection 100 
    .slave_latency     = 0,                                   // Slave latency
    .conn_sup_timeout  = (uint16_t)CONN_SUP_TIMEOUT        // Supervision time-out 4000
};

Also I am looking for a example which is i can write to a custom char. 

Thank you!,

Sirac

Parents Reply Children
No Data
Related