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

Multilink central scan problem

Hi,

I am using the nRF51-DK board as a central running with ble_app_multilink_central_s130_pca10028 sample application. I am using SDK version 9.0 with Keil 5.14 version. I have third party peripheral devices like Estimote, Sensor Tag. With the central device, I am not able to scan these peripheral devices. Can you please help me to scan these devices with the central board ?

  • Hi Hung,

    Thanks for help. I am able to discover a service and it's characteristics. Now I want to discover more than one service of the same peripheral device. I have tried, but after discovering the second service my central device is restarting. My client handling init is look like:

    void client_handling_init(void) { uint32_t err_code; uint32_t i;

    ble_uuid128_t base_uuid = MULTILINK_PERIPHERAL_BASE_UUID;	
    err_code = sd_ble_uuid_vs_add(&base_uuid, &m_base_uuid_type);
    APP_ERROR_CHECK(err_code);
    ble_uuid128_t base_uuid1 = MULTILINK_PERIPHERAL_BASE_UUID1;	
    err_code = sd_ble_uuid_vs_add(&base_uuid1, &m_base_uuid_type);
    APP_ERROR_CHECK(err_code);
    
    for (i = 0; i < MAX_CLIENTS; i++)
    {
        m_client[i].state  = IDLE;
    }
    
    m_client_count = 0;
    db_discovery_init();
    
    // Register with discovery module for the discovery of the service.
    ble_uuid_t uuid[2];
    uuid[0].type = m_base_uuid_type;
    uuid[0].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID;
    err_code = ble_db_discovery_evt_register(&uuid[0], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    	
    uuid[1].type = m_base_uuid_type;
    uuid[1].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID1;
    err_code = ble_db_discovery_evt_register(&uuid[1], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    

    }

    can you please tell, where i am going wrong ?

  • @Akshat: Why do you use the same &m_base_uuid_type when calling sd_ble_uuid_vs_add() ? They are 2 different base, they should be 2 m_base_uuid_type. Think of m_base_uuid_type as the index of the 128 bit UUID base in the stack's UUID database.

  • Hi Hung,

    Thank you very much. May be i need more understanding about the central implementation. By the way i am able to scan multiple services on peripheral device. Here is my client_init code sample, please check once.

    void client_handling_init(void) { uint32_t err_code; uint32_t i;

    ble_uuid128_t base_uuid = MULTILINK_PERIPHERAL_BASE_UUID;
    err_code = sd_ble_uuid_vs_add(&base_uuid, &m_base_uuid_type);
    APP_ERROR_CHECK(err_code);
    printf("base_uuid--%d\n\r", err_code);
    
    ble_uuid128_t base_uuid1 = MULTILINK_PERIPHERAL_BASE_UUID1;
    err_code = sd_ble_uuid_vs_add(&base_uuid1, &m_base_uuid_type1);
    APP_ERROR_CHECK(err_code);
    printf("base_uuid1--%d\n\r", err_code);
    
    ble_uuid128_t base_uuid2 = MULTILINK_PERIPHERAL_BASE_UUID2;
    err_code = sd_ble_uuid_vs_add(&base_uuid2, &m_base_uuid_type2);
    APP_ERROR_CHECK(err_code);
    printf("base_uuid2--%d\n\r", err_code);
    
    ble_uuid128_t base_uuid3 = MULTILINK_PERIPHERAL_BASE_UUID3;
    err_code = sd_ble_uuid_vs_add(&base_uuid3, &m_base_uuid_type3);
    APP_ERROR_CHECK(err_code);
    printf("base_uuid2--%d\n\r", err_code);
    
    for (i = 0; i < MAX_CLIENTS; i++)
    {
        m_client[i].state  = IDLE;
    }
    m_client_count = 0;
    db_discovery_init();
    
    // Register with discovery module for the discovery of the service.
    
    ble_uuid_t uuid[4];
    uuid[0].type = m_base_uuid_type;
    uuid[0].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID;
    err_code = ble_db_discovery_evt_register(&uuid[0], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    printf("evt_register--%d\n\r", err_code);
    
    uuid[1].type = m_base_uuid_type1;
    uuid[1].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID1;
    err_code = ble_db_discovery_evt_register(&uuid[1], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    printf("evt_register1--%d\n\r", err_code);
    	
    uuid[2].type = m_base_uuid_type2;
    uuid[2].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID2;
    err_code = ble_db_discovery_evt_register(&uuid[2], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    printf("evt_register2--%d\n\r", err_code);
    	
    uuid[3].type = m_base_uuid_type3;
    uuid[3].uuid = MULTILINK_PERIPHERAL_SERVICE_UUID3;
    err_code = ble_db_discovery_evt_register(&uuid[3], db_discovery_evt_handler);
    APP_ERROR_CHECK(err_code);
    printf("evt_register3--%d\n\r", err_code);
    	
    

    }

    Now i want to read the characteristics value properly. I have tried with - err_code = sd_ble_gattc_read(p_ble_gattc_evt->conn_handle, p_srv_being_discovered->charateristics[p_db_discovery->curr_char_ind].characteristic.handle_value, 0); in on_characteristic_discovery_rsp() function. I am getting the read response also, in the response i am getting data in p_ble_gattc_evt->params.read_rsp.data. Is this a correct procedure ? if not can you please tell me how to get the actual characteristics value ?

    Thank you one again for your response.

  • @Akshat: When you have follow up question, please create another case.

    I suggest you to test and see if it work, before asking if it work or not. The best way, it to study understand the example and then follow it to implement for you application.

Related