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

How to send notification for a large custom attribute

I am using nRF52 S132 and latest SDK V11. I defined a custom service with a custom characteristic which is 509 bytes (based on your tutorial). Read operation is fine from a client. But when using sd_ble_gatts_hvx() to send notification, only the first 20 bytes are received. The return code of this function is 0x3401, which means BLE_ERROR_GATTS_SYS_ATTR_MISSING. But it does not make sense to me. So I reduce the size from 509 to 10. The notification is sent and received. But the error code is still 0x3401. How to send notification properly?

Parents
  • Well you can only send 20 bytes in a notification because there's only room for that amount of data in a notification (unless you negotiate a large MTU first).

    And why does it make no sense to you to get BLE_ERROR_GATTS_SYS_ATTR_MISSING? That's one of the documented return codes from that function

     * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
    

    and system attributes are required to be set for notifications/indications, so if you haven't set them, you get that error.

Reply
  • Well you can only send 20 bytes in a notification because there's only room for that amount of data in a notification (unless you negotiate a large MTU first).

    And why does it make no sense to you to get BLE_ERROR_GATTS_SYS_ATTR_MISSING? That's one of the documented return codes from that function

     * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
    

    and system attributes are required to be set for notifications/indications, so if you haven't set them, you get that error.

Children
Related