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

ble_conn_params_change_conn_params getting error 0x3002 in nrf52832

I'm working nrf52 DK, SDK V15.3 , S132 . I have created custom Services and characteristics its working fine. I need to change gap parameter in some cases because i need to transfer higher amount of data. But when changing gap parameter getting error 0x3002.

       ble_gap_conn_params_t gap_conn_params;

        memset(&gap_conn_params, 0, sizeof(gap_conn_params));
        gap_conn_params.min_conn_interval = HP_MIN_CONN_INTERVAL;
        gap_conn_params.max_conn_interval = HP_MAX_CONN_INTERVAL;
        gap_conn_params.slave_latency = HP_SLAVE_LATENCY;
        gap_conn_params.conn_sup_timeout = HP_CONN_SUP_TIMEOUT;

    err_code = ble_conn_params_change_conn_params(&gap_conn_params);
    if (err_code != NRF_SUCCESS) {
        SEGGER_RTT_printf(0, "gap_params_update FAILED. err_code=%d\n", err_code);
        return err_code;
    }

Parents
  • Doesn't ble_conn_params_change_conn_params() have two input parameters?

    If you have changed that, what does your ble_conn_params_change_conn_params() definition looks like?

    In the unmodified SDK, it looks like this:

    ret_code_t ble_conn_params_change_conn_params(uint16_t                conn_handle,
                                                  ble_gap_conn_params_t * p_new_params)
    {
        ret_code_t                   err_code   = BLE_ERROR_INVALID_CONN_HANDLE;
        ble_conn_params_instance_t * p_instance = instance_get(conn_handle);
    
        if (p_new_params == NULL)
        {
            p_new_params = &m_preferred_conn_params;
        }
    
        if (p_instance != NULL)
        {
            // Send request to central.
            err_code = sd_ble_gap_conn_param_update(conn_handle, p_new_params);
            if (err_code == NRF_SUCCESS)
            {
                p_instance->params_ok             = false;
                p_instance->update_count          = 1;
                p_instance->preferred_conn_params = *p_new_params;
            }
        }
    
        return err_code;
    }

    Since 0x3002 is BLE_ERROR_INVALID_CONN_HANDLE, there are two possible reasons you get this:

    Either none of the if() check's returns true, seeing that you don't have a conn_handle, that is likely to happen.

    Or err_code = sd_ble_gap_conn_param_update(conn_handle, p_new_params); returns BLE_ERROR_INVALID_CONN_HANDLE, if the conn_handle is incorrect. 

    Try to debug inside ble_conn_params_change_conn_params() to see how it behaves.

    Best regards,

    Edvin

Reply
  • Doesn't ble_conn_params_change_conn_params() have two input parameters?

    If you have changed that, what does your ble_conn_params_change_conn_params() definition looks like?

    In the unmodified SDK, it looks like this:

    ret_code_t ble_conn_params_change_conn_params(uint16_t                conn_handle,
                                                  ble_gap_conn_params_t * p_new_params)
    {
        ret_code_t                   err_code   = BLE_ERROR_INVALID_CONN_HANDLE;
        ble_conn_params_instance_t * p_instance = instance_get(conn_handle);
    
        if (p_new_params == NULL)
        {
            p_new_params = &m_preferred_conn_params;
        }
    
        if (p_instance != NULL)
        {
            // Send request to central.
            err_code = sd_ble_gap_conn_param_update(conn_handle, p_new_params);
            if (err_code == NRF_SUCCESS)
            {
                p_instance->params_ok             = false;
                p_instance->update_count          = 1;
                p_instance->preferred_conn_params = *p_new_params;
            }
        }
    
        return err_code;
    }

    Since 0x3002 is BLE_ERROR_INVALID_CONN_HANDLE, there are two possible reasons you get this:

    Either none of the if() check's returns true, seeing that you don't have a conn_handle, that is likely to happen.

    Or err_code = sd_ble_gap_conn_param_update(conn_handle, p_new_params); returns BLE_ERROR_INVALID_CONN_HANDLE, if the conn_handle is incorrect. 

    Try to debug inside ble_conn_params_change_conn_params() to see how it behaves.

    Best regards,

    Edvin

Children
Related