<?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>How to set role for nrf_dm? One as reflector and the other as initiator</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109459/how-to-set-role-for-nrf_dm-one-as-reflector-and-the-other-as-initiator</link><description>I tested on two 52832 based devices with nrf_dm sample code. It worked. Then I disabled &amp;quot;scan_start()&amp;quot; on one device, trying it make it as reflector only. I did not change the other device, but the other device could not get the distance value. Need your</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 23 Mar 2024 04:19:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109459/how-to-set-role-for-nrf_dm-one-as-reflector-and-the-other-as-initiator" /><item><title>RE: How to set role for nrf_dm? One as reflector and the other as initiator</title><link>https://devzone.nordicsemi.com/thread/475474?ContentTypeID=1</link><pubDate>Sat, 23 Mar 2024 04:19:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cfd66a4-bdaa-45c9-ab80-ee1906173d01</guid><dc:creator>Jimmy0755</dc:creator><description>&lt;p&gt;Thanks for your support.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set role for nrf_dm? One as reflector and the other as initiator</title><link>https://devzone.nordicsemi.com/thread/475022?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2024 09:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40898c8f-15c6-4b02-9ae0-e653dd585a6f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The reason you stop seeing distance measurements when you disable scanning on one of the devices is due to the nature of how this sample decides who to perform the distance measurement with.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When you have one device that is only advertising, that device will never get the advertising reports (callbacks when it has scanned an advertiement). This means that scan_filter_match() will never be called, which again means that peer_supported_add() is never called.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then, later, when you advertise, and receive an&amp;nbsp;adv_scanned_cb() callback, it uses &amp;quot;if (peer_supported_test())&amp;quot; to check whether the peer is in the list, but since no devices are added by peer_supported_add(), it will not set up a req. with DM_ROLE_REFLECTOR.&lt;/p&gt;
&lt;p&gt;DM_ROLE_INITIATOR will not be used either, since that is triggered from the&amp;nbsp;data_cb() in the scan_filter_match().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, to make this work without scanning at all, you would need to comment out the line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (peer_supported_test(info-&amp;gt;addr)) {&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(and the opposing &amp;quot;}&amp;quot; a few lines below)&lt;/p&gt;
&lt;p&gt;in adv_scanned_cb(). Then you should see measurements where the non-scanning device acts as the reflector.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There are other ways to initiate this as well. One possible way would be to enter a BLE connection through normal advertising from one device and scanning from the other, and agree upon this inside the connection.&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>