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

PC-BLE-Driver with connectivity board doesn't connect as master

I have been using pc-ble-driver in Linux (downloaded and compiled from github here - github.com/.../3316c0c306257a825168751964f814cb95fc0d74) with our custom C++ application that is supposed to work in Central and Peripheral roles simultaneously.

For some reason, when I try to connect as Central, using sd_ble_gap_connect(adapter, p_peer_addr, p_scan_params, p_conn_params); I always get NRF_ERROR_INTERNAL. I do not have any problems with connecting as Peripheral. That is the following always returns 3.

 err_code = sd_ble_gap_connect(adapter, p_peer_addr, p_scan_params, p_conn_params);

Here is the BLE_enable code that is used in the intialization before any other API calls are made...

      params.common_enable_params.vs_uuid_count   = 1;
      params.gatts_enable_params.attr_tab_size = 0;   
      params.gatts_enable_params.service_changed = 1; 
      params.gap_enable_params.periph_conn_count = 1; 
      params.gap_enable_params.central_conn_count = 1; 
      params.gap_enable_params.central_sec_count = 1; 
    
     
     err_code = sd_ble_enable(adapter, &params, NULL); // Tried both NULL and 0x20002418

I am kinda stuck here. Any pointers much appreciated.

Parents
  • @Hung Bui, Here are the connection and scan parameters passed to sd_ble_gap_connect(). I have checked the examples that you pointed out. I am not using Python. I am using C++ and am able to enumerate ports, connect to slave devices etc. Heart rate collector example seems to be using Central role. However, I failed to see what I am doing wrong comparing that example to mine.

    ble_gap_scan_params_t   sp;
    ble_gap_conn_params_t   cp;
    ble_gap_addr_t *   addressToConnect = addressreceivedFromBLE_GAP_EVT_ADV_REPORT;
    
    sp.selective = 0;
    sp.active = 0; 
    sp.interval = 50;
    sp.window = 10;
    sp.timeout = 1;
    
    cp.min_conn_interval = 10;
    cp.max_conn_interval = 10;
    cp.slave_latency = 0;
    cp.conn_sup_timeout = 1000;
    
    //Connect to address we know from BLE_GAP_EVT_ADV_REPORT
    err_code = sd_ble_gap_connect(adapter, addressToConnect, &sp, &cp);
    
Reply
  • @Hung Bui, Here are the connection and scan parameters passed to sd_ble_gap_connect(). I have checked the examples that you pointed out. I am not using Python. I am using C++ and am able to enumerate ports, connect to slave devices etc. Heart rate collector example seems to be using Central role. However, I failed to see what I am doing wrong comparing that example to mine.

    ble_gap_scan_params_t   sp;
    ble_gap_conn_params_t   cp;
    ble_gap_addr_t *   addressToConnect = addressreceivedFromBLE_GAP_EVT_ADV_REPORT;
    
    sp.selective = 0;
    sp.active = 0; 
    sp.interval = 50;
    sp.window = 10;
    sp.timeout = 1;
    
    cp.min_conn_interval = 10;
    cp.max_conn_interval = 10;
    cp.slave_latency = 0;
    cp.conn_sup_timeout = 1000;
    
    //Connect to address we know from BLE_GAP_EVT_ADV_REPORT
    err_code = sd_ble_gap_connect(adapter, addressToConnect, &sp, &cp);
    
Children
No Data
Related