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

SD GATT procedure (%d) failed

Background: SDK 16.0.0, SoftDevice 7.0.1, 1 ble_central connected 6 ble_peripheral, Send an instruction to 6 ble_peripherals every 50 milliseconds, at the same time, the ble_peripheral returns the response data to the ble_central . An error will be reported after running for a period of time, the error code is as follows. The screenshot below is the error generated within 15 hours, 11times / 15 hours.

Operation flow chart

NRF_LOG_ERROR("SD GATT procedure (%d) failed on connection handle %d with error: 0x%08X.", p_req->type, conn_handle, err_code);

SD GATT procedure (1) failed on connection handle 0 with error: 0x00000013.

SD GATT procedure (1) failed on connection handle 3 with error: 0x00000013.

SD GATT procedure (1) failed on connection handle 1 with error: 0x00000013.

SD GATT procedure (1) failed on connection handle 5 with error: 0x00000013.

Error Code as below.

/**@brief Function handles error codes returned by GATT requests.
 *
 * @param[in] p_req       Pointer to GATT request.
 * @param[in] err_code    Error code returned by SoftDevice.
 * @param[in] conn_handle Connection handle.
 */
__STATIC_INLINE void request_err_code_handle(nrf_ble_gq_req_t const * const p_req,
                                             uint16_t                       conn_handle,
                                             ret_code_t                     err_code)
{
    if (err_code == NRF_SUCCESS)
    {
        NRF_LOG_DEBUG("SD GATT procedure (%d) succeeded on connection handle: %d.",
                       p_req->type,
                       conn_handle);
    }
    else
    {
        NRF_LOG_ERROR("SD GATT procedure (%d) failed on connection handle %d with error: 0x%08X.",
                      p_req->type, conn_handle, err_code);
        if (p_req->error_handler.cb != NULL)
        {
             p_req->error_handler.cb(err_code, p_req->error_handler.p_ctx, conn_handle);
        }
    }
}

The length of a command or response is 11 bytes. sdk_config.h as below.

Thanks and Best regards!

John

Parents
  • #define  NRF_ERROR_RESOURCES   (NRF_ERROR_BASE_NUM + 19)
     

    Not enough resources for operation.

    But I don't know what kind of resource shortage is。The smaller the time interval between sending data, the more likely this problem is。

    sender code:

    do
    {
    ret_val = ble_nus_c_string_send(&m_ble_nus_c, tmp, len);
    if ( (ret_val != NRF_ERROR_INVALID_STATE) && (ret_val != NRF_ERROR_RESOURCES) )
    {
       APP_ERROR_CHECK(ret_val);
    }
    } while (ret_val == NRF_ERROR_RESOURCES);

  • thanks for your reply, According to your suggestion, I modified the code as follows and found no problem with 0x13,

    do
    {
      err_code = ble_nus_data_send(&m_nus, data_array, &len, m_conn_handle);
      if ((err_code != NRF_ERROR_INVALID_STATE) &&
        (err_code != NRF_ERROR_RESOURCES) &&
        (err_code != NRF_SUCCESS) &&
        (err_code != NRF_ERROR_BUSY) &&
        (err_code != NRF_ERROR_NOT_FOUND))
     {
        APP_ERROR_CHECK(err_code);
     }
    } while (err_code == NRF_ERROR_BUSY || err_code == NRF_ERROR_RESOURCES);

    Regards,

Reply
  • thanks for your reply, According to your suggestion, I modified the code as follows and found no problem with 0x13,

    do
    {
      err_code = ble_nus_data_send(&m_nus, data_array, &len, m_conn_handle);
      if ((err_code != NRF_ERROR_INVALID_STATE) &&
        (err_code != NRF_ERROR_RESOURCES) &&
        (err_code != NRF_SUCCESS) &&
        (err_code != NRF_ERROR_BUSY) &&
        (err_code != NRF_ERROR_NOT_FOUND))
     {
        APP_ERROR_CHECK(err_code);
     }
    } while (err_code == NRF_ERROR_BUSY || err_code == NRF_ERROR_RESOURCES);

    Regards,

Children
Related