Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Invalid Parameter error while "nrf_ble_gq_item_add(p_gatt_queue, conn_handle)"

Hi,

I am getting error while calling the function "nrf_ble_gq_item_add(p_gatt_queue, conn_handle)" in my custom ble service. Here I am duplicated the same definitions for Specific Operation Control Point characteristic in the CGMS example (continous glucose measurement service). It works for the cgms but not in my custom service. 

Automatically disconnects while writing to this characteristic. How can I fix this problem.

The error is: Error 7 [Invalid parameter]

Looking forward for your help!!

Thanks and Regards,

Sreejith

  • Hi Sreejith,

    Can you try to debug in nrf_ble_gq_item_add() to narrow down more where NRF_ERROR_INVALID_PARAM comes from? (the function calls quite a few other functions, so there are several possibilities). If you digg down there as deep as you get then you will know more about which of your input parameters you need to look at.

  • Hi Einar,

    Thank you for your fast response!

    I am getting the error in the given below area: inside nrf_ble_gq.c

    // Check if connection handle is registered and if GATT request is valid.
    conn_id = conn_handle_id_find(p_gatt_queue, conn_handle);
    if ((p_req->type >= NRF_BLE_GQ_REQ_NUM) || (conn_id == p_gatt_queue->max_conns))
    {
    return NRF_ERROR_INVALID_PARAM;
    }

    here the conn_id == max_conns = 1 (so it shows invalid error)

    Thanks and Regards,

    Sreejith

  • Hi,

    I see. If you have more than one connection at a time you need to increase the number of connections supported by the GATT queue module as well. That is specified by the second parameter of NRF_BLE_GQ_DEF().

  • Hi,

    But I have only one connection. When I did debugging I found that while calling the conn_handle_id_find(), the p_conn_handle changes to 0xffff (I hope this meant INVALID CONNECTION) I do not know why this happens. I have done the NRF_BLE_GQ_DEF as mentioned in the cgms example itself

    Thanks and Regards,

    Sreejith

  • Hi,

    When I compare the values of the local variables of cgms service, I have found that the connection handle for p_gatt_queue is 0000 but in my custom service it shows FFFF. This is the reason why it shows invalid parameter. Why the gatt queue connection handle become invalid in my definition, how can I solve this problem?

    Thanks and Regards,

    Sreejith

Related