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

S130 sd_ble_gatts_value_get block

Hello Everyone

I have an issue when reading the value of an attribute using sd_ble_gatts_value_get, where if the connection has been lost, the call will block for ever. I use the following cleaned snippet.

uint16_t conn_handle;
uint16_t att_handle;
ble_gatts_value_t gatt_value;

get_att_handle(&att_handle);
get_conn_handle(&conn_handle);

gatt_value.len = 2;
gatt_value.offset = 0;
gatt_value.p_value = (uint8_t *)value;

error_code = sd_ble_gatts_value_get(conn_handle, att_handle, &gatt_value);
if (error_code != NRF_SUCCESS)
{
  //handle error
}

The characteristic I am reading has a vendor specefic UUID and data is fixed width 2 bytes. I am calling the snippet above in a loop to wait for a specific value. Everything works fine untill the device is disconnected. I have verified that the same thing happen no matter if I use the correct conn_handle or BLE_CONN_HANDLE_INVALID; everything Works fine untill connection is lost, after this the call will block.

Has anyone experienced this before, or perhaps know of a solution?

Parents
  • @Ramus: Sorry I am not very familiar with Embarcadero . But there could be other reason that it's blocked by something else, not because of the call. I would suggest you to add break point in the application assert handler. Also check if hardfault is triggered. If you can upload a simple example that can reproduce the issue, so that we can test here. It would be great.

Reply
  • @Ramus: Sorry I am not very familiar with Embarcadero . But there could be other reason that it's blocked by something else, not because of the call. I would suggest you to add break point in the application assert handler. Also check if hardfault is triggered. If you can upload a simple example that can reproduce the issue, so that we can test here. It would be great.

Children
No Data
Related