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

Characteristic tutorial : error when adding a characteristic to a service

I have a question concerning this tutorial : devzone.nordicsemi.com/.../ble-characteristics-a-beginners-tutorial

i have same problem than Milton (comment under the tutorial) : "I was able to add a custom service and verify it successfully on MCP. However, when I included the code to add a characteristic to the service, I always get "NRF_ERROR_INVALID_PARAM'."

he found a solution :

//for service
err_code = sd_ble_uuid_vs_add(&base_uuid, &m_base_uuid_type);
uuid.type   = m_base_uuid_type;
uuid.uuid   = BLE_UUID_OUR_SERVICE_UUID;

//For the characteristic:

char_uuid.uuid      = BLE_UUID_OUR_CHARACTERISTC_UUID;
char_uuid.type      = m_base_uuid_type;

i tryed his solution but i failed, i think it's because i do'nt know how to implement correctly the solution ...

(the tutorial work and advertise for me until this problem)

Parents Reply
  • OK - the sd_... calls are all SVC "calls" into the SoftDevice - so you can't step into them.

    So use the debugger to look at all the parameters you are passing - do they all look OK?

    The comment describing sd_ble_gatts_characteristic_add() says this about when it will return NRF_ERROR_INVALID_PARAM:

     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints.
    

    wonder if it could be due to bad values for defines (like in config_sdk.h).

    Did you Try increasing NRF_SDH_BLE_VS_UUID_COUNT to 4 - as said?

Children
Related