<?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>Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22041/best-way-to-locate-a-buttonless-device-in-dfu-mode</link><description>I&amp;#39;m using the experimental buttonless DFU app in SDK v13 to automatically change a device without buttons to run in DFU mode for an update. 
 I&amp;#39;d like to automatically reconnect o the device after the mode switch in the same way as the nRF connect app</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 May 2017 14:18:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22041/best-way-to-locate-a-buttonless-device-in-dfu-mode" /><item><title>RE: Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/thread/86496?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 14:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f01e4306-d581-4ec6-8706-d91dc99946f9</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;Thanks for the feedback and confirming the possibilities!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/thread/86494?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 11:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3f77738-23e4-4e21-8425-34ed953cb779</guid><dc:creator>atune</dc:creator><description>&lt;p&gt;Heh I&amp;#39;ve been so hasty that I&amp;#39;ve completely omitted the address-based option in your tools. :) In that case it&amp;#39;s even more straightforward even without changing the device name.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/thread/86493?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 11:18:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21611fae-2c4b-4890-a22a-93be5bbde2e1</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You could also add an additional characteristic to both the DFU service of the app and the bootloader that contains a unique ID of some sorts and use it to determine if you&amp;#39;ve connected to the correct &amp;quot;DFUTarg&amp;quot;. As far as I know the nRF Connect app simply uses the address, i.e. device address +1, to identify the device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/thread/86495?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 11:16:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58ea891c-93c5-4ff9-be13-080264a69bdf</guid><dc:creator>dingari</dc:creator><description>&lt;p&gt;This snippet is taken from &lt;code&gt;nrf_ble_dfu.c&lt;/code&gt; in the SDK:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint32_t gap_address_change(void)
{
    uint32_t            err_code;
    ble_gap_addr_t      addr;

#ifdef NRF51
    err_code = sd_ble_gap_address_get(&amp;amp;addr);
#elif NRF52
    err_code = sd_ble_gap_addr_get(&amp;amp;addr);
#else

#endif

    VERIFY_SUCCESS(err_code);

    // Increase the BLE address by one when advertising openly.
    addr.addr[0] += 1;

#ifdef NRF51
    err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &amp;amp;addr);
#elif NRF52
    err_code = sd_ble_gap_addr_set(&amp;amp;addr);
#else

#endif

    VERIFY_SUCCESS(err_code);

    return NRF_SUCCESS;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so I think it&amp;#39;s safe to assume that the address will always be one more than the address of your peripheral.&lt;/p&gt;
&lt;p&gt;Edit: Didn&amp;#39;t see the above answer before posting this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to locate a buttonless device in DFU mode</title><link>https://devzone.nordicsemi.com/thread/86492?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 11:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a0d5db2-a8c5-4758-820a-84164514a48a</guid><dc:creator>atune</dc:creator><description>&lt;p&gt;Indeed, the default Nordic implementation changes the device MAC address &lt;em&gt;(you speak of UUID)&lt;/em&gt; by incrementing the last octet by 1.&lt;/p&gt;
&lt;p&gt;nrf_ble_dfu.c:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint32_t gap_address_change(void)
{
...
    sd_ble_gap_addr_get(&amp;amp;addr);
...
// Increase the BLE address by one when advertising openly.
    addr.addr[0] += 1;
...
    sd_ble_gap_addr_set(&amp;amp;addr);
...
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So yeah, you can trust that the MAC is always +1 to the original and use that to connect to the right device.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The implementation also uses the device name &amp;quot;DfuTarg&amp;quot; by default, which is advertised and Nordic tools may also use this name to connect to the device.&lt;/p&gt;
&lt;p&gt;nrf_ble_dfu.c:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define DEVICE_NAME &amp;quot;DfuTarg&amp;quot; /**&amp;lt; Name of device. Will be included in the advertising data. */
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                      (const uint8_t *)DEVICE_NAME,
                                      strlen(DEVICE_NAME));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What I have personally done for now - since I needed to take the reference DFU into use ASAP with as little changes as possible - is changing the device name to &amp;quot;DfuAB:CD&amp;quot; where AB:CD are the last two octets of the MAC address. This way you can use the device name itself to more easily connect to the right device (e.g. using nrfutil without any modifications).&lt;/p&gt;
&lt;p&gt;So for example&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Original MAC address (FICR): 12:34:56:78:9A:BC&lt;/li&gt;
&lt;li&gt;DFU MAC address: 12:34:56:78:9A:BD&lt;/li&gt;
&lt;li&gt;DFU Device Name: Dfu9A:BD&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best way? Don&amp;#39;t know. But it works predictably. At least it&amp;#39;s a step to the right direction. I&amp;#39;ll probably be branching from the reference implementation quite a bit in the future, but for now this has been a good first step for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>