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

call to sd_ble_gattc_attr_info_discover() causes reset with bigger range

Hi@all,

i'm trying to connect to a BTLE Printer (printer -> peripheral) from my central (nrf51822 board). But i cannot use the standard discovery examples because i cannot add the 128 bit characteristic uuid. (The printers service uuid and characteristic uuid are totally different from each other - so i found no way to add the base uuid and characteristic uuid to perform discovery)

Luckely i found the API call: sd_ble_gattc_attr_info_discover() which:

This is the only GATT Client function that allows the application to retrieve full 128-bit UUIDs that do not need to be part of the list populated with sd_ble_vs_uuid_add(). An example of 128-bit UUID retrieval is shown below.

should get me a step closer to sending a byte to the printers characteristic. But:

what i'm trying to achieve is that i connect to a peripheral and, if connected, try to scan for custom services and characteristics. Connecting works well already, calling "sd_ble_gattc_attr_info_discover() when hitting BLE_GAP_EVT_CONNECTED only if the range is 0x0001 - 0x0004. If i set the range to the values of the migration document:

handle_range.start_handle = 0x0001;
handle_range.end_handle = 0xFFFF;

the app seems to restart.

by having a small range like 0x0001 - 0x0004, i get BLE_GATTC_EVT_ATTR_INFO_DISC_RSP with no problem other than that

if(p_ble_evt->evt.gattc_evt.params.attr_info_disc_rsp.format == BLE_GATTC_ATTR_INFO_FORMAT_128BIT) 

is always 0x00 (false).

i tried the following:

if(p_ble_evt->evt.gattc_evt.params.attr_info_disc_rsp.format == BLE_GATTC_ATTR_INFO_FORMAT_128BIT)
						{
							NRF_LOG_PRINTF("\r\nFound 128 Bit attr info");
							uint16_t attr_handle;
							ble_uuid128_t uuid128;
							/* Obtain the attribute handle and the full 128-bit UUID */
							attr_handle = p_ble_evt->evt.gattc_evt.params.attr_info_disc_rsp.attr_info[0].handle;
							memcpy(&uuid128, &p_ble_evt->evt.gattc_evt.params.attr_info_disc_rsp.attr_info[0].info.uuid128.uuid128, sizeof(uuid128));
						}else{
							NRF_LOG_PRINTF("\r\nNo 128 Bit attr info --> in Range: %d - %d", handle_range.start_handle, handle_range.end_handle);
							handle_range.start_handle = handle_range.end_handle;
							handle_range.end_handle = handle_range.start_handle + 0x0004;
							(void) sd_ble_gattc_attr_info_discover(m_conn_handle_printer_c, &handle_range);
						}

having the effect that it will run a loop. but never discovers the 128 bit service / characteristic uuid that the peripheral has. (i can see it using light blue on iOS and some other iOS apps).

Has anyone yet had successfully used sd_ble_gattc_attr_info_discover()?

Here some infos that might help:

  • SDK 11
  • Softdevice S130 v2.0.0 NRF51822AC
  • custom board
  • project loosely based on hrs relay example

I really hoe someone has a clue or can give me a hint. I spent the whole day on reading through the nordic documentation and related posts here in the community but found nothing that worked for me.

Related