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?

  • FormerMember
    0 FormerMember in reply to FormerMember

    Yes, if you get all the write responses the CCCD should be written.

    The error 0x3401, is it independent on which characteristic that is trying to transmit a notification? Do you see the same error code if it is the same characteristic that is transmitting three notifications?

    Just to double check, there is no write command that disable notifications that is being called?

Reply
  • FormerMember
    0 FormerMember in reply to FormerMember

    Yes, if you get all the write responses the CCCD should be written.

    The error 0x3401, is it independent on which characteristic that is trying to transmit a notification? Do you see the same error code if it is the same characteristic that is transmitting three notifications?

    Just to double check, there is no write command that disable notifications that is being called?

Children
No Data
Related