<?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>Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8984/switching-between-random-and-normal-mac-address</link><description>I&amp;#39;m using sd_ble_gap_address_set() to randomize mac address and it&amp;#39;s working fine. But I&amp;#39;m confused about how to change it back to normal(initial value I see) once I wan&amp;#39;t to stop randomizing my mac address. 
 I&amp;#39;m on nrf51-DK, softdevice 7.0 and sdk</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Sep 2015 17:18:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8984/switching-between-random-and-normal-mac-address" /><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33072?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2015 17:18:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e026c5de-0c66-4931-9811-7708fb3e4549</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;You were right, I edited my question with the working solution. It has nothing to do with reset, I just saved the initial value before randomizing and loaded it back to go back to normal. Done. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33074?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2015 05:00:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cea8aead-280f-4035-a62f-5681910fc638</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;any updates on this kerem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33071?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2015 13:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04e7f4a6-eb17-4162-88b9-c221d94db33c</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;Ok that makes sense, I think resetting was what&amp;#39;s working for me. I&amp;#39;ll update my answer after making sure that&amp;#39;s the case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33070?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2015 13:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08338f41-4511-448d-983c-788ba6e77a72</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I did not understand your comments.
When the softdevice initializes it gets the device address and type from FICR and keeps the value inside its structures. when you change the value using sd_ble_gap_address_set, it does not change the value in FICR but changes it inside the softdevice structure (which is used in radio packets).
This means that once you have called sd_ble_gap_address_set, softdevice completely forgot the original device address. It is upto the application to remember this before changing the value or the application can read it from FICR.
So if you want the device address to reset to its inital state, you have to either restart the softdevice (like resetting the device) which will make the SD to fetch this value from FICR again or read FICR explicitly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33073?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2015 12:53:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c2ec92f-eec0-4c1c-9d72-bdd1c7ff2209</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;By the way, even after scrambling the mac address, a call to &lt;strong&gt;sd_ble_gap_address_get&lt;/strong&gt; gives me the same original address so that&amp;#39;s ok. This is again for sd 7.0 and sdk 6.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33075?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2015 12:46:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bc1e1cd-92f9-4563-a0a1-919146fef9b4</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;Using &lt;code&gt;sd_ble_gap_address_get(&amp;amp;gap_address);&lt;/code&gt; fixed the problem, for some reason I was reading a different value which I see in the debugger.. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Switching between random and normal mac address?</title><link>https://devzone.nordicsemi.com/thread/33069?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2015 12:17:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92338f4d-d68c-45ff-8763-e62fce566943</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You can do it in two ways&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;save the original one before changing it using sd_ble_gap_address_get&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The Original device address is always present at
NRF_FICR-&amp;gt;DEVICEADD[0] and NRF_FICR-&amp;gt;DEVICEADD[1]&lt;/p&gt;
&lt;p&gt;You can fetch it by
ble_gap_addr_t gap_address&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   gap_address.addr_type     = NRF_FICR-&amp;gt;DEVICEADDRTYPE &amp;amp; 0x01UL;
*((uint32_t PACKED *)&amp;amp;gap_address.addr[0]) = NRF_FICR-&amp;gt;DEVICEADDR[0];
*((uint16_t PACKED *)&amp;amp;gap_address.addr[sizeof(uint32_t)]) = (NRF_FICR-&amp;gt;DEVICEADDR[1] &amp;amp; 0x0000FFFFUL);

    err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &amp;amp;gap_address);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since this is just reading, it can be done safely while softdevice is active.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>