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

sd_ble_gatts_hvx() return error :0x3401

Hi all,

I am trying to send data(rssi+MAC address) from GATT server to GATT client using sd_ble_gatts_hvx(). I added the service and the characteristic into the ATT table. I want to send data just when the client establish a connection. So in the BLE_EVT_CONNECTED of the on_ble_evt() I call sd_ble_gatts_hvx(). In debug, this call return 0x3401. Here is my configurations:

rssi_mac_service.rar

I am not able to find the problem yet.

Parents
  • Hi all,

    the problem is solved (Thank you God). In fact, the peripheral should enable the notification, and since I am testing with MCP as a peripheral, I have had to click on the " Enable Services" button. The BLE_EVT_TX_COMPLETE event was generated after calling sd_ble_gatts_hvx().

  • The system attributes consist of the CCCD values, i.e. the "preferences" for a peer. You are required to save these peer-specific values between connections if you are bonded, and the example Device Manager shows you how this can be done. Please refer to the GATTS documentation or header files for sd_ble_gatts_sys_attr_set(), *_get() and sd_ble_gatts_hvx() for lots of information on how these affect your program. In short, you have to detect that these are written to when WRITE events come, and only allow hvx() calls after they are enabled.

Reply
  • The system attributes consist of the CCCD values, i.e. the "preferences" for a peer. You are required to save these peer-specific values between connections if you are bonded, and the example Device Manager shows you how this can be done. Please refer to the GATTS documentation or header files for sd_ble_gatts_sys_attr_set(), *_get() and sd_ble_gatts_hvx() for lots of information on how these affect your program. In short, you have to detect that these are written to when WRITE events come, and only allow hvx() calls after they are enabled.

Children
No Data
Related