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

Errorcode 13313 at sd_ble_gatts_hvx()

Hello, I would like to send an int32 value every 500ms and use for this the same procedure as it is shown in the heart-rate-example. The code for sending is:

// Send value if connected and notifying

if ((p_ad->conn_handle != BLE_CONN_HANDLE_INVALID) 
&& (p_ad->is_notification_supported))

    {
        uint8_t                encoded_adValue[10];
        uint16_t               hvx_len;
        ble_gatts_hvx_params_t hvx_params;

        hvx_len = uint32_encode(SActualValue.i32Value, encoded_adValue);

        memset(&hvx_params, 0, sizeof(hvx_params));

        hvx_params.handle = p_ad->ad_actualValue_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
        hvx_params.offset = 0;
        hvx_params.p_len  = &hvx_len;
        hvx_params.p_data = encoded_adValue;

        err_code = sd_ble_gatts_hvx(p_ad->conn_handle, &hvx_params);
        if (err_code == NRF_SUCCESS)
        {
            err_code = NRF_ERROR_DATA_SIZE;
        }
    }
    else
    {
        err_code = NRF_ERROR_INVALID_STATE;
    }

    return err_code;

I suppose having initialized correctly everything (also in services_init()); looking at this forum I tried already the inclusion of

case BLE_GATTS_EVT_SYS_ATTR_MISSING:
       err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gatts_evt.conn_handle, NULL, 0, 0);
       APP_ERROR_CHECK(err_code);
       break;

in the function on_ble_event() but when debugging with a breakpoint I see that this part of code is never reached... What can I do next?

Parents
  • Hello Petter, sorry for my late reply - I was on a business travel.

    What I wanted to say is that I was looking at the forum before posting my problem - I found at the post devzone.nordicsemi.com/.../ the information that the mentioned error code comes from a missing value for the CCCD: In this post a collegue of you recommended as one possible action to use the following code lines case BLE_GATTS_EVT_SYS_ATTR_MISSING: err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gatts_evt.conn_handle, NULL, 0, 0); APP_ERROR_CHECK(err_code); break; which I have implemented in my code (in switch/case in function on_ble_evt()), but setting a breakpoint on that showed me that this code is never reached and by that can not help solve the problem... In the meantime I made some changes and now it works: One of the changes was to give more RAM to the S132 BLE stack; also some handles had to be changed. Finally I can't say any more which detail brought the solutions, but now it works! Thanks a lot!

Reply Children
No Data
Related