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 ?

Parents
  • Hi Akshat,

    How did you test that ? Note that the multilink_central example only connect to and print out log when the device that has the short or complete name matches target.

    What you should do is to print out the advertising data you receive when BLE_GAP_EVT_ADV_REPORT occurs.

    Make sure you are scanning without any whitelist (selective scanning)

  • 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.

Reply
  • 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.

Children
No Data
Related