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

strange error code 13313 (0x3401) returned by sd_ble_gatts_hvx()

Hi, I'm trying to update attribute value and notify it to client using sd_ble_gatts_hvx() function:

  memset(ms, 0, sizeof(params));
  params.type=BLE_GATT_HVX_NOTIFICATION;
  params.handle=p_lbs->button_char_handles.value_handle;
  params.p_data=&button_state;
  params.p_len=&len;
  err_code=sd_ble_gatts_hvx(p_lbs->conn_handle, ms);
  
  DPRINTF("BLE button update: state=%u, len=%u, conn_h=%u, svc_h=%u, val_h=%u, err=%u\n", *params.p_data, *params.p_len, p_lbs->conn_handle, p_lbs->service_handle, params.handle, err_code);
  return(err_code);

When connection is not established and connection handle is invalid (65535) I got error code 8 - NRF_ERROR_INVALID_STATE, shats OK. BLE button update: state=0, len=1, conn_h=65535, svc_h=12, val_h=14, err=8 When I connect via android tablet and try to read the value and change it I got strange error code 13313 (0x3401) that doesn't match any known NRF_ERROR_xx code. BLE button update: state=1, len=1, conn_h=0, svc_h=12, val_h=14, err=13313 But the updated value is readed OK. I tried more times update and tap read button on tablet and got same error but with good value. When I turn on the notify on tablet it works too (value is updated automatically) and returning error 0 like expected. BLE button update: state=0, len=1, conn_h=0, svc_h=12, val_h=14, err=0 Interesting that when I stop notify on tablet it keeps returning error 0 and not 13313. The updated value can still be read manually tapping read button...

Parents Reply Children
  • I may have overlooked this, but as I said above, you could end up seeing the 0x3401 error right after connection. However, it should go away as soon as all events are handled, and the sd_ble_gatts_sys_attr_set() function has been called. (If you absolutely need to avoid seeing this error at all, you can try calling the _set() function from the connected event.) Do you see other behavior?

Related