<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52250/ble-central-service-not-found-while-trying-to-implement-a-dfu-client</link><description>Hello. 
 I wish to implement a DFU Client. One (USB connected) nRF52840 based device should update an other (Wireless) nRF52840 device. 
 As the SDK only has a DFU service and not a DFU client, I&amp;#39;d figured I&amp;#39;d have to implement that myself. As a base</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Mar 2022 18:15:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52250/ble-central-service-not-found-while-trying-to-implement-a-dfu-client" /><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/358292?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2022 18:15:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0aa1eb19-8803-4edd-815f-03d305c4030b</guid><dc:creator>Carletti</dc:creator><description>&lt;p&gt;Hi Andre,&lt;/p&gt;
&lt;p&gt;I know this topic is a bit outdated, but it is exactly the solution I am looking for. Did you have any progress? Could you please share your results?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/210867?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2019 08:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4c9e2e1-8cd5-4cfa-8a33-ecdc4070026b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have not seen how you configure the SoftDevice and service discovery, but the typical reason for detecting the DFU service but not the DFU characteristics is failing to consider that the DFU characteristics are custom UUID&amp;#39;s even thought the DFU service is a registered UUID. Therefore you need to:&lt;/p&gt;
&lt;p&gt;1. Add vendor-specific base UUID to use with the Buttonless DFU characteristic when configuring the service discovery module, using, for instance, this snippet (BLE_NORDIC_VENDOR_BASE_UUID is defined in ble_dfu.h):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // Add vendor specific base UUID to use with the Buttonless DFU characteristic.
    ble_uuid128_t   nordic_base_uuid = BLE_NORDIC_VENDOR_BASE_UUID;
    ret_code_t err_code = sd_ble_uuid_vs_add(&amp;amp;nordic_base_uuid, &amp;amp;m_dfu_char_uuid_type);
    VERIFY_SUCCESS(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. For the above to work you must also make sure you have allocated memory for a custom UUID in the SoftDevice configuration. If not, the call to sd_ble_uuid_vs_add will return&amp;nbsp;NRF_ERROR_NO_MEM). To do that,&amp;nbsp;increment NRF_SDH_BLE_VS_UUID_COUNT in your sdk_config.h, and adust the app ram start and size address according to what is printed in the debug log.&lt;/p&gt;
&lt;p&gt;If this does not solve the problem, then please let me see more of your code, at least how you configure the service discovery (similar to for instance&amp;nbsp;ble_lbs_c_init()).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/210462?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2019 14:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1bb15f0-d5b8-4107-911d-e273bd7247f6</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;Here it is, this is a modified version of the original, with just the characteristics replaced, and a &amp;quot;service not found&amp;quot; log added.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
void ble_dfu_on_db_disc_evt(ble_dfu_c_t *p_ble_dfu_c,
		ble_db_discovery_evt_t const *p_evt) {
	// Check if the Led Button Service was discovered.
	if (p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE
			&amp;amp;&amp;amp; p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == BLE_DFU_SERVICE
			&amp;amp;&amp;amp; p_evt-&amp;gt;params.discovered_db.srv_uuid.type
					== p_ble_dfu_c-&amp;gt;uuid_type) {
		ble_dfu_c_evt_t evt;

		evt.evt_type = BLE_LBS_C_EVT_DISCOVERY_COMPLETE;
		evt.conn_handle = p_evt-&amp;gt;conn_handle;

		for (uint32_t i = 0; i &amp;lt; p_evt-&amp;gt;params.discovered_db.char_count; i++) {
			const ble_gatt_db_char_t *p_char =
					&amp;amp;(p_evt-&amp;gt;params.discovered_db.charateristics[i]);
			switch (p_char-&amp;gt;characteristic.uuid.uuid) {
			case BLE_DFU_BUTTONLESS_CHAR_UUID:
				NRF_LOG_DEBUG(&amp;quot;Setting BLE_DFU_BUTTONLESS_CHAR_UUID.&amp;quot;)
				;
				evt.params.peer_db.dfu_buttonless =
						p_char-&amp;gt;characteristic.handle_value;
				break;

			case BLE_DFU_PACKET_CHAR_UUID:
				NRF_LOG_DEBUG(&amp;quot;Setting BLE_DFU_PACKET_CHAR_UUID.&amp;quot;)
				;
				evt.params.peer_db.dfu_packet =
						p_char-&amp;gt;characteristic.handle_value;
				break;
			case BLE_DFU_CONTROL_CHAR_UUID:
				NRF_LOG_DEBUG(&amp;quot;Setting BLE_DFU_CONTROL_CHAR_UUID.&amp;quot;)
				;
				evt.params.peer_db.dfu_control =
						p_char-&amp;gt;characteristic.handle_value;
				break;

			default:
				break;
			}
		}

		NRF_LOG_DEBUG(&amp;quot;DFU Service discovered at peer.&amp;quot;);
		//If the instance has been assigned prior to db_discovery, assign the db_handles
		if (p_ble_dfu_c-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID) {
			if ((p_ble_dfu_c-&amp;gt;peer_lbs_db.dfu_buttonless
					== BLE_GATT_HANDLE_INVALID)
					&amp;amp;&amp;amp; (p_ble_dfu_c-&amp;gt;peer_lbs_db.dfu_control
							== BLE_GATT_HANDLE_INVALID)
					&amp;amp;&amp;amp; (p_ble_dfu_c-&amp;gt;peer_lbs_db.dfu_packet
							== BLE_GATT_HANDLE_INVALID)
					&amp;amp;&amp;amp; (p_ble_dfu_c-&amp;gt;peer_lbs_db.dfu_cccd_handle
							== BLE_GATT_HANDLE_INVALID)) {
				p_ble_dfu_c-&amp;gt;peer_lbs_db = evt.params.peer_db;
			}
		}

		p_ble_dfu_c-&amp;gt;evt_handler(p_ble_dfu_c, &amp;amp;evt);

	} else {
		NRF_LOG_INFO(&amp;quot;SERVICE NOT FOUND!&amp;quot;);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, in the first case, I get an evt_type = BLE_DB_DISCOVERY_SRV_NOT_FOUND&lt;/p&gt;
&lt;p&gt;WIth the extra call to the soft device, it ends up with BLE_DB_DISCOVERY_COMPLETE and char_count = 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/210425?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2019 13:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16ec7b70-5926-438e-b12b-cb14e4a73217</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you mimic ble_lbs_c, you can see how it searches for the characteristics in the loop&amp;nbsp;ble_lbs_on_db_disc_evt() which is called from the discovery even handler in main.c.&amp;nbsp;Can you show how you have handled the service discovery in your code? The same procedure&amp;nbsp;is the same with any service.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/210173?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2019 14:26:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a40448-2344-4856-bf11-afd386efc5c4</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;Addition: This doesn&amp;#39;t work completely. Even through the Service is found this way, it won&amp;#39;t have characteristics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central: Service Not Found, while trying to implement a DFU Client</title><link>https://devzone.nordicsemi.com/thread/210145?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2019 13:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:699e41c0-0f29-49c6-a4b4-aa0bc867f9fa</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;I have made some progress. Looking up on the ble_db_discovery_start function, it states says&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;This API propagates the error code returned by the SoftDevice API sd_ble_gattc_primary_services_discover. &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then when I call&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;            sd_ble_gattc_primary_services_discover( p_gap_evt-&amp;gt;conn_handle, 3, NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;before calling&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;err_code = ble_db_discovery_start(&amp;amp;m_db_disc, p_gap_evt-&amp;gt;conn_handle);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the Service gets discovered.&amp;nbsp; Only if I call both, and in that order.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is some ugly hack, and I am looking to do this properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>