This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Fails on CCC value reading during discover services.

Issue is related to: devzone.nordicsemi.com/.../ Now I use latest SD S130_1.0 So, I added to my service characteristic with notifications enabled. But during discovering services using MCP on PC at reading CCC of char. with notify my device reboots. Using last issue (link above) I added case in ble event dispatcher:

case BLE_GATTS_EVT_SYS_ATTR_MISSING:
			err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.common_evt.conn_handle, NULL, 0, 0);
			APP_ERROR_CHECK(err_code);

And now it works. The question is: should I use this workaround or I do something wrong when initialize and add this characteristic?

Parents
  • Ideally, you should immediately set the system attributes when you connect to a device. Then you will rarely, if ever, get this event. If you choose to solve it like you do, you should also use the p_ble_evt->evt.gatts_evt.conn_handle struct, which might be your problem here.

    If you have bonded previously, the system attributes must be restored to what they were in the last connection. And if you have no bond with the device, then you should set them to NULL as you do there. The Device Manager should have some code that shows how to accomplish this.

    The original problem is that the Master Control Panel tries to read the CCCDs/SCCDs, and the values of these are undefined for every new connection. They are not defined until they are either written to, or sys_attr_set() has been called.

Reply
  • Ideally, you should immediately set the system attributes when you connect to a device. Then you will rarely, if ever, get this event. If you choose to solve it like you do, you should also use the p_ble_evt->evt.gatts_evt.conn_handle struct, which might be your problem here.

    If you have bonded previously, the system attributes must be restored to what they were in the last connection. And if you have no bond with the device, then you should set them to NULL as you do there. The Device Manager should have some code that shows how to accomplish this.

    The original problem is that the Master Control Panel tries to read the CCCDs/SCCDs, and the values of these are undefined for every new connection. They are not defined until they are either written to, or sys_attr_set() has been called.

Children
Related