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

nRF Connect desktop Error: "failed to get descriptor"

Hi,

I am trying to use nRF Connect for desktop with a dongle or nrf52 DK to connect with another board. When I want to get the value from the connected board, it would always display this error: "failed to get descriptor", no matter whether using "notify". I cannot read or write anything

 

Could you please tell me how to solve this problem?

Thank you in advance!

Best,

Taoyi

  • When I used nrf connect for android, it cannot read the value of CCCD. But the value of CCCD should be 0x0000 or 0x0001 depends on whether the notification is opening!

    When I tried to read the value, it would disconnect and return error 0x85 GATT error

  • Hi Taoyi

    According to the error message, another GATT operation is already in progress, so I assume the connected board is already doing something GATT related. What application is this? I just tested myself, using the ble_app_hrs example application (SDK v.16.0.0), and don't run into this problem at all using two nRF52 DKs. AS you can see in the log below, reading and writing attribute values do not cause any issues.

    Best regards,

    Simon

  • I tried the hrs example in the official SDK and it works. The example I was running was provided by another company and it was just a simplified version of the official ble_hrs_example.  

    When I tried to connect it using nrf connect for android, if I first open the notification, and then read the cccd, it works. However, if I first read the cccd, then it returns the error! It depends on the order! All other functions (read the location...) could work.

     Thus, I'm thinking that could it be possible that some configurations are wrong? or some parameters are wrong? or something is missing?

    Here's the code of charateristic add part

        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = BLE_UUID_HEART_RATE_MEASUREMENT_CHAR;
        add_char_params.max_len           = MAX_HRM_LEN;
        add_char_params.init_len          = 0;
        add_char_params.p_init_value      = initial_hrm;
        add_char_params.is_var_len        = true;
        add_char_params.char_props.notify = 1;
        add_char_params.cccd_write_access = p_hrs_init->hrm_cccd_wr_sec;
    				
    	
        err_code = characteristic_add(p_hrs->service_handle, &add_char_params, &(p_hrs->hrm_handles));
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }

    Thank you very much

  • Hi

    What exact changes have been made from the original ble_app_hrs example? Does this error occur on all of the services, or just the body sensor one? Is seems like the body sensor characteristic has been edited somewhat in your example. Can you show me how it is configured as well?

    I also see that your init_len and init_value differs from the characteristic parameters of the HRM configuration, try changing these to the values below to see if that helps.

        add_char_params.init_len          = hrm_encode(p_hrs, INITIAL_VALUE_HRM, encoded_initial_hrm);
        add_char_params.p_init_value      = encoded_initial_hrm;

    We also have this BLE characteristics tutorial, so if your goal is to add custom characteristics I suggest taking a look at that.

    Best regards,

    Simon

  • Thanks for your help. This error only happens when the characteristic uses notification and has cccd. I tried your method and it does not work. 
    The example I'm using only remove battery level service, and simplify the heart rate function. Here's the related code, and I cannot find the difference of CCCD related part between official example and this one. 

    static void services_init(void)
    {
    ret_code_t err_code;
    ble_hrs_init_t hrs_init;
    ble_dis_init_t dis_init;
    uint8_t body_sensor_location;
    nrf_ble_qwr_init_t qwr_init = {0};
    
    qwr_init.error_handler = nrf_qwr_error_handler;
    err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
    APP_ERROR_CHECK(err_code);
    
    
    /*------------------------------------*/
    body_sensor_location = BLE_HRS_BODY_SENSOR_LOCATION_WRIST;
    memset(&hrs_init, 0, sizeof(hrs_init));
    hrs_init.evt_handler = NULL;
    hrs_init.is_sensor_contact_supported = true;
    hrs_init.p_body_sensor_location = &body_sensor_location;
    
    hrs_init.hrm_cccd_wr_sec = SEC_OPEN;
    hrs_init.bsl_rd_sec = SEC_OPEN;
    err_code = ble_hrs_init(&m_hrs, &hrs_init);
    APP_ERROR_CHECK(err_code);
    /*--------------------END-------------------*/
    
    /*------------------------------*/
    memset(&dis_init, 0, sizeof(dis_init));
    
    ble_srv_ascii_to_utf8(&dis_init.manufact_name_str, (char *)MANUFACTURER_NAME);
    dis_init.dis_char_rd_sec = SEC_OPEN;
    err_code = ble_dis_init(&dis_init);
    APP_ERROR_CHECK(err_code);
    /*-------------------END-----------------*/
    }
    
    
    uint32_t ble_hrs_init(ble_hrs_t * p_hrs, const ble_hrs_init_t * p_hrs_init)
    {
        uint32_t              err_code;
        ble_uuid_t            ble_uuid;
        ble_add_char_params_t add_char_params;
        uint8_t               initial_hrm[9];
    	uint8_t               encoded_initial_hrm[MAX_HRM_LEN];
      
        p_hrs->evt_handler                 = p_hrs_init->evt_handler;
        p_hrs->is_sensor_contact_supported = p_hrs_init->is_sensor_contact_supported;
        p_hrs->conn_handle                 = BLE_CONN_HANDLE_INVALID;
        p_hrs->is_sensor_contact_detected  = false;
        p_hrs->rr_interval_count           = 0;
        p_hrs->max_hrm_len                 = MAX_HRM_LEN;
    
        BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HEART_RATE_SERVICE);
        err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                            &ble_uuid,
                                            &p_hrs->service_handle);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = BLE_UUID_HEART_RATE_MEASUREMENT_CHAR;
        add_char_params.max_len           = MAX_HRM_LEN;
        add_char_params.init_len          = hrm_encode(p_hrs, INITIAL_VALUE_HRM, encoded_initial_hrm);
        add_char_params.p_init_value      = encoded_initial_hrm;
        add_char_params.is_var_len        = true;
    	
        add_char_params.char_props.notify = 1;
        add_char_params.cccd_write_access = p_hrs_init->hrm_cccd_wr_sec;
    				
    		//char_md.p_char_user_desc = (uint8_t *) user_desc;
       // char_md.char_user_desc_size = strlen(user_desc);
       // char_md.char_user_desc_max_size = strlen(user_desc);
    		
    		
        //Add char
        err_code = characteristic_add(p_hrs->service_handle, &add_char_params, &(p_hrs->hrm_handles));
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    		
    		
    		
        if (p_hrs_init->p_body_sensor_location != NULL)
        {
            memset(&add_char_params, 0, sizeof(add_char_params));
            add_char_params.uuid            = BLE_UUID_BODY_SENSOR_LOCATION_CHAR;
            add_char_params.max_len         = sizeof(uint8_t);
            add_char_params.init_len        = sizeof(uint8_t);
            add_char_params.p_init_value    = p_hrs_init->p_body_sensor_location;
            add_char_params.char_props.read = 1;
            add_char_params.read_access     = p_hrs_init->bsl_rd_sec;
    				
            err_code = characteristic_add(p_hrs->service_handle, &add_char_params, &(p_hrs->bsl_handles));
            if (err_code != NRF_SUCCESS)
            {
                return err_code;
            }
        }
    
        return NRF_SUCCESS;
    }

Related