Hi, I'm calling sd_ble_gatts_hvx and every once in a while I get an error code of 0x3401. I went through the SDK documentation but I could not find what that error code is. Have you seen this error code before? thank you, akbar
Hi, I'm calling sd_ble_gatts_hvx and every once in a while I get an error code of 0x3401. I went through the SDK documentation but I could not find what that error code is. Have you seen this error code before? thank you, akbar
I'm assuming you are using S110 v7.0.0
0x3XXX = Stack error
0x34XX = GATTS error
0x3401 = BLE_ERROR_GATTS_SYS_ATTR_MISSING
This error comes when the stack does not know the state of the CCCD, and whether notifications/indications are enabled for that specific characteristic. When connecting to a brand new device, the attribute states should be set with NULL as a param, resetting all the CCCD states to disallowing HVX. For a bonded device, however, the previous states need to be restored. This handling is left to the application in the current SoftDevices by using sd_ble_gatts_sys_attr_get() upon disconnection and and _set() on reconnection to the same device.
The handling of system attributes (and more) should be handled in the Device Manager SDK module.
Hi,
I'm using softdevice 7.0.0 and last sdk,
The same error occur when i want to send notification with notifications not enables despite catching NRF_ERROR_INVALID_STATE :
err_code = sd_ble_gatts_hvx(p_bts->conn_handle, ¶ms);
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
I'm not using bond manager and CCCD attributes are initialized after BLE_GATTS_EVT_SYS_ATTR_MISSING event :
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0);
APP_ERROR_CHECK(err_code);
How i can avoid this error ?
Regards,
Thomas
You will only get the SYS_ATTR_MISSING event if a peer GATT client tries to read a CCCD state, so this might not have happened yet. You should instead set system attributes on CONNECTED. If you try to indicate/notify a characteristic that the SoftDevice does not know the state of, you will get this return code as specified in the documentation: devzone.nordicsemi.com/.../a00922.html