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

Notification issue in sd_ble_gatts_hvx

Hi, I have problem with notification. My action on central: After I discover characteristics I call function for registration cccd and I registrate cccd of first characteristic. Then I waiting for event BLE_GATTC_EVT_WRITE_RSP when I check characteristic handle and set my own flag and call cccd registration for another characteristic the same way. When I have set all my flags I write flag by sd_ble_gattc_write once within while loop. My action on peripheral: I read my flag by sd_ble_gatts_value_get ble_evt_dispatch. This flag I set in central as I have written above. If flag is OK, I will use sd_ble_gatts_hvx for each of my 5 characteristics.

My problem is that I call third sd_ble_gatts_hvx, I get error 0x3401. If I use sd_ble_gatts_sys_attr_set(m_conn_handle,NULL,0) I will get error NRF_ERROR_INVALID_STATE. Connection state is connected. So Where could be problem ? It works for two characteristics and there is no diference between other characteristics. Length of characteristics is 20 bytes.

Parents
  • FormerMember
    0 FormerMember

    The error 0x3401 is BLE_ERROR_GATTS_SYS_ATTR_MISSING. When sd_ble_gatts_hvx() returns this value, typically, notifications have not been enabled for that characteristic. Could you double check that notifications have been enabled? For the "problematic" characteristic?

  • I get all BLE_GATTC_EVT_WRITE_RSP. So I expect that all cccd are written. No characteristics are problematic. It is independent on characteristics. When I notify more than 2 characteristics I will get an error...If respons for all sd_ble_gattc_write witch write cccd doesn't mean, that notifications are enabled, then it is possible that these characteristics are not enabled all. My devices are unbonded.

Reply
  • I get all BLE_GATTC_EVT_WRITE_RSP. So I expect that all cccd are written. No characteristics are problematic. It is independent on characteristics. When I notify more than 2 characteristics I will get an error...If respons for all sd_ble_gattc_write witch write cccd doesn't mean, that notifications are enabled, then it is possible that these characteristics are not enabled all. My devices are unbonded.

Children
No Data
Related