<?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>Issue facing in connection between central device (1st &amp;quot;xiao nrf52840 sense&amp;quot;) to peripheral device (2nd &amp;quot;xiao nrf52840 sense&amp;quot;)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116439/issue-facing-in-connection-between-central-device-1st-xiao-nrf52840-sense-to-peripheral-device-2nd-xiao-nrf52840-sense</link><description>Hi everyone, 
 I’m a complete beginner and need some help. I’m working with two XIAO nRF52840 Sense boards: one as a central and the other as a peripheral. My goal is to send a notification from the peripheral to the central every time an external touch</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Nov 2024 00:10:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116439/issue-facing-in-connection-between-central-device-1st-xiao-nrf52840-sense-to-peripheral-device-2nd-xiao-nrf52840-sense" /><item><title>RE: Issue facing in connection between central device (1st "xiao nrf52840 sense") to peripheral device (2nd "xiao nrf52840 sense")</title><link>https://devzone.nordicsemi.com/thread/512462?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2024 00:10:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1afb10c6-0311-45d2-8b97-1dccac75374f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;That is great to hear! Even watching the sample, it is not trivial to get this working, so well done!&lt;/p&gt;
&lt;p&gt;If you compare your old implementation with the current one (the one from the central_uart sample), you can see that the one in the central_uart sample uses the API that you used to use a few steps into the implementation. The difference is that when it receives the equivalent of your old discovery_func callback, it does some checks, and returns&amp;nbsp;&lt;span&gt;BT_GATT_ITER_CONTINUE in some cases. Actually, in most cases, unless it is the very last characteristic in the very last service.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Your implementation, however, returned BT_GATT_ITER_STOP if the first UUID didn&amp;#39;t match the one you were looking for. Since the first UUID belongs to some general service that most devices has (containing name and type and so on), you told it to stop the discovery process, instead of continuing to the next UUID in the peripheral. Hence, you never found the service/characteristic that you were looking for.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue facing in connection between central device (1st "xiao nrf52840 sense") to peripheral device (2nd "xiao nrf52840 sense")</title><link>https://devzone.nordicsemi.com/thread/512208?ContentTypeID=1</link><pubDate>Tue, 26 Nov 2024 17:25:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d07044ec-701b-4673-bcb0-8f89bb45fa79</guid><dc:creator>JAYnish2345</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Edvin,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you so much! It worked perfectly. The central device is now successfully connected and subscribed to notifications from the peripheral. I implemented the discovery mechanism from &lt;code&gt;NCS\nrf\samples\bluetooth\central_uart&lt;/code&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Since I am entirely new to this and coding in general, I would like to understand why the previous code didn&amp;#39;t work. Could you explain the possible mistakes I made in my earlier code?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue facing in connection between central device (1st "xiao nrf52840 sense") to peripheral device (2nd "xiao nrf52840 sense")</title><link>https://devzone.nordicsemi.com/thread/510974?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 23:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0621a3d-2ed7-4c57-9269-fa7bfda15f97</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What is happening here is that the discovery callback is triggered, but with an UUID that is not the one you are looking for. When you then reutn BT_GATT_ITER_STOP, it stops the discovery process to continue searching for more services. The service that it typically will find first is the Generic Access Service, which just holds the name and appearance (icon ID) of the device.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suggest that you look into the NCS\nrf\samples\bluetooth\central_uart and how it does it&amp;#39;s discovery process. You can notice that it uses&amp;nbsp;bt_gatt_dm_start() (dm = discovery manager), to handle the discovery callbacks, and then let it handle when to proceed and when to stop. Then, in the callbacks, you can print the UUIDs of the discovered service. You will probably see the discovery of some services that you are not interested in, but eventually, you will see the one you are looking for.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Alternatively, you can look at the discovery flow in the discovery module (ncs\nrf\subsys\bluetooth\gatt_dm.c), and how it handles it&amp;#39;s callbacks, when it returns&amp;nbsp;BT_GATT_ITER_STOP, and when it returns&amp;nbsp;BT_GATT_ITER_CONTINUE.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>