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
  • Sorry p_our_service->service_handle found 0x000B isn't theproblem. (i'll explain it under)

     

    I Undo all modifications progressivly according to the tutorial to find when comes the error 0x07.

    There is no error at STEP 2.H include. At STEP 3.A error occurs adding this code :

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
    		BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    		cccd_md.vloc                = BLE_GATTS_VLOC_STACK;
    		char_md.p_cccd_md           = &cccd_md;
    		char_md.char_props.notify   = 1;

    AT STEP 2.H my module is Advertising i can connect and then see the service and its characteristics write and read...

    And at STEP2.H p_our_service->service_handle is already at value 0x000B

    AT STEP 3.A there is err_code 0x07 in return from sd_ble_gatts_characteristic_add. if i comment APP_ERROR_CHECK where err_code = 0x07, i can see my module advertising but i don't see the service and its characteritics

Children
Related