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

  • Thanks Edvin,

    Fixed erros issue by passing second argument conn_handle. But after calling ble_conn_params_change_conn_params function with new conn parameter, value not updating its showing initial values only.

  • Where does it show initial values?

    Note that the parameters will not change before both devices have agreed upon the changes. You should get an event called BLE_GAP_EVT_CONN_PARAM_UPDATE, when the parameters are updated.

Reply Children
  • I read the connection parameter from nrf_connect app. From ble servies Generic Access ->Peripheral Preferred Connection Parameter , after connected the device i just read values thats correct ,its values set in initially using gap_params_init  ( Conn. interval 50ms - 100ms) . But once after change new parameter (Conn. interval 10ms - 15ms ) using ble_conn_params_change_conn_params, not updating. i read again from  ble servies Generic Access ->Peripheral Preferred Connection Parameter , same value is showing 50ms and 100. Anyway getting BLE_GAP_EVT_CONN_PARAM_UPDATE event .

  • NIDHIN K said:
    Anyway getting BLE_GAP_EVT_CONN_PARAM_UPDATE event

    And what are the connection parameters in this event?

    Maybe your application receives this event, and then finds out that these are not in line with the peripheral preferred connection parameters, and then asks for an update again?

    This is probably checked in your on_conn_params_update() function in ble_evt_handler() in ble_conn_params.c.

    BR,

    Edvin

Related